forked from science-ation/science-ation
- Avoid a divde by zero in label generation
- Never allow the number of lines for text data to be zero in the first place.
This commit is contained in:
parent
801e70cb0c
commit
edf26caf1e
@ -281,6 +281,7 @@ foreach($report_stock as $n=>$v) {
|
|||||||
/* field, value, x, y, w, h, lines, face, align */
|
/* field, value, x, y, w, h, lines, face, align */
|
||||||
$vals = "'$k','$v','0','0','0','0','0','',''";
|
$vals = "'$k','$v','0','0','0','0','0','',''";
|
||||||
} else {
|
} else {
|
||||||
|
if($v['lines'] == 0) $v['lines'] =1;
|
||||||
$opts = "{$v['align']} {$v['valign']}";
|
$opts = "{$v['align']} {$v['valign']}";
|
||||||
$vals = "'{$v['field']}','{$v['value']}',
|
$vals = "'{$v['field']}','{$v['value']}',
|
||||||
'{$v['x']}','{$v['y']}','{$v['w']}',
|
'{$v['x']}','{$v['y']}','{$v['w']}',
|
||||||
@ -707,9 +708,9 @@ foreach($report_stock as $n=>$v) {
|
|||||||
/* Special column, override result with static text */
|
/* Special column, override result with static text */
|
||||||
if($f == 'static_text') $v = $d['value'];
|
if($f == 'static_text') $v = $d['value'];
|
||||||
|
|
||||||
|
$lh = ($d['lines'] == 0) ? 0 : $d['h']/$d['lines'];
|
||||||
$rep->addLabelText2($d['x'], $d['y'], $d['w'],
|
$rep->addLabelText2($d['x'], $d['y'], $d['w'],
|
||||||
$d['h'], $d['h']/$d['lines'],
|
$d['h'], $lh,
|
||||||
$v, $opt);
|
$v, $opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,7 @@ function reportChange()
|
|||||||
$v = stripslashes($v);
|
$v = stripslashes($v);
|
||||||
} else if(in_array($l, $floatloc)) {
|
} else if(in_array($l, $floatloc)) {
|
||||||
$v = floatval($v);
|
$v = floatval($v);
|
||||||
|
if($l == 'lines' && $v==0) $v=1;
|
||||||
} else if($l == 'face') {
|
} else if($l == 'face') {
|
||||||
$v = ($v == 'bold') ? 'bold' : '';
|
$v = ($v == 'bold') ? 'bold' : '';
|
||||||
} else if($l == 'align') {
|
} else if($l == 'align') {
|
||||||
@ -155,7 +156,7 @@ function reportChange()
|
|||||||
echo "Invalid valignment $v";
|
echo "Invalid valignment $v";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$a[$l] = $v;
|
$a[$l] = $v;
|
||||||
}
|
}
|
||||||
if(trim($a['field']) == '') continue;
|
if(trim($a['field']) == '') continue;
|
||||||
@ -271,6 +272,7 @@ function reportChange()
|
|||||||
$vw = intval($v['w']);
|
$vw = intval($v['w']);
|
||||||
$vh = intval($v['h']);
|
$vh = intval($v['h']);
|
||||||
$vlines = intval($v['lines']);
|
$vlines = intval($v['lines']);
|
||||||
|
if($vlines == 0) $vlines = 1;
|
||||||
$face = $v['face'];
|
$face = $v['face'];
|
||||||
$align = $v['align']. ' ' . $v['valign'];
|
$align = $v['align']. ' ' . $v['valign'];
|
||||||
$value=mysql_escape_string(stripslashes($v['value']));
|
$value=mysql_escape_string(stripslashes($v['value']));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user