Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions classes/items.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -877,6 +877,7 @@ public function sendNotification($organizationId, $importData = null): bool
}

$textOld = $gL10n->get('SYS_NO_USER_FOUND');
$textNew = '';
if ($this->itemImported) {
$textOld = '';
$textNew = $gL10n->get('SYS_NO_USER_FOUND');
Expand Down
8 changes: 4 additions & 4 deletions common_function.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,16 +40,16 @@ function defineConstantsPIM()
define('PLUGIN_FOLDER_IM', '/' . basename(__DIR__));
}
if (!defined('TBL_INVENTORY_MANAGER_FIELDS')) {
define('TBL_INVENTORY_MANAGER_FIELDS', $g_tbl_praefix . '_inventory_manager_fields');
define('TBL_INVENTORY_MANAGER_FIELDS', TABLE_PREFIX . '_inventory_manager_fields');
}
if (!defined('TBL_INVENTORY_MANAGER_DATA')) {
define('TBL_INVENTORY_MANAGER_DATA', $g_tbl_praefix . '_inventory_manager_data');
define('TBL_INVENTORY_MANAGER_DATA', TABLE_PREFIX . '_inventory_manager_data');
}
if (!defined('TBL_INVENTORY_MANAGER_ITEMS')) {
define('TBL_INVENTORY_MANAGER_ITEMS', $g_tbl_praefix . '_inventory_manager_items');
define('TBL_INVENTORY_MANAGER_ITEMS', TABLE_PREFIX . '_inventory_manager_items');
}
if (!defined('TBL_INVENTORY_MANAGER_LOG')) {
define('TBL_INVENTORY_MANAGER_LOG', $g_tbl_praefix . '_inventory_manager_log');
define('TBL_INVENTORY_MANAGER_LOG', TABLE_PREFIX . '_inventory_manager_log');
}
}

Expand Down
30 changes: 21 additions & 9 deletions import/import_items.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,7 @@
*/
function compareArrays(array $array1, array $array2): bool {
$array1 = array_filter($array1, function($key) {
return $key !== 'KEEPER' && $key !== 'LAST_RECEIVER' && $key !== 'CATEGORY' && $key !== 'IN_INVENTORY' && $key !== 'RECEIVED_ON' && $key !== 'RECEIVED_BACK_ON';
return $key !== 'KEEPER' && $key !== 'LAST_RECEIVER' && $key !== 'IN_INVENTORY' && $key !== 'RECEIVED_ON' && $key !== 'RECEIVED_BACK_ON';
}, ARRAY_FILTER_USE_KEY);

foreach ($array1 as $value) {
Expand DownExpand Up@@ -113,11 +113,23 @@ function compareArrays(array $array1, array $array2): bool {
$itemValues = array();
foreach ($items->mItemData as $key => $itemData) {
$itemValue = $itemData->getValue('imd_value');
if ($itemData->getValue('imf_name_intern') === 'KEEPER' || $itemData->getValue('imf_name_intern') === 'LAST_RECEIVER' || $itemData->getValue('imf_name_intern') === 'CATEGORY' || $itemData->getValue('imf_name_intern') === 'IN_INVENTORY' || $itemData->getValue('imf_name_intern') === 'RECEIVED_ON' || $itemData->getValue('imf_name_intern') === 'RECEIVED_BACK_ON')
if ($itemData->getValue('imf_name_intern') === 'KEEPER' || $itemData->getValue('imf_name_intern') === 'LAST_RECEIVER' || $itemData->getValue('imf_name_intern') === 'IN_INVENTORY' || $itemData->getValue('imf_name_intern') === 'RECEIVED_ON' || $itemData->getValue('imf_name_intern') === 'RECEIVED_BACK_ON')
{
continue;
}

if ($itemData->getValue('imf_name_intern') === 'CATEGORY') {
$imfNameIntern = $itemData->getValue('imf_name_intern');
// get value list of the item field
$valueList = $items->getProperty($imfNameIntern, 'imf_value_list');

// select the value from the value list
$val = $valueList[$itemValue];

$itemValues[] = array($itemData->getValue('imf_name_intern') => $val);
continue;
}

$itemValues[] = array($itemData->getValue('imf_name_intern') => $itemValue);
}
$itemValues = array_merge_recursive(...$itemValues);
Expand DownExpand Up@@ -169,13 +181,13 @@ function compareArrays(array $array1, array $array2): bool {
}
else {
$sql = 'SELECT usr_id, CONCAT(last_name.usd_value, \', \', first_name.usd_value, IFNULL(CONCAT(\', \', postcode.usd_value),\'\'), IFNULL(CONCAT(\' \', city.usd_value),\'\'), IFNULL(CONCAT(\', \', street.usd_value),\'\') ) as name
FROM ' . TBL_USERS . '
JOIN ' . TBL_USER_DATA . ' as last_name ON last_name.usd_usr_id = usr_id AND last_name.usd_usf_id = ' . $gProfileFields->getProperty('LAST_NAME', 'usf_id') . '
JOIN ' . TBL_USER_DATA . ' as first_name ON first_name.usd_usr_id = usr_id AND first_name.usd_usf_id = ' . $gProfileFields->getProperty('FIRST_NAME', 'usf_id') . '
LEFT JOIN ' . TBL_USER_DATA . ' as postcode ON postcode.usd_usr_id = usr_id AND postcode.usd_usf_id = ' . $gProfileFields->getProperty('POSTCODE', 'usf_id') . '
LEFT JOIN ' . TBL_USER_DATA . ' as city ON city.usd_usr_id = usr_id AND city.usd_usf_id = ' . $gProfileFields->getProperty('CITY', 'usf_id') . '
LEFT JOIN ' . TBL_USER_DATA . ' as street ON street.usd_usr_id = usr_id AND street.usd_usf_id = ' . $gProfileFields->getProperty('ADDRESS', 'usf_id') . '
WHERE usr_valid = 1 AND EXISTS (SELECT 1 FROM ' . TBL_MEMBERS . ', ' . TBL_ROLES . ', ' . TBL_CATEGORIES . ' WHERE mem_usr_id = usr_id AND mem_rol_id = rol_id AND mem_begin <= \'' . DATE_NOW . '\' AND mem_end > \'' . DATE_NOW . '\' AND rol_valid = 1 AND rol_cat_id = cat_id AND (cat_org_id = ' . $gCurrentOrgId . ' OR cat_org_id IS NULL)) ORDER BY last_name.usd_value, first_name.usd_value;';
FROM ' . TBL_USERS . '
JOIN ' . TBL_USER_DATA . ' as last_name ON last_name.usd_usr_id = usr_id AND last_name.usd_usf_id = ' . $gProfileFields->getProperty('LAST_NAME', 'usf_id') . '
JOIN ' . TBL_USER_DATA . ' as first_name ON first_name.usd_usr_id = usr_id AND first_name.usd_usf_id = ' . $gProfileFields->getProperty('FIRST_NAME', 'usf_id') . '
LEFT JOIN ' . TBL_USER_DATA . ' as postcode ON postcode.usd_usr_id = usr_id AND postcode.usd_usf_id = ' . $gProfileFields->getProperty('POSTCODE', 'usf_id') . '
LEFT JOIN ' . TBL_USER_DATA . ' as city ON city.usd_usr_id = usr_id AND city.usd_usf_id = ' . $gProfileFields->getProperty('CITY', 'usf_id') . '
LEFT JOIN ' . TBL_USER_DATA . ' as street ON street.usd_usr_id = usr_id AND street.usd_usf_id = ' . $gProfileFields->getProperty('ADDRESS', 'usf_id') . '
WHERE usr_valid = 1 AND EXISTS (SELECT 1 FROM ' . TBL_MEMBERS . ', ' . TBL_ROLES . ', ' . TBL_CATEGORIES . ' WHERE mem_usr_id = usr_id AND mem_rol_id = rol_id AND mem_begin <= \'' . DATE_NOW . '\' AND mem_end > \'' . DATE_NOW . '\' AND rol_valid = 1 AND rol_cat_id = cat_id AND (cat_org_id = ' . $gCurrentOrgId . ' OR cat_org_id IS NULL)) ORDER BY last_name.usd_value, first_name.usd_value;';
}

$result = $gDb->queryPrepared($sql);
Expand Down
4 changes: 2 additions & 2 deletions inventory_manager.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -52,7 +52,7 @@
// Access only with valid login
require_once(__DIR__ . '/../../adm_program/system/login_valid.php');

//$scriptName ist der Name wie er im Menue eingetragen werden muss, also ohne evtl. vorgelagerte Ordner wie z.B. /playground/adm_plugins/inventory_manager...
//$scriptName is the name as it must be entered in the menu, without any preceding folders such as /playground/adm_plugins/InventoryManager...
$scriptName = substr($_SERVER['SCRIPT_NAME'], strpos($_SERVER['SCRIPT_NAME'], FOLDER_PLUGINS));

// only authorized user are allowed to start this module
Expand DownExpand Up@@ -154,7 +154,7 @@
// if html mode and last url was not a list view then save this url to navigation stack
if ($gNavigation->count() === 0 || ($getMode == 'html' && strpos($gNavigation->getUrl(), 'inventory_manager.php') === false))
{
$gNavigation->addStartUrl(CURRENT_URL, $headline, 'fa-key');
$gNavigation->addStartUrl(CURRENT_URL, $headline, 'fa-warehouse');
}

$datatable = false;
Expand Down
2 changes: 1 addition & 1 deletion items/items_edit_new.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -228,7 +228,7 @@ function validateReceivedOnAndBackOn() {
$form->addCheckbox(
'imf-' . $items->getProperty($imfNameIntern, 'imf_id'),
convlanguagePIM($items->getProperty($imfNameIntern, 'imf_name')),
(bool) $items->getValue($imfNameIntern),
($getItemId === 0) ? true : (bool) $items->getValue($imfNameIntern),
array(
'property' => $fieldProperty,
'helpTextIdLabel' => $helpId,
Expand Down
4 changes: 2 additions & 2 deletions items/items_history.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,7 +140,7 @@
if ($imlValueOld !== '') {
if ($items->getPropertyById((int) $row['iml_imf_id'], 'imf_name_intern') === 'KEEPER' || $items->getPropertyById((int) $row['iml_imf_id'], 'imf_name_intern') === 'LAST_RECEIVER') {
if (is_numeric($imlValueOld)) {
$found = $user->readDataById($imlValueNew);
$found = $user->readDataById($imlValueOld);
if ($found) {
$columnValues[] = '<a href="'.SecurityUtils::encodeUrl(ADMIDIO_URL.FOLDER_MODULES.'/profile/profile.php', array('user_uuid' => $user->getValue('usr_uuid'))).'">'.$user->getValue('LAST_NAME').', '.$user->getValue('FIRST_NAME').'</a>';
}
Expand All@@ -149,7 +149,7 @@
}
}
else {
$columnValues[] = $imlValueNew;
$columnValues[] = $imlValueOld;
}
}
else {
Expand Down