You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2014-07-14 19:02:19

sjthespian
Member
From: San Jose, CA
Registered: 2014-07-14
Posts: 3
Website

Barcode plugin bug and feature requests

Sorry for posting in English in the French forums, there isn't a plugin forum in English...

I found a minor bug with GLPI 0.84.7 and version 0.84+1.0 of the Barcode plugin. It always includes the date in the barcode, even if you set it to "no" on the generation page.

I have a handful of feature requests, given some time I can probably figure out how to do these myself and submit a patch...

  • Provide an option to include a text label under the QR code. I am going to be using these barcodes to identify desktop systems and servers, and it would be nice to not have to print out a separate label with the hostname on it.

  • Provide a bit more control over the generated barcode. Sometimes I would like smaller codes, so having control over the error correction level, pixel size, etc. would be a big win. As an example, see this site: http://www.qrexplore.com/generate/ (I have been playing with this page and the qrencode command line tool for doing my location barcodes).

  • Allow generation of barcodes for locations. I'm not sure if this is possible, but since I hope to use these barcodes for physical inventory I need to have barcodes for not just equipment, but also the location of that equipment. Is it even possible to add a "Barcode - Print QR Codes" action to the Setup -> Dropdown -> Locations web page?

  • Along with the hostname, having a URL barcode that just includes the URL to the GLPI host info would be useful. The current QR code appears to be just a text code, so none of the QR scanners I have tested will follow the URL embedded in the code. Having an option to generate a URL code would allow scanning to take me directly to the host info page in GLPI.

It looks like this is going to be a really useful plugin, if we can just figure out the best way to work it into our workflow. Thanks!

Offline

#2 2014-07-14 23:03:42

ddurieux
Plugins Dev
From: Propières, France
Registered: 2005-06-17
Posts: 7,521

Re: Barcode plugin bug and feature requests

Not sure can define an URL in the barcode (seems too long text), I have tested 3 or 4 app for read qrcode on Android and Iphone and you can follow the url...

Offline

#3 2014-07-15 03:38:37

sjthespian
Member
From: San Jose, CA
Registered: 2014-07-14
Posts: 3
Website

Re: Barcode plugin bug and feature requests

I think I see what the issue is. The "standard" (such as it is) seems to be that URLs should be naked. I think the "URL =" is throwing off the qr readers I have been testing. Several apps I tested work just fine if the "URL = " is removed but won't recognize it as a URL if that is there. However, none of the ones I have tested so far work if there is anything else in the QR code (such as date, serial number, or hostname). So the bug I mentioned about the date always being in the QR is going to be a problem for me.

I'm haven't dug through your code to see what you are using to generate the QRs.

This seems to be one of the better references in what "standards" are in use by various QR readers.

Offline

#4 2014-10-14 18:15:41

sjthespian
Member
From: San Jose, CA
Registered: 2014-07-14
Posts: 3
Website

Re: Barcode plugin bug and feature requests

I haven't had a chance to try the latest version of the plugin yet (still testing on 0.84), but have you had a chance to figure out why it is always putting the date in the QR code?

Any thoughts on some of the feature suggestions from my earlier post? Having QR codes with just the URL (without the "URL = ") and the hostname printed below the barcode would go a long way towards this being more useful for me. Having smaller barcodes would be great as well.

For example (although a bigger font for the host name would be good):
redlace.png

Although I still have to come up with a way to associate a computer with a location without scrolling through a huge list of locations. In our current proprietary inventory system they just scan the barcode on the computer/monitor/etc. and then scan the barcode on the cube. I would love to have QR codes for the cube locations, but I haven't come up with a good way in GLPI to do the association between them.

Offline

#5 2014-10-29 14:03:26

tcse10
Member
From: Germany
Registered: 2014-10-22
Posts: 14

Re: Barcode plugin bug and feature requests

Hy,
I wood like to support the feature request for the ability to add plaintext Information to a QR code in order to get a kind of system label. But I wood suggest to put the text beside the QR code. This way it will fit on standard label sheets for A4 Printers.

Offline

#6 2014-10-29 14:08:20

ddurieux
Plugins Dev
From: Propières, France
Registered: 2005-06-17
Posts: 7,521

Re: Barcode plugin bug and feature requests

beside?

Offline

#7 2014-10-30 11:31:45

tcse10
Member
From: Germany
Registered: 2014-10-22
Posts: 14

Re: Barcode plugin bug and feature requests

I am not sure if I was using the right words (never was grate at describing things in English). So here is a picture:

|-----------| Device Name
|QR Code    | Inventory Number
|               | ...
|-----------|

Offline

#8 2014-10-30 11:39:11

ddurieux
Plugins Dev
From: Propières, France
Registered: 2005-06-17
Posts: 7,521

Re: Barcode plugin bug and feature requests

Ah ok, may add an option for this. I have added a ticket for this feature: https://forge.indepnet.net/issues/5116

Offline

#9 2015-01-29 17:03:49

benoit.goemanne
Member
From: Belgium
Registered: 2015-01-20
Posts: 3

Re: Barcode plugin bug and feature requests

I'm also an asking party for the feature to put the computername beside the QR-code. Is there any progress? Otherwise I may try to do this, because we really need that.

Offline

#10 2015-03-17 17:24:54

bgirault
Member
Registered: 2015-02-04
Posts: 30

Re: Barcode plugin bug and feature requests

Bonjour en effet cette option serait intéressante, je cherche le moyen de mettre un tag ou le nom du poste sur l'etiquette qrcode

y a t'il une avancée ?

Offline

#11 2015-04-08 04:24:56

ged
Member
Registered: 2015-03-24
Posts: 2

Re: Barcode plugin bug and feature requests

tcse10 wrote:

I am not sure if I was using the right words (never was grate at describing things in English). So here is a picture:

|-----------| Device Name
|QR Code    | Inventory Number
|               | ...
|-----------|

I'm hacked this plugin for the futures for glpi-barcode-0.85+1.0
Not the best programming, but it works.
P.S. My be commit to original plugin?

diff ./inc/qrcode.class.php.orig ./inc/qrcode.class.php

52,53c52,97
<
<
---
>    function getAllText($itemtype, $items_id, $data) {
>    global $CFG_GLPI;
>       $item = new $itemtype();
>       $item->getFromDB($items_id);
>       $a_content = array();
>       $have_content = FALSE;
>       if ($data['serialnumber']) {
>          if ($item->fields['serial'] != '') {
>             $have_content = TRUE;
>          }
>          $a_content[] = 'S/N: '.$item->fields['serial'];
>       }
>       if ($data['inventorynumber']) {
>          if ($item->fields['otherserial'] != '') {
>             $have_content = TRUE;
>          }
>          $a_content[] = 'Inv/N: '.$item->fields['otherserial'];
>       }
>       if ($data['id']) {
>          if ($item->fields['id'] != '') {
>             $have_content = TRUE;
>          }
>          $a_content[] = 'ID: '.$item->fields['id'];
>       }
>       if ($data['uuid']) {
>          if ($item->fields['uuid'] != '') {
>             $have_content = TRUE;
>          }
>          $a_content[] = 'UUID: '.$item->fields['uuid'];
>       }
>       if ($data['name']) {
>          if ($item->fields['name'] != '') {
>             $have_content = TRUE;
>          }
>          $a_content[] = 'Name: '.$item->fields['name'];
>       }
>       if ($data['url']) {
>          $a_content[] = 'URL: '.$CFG_GLPI["url_base"].Toolbox::getItemTypeFormURL($itemtype, false)."?id=".$items_id;
>       }
>
>       if (count($a_content) > 0) {
>          return $a_content;
>       }
>       return false;
>
>    }
120c164,165
<
---
>
>
123a169,177
>
>       echo '<tr>';
>       echo '<td>';
>       echo __('Number of copies', 'barcode')." : </td><td>";
>       Dropdown::showNumber("copies", array('value' => 2,'width' => '100','min'   => 1,'max'   => 10));
>       echo '</td>';
>       echo '</tr>';
>
>
218a273
>                       $names[]=$pbQRcode->getAllText($item->getType(), $key, $ma->POST);
231a287
>               $params['names']  = $names;
255c311
< ?>
\ No newline at end of file
---
> ?>

diff ./inc/barcode.class.php.orig ./inc/barcode.class.php

62,63d61
<
<
240a239,245
>       echo __('Number of copies', 'barcode')." : </td><td>";
>       Dropdown::showNumber("copies", array('value' => 2,'width' => '100','min'   => 1,'max'   => 10));
>       echo '</td>';
>       echo '</tr>';
>
>       echo '<tr>';
>       echo '<td>';
244a250,295
>
>
>       echo '<tr>';
>       echo '<td>';
>       echo __('Serial number')." : </td><td>";
>       Dropdown::showYesNo("serialnumber", 1, -1, array('width' => '100'));
>       echo '</td>';
>       echo '</tr>';
>       echo '<tr>';
>       echo '<td>';
>       echo __('Inventory number')." : </td><td>";
>       Dropdown::showYesNo("inventorynumber", 1, -1, array('width' => '100'));
>       echo '</td>';
>       echo '</tr>';
>       echo '<tr>';
>       echo '<td>';
>       echo __('ID')." : </td><td>";
>       Dropdown::showYesNo("id", 1, -1, array('width' => '100'));
>       echo '</td>';
>       echo '</tr>';
>       echo '<tr>';
>       echo '<td>';
>       echo __('UUID')." : </td><td>";
>       Dropdown::showYesNo("uuid", 1, -1, array('width' => '100'));
>       echo '</td>';
>       echo '</tr>';
>       echo '<tr>';
>       echo '<td>';
>       echo __('Name')." : </td><td>";
>       Dropdown::showYesNo("name", 1, -1, array('width' => '100'));
>       echo '</td>';
>       echo '</tr>';
>       echo '<tr>';
>       echo '<td>';
>       echo __('Web page of the device')." : </td><td>";
>       Dropdown::showYesNo("url", 1, -1, array('width' => '100'));
>       echo '</td>';
>       echo '</tr>';
>       echo '<tr>';
>       echo '<td>';
>       echo __('Date QRcode')." (".date('Y-m-d').") : </td><td>";
>       Dropdown::showYesNo("qrcodedate", 1, -1, array('width' => '100'));
>       echo '</td>';
>       echo '</tr>';
>
>
262a314,317
>       $names = $p_params['names'];
>       $copies = $p_params['copies'];
>       if ( $copies < 1 ) {$copies=1;}
>
329a385
>       $count_codes=-1;
330a387,389
>       $count_codes++;
> for ($i=0;$i<$copies;$i++)
> {
340c399
<                   $y = $pdf->ez['pageHeight'] - $pdf->ez['topMargin'] - $height;
---
>                   $y = $pdf->ez['pageHeight'] - $pdf->ez['topMargin'];
342c401
<                   $y -= $height + $marginV;
---
>                   $y -= $height + $marginV + $max_count*10;
366a426
> //$pdf->addText($x,$y,5,$item->getField('name'),0,0);
390,392c450,460
<                if ($p_params['border']) {
<                   $pdf->Rectangle($x, $y, $width, $height);
<                }
---
>
>               for ($i=0;$i<count($names[$count_codes]);$i++)
>               {
>                       $pdf->addText($x,$y-(10*($i+1)),10,$names[$count_codes][$i],0,0);
>                       if ($max_count<$i) $max_count=$i;
>               }
>               if ($p_params['border'])
>               {
>                       $pdf->Rectangle($x-3, $y-(10*count($names[$count_codes])+3), $width+6, $height+(10*count($names[$count_codes]))+3);
>               }
>
396a465
> }
461a531
>             $namess = array();
464a535
>                 $names[] = '';
466a538
> $i=0;
468a541
>               $i++;
473c546,553
<                      $codes[] = $item->getField('otherserial');
---
>                       if ($item->getField('otherserial') == '')
>                       {
>                               $codes[] = $item->getField('name');
>                       }
>                       else
>                       {
>                               $codes[] = $item->getField('otherserial');
>                       }
475a556
>               $names[]=$pbQRcode->getAllText($item->getType(), $key, $ma->POST);
479a561,562
>                $params['names']  = $names;
>                $params['copies']  = $ma->POST['copies'];;

Last edited by ged (2015-04-08 04:52:10)

Offline

#12 2015-04-13 13:27:45

tcse10
Member
From: Germany
Registered: 2014-10-22
Posts: 14

Re: Barcode plugin bug and feature requests

Hy. I also did some programming on this. Maybe my solution is more powerful. I also fixed margins problem, and wood like to commit my changes (to a new branch?).

Offline

#13 2015-04-13 14:44:51

bgirault
Member
Registered: 2015-02-04
Posts: 30

Re: Barcode plugin bug and feature requests

Bonjour,

est ce que le plugin va intégrer ces fonctionnalités ?

merci

Offline

#14 2015-04-13 15:29:08

ddurieux
Plugins Dev
From: Propières, France
Registered: 2005-06-17
Posts: 7,521

Re: Barcode plugin bug and feature requests

Oui, juste trouver le temps de le faire wink

Offline

#15 2015-04-15 12:03:04

bgirault
Member
Registered: 2015-02-04
Posts: 30

Re: Barcode plugin bug and feature requests

oh oui j'imagine que c'est du boulot
merci en tout cas

Offline

#16 2015-04-15 12:05:46

bgirault
Member
Registered: 2015-02-04
Posts: 30

Re: Barcode plugin bug and feature requests

Je surveillerai les maj wink

Last edited by bgirault (2015-04-15 12:06:54)

Offline

#17 2015-04-22 14:17:05

tcse10
Member
From: Germany
Registered: 2014-10-22
Posts: 14

Re: Barcode plugin bug and feature requests

By the Way: this is my patch if anyone is interested in it.

Changelog:
* Added: function to display text beside QR Code (with automatic linebackers)
* Fixed: Margins dos not take effect
* Fixed: QR Code generation not available for network equipment
* Added: QR Code generation for Software Licenses

Known problems/Limitations:
* Text Settings dos not take effect, but can be set in /inc/barcode.class.php at line 311
* Only QR Code generation has been tested

Index: hook.php
===================================================================
--- hook.php    (revision 151)
+++ hook.php    (working copy)
@@ -44,16 +44,17 @@
 
    switch ($type) {
       // New action for core and other plugin types : name = plugin_PLUGINNAME_actionname
+      case 'SoftwareLicense' :
       case 'Computer' :
       case 'Monitor' :
-        case 'Networking' :
-        case 'Printer' :
-        case 'Peripheral' :
-        case 'Phone' :
+      case 'NetworkEquipment' :
+      case 'Printer' :
+      case 'Peripheral' :
+      case 'Phone' :
          return array("PluginBarcodeBarcode".MassiveAction::CLASS_ACTION_SEPARATOR.'Generate' => __('Barcode', 'barcode')." - ".__('Print barcodes', 'barcode'),
                       "PluginBarcodeQRcode".MassiveAction::CLASS_ACTION_SEPARATOR.'Generate'  => __('Barcode', 'barcode')." - ".__('Print QRcodes', 'barcode'));
          
-        case 'Ticket' :
+      case 'Ticket' :
          return array("PluginBarcodeBarcode".MassiveAction::CLASS_ACTION_SEPARATOR.'Generate' => __('Barcode', 'barcode')." - ".__('Print barcodes', 'barcode'));
 
 //      case 'Profile' :
Index: inc/barcode.class.php
===================================================================
--- inc/barcode.class.php    (revision 151)
+++ inc/barcode.class.php    (working copy)
@@ -218,38 +218,39 @@
       $config = $pbConfig->getConfigType();
 
       echo '<table>';
-      echo '<tr>';
-      echo '<td>';
-        echo "<br/>".__('Page size', 'barcode')." : </td><td>";
-        $pbBarcode->showSizeSelect($config['size']);
-      echo '</td>';
-      echo '</tr>';
-      echo '<tr>';
-      echo '<td>';
-        echo "<br/>".__('Orientation', 'barcode')." : </td><td>";
-        $pbBarcode->showOrientationSelect($config['orientation']);
-      echo '</td>';
-      echo '</tr>';
-      echo '<tr>';
-      echo '<td>';
-      echo __('Not use first xx barcodes', 'barcode')." : </td><td>";
-      Dropdown::showNumber("eliminate", array('width' => '100')); 
-      echo '</td>';
-      echo '</tr>';
-      echo '<tr>';
-      echo '<td>';
-      echo __('Display border', 'barcode')." : </td><td>";
-      Dropdown::showYesNo("border", 1, -1, array('width' => '100'));
-      echo '</td>';
-      echo '</tr>';
+        echo '<tr>';
+            echo '<td>';
+                echo "<br/>".__('Page size', 'barcode')." : </td><td>";
+                $pbBarcode->showSizeSelect($config['size']);
+            echo '</td>';
+        echo '</tr>';
+        echo '<tr>';
+            echo '<td>';
+                echo "<br/>".__('Orientation', 'barcode')." : </td><td>";
+                $pbBarcode->showOrientationSelect($config['orientation']);
+            echo '</td>';
+        echo '</tr>';
+        echo '<tr>';
+            echo '<td>';
+                echo __('Not use first xx barcodes', 'barcode')." : </td><td>";
+                Dropdown::showNumber("eliminate", array('width' => '100')); 
+            echo '</td>';
+        echo '</tr>';
+        echo '<tr>';
+            echo '<td>';
+                echo __('Display border', 'barcode')." : </td><td>";
+                Dropdown::showYesNo("border", 1, -1, array('width' => '100'));
+            echo '</td>';
+        echo '</tr>';
       echo '</table>';
       echo '</center>';
       
       echo "<br/><input type='submit' value='".__('Create', 'barcode')."' class='submit'>";
+
    }
 
+
    
-   
    function printPDF($p_params) {
       
       $pbConfig = new PluginBarcodeConfig();
@@ -259,9 +260,11 @@
       $type = $p_params['type'];
       $size = $p_params['size'];
       $orientation = $p_params['orientation'];
+      $qrDataCollection = array();// $p_params['qrData'];
       $codes = array();
       if ($type == 'QRcode') {
          $codes = $p_params['codes'];
+         $qrDataCollection = $p_params['qrData'];
       } else {
          if (isset($p_params['code'])) {
             if (isset($p_params['nb']) AND $p_params['nb']>1) {
@@ -268,6 +271,7 @@
                $this->create($p_params['code'], $type, $ext);
                for ($i=1 ; $i<=$p_params['nb'] ; $i++) {
                   $codes[] = $p_params['code'];
+                  $qrDataCollection[] = $p_params['qrData'];
                }
             } else {
                if (!$this->create($p_params['code'], $type, $ext)) {
@@ -274,9 +278,11 @@
                   Session::addMessageAfterRedirect(__('The generation of some bacodes produced errors.', 'barcode'));
                }
                $codes[] = $p_params['code'];
+               $qrDataCollection[] = $p_params['qrData'];
             }
          } elseif (isset($p_params['codes'])) {
             $codes = $p_params['codes'];
+            $qrDataCollection = $p_params['qrData'];
             foreach ($codes as $code) {
                if ($code != '') {
                   $this->create($code, $type, $ext);
@@ -297,11 +303,16 @@
 
       $pdf= new Cezpdf($size, $orientation);
       $pdf->selectFont(GLPI_ROOT."/plugins/barcode/lib/ezpdf/fonts/Helvetica.afm");
-      $pdf->ezStartPageNumbers($pdf->ez['pageWidth']-30, 10, 10, 'left', '{PAGENUM} / {TOTALPAGENUM}').
+      $pdf->ezStartPageNumbers($pdf->ez['pageWidth']-30, 10, 10, 'left', '{PAGENUM} / {TOTALPAGENUM}'). 
       $width   = $config['maxCodeWidth'];
       $height  = $config['maxCodeHeight'];
       $marginH = $config['marginHorizontal'];
       $marginV = $config['marginVertical'];
+      $txtSize = 11; //$config['txtSize'];//why is this not working?
+      $Spacing = 4; //$config['Spacing'];//4;
+      // bogfix margins mot set (ezSetCmMargins wood be nice) VALUE =  (CM / 2.54 ) * 72
+      $pdf->ezSetMargins($config['marginTop'],$config['marginBottom'],$config['marginLeft'],$config['marginRight']);
+      
       
       $heightimage = $height;
 
@@ -327,7 +338,10 @@
       
       
       $first=true;
-      foreach ($codes as $code) {
+      //foreach ($codes as $code) {
+        for($ia = 0; $ia <= count($codes); $ia++){
+         $code = $codes[$ia];
+         $qrData = $qrDataCollection[$ia];
          if ($first) {
             $x = $pdf->ez['leftMargin'];
             $y = $pdf->ez['pageHeight'] - $pdf->ez['topMargin'] - $height;
@@ -363,11 +377,12 @@
                   $imgHeight = $heightimage;
                   $imgWidth  = $imgWidth * ($ratio / 100);
                }
-
+                
+                //Add Barcode
                $image = imagecreatefrompng($imgFile);               
                if ($imgWidth < $width) {
                   $pdf->addImage($image, 
-                                 $x + (($width - $imgWidth) / 2), 
+                                 $x + $Spacing,//$x + (($width - $imgWidth) / 2), 
                                  $y, 
                                  $imgWidth, 
                                  $imgHeight);
@@ -387,6 +402,12 @@
                                  $logoWidth, 
                                  $logoHeight);
                }
+               //Add Plain Text Info
+               $txtOffsett = 0;
+               for($i = 0; $i <= count($qrData); $i++){
+                   $txtOffsett =+ $this->AddText($x + $Spacing * 2 + $imgWidth,$y + ($imgHeight - $txtSize * ($i + 1 + $txtOffsett)), ($width - ($Spacing * 2 + $imgWidth)) ,$txtSize,$qrData[$i],$pdf);
+               }
+               
                if ($p_params['border']) {
                   $pdf->Rectangle($x, $y, $width, $height);
                }
@@ -400,9 +421,25 @@
       file_put_contents($this->docsPath.$pdfFile, $file);
       return '/files/_plugins/barcode/'.$pdfFile;
    }
+    
+    
+   /*******************************************************************************
+   * @Function    AddText
+   * @Description Adds multi line text and returns number of used Lines (zero based)
+   * @author     Jonas Jansen
+   * @license    AGPL License 3.0 or (at your option) any later version
+                 http://www.gnu.org/licenses/agpl-3.0-standalone.html
+   * @since      22.04.2015 Patch for text Besite QRCode
+   ********************************************************************************/
+    function AddText($PosX, $PosY, $width, $textSize, $text, $pdf) {
+        $snip = '';
+        if(($snip = $pdf->addTextWrap($PosX,$PosY,$width,$textSize,$text)) != ''){
+            return 1 + $this->AddText($PosX,($PosY - $textSize),$width,$textSize,$snip,$pdf);
+        }
+        return 0;
+   }
+   
 
-   
-   
    function create($p_code, $p_type, $p_ext) {
       require_once(GLPI_ROOT.'/plugins/barcode/lib/Image_Barcode/Barcode.php');
       require_once(GLPI_ROOT.'/plugins/barcode/inc/functions_debug.php');
Index: inc/config.class.php
===================================================================
--- inc/config.class.php    (revision 151)
+++ inc/config.class.php    (working copy)
@@ -187,6 +187,15 @@
             echo "<input type='text' size='20' name='maxCodeHeight' value='".$config['maxCodeHeight']."'>";
             echo "</td>";
          echo "</tr>";
+         echo "<tr><th colspan='4'>".__('Text Settings', 'barcode')."</th></tr>";
+         echo "<tr class='tab_bg_1'>";
+            echo "<td>".__('Font Size', 'barcode')."</td><td>";
+            echo "<input type='text' size='20' name='txtSize ' value='".$config['txtSize']."'>";
+            echo "</td>";
+            echo "<td>".__('Spacing between code and Text', 'barcode')."</td><td>";
+            echo "<input type='text' size='20' name='Spacing ' value='".$config['Spacing']."'>";
+            echo "</td>";
+         echo "</tr>";
 
         echo "<tr><td class='tab_bg_1' colspan='4' align='center'><input type='submit' value='".__('Save')."' class='submit'></td></tr>";
         echo "</table>";
Index: inc/qrcode.class.php
===================================================================
--- inc/qrcode.class.php    (revision 151)
+++ inc/qrcode.class.php    (working copy)
@@ -57,6 +57,7 @@
       $item = new $itemtype();
       $item->getFromDB($items_id);
       $a_content = array();
+      $b_content = array(8);
       $have_content = FALSE;
       if ($data['serialnumber']) {
          if ($item->fields['serial'] != '') {
@@ -63,6 +64,9 @@
             $have_content = TRUE;
          }
          $a_content[] = 'Serial Number = '.$item->fields['serial'];
+         if ($data['dpserialnumber']) { 
+            $b_content[($data['dpserialnumber'] - 1)] = 'Serial Number = '.$item->fields['serial'];
+         }
       }
       if ($data['inventorynumber']) {
          if ($item->fields['otherserial'] != '') {
@@ -69,6 +73,9 @@
             $have_content = TRUE;
          }
          $a_content[] = 'Inventory Number = '.$item->fields['otherserial'];
+         if ($data['dpinventorynumber']) { 
+            $b_content[($data['dpinventorynumber'] - 1)] = 'Inventory Number = '.$item->fields['otherserial'];
+         }
       }
       if ($data['id']) {
          if ($item->fields['id'] != '') {
@@ -75,6 +82,9 @@
             $have_content = TRUE;
          }
          $a_content[] = 'ID = '.$item->fields['id'];
+         if ($data['dpid']) { 
+            $b_content[($data['dpid'] - 1)] = 'ID = '.$item->fields['otherserial'];
+         }
       }
       if ($data['uuid']) {
          if ($item->fields['uuid'] != '') {
@@ -81,6 +91,9 @@
             $have_content = TRUE;
          }
          $a_content[] = 'UUID = '.$item->fields['uuid'];
+         if ($data['dpuuid']) { 
+            $b_content[($data['dpuuid'] - 1)] = 'UUID = '.$item->fields['otherserial'];
+         }
       }      
       if ($data['name']) {
          if ($item->fields['name'] != '') {
@@ -87,12 +100,21 @@
             $have_content = TRUE;
          }
          $a_content[] = 'Name = '.$item->fields['name'];
+         if ($data['dpname']) { 
+            $b_content[($data['dpname'] - 1)] = 'Name = '.$item->fields['name'];
+         }
       }
       if ($data['url']) {
          $a_content[] = 'URL = '.$CFG_GLPI["url_base"].Toolbox::getItemTypeFormURL($itemtype, false)."?id=".$items_id;
+         if ($data['dpurl']) { 
+            $b_content[($data['dpurl'] - 1)] = 'URL = '.$CFG_GLPI["url_base"].Toolbox::getItemTypeFormURL($itemtype, false)."?id=".$items_id;
+         }
       }      
       if ($data['qrcodedate']) {
          $a_content[] = 'QRcode date = '.date('Y-m-d');
+                  if ($data['dpqrcodedate']) { 
+            $b_content[($data['dpqrcodedate'] - 1)] = 'QRcode date = '.date('Y-m-d');
+         }
       }      
       
       if (count($a_content) > 0) {
@@ -101,7 +123,7 @@
                      GLPI_PLUGIN_DOC_DIR.'/barcode/_tmp_'.$rand.'-'.$number.'.png',
                      QR_ECLEVEL_L, 
                      4);
-         return GLPI_PLUGIN_DOC_DIR.'/barcode/_tmp_'.$rand.'-'.$number.'.png';
+         return array(GLPI_PLUGIN_DOC_DIR.'/barcode/_tmp_'.$rand.'-'.$number.'.png',$b_content);
       }
       return false;
    }
@@ -127,6 +149,12 @@
       Dropdown::showYesNo("serialnumber", 1, -1, array('width' => '100'));
       echo '</td>';
       echo '</tr>';
+      echo '<tr>';
+      echo '<td>';
+      echo __('Display Serial number')." : </td><td>";
+      Dropdown::showFromArray("dpserialnumber",array(3 => "third",-1 => "No",1 => "first",2 => "second", 4 => "fourth",5 => "fifth",6 => "sixth", 7 => "seventh"), array('width' => '100'));
+      echo '</td>';
+      echo '</tr>';
       echo '<tr>';
       echo '<td>';
       echo __('Inventory number')." : </td><td>";
@@ -133,6 +161,12 @@
       Dropdown::showYesNo("inventorynumber", 1, -1, array('width' => '100')); 
       echo '</td>';
       echo '</tr>';
+      echo '<tr>';
+      echo '<td>';
+      echo __('Display Inventory number')." : </td><td>";
+      Dropdown::showFromArray("dpinventorynumber",array(2 => "second",-1 => "No",1 => "first",3 => "third", 4 => "fourth",5 => "fifth",6 => "sixth", 7 => "seventh"), array('width' => '100'));
+      echo '</td>';
+      echo '</tr>';
       echo '<tr>';
       echo '<td>';
       echo __('ID')." : </td><td>";
@@ -139,6 +173,12 @@
       Dropdown::showYesNo("id", 1, -1, array('width' => '100')); 
       echo '</td>';
       echo '</tr>';
+      echo '<tr>';
+      echo '<td>';
+      echo __('Display ID')." : </td><td>";
+      Dropdown::showFromArray("dpid",array(-1 => "No",1 => "first",2 => "second",3 => "third", 4 => "fourth",5 => "fifth",6 => "sixth", 7 => "seventh"), array('width' => '100'));
+      echo '</td>';
+      echo '</tr>';
       echo '<tr>';
       echo '<td>';
       echo __('UUID')." : </td><td>";
@@ -145,6 +185,12 @@
       Dropdown::showYesNo("uuid", 1, -1, array('width' => '100')); 
       echo '</td>';
       echo '</tr>';
+      echo '<tr>';
+      echo '<td>';
+      echo __('Display UUID')." : </td><td>";
+      Dropdown::showFromArray("dpuuid",array(-1 => "No",1 => "first",2 => "second",3 => "third", 4 => "fourth",5 => "fifth",6 => "sixth", 7 => "seventh"), array('width' => '100'));
+      echo '</td>';
+      echo '</tr>';
       echo '<tr>';
       echo '<td>';
       echo __('Name')." : </td><td>";
@@ -151,6 +197,12 @@
       Dropdown::showYesNo("name", 1, -1, array('width' => '100'));
       echo '</td>';
       echo '</tr>';
+      echo '<tr>';
+      echo '<td>';
+      echo __('Display Name')." : </td><td>";
+      Dropdown::showFromArray("dpname",array(1 => "first",-1 => "No",2 => "second",3 => "third", 4 => "fourth",5 => "fifth",6 => "sixth", 7 => "seventh"), array('width' => '100'));
+      echo '</td>';
+      echo '</tr>';
       echo '<tr>';
       echo '<td>';     
       echo __('Web page of the device')." : </td><td>";
@@ -157,6 +209,12 @@
       Dropdown::showYesNo("url", 1, -1, array('width' => '100'));
       echo '</td>';
       echo '</tr>';
+      echo '<tr>';
+      echo '<td>';
+      echo __('Display Web page of the device')." : </td><td>";
+      Dropdown::showFromArray("dpurl",array(-1 => "No",1 => "first",2 => "second",3 => "third", 4 => "fourth",5 => "fifth",6 => "sixth", 7 => "seventh"), array('width' => '100'));
+      echo '</td>';
+      echo '</tr>';
       echo '<tr>';
       echo '<td>';
       echo __('Date QRcode')." (".date('Y-m-d').") : </td><td>";
@@ -163,9 +221,16 @@
       Dropdown::showYesNo("qrcodedate", 1, -1, array('width' => '100'));
       echo '</td>';
       echo '</tr>';
+      echo '<tr>';
+      echo '<td>';
+      echo __('Display QRcode Date')." : </td><td>";
+      Dropdown::showFromArray("dpqrcodedate",array(-1 => "No",1 => "first",2 => "second",3 => "third", 4 => "fourth",5 => "fifth",6 => "sixth", 7 => "seventh"), array('width' => '100'));
+      echo '</td>';
+      echo '</tr>';
       echo '</table>';
       echo '<br/>';
       
+      
       PluginBarcodeBarcode::commonShowMassiveAction();
    }
 
@@ -206,16 +271,21 @@
             $rand = mt_rand();
             $number = 0;     
             $codes = array();
+            $qrDataColection = array();
             if ($ma->POST['eliminate'] > 0) {
                for ($nb=0; $nb < $ma->POST['eliminate']; $nb++) {
                   $codes[] = '';
+                  $qrDataColection[] = '';
                }
             }
             if ($ma->POST['type'] == 'QRcode') {
                foreach ($ids as $key) {
-                  $filename = $pbQRcode->generateQRcode($item->getType(), $key, $rand, $number, $ma->POST);
+                  $return = $pbQRcode->generateQRcode($item->getType(), $key, $rand, $number, $ma->POST);
+                  $filename = $return[0];
+                  $qrData = $return[1];
                   if ($filename) {
                      $codes[] = $filename;
+                     $qrDataColection[] = $qrData;
                      $number++;
                   }
                }
@@ -228,6 +298,7 @@
                }
             }
             if (count($codes) > 0) {
+               $params['qrData'] = $qrDataColection;
                $params['codes']  = $codes;
                $params['type']   = $ma->POST['type'];
                $params['size']   = $ma->POST['size'];

Offline

#18 2015-06-01 04:16:58

abbylee
Member
Registered: 2015-01-07
Posts: 3

Re: Barcode plugin bug and feature requests

Thanks for your barcode plug-in, but I want to know whether it support working in .net or java application? Now I only have a trial of one .net barcode generator, looking forward to try yours.
Thank you so much.

Offline

#19 2015-10-15 13:27:37

ynasri
Member
Registered: 2012-04-04
Posts: 8

Re: Barcode plugin bug and feature requests

comment peut-on utiliser ce patch  ? merci de votre aide

Offline

#20 2016-10-15 09:46:09

akhiljirra
Member
Registered: 2016-10-15
Posts: 4

Re: Barcode plugin bug and feature requests

Hi,
How can we use this patch for Barcode plugin 0.90+1.0, running GLPI 0.90.3

Appariciate your help

Offline

Board footer

Powered by FluxBB