49 lines
2.0 KiB
PHP
49 lines
2.0 KiB
PHP
<?php
|
|
|
|
use Glpi\Event;
|
|
include_once ('../lib/phpqrcode/qrlib.php');
|
|
$tempdirpath = dirname(__DIR__).DIRECTORY_SEPARATOR.'pics';
|
|
$PNG_WEB_DIR = 'temp'.DIRECTORY_SEPARATOR;
|
|
if(isset($_GET['artcode']) && isset($_GET['artlib'])){
|
|
|
|
$codeartc = $_GET['artcode'];
|
|
$libartc = $_GET['artlib'];
|
|
$sr = isset($_GET['serial']) ? " S/N: ".$_GET['serial'] : "";
|
|
$libartc = $_GET['artlib'].$sr;
|
|
if (!file_exists($tempdirpath))
|
|
mkdir($tempdirpath);
|
|
|
|
|
|
$codetemp = str_replace('/','_',$codeartc);
|
|
$filename = $tempdirpath.DIRECTORY_SEPARATOR.$PNG_WEB_DIR.$codetemp.'.png';
|
|
QRcode::png($codeartc, $filename, 'H', 2, 2) ;
|
|
include('../lib/tcpdf/templates/article_qr_one_product.php');
|
|
}else if(isset($_GET['bulk'])){
|
|
include_once('../model_controller/articles.list.immo.php');
|
|
$zone = $_GET['bulk'];
|
|
$results = getArticlesOfImmo($_GET['bulk']);
|
|
$arry = array();
|
|
for($i = 0;$i < count($results); $i++) {
|
|
$codetemp = str_replace('/','_',$results[$i]['ART_CODE']);
|
|
$zn = isset($results[$i]['STK_ZONE']) && !empty($results[$i]['STK_ZONE']) ? " Zone: ".$results[$i]['STK_ZONE'] : "";
|
|
if (isset($_GET['serial']) && $_GET['serial'] == 1){
|
|
$sr = isset($results[$i]['STK_NUMLOT']) && !empty($results[$i]['STK_NUMLOT']) ? " S/N: ".$results[$i]['STK_NUMLOT'] : "";
|
|
$libartc = $results[$i]['ART_LIB'].$sr.$zn;
|
|
}else{
|
|
$libartc = $results[$i]['ART_LIB'].$zn;
|
|
}
|
|
$filename = $tempdirpath.DIRECTORY_SEPARATOR.$PNG_WEB_DIR.$codetemp.'.png';
|
|
if(!file_exists($filename))
|
|
QRcode::png($results[$i]['ART_CODE'], $filename, 'H', 2, 2) ;
|
|
unset($row);
|
|
$row[$libartc] = $filename;
|
|
array_push($arry,$row);
|
|
}
|
|
// print_r(array_values($arry));
|
|
// print_r($results);
|
|
include('../lib/tcpdf/templates/article_qr_bulk_small.php');
|
|
//$path = $tempdirpath.DIRECTORY_SEPARATOR.$PNG_WEB_DIR;
|
|
//print_r(array_diff(scandir($path), array('.', '..')));
|
|
}else{
|
|
Html::redirect($CFG_GLPI["root_doc"]."/front/articles.list.immo.php");
|
|
} |