|
|
@@ -831,45 +831,35 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
$item = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace, [ 'propertyName' => '*,field' ]);
|
|
|
DBG::log($item, 'array', "TODO: addObjectBaseProcesAjax for \$item");
|
|
|
|
|
|
- throw new HttpException("TODO: addObjectBaseProcesAjax('{$namespace}')", 400); // TODO: ...
|
|
|
-
|
|
|
- // $return['$tableStruct'] = $tableStruct;
|
|
|
- //
|
|
|
- // $idTable = $this->fetchTableId($idStorage, $tblName);
|
|
|
- // if ($idTable <= 0) {
|
|
|
- // UI::alert('warning', "Zasob tabela '{$tblName}' nie istnieje");// TODO: add p5UI btn
|
|
|
- // DBG::table("tblStruct", $tblStruct, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- // throw new Exception("Zasob tabela '{$tblName}' nie istnieje");
|
|
|
- // }
|
|
|
- // $cellZasobList = array();
|
|
|
- // foreach (DB::getPDO()->fetchAllByKey("
|
|
|
- // select z.ID, z.`DESC`, z.A_STATUS
|
|
|
- // from CRM_LISTA_ZASOBOW z
|
|
|
- // where z.PARENT_ID = '{$idTable}'
|
|
|
- // ", $key = 'DESC') as $ind => $row) {
|
|
|
- // $cellZasobList[strtolower($ind)] = $row;
|
|
|
- // }
|
|
|
- //
|
|
|
- // $return['$cellZasobList'] = $cellZasobList;
|
|
|
-
|
|
|
- // TODO: ACL::modify('default_db/CRM_PROCES/CRM_PROCES_INIT', [ 'ref:...' => $namespace ]);
|
|
|
+ if (!$item['idZasob']) throw new Exception("Missing id zasob for object '{$namespace}'");
|
|
|
+ if (!$item['idDatabase']) throw new Exception("Missing id database for object '{$namespace}'");
|
|
|
+ if (!$item['_rootTableName']) throw new Exception("Missing root table name for object '{$namespace}'");
|
|
|
+ if ('AntAcl' != $item['_type']) throw new Exception("Not implemented type '{$item['_type']}' for namespace '{$namespace}' - only AntAcl supported");
|
|
|
+ if (!$item['hasStruct']) throw new Exception("Missing structure for object '{$namespace}'");
|
|
|
+ if (!$item['isStructInstalled']) throw new Exception("Structure not installed for object '{$namespace}'");
|
|
|
+ if (!$item['isObjectActive']) throw new Exception("Object is not active '{$namespace}'");
|
|
|
+ $fieldsWithIdZasob = array_filter($item['field'], function ($field) {
|
|
|
+ if (!$field['idZasob']) return false;
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ if (empty($fieldsWithIdZasob)) throw new Exception("Missing fields with id zasob in object '{$namespace}'");
|
|
|
+
|
|
|
$idProces = DB::getDB()->ADD_NEW_OBJ('CRM_PROCES', (object)[
|
|
|
'TYPE' => 'PROCES_INIT',
|
|
|
- 'DESC' => "Proces dla obiektu '{$namespace}'",
|
|
|
+ 'DESC' => "TODO: Proces dla obiektu '{$namespace}'",
|
|
|
]);
|
|
|
if (!$idProces) throw new Exception("DB ERROR - nie udało się dodać procesu");
|
|
|
- // TODO: add wskaznik do $item['idZasob']
|
|
|
- // foreach ($cellZasobList as $loverName => $row) {
|
|
|
- // DB::getDB()->ADD_NEW_OBJ('CRM_WSKAZNIK', (object)[
|
|
|
- // 'ID_PROCES' => $idProces,
|
|
|
- // 'ID_ZASOB' => $row['ID'],
|
|
|
- // 'TYP' => 'P',
|
|
|
- // 'ID_PRZYPADEK' => 2
|
|
|
- // ]);
|
|
|
- // }
|
|
|
- // $return['type'] = 'success';
|
|
|
- // $return['msg'] = "Utworzono proces {{$idProces}}";
|
|
|
- // return $return;
|
|
|
+ array_map(function ($field) use ($idProces) {
|
|
|
+ DB::getDB()->ADD_NEW_OBJ('CRM_WSKAZNIK', (object)[
|
|
|
+ 'ID_PROCES' => $idProces,
|
|
|
+ 'ID_ZASOB' => $field['idZasob'],
|
|
|
+ 'TYP' => 'P',
|
|
|
+ 'ID_PRZYPADEK' => 2
|
|
|
+ ]);
|
|
|
+ }, $fieldsWithIdZasob);
|
|
|
+ $return['type'] = 'success';
|
|
|
+ $return['msg'] = "Utworzono proces {{$idProces}}";
|
|
|
+ return $return;
|
|
|
}
|
|
|
|
|
|
public function addGeomEtykietaCellsAction() {
|