|
|
@@ -609,8 +609,9 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
]
|
|
|
]),
|
|
|
// 'opis' => $item['description'],
|
|
|
- 'active?' => ($item['isActive']) ? '<span class="label label-success">TAK</span>' : '<span class="text text-muted">nie</span>',
|
|
|
+ 'hasStruct' => ($item['hasStruct']) ? '<span class="label label-success">TAK</span>' : '<span class="text text-muted">nie</span>',
|
|
|
'installed' => $item['isStructInstalled'] ? '<span class="label label-success">TAK</span>' : '<span class="text text-muted">nie</span>',
|
|
|
+ 'active?' => $item['isObjectActive'] ? '<span class="label label-success">TAK</span>' : '<span class="text text-muted">nie</span>',
|
|
|
'menu' => UI::h('div', ['class'=>"p5UI__dropdown-wrap"], [
|
|
|
UI::h('button', ['onClick' => "p5UI__dropdown(event, this, 'left bottom')", 'class' => "btn btn-xs btn-default p5UI__dropdown-btn"], [
|
|
|
'<i class="glyphicon glyphicon-menu-hamburger"></i>',
|
|
|
@@ -699,26 +700,69 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
if ($a['fieldNamespace'] < $b['fieldNamespace']) return -1;
|
|
|
return 0;
|
|
|
});
|
|
|
- echo UI::h('a', [
|
|
|
- 'href' => $this->getLink('objectReinstall', ['namespace' => $item['namespace']]),
|
|
|
- 'class' => 'btn btn-link pull-right'
|
|
|
- ], "reinstall object");
|
|
|
- echo ($item['idZasob'] > 0)
|
|
|
- ? UI::h('h3', [], "Nr zasobu {$item['idZasob']}")
|
|
|
- : UI::h('h3', [], [
|
|
|
- "Nr zasobu ",
|
|
|
- UI::hButtonAjax("+ do zasobów", 'addAclObjectToZasobyAjax', [
|
|
|
- 'class' => "btn btn-xs btn-primary",
|
|
|
- 'href' => $this->getLink('addAclObjectToZasobyAjax'),
|
|
|
- 'data' => [
|
|
|
- 'idStorage' => $item['idDatabase'],
|
|
|
- 'namespace' => $item['namespace'],
|
|
|
- ]
|
|
|
- ])
|
|
|
- ]);// TODO: UI::hButtonAjax(...)
|
|
|
$thisGetLink = array($this, 'getLink');
|
|
|
UI::table([
|
|
|
- 'caption' => UI::h('h3', [], "Struktura obiektu '{$item['namespace']}'"),
|
|
|
+ 'caption' => UI::h('span', [], [
|
|
|
+ UI::h('span', [ 'style' => "margin-right:6px;color:#000" ], "Struktura obiektu '{$item['namespace']}'"),
|
|
|
+ ' ',
|
|
|
+ ( ($item['idZasob'] > 0)
|
|
|
+ ? UI::h('span', [ 'title' => "Nr zasobu '{$item['idZasob']}'" ], "[{$item['idZasob']}]")
|
|
|
+ : UI::h('span', [ 'title' => "Brak nr zasobu - dodaj do zasobów" ], [
|
|
|
+ UI::hButtonAjax("+ do zasobów", 'addAclObjectToZasobyAjax', [
|
|
|
+ 'class' => "btn btn-xs btn-primary",
|
|
|
+ 'href' => $this->getLink('addAclObjectToZasobyAjax'),
|
|
|
+ 'data' => [
|
|
|
+ 'idStorage' => $item['idDatabase'],
|
|
|
+ 'namespace' => $item['namespace'],
|
|
|
+ ]
|
|
|
+ ])
|
|
|
+ ])
|
|
|
+ ),
|
|
|
+ ' ',
|
|
|
+ ( ($item['isObjectActive'] > 0)
|
|
|
+ ? UI::h('span', [ 'class' => "label label-success", 'title' => "Namespace active" ], "Active")
|
|
|
+ : UI::h('span', [ 'title' => "Namespace not active" ], [
|
|
|
+ ($item['idZasob'] > 0)
|
|
|
+ ? UI::hButtonAjax("Aktywuj", 'activateObjectAjax', [
|
|
|
+ 'class' => "btn btn-xs btn-primary",
|
|
|
+ 'href' => $this->getLink('activateObjectAjax'),
|
|
|
+ 'data' => [
|
|
|
+ 'namespace' => $item['namespace'],
|
|
|
+ ]
|
|
|
+ ])
|
|
|
+ : '',
|
|
|
+ ])
|
|
|
+ ),
|
|
|
+ ' ',
|
|
|
+ UI::h('a', [
|
|
|
+ 'href' => "index.php?_route=ViewTableAjax&namespace={$item['namespace']}",
|
|
|
+ 'class' => "btn btn-md btn-link"
|
|
|
+ ], "Przeglądaj tabelę"),
|
|
|
+ ' ',
|
|
|
+ ( ($item['idZasob'] > 0)
|
|
|
+ ? UI::h('a', [
|
|
|
+ 'href' => "procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id={$item['idZasob']}&filtr_ids=%2B&filtr_ob=%2B",
|
|
|
+ 'class' => "btn btn-md btn-link",
|
|
|
+ 'title' => "Struktura tabeli w drzewie zasobów"
|
|
|
+ ], "Zasoby")
|
|
|
+ : ''
|
|
|
+ ),
|
|
|
+ ' ',
|
|
|
+ ( ($item['idZasob'] > 0)
|
|
|
+ ? UI::h('a', [
|
|
|
+ 'href' => "index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=PROCES_FOR_TABLE&tblId={$item['idZasob']}",
|
|
|
+ 'class' => "btn btn-md btn-link",
|
|
|
+ 'title' => "Procesy dla aktualnie przeglądanej tabeli"
|
|
|
+ ], "Procesy")
|
|
|
+ : ''
|
|
|
+ ),
|
|
|
+ ' ',
|
|
|
+ UI::h('a', [
|
|
|
+ 'href' => $this->getLink('objectReinstall', ['namespace' => $item['namespace']]),
|
|
|
+ 'class' => 'btn btn-link', 'style' => "color:#f00",
|
|
|
+ 'title' => "Zainstaluje ponownie obiekt"
|
|
|
+ ], "reinstall object"),
|
|
|
+ ]),
|
|
|
'rows' => array_map(function ($field) use ($item, $thisGetLink) {
|
|
|
$tblItem = []; foreach ($field as $k => $v) $tblItem[$k] = $v;
|
|
|
$tblItem['namespace'] = UI::h('span', [], [
|
|
|
@@ -733,7 +777,8 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
'class' => "btn btn-xs btn-primary",
|
|
|
'href' => $thisGetLink('addFieldToZasobyAjax'),
|
|
|
'data' => [
|
|
|
- 'namespace' => $field['namespace'],
|
|
|
+ 'namespace' => $item['namespace'],
|
|
|
+ 'fieldNamespace' => $field['namespace'],
|
|
|
]
|
|
|
])
|
|
|
: UI::h('span', ['title'=>"Brak Nr zasobu dla obiektu", 'class'=>"btn btn-xs btn-danger"], "Brak nr zasobu obiektu")
|
|
|
@@ -746,12 +791,10 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
]);
|
|
|
UI::hButtonAjaxOnResponse('addFieldToZasobyAjax', /* payload, n */ "
|
|
|
if (!payload.type) return false
|
|
|
- console.log('TODO: addFieldToZasobyAjax response', payload);
|
|
|
- if (payload.data && payload.data.id && payload.data.id > 0) { // if ('success' == payload.type) {
|
|
|
- n.parentNode.replaceChild(document.createTextNode(payload.data.id), n)
|
|
|
- } else {
|
|
|
- console.log('TODO: addFieldToZasobyAjax unknown response', payload);
|
|
|
+ if (payload.body && payload.body.id && payload.body.id > 0) { // if ('success' == payload.type) {
|
|
|
+ n.parentNode.replaceChild(document.createTextNode(payload.body.id), n)
|
|
|
}
|
|
|
+ jQuery.notify(payload.msg, payload.type)
|
|
|
");
|
|
|
UI::hButtonAjaxOnResponse('addAclObjectToZasobyAjax', /* payload, n */ "
|
|
|
if (!payload.type) return false
|
|
|
@@ -764,6 +807,27 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
window.location.reload()
|
|
|
}
|
|
|
");
|
|
|
+ UI::hButtonAjaxOnResponse('activateObjectAjax', /* payload, n */ "
|
|
|
+ jQuery.notify(payload.msg, payload.type)
|
|
|
+ if (!payload.type) return false
|
|
|
+ if ('success' === payload.type || 'info' === payload.type) {
|
|
|
+ if (payload.body && payload.body.isObjectActive && payload.body.isObjectActive > 0) {
|
|
|
+ n.parentNode.replaceChild(document.createTextNode('Active'), n)
|
|
|
+ } else {
|
|
|
+ console.log('TODO: activateObjectAjax unknown response', payload);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ");
|
|
|
+ if ($item['isObjectActive']) {
|
|
|
+ echo UI::hButtonAjax("Dodaj podstawowy proces dla obiektu '{$item['namespace']}' - read only (TODO)", 'addObjectBaseProcesAjax', [
|
|
|
+ 'class' => "btn btn-xs btn-default",
|
|
|
+ 'href' => $this->getLink('addObjectBaseProcesAjax'),
|
|
|
+ 'data' => [ 'namespace' => $item['namespace'] ]
|
|
|
+ ]);
|
|
|
+ UI::hButtonAjaxOnResponse('addObjectBaseProcesAjax', /* payload, n */ "
|
|
|
+ jQuery.notify(payload.msg, payload.type)
|
|
|
+ ");
|
|
|
+ }
|
|
|
DBG::nicePrint($item, '$item');
|
|
|
} catch (Exception $e) {
|
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
@@ -993,11 +1057,11 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
]);
|
|
|
echo '<hr>';
|
|
|
|
|
|
- $ajaxAddBaseProcesLink = Request::getPathUri() . "index.php?_route=Storage&_task=addBaseProces&idStorage={$idStorage}&tblName={$tblName}";
|
|
|
- $onClick = "return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Storage:addBaseProces', { href: '{$ajaxAddBaseProcesLink}' })";
|
|
|
+ $ajaxAddBaseProcesLink = Request::getPathUri() . "index.php?_route=Storage&_task=addTableBaseProces&idStorage={$idStorage}&tblName={$tblName}";
|
|
|
+ $onClick = "return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Storage:addTableBaseProces', { href: '{$ajaxAddBaseProcesLink}' })";
|
|
|
UI::tag('a', ['onclick'=>$onClick, 'class'=>"btn btn-xs btn-default", 'href'=>"#"], "Dodaj podstawowy proces dla tabeli '{$tblName}' - read only", true);
|
|
|
echo UI::h('script', [], "
|
|
|
- jQuery(document).on('p5UIBtnAjax:Storage:addBaseProces:ajaxLoaded', function(e, n, payload) {
|
|
|
+ jQuery(document).on('p5UIBtnAjax:Storage:addTableBaseProces:ajaxLoaded', function(e, n, payload) {
|
|
|
jQuery.notify(payload.msg, payload.type);
|
|
|
});
|
|
|
");
|
|
|
@@ -1085,10 +1149,10 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- public function addBaseProcesAction() {
|
|
|
- Response::sendTryCatchJson(array($this, 'addBaseProces'), $_REQUEST);
|
|
|
+ public function addTableBaseProcesAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'addTableBaseProces'), $_REQUEST);
|
|
|
}
|
|
|
- public function addBaseProces($args) {
|
|
|
+ public function addTableBaseProces($args) {
|
|
|
$return = [
|
|
|
'type' => 'error',
|
|
|
'msg' => 'todo: F.' . __FUNCTION__ . ' L.' . __LINE__,
|
|
|
@@ -1139,6 +1203,60 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
+ public function addObjectBaseProcesAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'addObjectBaseProcesAjax'), $_REQUEST);
|
|
|
+ }
|
|
|
+ public function addObjectBaseProcesAjax($args) {
|
|
|
+ $return = [
|
|
|
+ 'type' => 'error',
|
|
|
+ 'msg' => 'todo: F.' . __FUNCTION__ . ' L.' . __LINE__,
|
|
|
+ ];
|
|
|
+ $namespace = V::get('namespace', 0, $args);
|
|
|
+ if (empty($namespace)) throw new HttpException("Missing namespace", 400);
|
|
|
+ $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 ]);
|
|
|
+ $idProces = DB::getDB()->ADD_NEW_OBJ('CRM_PROCES', (object)[
|
|
|
+ 'TYPE' => 'PROCES_INIT',
|
|
|
+ 'DESC' => "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;
|
|
|
+ }
|
|
|
+
|
|
|
public function addGeomEtykietaCellsAction() {
|
|
|
Response::sendTryCatchJson(array($this, 'addGeomEtykietaCells'), $_REQUEST);
|
|
|
}
|
|
|
@@ -1746,65 +1864,54 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
public function addFieldToZasobyAjax($args) {
|
|
|
$namespace = V::get('namespace', '', $args);
|
|
|
if (empty($namespace)) throw new HttpException("Missing namespace");
|
|
|
-
|
|
|
- $fieldItem = SchemaFactory::loadDefaultObject('SystemObjectField')->getItem($namespace);
|
|
|
- $zasobTableName = substr($fieldItem['objectNamespace'], strlen('default_db/'));
|
|
|
- $zasobTableName = (false !== strpos($zasobTableName, '/'))
|
|
|
- ? $fieldItem['objectNamespace']
|
|
|
- : $zasobTableName;
|
|
|
+ $fieldNamespace = V::get('fieldNamespace', '', $args);
|
|
|
+ if (empty($fieldNamespace)) throw new HttpException("Missing fieldNamespace");
|
|
|
+ $fieldItem = SchemaFactory::loadDefaultObject('SystemObjectField')->getItem($fieldNamespace);
|
|
|
+ if (!$fieldItem) throw new HttpException("Field not found '{$fieldNamespace}'", 404);
|
|
|
+ DBG::log($fieldItem, 'array', "\$fieldItem");
|
|
|
+ if ($fieldItem['idZasob'] > 0) throw (new AlertSuccessException("Field already added to Zasoby '{$fieldItem['idZasob']}'"))->setBody([ 'id' => $fieldItem['idZasob'] ]);
|
|
|
+ $objectItem = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace);
|
|
|
+ if (!$objectItem) throw new HttpException("Object not found '{$namespace}'", 404);
|
|
|
+ DBG::log($objectItem, 'array', "\$objectItem");
|
|
|
+ if (!$objectItem['idZasob']) throw new Exception("Missing Object idZasob");
|
|
|
$zasobItem = DB::getPDO()->fetchFirst("
|
|
|
select zField.ID, zField.`DESC`, zField.`TYPE`, zField.PARENT_ID
|
|
|
from CRM_LISTA_ZASOBOW as zField
|
|
|
join CRM_LISTA_ZASOBOW as zTable on(zTable.ID = zField.PARENT_ID)
|
|
|
- where zTable.PARENT_ID = {$fieldItem['idDatabase']}
|
|
|
- and zTable.`DESC` = '{$zasobTableName}'
|
|
|
+ where zTable.`ID` = '{$objectItem['idZasob']}'
|
|
|
and zTable.`TYPE` = 'TABELA'
|
|
|
and zField.`DESC` = '{$fieldItem['fieldNamespace']}'
|
|
|
and zField.`TYPE` = 'KOMORKA'
|
|
|
");
|
|
|
if ($zasobItem) {
|
|
|
SchemaFactory::loadDefaultObject('SystemObjectField')->updateItem([
|
|
|
- 'namespace' => $namespace,
|
|
|
+ 'namespace' => $fieldItem['namespace'],
|
|
|
'idZasob' => $zasobItem['ID']
|
|
|
]);
|
|
|
- return [
|
|
|
- 'type' => 'success',
|
|
|
- 'msg' => "Zasob już istnieje",
|
|
|
- 'data' => [
|
|
|
- 'id' => $zasobItem['ID']
|
|
|
- ],
|
|
|
- '__DBG__' => [
|
|
|
- $zasobItem,
|
|
|
- $fieldItem,
|
|
|
- $args,
|
|
|
- ]
|
|
|
- ];
|
|
|
+ throw (new AlertSuccessException("Zasob już istnieje"))->setBody([ 'id' => $zasobItem['ID'] ]);
|
|
|
}
|
|
|
|
|
|
- return [
|
|
|
- 'type' => 'success',
|
|
|
- 'msg' => "TODO: addFieldToZasobyAjax",
|
|
|
- 'data' => [
|
|
|
- 'id' => 123
|
|
|
- ],
|
|
|
- '__DBG__' => [
|
|
|
- $zasobItem,
|
|
|
- $fieldItem,
|
|
|
- $args,
|
|
|
- ]
|
|
|
- ];
|
|
|
-
|
|
|
- // throw new Exception("TODO: F.addFieldToZasobyAjax");
|
|
|
-
|
|
|
- return [
|
|
|
- 'type' => 'success',
|
|
|
- 'msg' => "TODO: addFieldToZasobyAjax",
|
|
|
- 'data' => [
|
|
|
- 'id' => 123
|
|
|
- ],
|
|
|
- '__DBG__args' => $args
|
|
|
+ $newFieldItem = [
|
|
|
+ 'PARENT_ID' => $objectItem['idZasob'],
|
|
|
+ 'TYPE' => 'KOMORKA',
|
|
|
+ 'DESC' => $fieldItem['fieldNamespace'],
|
|
|
+ 'DESC_PL' => $fieldItem['fieldNamespace'],
|
|
|
];
|
|
|
+ DBG::log($newFieldItem, 'array', "add new field item");
|
|
|
+ try {
|
|
|
+ $acl = User::getAcl()->getObjectAcl('default_db', 'crm_lista_zasobow');
|
|
|
+ } catch (Exception $e) {
|
|
|
+ throw new Exception("Brak dostępu do tabeli Zasoby");
|
|
|
+ }
|
|
|
+ $createdId = $acl->addItem($newFieldItem);
|
|
|
+ if (!$createdId) throw new Exception("Nie udało się utworzyć nowego rekordu!");
|
|
|
+ SchemaFactory::loadDefaultObject('SystemObjectField')->updateItem([
|
|
|
+ 'namespace' => $fieldItem['namespace'],
|
|
|
+ 'idZasob' => $createdId
|
|
|
+ ]);
|
|
|
+ throw (new AlertSuccessException("Utworzono pomyślnie rekord nr {$createdId}"))->setBody([ 'id' => $createdId ]);
|
|
|
}
|
|
|
+
|
|
|
public function addCellToZasobyAction() {// sends JSON
|
|
|
$response = new stdClass();
|
|
|
try {
|
|
|
@@ -1957,4 +2064,38 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
|
|
|
UI::dol();
|
|
|
}
|
|
|
|
|
|
+ public function activateObjectAjaxAction() {
|
|
|
+ DBG::log($_REQUEST, 'array', '$_REQUEST');
|
|
|
+ Response::sendTryCatchJson(array($this, 'activateObjectAjax'), $_REQUEST);
|
|
|
+ }
|
|
|
+ public function activateObjectAjax($args) {
|
|
|
+ $namespace = V::get('namespace', '', $args);
|
|
|
+ if (empty($namespace)) throw new Exception("Missing param namespace");
|
|
|
+ $item = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace, [ 'propertyName' => '*,field' ]);
|
|
|
+ if (empty($item)) throw new HttpException("Namespace not found", 404);
|
|
|
+ DBG::log($item, 'array', "TODO: activateObjectAjax \$item");
|
|
|
+ if ($item['isObjectActive']) throw new AlertSuccessException("Namespace '{$namespace}' already active");
|
|
|
+ if (!$item['hasStruct']) throw new Exception("Missing struct for namespace '{$namespace}'");
|
|
|
+ if (!$item['isStructInstalled']) throw new Exception("Namespace struct not installed '{$namespace}'");
|
|
|
+ $activeFields = array_filter($item['field'], function ($field) {
|
|
|
+ if (!$field['isActive']) return false;
|
|
|
+ if (!$field['idZasob']) return false;
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ if (empty($activeFields)) throw new Exception("Missing active fields for namespace '{$namespace}'");
|
|
|
+
|
|
|
+ $affected = SchemaFactory::loadDefaultObject('SystemObject')->updateItem([
|
|
|
+ 'namespace' => $item['namespace'],
|
|
|
+ 'isObjectActive' => 1
|
|
|
+ ]);
|
|
|
+ if ($affected < 0) throw new Exception("Nie udało się aktywować obiektu '{$namespace}'");
|
|
|
+ return [
|
|
|
+ 'type' => "success",
|
|
|
+ 'msg' => "Aktywowano obiekt '{$namespace}'",
|
|
|
+ 'body' => [
|
|
|
+ 'isObjectActive' => 1
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
}
|