|
|
@@ -757,7 +757,7 @@ jQuery(document).on('p5UIBtnAjax:Storage:addCellToZasoby:ajaxLoaded', function(e
|
|
|
|
|
|
$ajaxAddZasobLink = Request::getPathUri() . "index.php?_route=Storage&_task=addGeomEtykietaCells&idStorage={$idStorage}&tblName={$tblName}";
|
|
|
$onClick = "return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Storage:addGeomEtykietaCells', { href: '{$ajaxAddZasobLink}' })";
|
|
|
- UI::tag('a', ['onclick'=>$onClick, 'class'=>"btn btn-xs btn-primary", 'href'=>"#"], "Dodaj komórki etykiet", true);
|
|
|
+ UI::tag('a', ['onclick'=>$onClick, 'class'=>"btn btn-xs btn-default", 'href'=>"#"], "Dodaj komórki etykiet", true);
|
|
|
echo "<i>(<code>`etykieta_x`</code>, <code>`etykieta_y`</code>, <code>`etykieta_obrot`</code>)</i>";
|
|
|
?>
|
|
|
<script>
|
|
|
@@ -773,12 +773,78 @@ jQuery(document).on('p5UIBtnAjax:Storage:addGeomEtykietaCells:ajaxLoaded', funct
|
|
|
});
|
|
|
</script>
|
|
|
<?php
|
|
|
+
|
|
|
+ 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}' })";
|
|
|
+ UI::tag('a', ['onclick'=>$onClick, 'class'=>"btn btn-xs btn-default", 'href'=>"#"], "Dodaj podstawowy proces dla tabeli '{$tblName}' - read only", true);
|
|
|
+ ?>
|
|
|
+<script>
|
|
|
+jQuery(document).on('p5UIBtnAjax:Storage:addBaseProces:ajaxLoaded', function(e, n, payload) {
|
|
|
+ jQuery.notify(payload.msg, payload.type);
|
|
|
+});
|
|
|
+</script>
|
|
|
+ <?php
|
|
|
} catch (Exception $e) {
|
|
|
UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
}
|
|
|
UI::dol();
|
|
|
}
|
|
|
|
|
|
+ public function addBaseProcesAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'addBaseProces'), $_REQUEST);
|
|
|
+ }
|
|
|
+ public function addBaseProces($args) {
|
|
|
+ $return = [
|
|
|
+ 'type' => 'error',
|
|
|
+ 'msg' => 'todo: F.' . __FUNCTION__ . ' L.' . __LINE__,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $idStorage = V::get('idStorage', 0, $args, 'int');
|
|
|
+ if ($idStorage <= 0) throw new HttpException("Missing idStorage", 400);
|
|
|
+ $storage = DB::getStorage($idStorage);
|
|
|
+ $tblName = V::get('tblName', 0, $args, 'word');
|
|
|
+ if (empty($tblName)) throw new HttpException("Missing tblName", 400);
|
|
|
+
|
|
|
+ $tableStruct = $storage->getTableStruct($tblName);
|
|
|
+
|
|
|
+ $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;
|
|
|
+
|
|
|
+ $idProces = DB::getDB()->ADD_NEW_OBJ('CRM_PROCES', (object)[
|
|
|
+ 'TYPE' => 'PROCES_INIT',
|
|
|
+ 'DESC' => "Proces dla tabeli '{$tblName}'",
|
|
|
+ ]);
|
|
|
+ if (!$idProces) throw new Exception("DB ERROR - nie udało się dodać procesu");
|
|
|
+ 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);
|
|
|
}
|