From 8efb3f2bcff66c4f7106cbed1997c5cfab0a647f Mon Sep 17 00:00:00 2001 From: james Date: Thu, 17 Mar 2011 22:20:45 +0000 Subject: [PATCH] Add projectbarcode (only works with tcpdf) IF report has no items, still return the empty shell of the report (fix typo,. was returning $ret, instead of $report) --- admin/reports.inc.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/admin/reports.inc.php b/admin/reports.inc.php index 0d14e55..69a78a8 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -419,7 +419,7 @@ foreach($report_stock as $n=>$v) { ORDER BY `ord`"); print(mysql_error()); - if(mysql_num_rows($q) == 0) return $ret; + if(mysql_num_rows($q) == 0) return $report; while($a = mysql_fetch_assoc($q)) { $f = $a['field']; @@ -429,14 +429,13 @@ foreach($report_stock as $n=>$v) { /* We dont' care about order, just construct * ['option'][name] = value; */ if(!in_array($f, $allow_options)) { - print("Type[$type] Field[$f] not allowed.\n"); +// print("Type[$type] Field[$f] not allowed.\n"); continue; } $report['option'][$f] = $a['value']; - break; default: if(!in_array($f, $allow_fields)) { - print("Type[$type] Field[$f] not allowed.\n"); +// print("Type[$type] Field[$f] not allowed.\n"); continue; } /* Pull out all the data */ @@ -896,11 +895,25 @@ foreach($report_stock as $n=>$v) { if($f == 'static_text') $v = $d['value']; $v = iconv("ISO-8859-1//TRANSLIT", "UTF-8", $v); + if($f=="projectbarcode") { + $style = array( + 'border' => 2, + 'vpadding' => 'auto', + 'hpadding' => 'auto', + 'fgcolor' => array(0,0,0), + 'bgcolor' => false, //array(255,255,255) + 'module_width' => 2, // width of a single module in points + 'module_height' => 2 // height of a single module in points + ); + $rep->barcode($v, 'QRCODE,H', $d['x'], $d['y'], $d['w'], $d['h'], $style, 'N'); + } + else { + $rep->label_text($d['x'], $d['y'], $d['w'], $d['h'], + $v, $show_box, $d['align'], $d['valign'], + $d['fontname'],$d['fontstyle'],$d['fontsize'], + $d['on_overflow']); + } - $rep->label_text($d['x'], $d['y'], $d['w'], $d['h'], - $v, $show_box, $d['align'], $d['valign'], - $d['fontname'],$d['fontstyle'],$d['fontsize'], - $d['on_overflow']); } }