// only users with the right to edit inventory could use this script if (!$gCurrentUser->editInventory()) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } // set headline of the script $headline = $gL10n->get('INV_ITEM_MANAGEMENT'); // Navigation of the module starts here $gNavigation->addStartUrl(CURRENT_URL, $headline); $gInventoryFields = new InventoryFields($gDb, $gCurrentOrganization->getValue('org_id')); // alle Items zur Auswahl selektieren $sql = 'SELECT inv_id, item_name.ind_value as item_name, room_id.ind_value as room_id, COALESCE(inv_timestamp_change, inv_timestamp_create) as timestamp FROM ' . TBL_INVENT . ' INNER JOIN ' . TBL_INVENT_DATA . ' as item_name ON item_name.ind_itm_id = inv_id AND item_name.ind_inf_id = ' . $gInventoryFields->getProperty('ITEM_NAME', 'inf_id') . ' INNER JOIN ' . TBL_INVENT_DATA . ' as room_id ON room_id.ind_itm_id = inv_id AND room_id.ind_inf_id = ' . $gInventoryFields->getProperty('ROOM_ID', 'inf_id') . ' WHERE inv_valid = 1 ORDER BY item_name.ind_value, room_id.ind_value '; $mglStatement = $gDb->query($sql); // create html page object $page = new HtmlPage($headline); $page->addJavascript(' $(".admidio-icon-link-popup").colorbox({rel:\'nofollow\', scrolling:false, onComplete:function() { $("#admButtonNo").focus(); }}); ', true); // get module menu $itemsAdministrationMenu = $page->getMenu(); $itemsAdministrationMenu->addItem('menu_item_create_user', $g_root_path . '/adm_program/modules/inventory/item_new.php', $gL10n->get('INV_CREATE_ITEM'), 'add.png'); // show link to room management
$fieldProperty = FIELD_DEFAULT; $fieldHelpId = null; if (!$gCurrentUser->isWebmaster() && $getNewItem == 0) { $fieldProperty = FIELD_DISABLED; } elseif ($getNewItem > 0) { $fieldProperty = FIELD_REQUIRED; $fieldHelpId = 'PRO_inventoryNAME_DESCRIPTION'; } $form->addLine(); } } } // add profile fields to form $fieldProperty = FIELD_DEFAULT; $helpId = null; if ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_disabled') == 1 && !$gCurrentUser->editUsers() && $getNewUser == 0) { // disable field if this is configured in profile field configuration $fieldProperty = FIELD_DISABLED; } elseif ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_mandatory') == 1) { // set mandatory field $fieldProperty = FIELD_REQUIRED; } if (strlen($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_description')) > 0) { $helpId = array('item_field_description', $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name_intern')); } // code for different field types if ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'CHECKBOX') { $form->addCheckbox('inf-' . $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_id'), $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name'), $inventory->getValue($field->getValue('inf_name_intern')), $fieldProperty, $helpId, null, $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_icon', 'database')); } elseif ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_type') === 'DROPDOWN' || $gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name_intern') === 'ROOM_ID') { // set array with values and set default value if ($gInventoryFields->getProperty($field->getValue('inf_name_intern'), 'inf_name_intern') === 'ROOM_ID') {