Fix load/save now that face and lines are gone. Change TCPDF report

types to use the old types.
This commit is contained in:
dave 2010-06-08 18:57:01 +00:00
parent ce1d289a31
commit 180550f15e

View File

@ -49,7 +49,7 @@
$report_options = array();
$report_options['type'] = array('desc' => 'Report Format',
'values' => array('tcpdf' => 'PDF', 'tcpdf_label'=>'Label', 'csv'=>'CSV (for Excel)', 'text'=>'Text (Plain text in columns)', 'pdf'=>'PDF (PDFlib deprecated)', 'label'=>'Label (PDFlib deprecated)', )
'values' => array('pdf' => 'PDF', 'label'=>'Label', 'csv'=>'CSV (for Excel)', 'text'=>'Coming Soon: Text (Plain text in columns)', 'html'=>'Coming Soon: HTML (Browser Renderable)' )
);
$report_options['group_new_page'] = array('desc' => 'Start each new grouping on a new page',
'values' => array('no'=>'No', 'yes'=>'Yes')
@ -348,16 +348,13 @@ foreach($report_stock as $n=>$v) {
$x = 0;
foreach($report[$type] as $k=>$v) {
if($type == 'option') {
/* field, value, x, y, w, h, lines, face, align, valign, fn, fs, fsize, overflow */
$vals = "'$k','$v','0','0','0','0','0','','','','','','0','truncate'";
/* field, value, x, y, w, h, align, valign, fn, fs, fsize, overflow */
$vals = "'$k','$v','0','0','0','0','','','','','0','truncate'";
} else {
if($v['lines'] == 0) $v['lines'] =1;
$fs = is_array($v['fontstyle']) ? implode(',',$v['fontstyle']) : '';
$opts = "{$v['align']} {$v['valign']}";
$vals = "'{$v['field']}','{$v['value']}',
'{$v['x']}','{$v['y']}','{$v['w']}',
'{$v['h']}','{$v['lines']}','{$v['face']}',
'$opts','{$v['valign']}',
'{$v['x']}','{$v['y']}','{$v['w']}','{$v['h']}',
'{$v['align']}','{$v['valign']}',
'{$v['fontname']}','$fs','{$v['fontsize']}',
'{$v['on_overflow']}'";
}
@ -368,7 +365,7 @@ foreach($report_stock as $n=>$v) {
mysql_query("INSERT INTO reports_items(`reports_id`,`type`,`ord`,
`field`,`value`,`x`, `y`, `w`, `h`,
`lines`, `face`, `align`,`valign`,
`align`,`valign`,
`fontname`,`fontstyle`,`fontsize`,`on_overflow`)
VALUES $q;");
@ -436,28 +433,10 @@ foreach($report_stock as $n=>$v) {
}
/* Pull out all the data */
$val = array();
$col_fields = array('field', 'x', 'y', 'w', 'h', 'lines', 'face', 'align', 'valign', 'value', 'fontname','fontsize','on_overflow');
$col_fields = array('field', 'x', 'y', 'w', 'h', 'align', 'valign', 'value', 'fontname','fontsize','on_overflow');
foreach($col_fields as $lf) $val[$lf] = $a[$lf];
$val['fontstyle'] = explode(',', $a['fontstyle']);
/* valign, fontname, fontsize,fontstyle are unused, except in tcpdf reports
(i.e. nothign has changed, only adding on */
if($val['lines'] == 0) $val['lines'] = 1;
/* Old format, where align and valign are stored in 'align',
* separte them. */
$opts = explode(" ", $val['align']);
$align_opts = array ('left', 'right', 'center');
$valign_opts = array ('vtop', 'vbottom', 'vcenter');
foreach($opts as $o) {
if(in_array($o, $align_opts)) $val['align'] = $o;
if(in_array($o, $valign_opts)) $val['valign'] = $o;
}
/* Turn the old 'face' into the fontstyle array */
$style_opts = array ('bold');
if(in_array($val['face'], $style_opts)) {
$val['fontstyle'] = array($val['face']);
}
$report[$t][$a['ord']] = $val;
break;
@ -897,28 +876,6 @@ foreach($report_stock as $n=>$v) {
}
if($gen_mode == 'table') {
$data[] = $v;
} else if($gen_mode == 'label') {
$opt = array();
if($d['face'] == 'bold') $opt[] = 'bold';
$opt[] = $d['align'];
$opt[] = $d['valign'];
if($report['option']['field_box'] == 'yes')
$opt[] = 'field_box';
/* Special column, draw a box */
if($f == 'static_box') {
$rep->addLabelBox($d['x'], $d['y'], $d['w'],
$d['h']);
} else {
/* Special column, override result with static text */
if($f == 'static_text') $v = $d['value'];
$lh = ($d['lines'] == 0) ? 0 : $d['h']/$d['lines'];
$rep->addLabelText2($d['x'], $d['y'], $d['w'],
$d['h'], $lh,
$v, $opt);
}
} else if($gen_mode == 'tcpdf_label') {
/* Setup additional options */
$show_box = ($report['option']['field_box'] == 'yes') ? true : false;