Skip to content

Fix undefined displayData on barcode generation#58

Merged
cedric-anne merged 1 commit into
pluginsGLPI:developfrom
cedric-anne:bugfix/fix-undefined-displaydata
Nov 12, 2019
Merged

Fix undefined displayData on barcode generation#58
cedric-anne merged 1 commit into
pluginsGLPI:developfrom
cedric-anne:bugfix/fix-undefined-displaydata

Conversation

@cedric-anne
Copy link
Copy Markdown
Contributor

In #36, no displayData was added in barcode generation parameters. So when generation a barcode, following errors are trigerred.

I do not know if is is due to something missing in the PR or if it is normal (functionnal point of view). @xacobofg ?

[2019-11-08 10:31:33] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 663
  *** PHP Notice(8): Undefined index: displayData
  Backtrace :
  plugins/barcode/inc/barcode.class.php:294          
  plugins/barcode/inc/barcode.class.php:512          PluginBarcodeBarcode->printPDF()
  inc/massiveaction.class.php:1027                   PluginBarcodeBarcode::processMassiveActionsForOneItemtype()
  inc/massiveaction.class.php:1006                   MassiveAction->processForSeveralItemtypes()
  front/massiveaction.php:59                         MassiveAction->process()
  {"user":"2@4028a755e155"} 
[2019-11-08 10:31:33] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 663
  *** PHP Notice(8): Trying to access array offset on value of type null
  Backtrace :
  plugins/barcode/inc/barcode.class.php:348          
  plugins/barcode/inc/barcode.class.php:512          PluginBarcodeBarcode->printPDF()
  inc/massiveaction.class.php:1027                   PluginBarcodeBarcode::processMassiveActionsForOneItemtype()
  inc/massiveaction.class.php:1006                   MassiveAction->processForSeveralItemtypes()
  front/massiveaction.php:59                         MassiveAction->process()
  {"user":"2@4028a755e155","mem_usage":"0.002\", 10.19Mio)"} 

@cedric-anne cedric-anne added the bug label Nov 8, 2019
@cedric-anne cedric-anne added this to the 2.4.1 milestone Nov 8, 2019
@cedric-anne cedric-anne self-assigned this Nov 8, 2019
Copy link
Copy Markdown
Contributor

@trasher trasher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm on a code pov

@xacobofg
Copy link
Copy Markdown
Contributor

xacobofg commented Nov 8, 2019

Errors are caused by the barcode not generating any data.
When I created the code I only considered the generation of labels for the QR.
I did not realize that since both use the same function to print, when trying to generate a barcode would cause an error to not have defined in the array displayData when sending the parameters.
I'm fine with the solution you're proposing.

@cedric-anne cedric-anne merged commit da8977e into pluginsGLPI:develop Nov 12, 2019
@cedric-anne cedric-anne deleted the bugfix/fix-undefined-displaydata branch November 12, 2019 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants