InfotelGLPI / consumables

Plugin consumables for GLPI
http://blogglpi.infotel.com
GNU General Public License v2.0
7 stars 5 forks source link

Undefined array key "order_ref" in /var/www/html/glpi/marketplace/consumables/inc/field.class.php #16944 #36

Open geppauso opened 3 months ago

geppauso commented 3 months ago

Version of the plugin: 2.0.1

Version GLPI: 10.0.14

Bug description After upgrading from 10.0.12 we notice that modifying an item in our consumable inventory the field "name" on table "glpi.glpi_consumableitems" is overwritten by the value of field "Order reference". Apache logs report messages about 'Undefined array key "order_ref"'

Relevant log output [php:warn] [pid 106627] [client 172.29.58.80:34682] PHP Warning: Undefined array key "order_ref" in /var/www/html/glpi/marketplace/consumables/inc/field.class.php on line 110, referer: http://www.mydomain.it/front/consumableitem.form.php?id=7

Page URL /front/consumableitem.form.php

Steps To reproduce

  1. Home -> Assets -> Consumables
  2. Search for any item in your inventory. With debug enabled we got the error "PHP User Warning (512): Duplicate keys found in search options for item type ConsumableItem: 1, 2 in /var/www/html/glpi/src/Search.php at line 8346" but this seems to be harmless.
  3. Select the item to edit its properties.
  4. Save the tab, even if no modifications was made.

1

2

3

TruiteOxyg3nee commented 1 month ago

Hi, for fix the overwritten of field "name" by the field "Order reference" you can "hardfix" this by modify in "marketplace/consumables/inc/field.class.php" line 78 : ;echo Html::input('name', ['value' => $field->fields['order_ref'], 'size' => 40]); by : echo Html::input('order_ref', ['value' => $field->fields['order_ref'], 'size' => 40]);