pluginsGLPI / barcode

GNU Affero General Public License v3.0
36 stars 35 forks source link

url generated by qrcode is always going to computer with id=1 #65

Closed rheritahiana closed 3 years ago

rheritahiana commented 4 years ago

I am using glpi on version 9.4.5 with barcode plugins version 2.4.1 Everything seems to be working fine except from the url generated. il always point to computer of id=1. I am trying to check the file checkItembyInv.php to understand. it figures out that tsis code is always redirecting to '1' instead of redirectind to computer's Id.

include ('../../../inc/includes.php');
Session::checkRight("config", UPDATE);
// To be available when plugin is not activated
Plugin::load('barcode');
Html::header(__('Barcode', 'barcode'), $_SERVER['PHP_SELF'], "config", "plugins");
$itemtype = $_GET['itemtype'];
$item = new $itemtype();
$itemInventoryNumber[] = $_GET['inventoryNumber'];
foreach ($itemInventoryNumber as $key => $value) {
   $item = $item->getFromDBByCrit(['otherserial' => $value]);
   Html::redirect($itemtype::getFormURLWithID($item));
};
Html::footer();
rheritahiana commented 4 years ago

Hi all, i finally achieved waht i wanted by changing the line with "$URLByInvNumber" in the file /inc/qrcode.class.php with tsis one: $URLByInvNumber = 'URL = ' . $CFG_GLPI['url_base'] . '/front/computer.form.php?id='. $items_id; Now the ling generated leads me directly to the url of the computer.

Fiyorden commented 4 years ago

I have the same error in 9.5 and installed the plugin in marketplace and version 2.5

However it works on genericObject

Phorta commented 4 years ago

Thank you @rheritahiana
helped me solve a problem with the url. a doubt, by chance you can generate the label with the name of the equipment underneath and the Qrcode has only the URL ?

@ddurieux

infotv commented 4 years ago

I have the same error in 9.5 and installed the plugin in marketplace and version 2.5

However it works on genericObject

$URLByInvNumber = 'URL = ' . $CFG_GLPI['url_base'] . '/front/'. $itemtype . '.form.php?id='. $items_id;

dosgamer commented 4 years ago

I have the same error in 9.5 and installed the plugin in marketplace and version 2.5 However it works on genericObject

$URLByInvNumber = 'URL = ' . $CFG_GLPI['url_base'] . '/front/'. $itemtype . '.form.php?id='. $items_id;

for Linux, case must be respected: $URLByInvNumber = 'URL = ' . $CFG_GLPI['url_base'] . '/front/'. strtolower($itemtype) . '.form.php?id=' . $items_id;

cedric-anne commented 3 years ago

Fixed by #78