diff --git a/fields/fields_edit_new.php b/fields/fields_edit_new.php index aaa3eba..eb40fc9 100644 --- a/fields/fields_edit_new.php +++ b/fields/fields_edit_new.php @@ -125,7 +125,7 @@ function setValueList() { ); $form->addCheckbox('imf_mandatory', $gL10n->get('SYS_REQUIRED_INPUT'), (bool)$itemField->getValue('imf_mandatory'), array( - 'property' => $itemField->getValue('imf_system') == 1 ? HtmlForm::FIELD_DISABLED : HtmlForm::FIELD_DEFAULT, + 'property' => HtmlForm::FIELD_DEFAULT, 'icon' => 'fa-asterisk' ) ); @@ -144,5 +144,5 @@ function setValueList() { )); // add form to html page and show page -$page->addHtml($form->show(false)); +$page->addHtml($form->show()); $page->show(); diff --git a/import/import_column_config.php b/import/import_column_config.php index 4b21041..1305caf 100644 --- a/import/import_column_config.php +++ b/import/import_column_config.php @@ -91,15 +91,12 @@ function getColumnAssignmentHtml(array $arrayColumnList, array $arrayCsvColumns) return $html; } -$items = new CItems($gDb, $gCurrentOrgId); -$items->readItems($gCurrentOrgId); - // create html page object $page = new HtmlPage('admidio-items-import-csv', $headline); $page->addHtml('

'.$gL10n->get('PLG_INVENTORY_MANAGER_IMPORT_ASSIGN_FIELDS').'

'); // show form -$form = new HtmlForm('import_assign_fields_form', ADMIDIO_URL . FOLDER_PLUGINS . PLUGIN_FOLDER_IM . '/import/import_items.php', $page, array('type' => 'vertical')); +$form = new HtmlForm('import_assign_fields_form', SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_PLUGINS . PLUGIN_FOLDER_IM . '/import/import_items.php'), $page, array('type' => 'vertical')); $form->addCheckbox('first_row', $gL10n->get('SYS_FIRST_LINE_COLUMN_NAME'), $formValues['first_row']); $form->addHtml('
'.$gL10n->get('PLG_INVENTORY_MANAGER_IMPORT_UNUSED_HEAD').'
-
'); @@ -147,31 +144,31 @@ function getColumnAssignmentHtml(array $arrayColumnList, array $arrayCsvColumns) '; - $arrayCsvColumns = $_SESSION['import_data'][0]; - // Remove only null values - $arrayCsvColumns = array_filter($arrayCsvColumns, function ($value) { - return !is_null($value); - }); +$arrayCsvColumns = $_SESSION['import_data'][0]; +// Remove only null values +$arrayCsvColumns = array_filter($arrayCsvColumns, function ($value) { + return !is_null($value); +}); - $categoryId = null; - $arrayImportableFields = array(); - - $items = new CItems($gDb, $gCurrentOrgId); - $row = array(); - foreach ($items->mItemFields as $columnKey => $columnValue) { - $imfName = $columnValue->GetValue('imf_name'); - - // If the field name starts with 'PIM_', it is a language key - if (strpos($imfName, 'PIM_') !== false) { - $row = array($columnValue->GetValue('imf_name_intern') => $gL10n->get($imfName)); - } else { - $row = array($columnValue->GetValue('imf_name_intern') => $imfName); - } - - $arrayImportableFields[] = $row; - } +$categoryId = null; +$arrayImportableFields = array(); + +$items = new CItems($gDb, $gCurrentOrgId); +$row = array(); +foreach ($items->mItemFields as $columnKey => $columnValue) { + $imfName = $columnValue->GetValue('imf_name'); + + // If the field name starts with 'PIM_', it is a language key + if (strpos($imfName, 'PIM_') !== false) { + $row = array($columnValue->GetValue('imf_name_intern') => $gL10n->get($imfName)); + } else { + $row = array($columnValue->GetValue('imf_name_intern') => $imfName); + } + + $arrayImportableFields[] = $row; +} - $htmlFieldTable .= getColumnAssignmentHtml($arrayImportableFields, $arrayCsvColumns) .' +$htmlFieldTable .= getColumnAssignmentHtml($arrayImportableFields, $arrayCsvColumns) .' '; $form->addHtml($htmlFieldTable); diff --git a/import/import_items.php b/import/import_items.php index f7eb1e5..6c607e5 100644 --- a/import/import_items.php +++ b/import/import_items.php @@ -1,4 +1,3 @@ - format('Y-m-d'); } } + else { + unset($array1[$dateField]); + } } foreach ($array1 as $value) { diff --git a/import/import_read_file.php b/import/import_read_file.php index 16d7b11..fc1dd23 100644 --- a/import/import_read_file.php +++ b/import/import_read_file.php @@ -12,7 +12,6 @@ require_once(__DIR__ . '/../../../adm_program/system/common.php'); require_once(__DIR__ . '/../common_function.php'); -require_once(__DIR__ . '/../classes/items.php'); // Access only with valid login require_once(__DIR__ . '/../../../adm_program/system/login_valid.php'); @@ -73,12 +72,6 @@ // => EXIT } -$items = new CItems($gDb, $gCurrentOrgId); -$items->readItemData($getItemId, $gCurrentOrgId); - -// read file using the phpSpreadsheet library -//$_SESSION['rol_id'] = (int) $items->getValue('rol_id'); - switch ($postImportFormat) { case 'XLSX': $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); diff --git a/items/items_delete.php b/items/items_delete.php index 2b1471a..b72956d 100644 --- a/items/items_delete.php +++ b/items/items_delete.php @@ -107,7 +107,7 @@ function displayItemDeleteForm($items, $user, $getItemId, $getItemFormer) { $form->addCustomContent('', '
'.$gL10n->get('PLG_INVENTORY_MANAGER_ITEM_MAKE_TO_FORMER')); } - $page->addHtml($form->show(false)); + $page->addHtml($form->show()); $page->show(); } diff --git a/items/items_edit_new.php b/items/items_edit_new.php index bfa4c7e..edb22ab 100644 --- a/items/items_edit_new.php +++ b/items/items_edit_new.php @@ -434,5 +434,5 @@ function isSelect2Empty(selectId) { (int) $infoItem->getValue('imi_usr_id_change'), $infoItem->getValue('imi_timestamp_change') )); -$page->addHtml($form->show(false)); +$page->addHtml($form->show()); $page->show(); \ No newline at end of file diff --git a/items/items_history.php b/items/items_history.php index 32a5555..367531f 100644 --- a/items/items_history.php +++ b/items/items_history.php @@ -91,7 +91,7 @@ $form->addInput('filter_date_to', $gL10n->get('SYS_END'), $dateToHtml, array('type' => 'date', 'maxLength' => 10)); $form->addInput('item_id', '', $getItemId, array('property' => HtmlForm::FIELD_HIDDEN)); $form->addSubmitButton('btn_send', $gL10n->get('SYS_OK')); -$FilterNavbar->addForm($form->show(false)); +$FilterNavbar->addForm($form->show()); $page->addHtml($FilterNavbar->show()); $table = new HtmlTable('profile_field_history_table', $page, true, true); diff --git a/preferences/preferences_function.php b/preferences/preferences_function.php index ad558b5..7542d18 100644 --- a/preferences/preferences_function.php +++ b/preferences/preferences_function.php @@ -124,7 +124,7 @@ function showDeinstallationDialog() { $form->addSubmitButton('btn_deinstall', $gL10n->get('PLG_INVENTORY_MANAGER_DEINSTALLATION'), array('icon' => 'fa-trash-alt', 'class' => 'offset-sm-3')); // add form to html page and show page - $page->addHtml($form->show(false)); + $page->addHtml($form->show()); $page->show(); }