|
|
@@ -4586,14 +4586,13 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $fieldsList = $this->_acl->getFields();
|
|
|
+ $pkField = $acl->getPrimaryKeyField();
|
|
|
+ $fieldsList = $acl->getFields();
|
|
|
+ $fieldsList = array_filter($fieldsList, function ($vCol) {
|
|
|
+ return ($vCol['name'] != $pkField);
|
|
|
+ });
|
|
|
foreach ($fieldsList as $kID => $vCol) {
|
|
|
$defaultValue = '';
|
|
|
- if ($vCol['name'] == 'ID') {
|
|
|
- unset($fieldsList[$kID]);
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
if (!empty($forceFilterInit[$vCol['name']])) {
|
|
|
$defaultValue = $forceFilterInit[$vCol['name']];
|
|
|
}
|
|
|
@@ -4601,7 +4600,8 @@ jQuery(document).ready(function(){
|
|
|
// TODO: read from session cache
|
|
|
$cols[$kID] = V::get("f{$kID}", $defaultValue, $_POST);
|
|
|
|
|
|
- $fieldsList[$kID]['label'] = (!empty($vCol['label']))? $vCol['label'] : $vCol['name'];
|
|
|
+ $label = V::get('label', '', $vCol);
|
|
|
+ $fieldsList[$kID]['label'] = ($label) ? $label : $vCol['name'];
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
@@ -4609,10 +4609,8 @@ jQuery(document).ready(function(){
|
|
|
<form action="" method="post" id="CREATE_FRM_<?php echo $this->_htmlID; ?>">
|
|
|
<fieldset>
|
|
|
<legend>Dodaj nowy rekord</legend>
|
|
|
-
|
|
|
-
|
|
|
<?php $tabindex = 0; foreach ($fieldsList as $kID => $vCol) : ?>
|
|
|
- <?php if ($this->_acl->canCreateField($vCol['name'])) : ?>
|
|
|
+ <?php if ($acl->canCreateField($vCol['name'])) : ?>
|
|
|
<div class="form-group">
|
|
|
<label class="control-label" for="<?php echo "f{$kID}"; ?>"><?= V::get('label', $vCol['name'], $vCol); ?>
|
|
|
<i class="glyphicon glyphicon-info-sign frm-help" data-toggle="popover" data-trigger="hover" title="" data-content="<?php echo htmlspecialchars(V::get('opis', '', $vCol)); ?>" data-original-title="<?php echo "[{$kID}] {$vCol['name']}"; ?>"></i>
|
|
|
@@ -4620,7 +4618,7 @@ jQuery(document).ready(function(){
|
|
|
<div>
|
|
|
<?php
|
|
|
$fieldParams = array('appendBack'=>true, 'tabindex'=>(++$tabindex), 'maxGrid'=>8);
|
|
|
- echo $this->_acl->showFormItem('C', $kID, "f{$kID}", $cols[$kID], $fieldParams);
|
|
|
+ echo $acl->showFormItem('C', $kID, "f{$kID}", $cols[$kID], $fieldParams);
|
|
|
?>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -4754,18 +4752,19 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
|
|
|
private function ajaxCreateSave($args) {
|
|
|
+ $acl = $this->_acl;
|
|
|
$response = new stdClass();
|
|
|
$createdId = null;
|
|
|
try {
|
|
|
- $item = $this->_acl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
|
|
|
+ $item = $acl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
|
|
|
|
|
|
- $createdId = $this->_acl->addItem($item);
|
|
|
+ $createdId = $acl->addItem($item);
|
|
|
|
|
|
if ($createdId) {
|
|
|
$response->type = 'success';
|
|
|
$response->msg = "Utworzono pomyślnie rekord nr {$createdId}";
|
|
|
$response->id = $createdId;
|
|
|
- $response->record = $this->_acl->buildQuery([])->getItem($createdId);
|
|
|
+ $response->record = $acl->buildQuery([])->getItem($createdId);
|
|
|
}
|
|
|
else {
|
|
|
$response->type = 'error';
|
|
|
@@ -4781,29 +4780,30 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
|
|
|
private function ajaxCopy($args) {
|
|
|
+ $acl = $this->_acl;
|
|
|
$id = V::get('ID', 0, $_REQUEST, 'int');
|
|
|
if ($id <= 0) {
|
|
|
throw new HttpException("Wrong param ID!", 404);
|
|
|
}
|
|
|
|
|
|
- $item = $this->_acl->buildQuery([])->getItem($id);
|
|
|
+ $item = $acl->buildQuery([])->getItem($id);
|
|
|
if (!$item) {
|
|
|
throw new HttpException("Item '{$id}' not exists!", 404);
|
|
|
}
|
|
|
|
|
|
$response = new stdClass();
|
|
|
- $itemCopy = $this->_acl->createItemCopy($item);
|
|
|
+ $itemCopy = $acl->createItemCopy($item);
|
|
|
|
|
|
$createdId = null;
|
|
|
try {
|
|
|
|
|
|
- $createdId = $this->_acl->addItem($itemCopy);
|
|
|
+ $createdId = $acl->addItem($itemCopy);
|
|
|
|
|
|
if ($createdId) {
|
|
|
$response->type = 'success';
|
|
|
$response->msg = "Rekord skopiowany pomyślnie - utworzono rekord nr {$createdId}";
|
|
|
$response->id = $createdId;
|
|
|
- $response->record = $this->_acl->buildQuery([])->getItem($createdId);
|
|
|
+ $response->record = $acl->buildQuery([])->getItem($createdId);
|
|
|
}
|
|
|
else {
|
|
|
$response->type = 'error';
|