Skip to content

Commit d731c35

Browse files
committed
small fixes inventory module
1 parent 43d24f3 commit d731c35

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

languages/en.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,9 @@
856856
<string name="SYS_INVENTORY_ITEMS_PER_PAGE">Number of items per page</string>
857857
<string name="SYS_INVENTORY_KEEPER">Keeper</string>
858858
<string name="SYS_INVENTORY_KEEPER_DESC">Keeper of the item</string>
859-
<string name="SYS_INVENTORY_KEEPER_ITEM_REINSTATE_DESC">You can reinstate the item into the inventory manager.\n\nIf you want to delete the item, please contact an administrator or the manager of the inventory manager!\n\n#VAR1#</string>
860-
<string name="SYS_INVENTORY_KEEPER_ITEM_RETIRE_DESC">You can retire the item from the inventory manager. This has the advantage that the data is preserved and you can later always see who has borrowed this item.\n\nIf you want to delete the item, please contact an administrator or the manager of the inventory manager!</string>
859+
<string name="SYS_INVENTORY_KEEPER_ITEM_DELETE_DESC">If you want to delete the item, please contact an administrator or the manager of the inventory manager!</string>
860+
<string name="SYS_INVENTORY_KEEPER_ITEM_REINSTATE_DESC">You can reinstate the item into the inventory manager.\n\n#VAR1#\n\n#VAR2#</string>
861+
<string name="SYS_INVENTORY_KEEPER_ITEM_RETIRE_DESC">You can retire the item from the inventory manager. This has the advantage that the data is preserved and you can later always see who has borrowed this item.\n\n#VAR1#</string>
861862
<string name="SYS_INVENTORY_LAST_RECEIVER">Last receiver</string>
862863
<string name="SYS_INVENTORY_LAST_RECEIVER_DESC">Last receiver of the item</string>
863864
<string name="SYS_INVENTORY_NO_NEW_IMPORT_DATA">There was no new data in the import file!</string>

modules/inventory.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,19 @@
278278
</div>
279279
<div class="modal-body">';
280280
if (count($getItemUUIDs) > 0) {
281-
$msg .= '<p><i class="bi bi-eye-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_SELECTION_REINSTATE_DESC', array($gL10n->get('SYS_INVENTORY_SELECTION_REINSTATE'))) . '</p>';
282-
$msg .= '<p><i class="bi bi-eye-slash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_SELECTION_RETIRE_DESC', array($gL10n->get('SYS_INVENTORY_SELECTION_RETIRE'))) . '</p>';
283-
$msg .= '<p><i class="bi bi-trash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_SELECTION_DELETE_DESC', array($gL10n->get('SYS_INVENTORY_SELECTION_DELETE'))) . '</p>';
281+
$msg .= '<p><i class="bi bi-eye-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_SELECTION_REINSTATE_DESC', array('SYS_INVENTORY_SELECTION_REINSTATE')) . '</p>';
282+
$msg .= '<p><i class="bi bi-eye-slash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_SELECTION_RETIRE_DESC', array('SYS_INVENTORY_SELECTION_RETIRE')) . '</p>';
283+
if ($gCurrentUser->isAdministratorInventory()) {
284+
$msg .= '<p><i class="bi bi-trash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_SELECTION_DELETE_DESC', array('SYS_INVENTORY_SELECTION_DELETE')) . '</p>';
285+
} else {
286+
$msg .= '<p><i class="bi bi-trash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_KEEPER_ITEM_DELETE_DESC') . '</p>';
287+
}
284288
} else {
285289
if (!$getRetired) {
286-
$msg .= '<p><i class="bi bi-eye-slash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_ITEM_RETIRE_DESC', array($gL10n->get('SYS_INVENTORY_ITEM_RETIRE'))) . '</p>';
290+
$msg .= '<p><i class="bi bi-eye-slash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_ITEM_RETIRE_DESC', array('SYS_INVENTORY_ITEM_RETIRE')) . '</p>';
287291
}
288292
if ($gCurrentUser->isAdministratorInventory()) {
289-
$msg .= '<p><i class="bi bi-trash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_ITEM_DELETE_DESC', array($gL10n->get('SYS_INVENTORY_ITEM_DELETE'))) . '</p>';
293+
$msg .= '<p><i class="bi bi-trash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_ITEM_DELETE_DESC', array('SYS_INVENTORY_ITEM_DELETE')) . '</p>';
290294
}
291295
}
292296
$msg .= '</div>
@@ -296,8 +300,10 @@
296300
<i class="bi bi-eye"></i>' . $gL10n->get('SYS_INVENTORY_SELECTION_REINSTATE') . '</button>';
297301
$msg .= '<button id="adm_button_retire" type="button" class="btn btn-primary mr-4" onclick="' . $retireOnClick . '">
298302
<i class="bi bi-eye-slash"></i>' . $gL10n->get('SYS_INVENTORY_SELECTION_RETIRE') . '</button>';
299-
$msg .= '<button id="adm_button_delete" type="button" class="btn btn-primary" onclick="' . $deleteOnClick . '">
303+
if ($gCurrentUser->isAdministratorInventory()) {
304+
$msg .= '<button id="adm_button_delete" type="button" class="btn btn-primary" onclick="' . $deleteOnClick . '">
300305
<i class="bi bi-trash"></i>' . $gL10n->get('SYS_INVENTORY_SELECTION_DELETE') . '</button>';
306+
}
301307
} else {
302308
if (!$getRetired) {
303309
$msg .= '<button id="adm_button_retire" type="button" class="btn btn-primary mr-4" onclick="' . $retireOnClick . '">
@@ -321,7 +327,7 @@
321327
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
322328
</div>
323329
<div class="modal-body">
324-
<p><i class="bi bi-eye-slash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_KEEPER_ITEM_RETIRE_DESC') . '</p>
330+
<p><i class="bi bi-eye-slash-fill"></i>&nbsp;' . $gL10n->get('SYS_INVENTORY_KEEPER_ITEM_RETIRE_DESC', array('SYS_INVENTORY_KEEPER_ITEM_DELETE_DESC')) . '</p>
325331
</div>
326332
<div class="modal-footer">
327333
<button id="adm_button_retire" type="button" class="btn btn-primary mr-4" onclick="callUrlHideElement(\'adm_inventory_item_' . $getiniUUID . '\', \'' . SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/inventory.php', array('mode' => 'item_retire', 'item_uuid' => $getiniUUID)) . '\', \'' . $gCurrentSession->getCsrfToken() . '\')">

src/UI/Presenter/InventoryItemPresenter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ public function createEditItemsForm(array $itemUUIDs = array())
497497
'type' => 'text',
498498
'property' => $fieldProperty,
499499
'helpTextId' => $helpId,
500-
'icon' => $items->getProperty($infNameIntern, 'inf_icon', 'database')
500+
'icon' => $items->getProperty($infNameIntern, 'inf_icon', 'database'),
501+
'toggleable' => true
501502
)
502503
);
503504

@@ -512,6 +513,7 @@ public function createEditItemsForm(array $itemUUIDs = array())
512513
array(
513514
'property' => FormPresenter::FIELD_REQUIRED,
514515
'defaultValue' => $items->getValue($infNameIntern, 'database'),
516+
'toggleable' => true
515517
)
516518
);
517519
} else {
@@ -527,6 +529,7 @@ public function createEditItemsForm(array $itemUUIDs = array())
527529
array(
528530
'property' => FormPresenter::FIELD_REQUIRED,
529531
'defaultValue' => $items->getValue($infNameIntern, 'database'),
532+
'toggleable' => true
530533
)
531534
);
532535
}

src/UI/Presenter/InventoryPresenter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ public function prepareData(string $mode = 'html'): array
998998
'tooltip' => $gL10n->get('SYS_INVENTORY_ITEM_COPY')
999999
);
10001000
} else {
1001-
$dataMessage = ($this->isKeeperAuthorizedToEdit((int)$this->itemsData->getValue('KEEPER', 'database'))) ? $gL10n->get('SYS_INVENTORY_KEEPER_ITEM_REINSTATE_DESC', array('SYS_INVENTORY_ITEM_REINSTATE_CONFIRM')) : $gL10n->get('SYS_INVENTORY_ITEM_REINSTATE_CONFIRM');
1001+
$dataMessage = ($this->isKeeperAuthorizedToEdit((int)$this->itemsData->getValue('KEEPER', 'database'))) ? $gL10n->get('SYS_INVENTORY_KEEPER_ITEM_REINSTATE_DESC', array('SYS_INVENTORY_KEEPER_ITEM_DELETE_DESC', 'SYS_INVENTORY_ITEM_REINSTATE_CONFIRM')) : $gL10n->get('SYS_INVENTORY_ITEM_REINSTATE_CONFIRM');
10021002
// Add reinstate action
10031003
$rowValues['actions'][] = array(
10041004
'dataHref' => 'callUrlHideElement(\'adm_inventory_item_' . $item['ini_uuid'] . '\', \'' . SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/inventory.php', array('mode' => 'item_reinstate', 'item_uuid' => $item['ini_uuid'], 'item_retired' => $this->itemsData->isRetired())) . '\', \'' . $gCurrentSession->getCsrfToken() . '\')',
@@ -1008,7 +1008,7 @@ public function prepareData(string $mode = 'html'): array
10081008
);
10091009
}
10101010

1011-
if ($this->isKeeperAuthorizedToEdit((int)$this->itemsData->getValue('KEEPER', 'database'))) {
1011+
if (!$gCurrentUser->isAdministratorInventory() && $this->isKeeperAuthorizedToEdit((int)$this->itemsData->getValue('KEEPER', 'database'))) {
10121012
if (!$this->itemsData->isRetired()) {
10131013
// Add retire action
10141014
$rowValues['actions'][] = array(
@@ -1295,7 +1295,7 @@ public function prepareDataProfile(ItemsData $itemsData, string $itemFieldFilter
12951295
'tooltip' => $gL10n->get('SYS_INVENTORY_ITEM_COPY')
12961296
);
12971297
} else {
1298-
$dataMessage = ($this->isKeeperAuthorizedToEdit((int)$itemsData->getValue('KEEPER', 'database'))) ? $gL10n->get('SYS_INVENTORY_KEEPER_ITEM_REINSTATE_DESC', array('SYS_INVENTORY_ITEM_REINSTATE_CONFIRM')) : $gL10n->get('SYS_INVENTORY_ITEM_REINSTATE_CONFIRM');
1298+
$dataMessage = ($this->isKeeperAuthorizedToEdit((int)$itemsData->getValue('KEEPER', 'database'))) ? $gL10n->get('SYS_INVENTORY_KEEPER_ITEM_REINSTATE_DESC', array('SYS_INVENTORY_KEEPER_ITEM_DELETE_DESC', 'SYS_INVENTORY_ITEM_REINSTATE_CONFIRM')) : $gL10n->get('SYS_INVENTORY_ITEM_REINSTATE_CONFIRM');
12991299
// Add reinstate action
13001300
$rowValues['actions'][] = array(
13011301
'dataHref' => 'callUrlHideElement(\'adm_inventory_item_' . $item['ini_uuid'] . '\', \'' . SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/inventory.php', array('mode' => 'item_reinstate', 'item_uuid' => $item['ini_uuid'], 'item_retired' => $itemsData->isRetired())) . '\', \'' . $gCurrentSession->getCsrfToken() . '\')',
@@ -1305,7 +1305,7 @@ public function prepareDataProfile(ItemsData $itemsData, string $itemFieldFilter
13051305
);
13061306
}
13071307

1308-
if ($this->isKeeperAuthorizedToEdit((int)$itemsData->getValue('KEEPER', 'database'))) {
1308+
if (!$gCurrentUser->isAdministratorInventory() && $this->isKeeperAuthorizedToEdit((int)$itemsData->getValue('KEEPER', 'database'))) {
13091309
if (!$itemsData->isRetired()) {
13101310
// Add retire action
13111311
$rowValues['actions'][] = array(

0 commit comments

Comments
 (0)