Ver código fonte

rollerstorage menu fixies

szollosil 9 meses atrás
pai
commit
822809c639

+ 5 - 5
custom/rollerstorage/core/modules/modRollerstorage.class.php

@@ -289,21 +289,22 @@ class modRollerstorage extends DolibarrModules
 		$this->rights[$r][4] = 'rollerhistory';
 		$this->rights[$r][5] = 'readall'; // In php code, permission will be checked by test if ($user->rights->rollerstorage->rollerhistory->readall)
 		$r++;
-		foreach ($this->getWarehouses() as $warehouse) {
+		$warehousesFromDB = $this->getWarehouses();
+		foreach ($warehousesFromDB as $warehouse) {
 			$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
 			$this->rights[$r][1] = $warehouse['ref'] . ' (Olvasás)'; // Permission label
 			$this->rights[$r][4] = 'rollerhistory';
 			$this->rights[$r][5] = 'read_'.$warehouse['rowid']; // In php code, permission will be checked by test if ($user->rights->rollerstorage->rollerhistory->read_1)
 			$r++;
 		}
-		foreach ($this->getWarehouses() as $warehouse) {
+		foreach ($warehousesFromDB as $warehouse) {
 			$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
 			$this->rights[$r][1] = $warehouse['ref'] . ' (írás)'; // Permission label
 			$this->rights[$r][4] = 'rollerhistory';
 			$this->rights[$r][5] = 'write_'.$warehouse['rowid']; // In php code, permission will be checked by test if ($user->rights->rollerstorage->rollerhistory->read_1)
 			$r++;
 		}
-		foreach ($this->getWarehouses() as $warehouse) {
+		foreach ($warehousesFromDB as $warehouse) {
 			$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
 			$this->rights[$r][1] = $warehouse['ref'] . ' (törlés)'; // Permission label
 			$this->rights[$r][4] = 'rollerhistory';
@@ -315,7 +316,6 @@ class modRollerstorage extends DolibarrModules
 		// Main menu entries to add
 		$this->menu = array();
 		$r = 0;
-		$warehouses = $this->getWarehouses();
 		// Add here entries to declare new menus
 		/* BEGIN MODULEBUILDER TOPMENU */
 		$this->menu[$r++] = array(
@@ -396,7 +396,7 @@ class modRollerstorage extends DolibarrModules
 			'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
 		);
 		
-		foreach ($this->getWarehouses("'1'") as $warehouse) {
+		foreach ($warehousesFromDB as $warehouse) {
 			$this->menu[$r++] = array(
 				'fk_menu' => 'fk_mainmenu=rollerstorage',
 				// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode