Bug 5203 - Creating a label template causes fatal error if description field is empty

This is due to the underlying script not having any defaults hard coded which results
in skewed hash elements when the parameter array is coerced into a hash at a later point.

This also occurs in layouts and profiles. This patch adds defaults to all three.

No documentation changes are necessary.
This commit is contained in:
Chris Nighswonger 2010-09-23 13:52:40 -04:00
parent e58961f689
commit b8d5a69e4e
3 changed files with 29 additions and 29 deletions

View file

@ -122,15 +122,15 @@ elsif ($op eq 'save') {
$cgi->param('format_string', $format_string);
}
my @params = (
barcode_type => $cgi->param('barcode_type'),
printing_type => $cgi->param('printing_type'),
layout_name => $cgi->param('layout_name'),
barcode_type => $cgi->param('barcode_type') || 'CODE39',
printing_type => $cgi->param('printing_type') || 'BAR',
layout_name => $cgi->param('layout_name') || 'DEFAULT',
guidebox => ($cgi->param('guidebox') ? 1 : 0),
font => $cgi->param('font'),
font_size => $cgi->param('font_size'),
font => $cgi->param('font') || 'TR',
font_size => $cgi->param('font_size') || 3,
callnum_split => ($cgi->param('callnum_split') ? 1 : 0),
text_justify => $cgi->param('text_justify'),
format_string => $cgi->param('format_string'),
text_justify => $cgi->param('text_justify') || 'L',
format_string => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, callnumber',
);
if ($layout_id) { # if a label_id was passed in, this is an update to an existing layout
$layout = C4::Labels::Layout->retrieve(layout_id => $layout_id);

View file

@ -54,13 +54,13 @@ if ($op eq 'edit') {
}
elsif ($op eq 'save') {
my @params = (
printer_name => $cgi->param('printer_name'),
paper_bin => $cgi->param('paper_bin'),
offset_horz => $cgi->param('offset_horz'),
offset_vert => $cgi->param('offset_vert'),
creep_horz => $cgi->param('creep_horz'),
creep_vert => $cgi->param('creep_vert'),
units => $cgi->param('units'),
printer_name => $cgi->param('printer_name') || 'DEFAULT PRINTER',
paper_bin => $cgi->param('paper_bin') || 'Tray 1',
offset_horz => $cgi->param('offset_horz') || 0,
offset_vert => $cgi->param('offset_vert') || 0,
creep_horz => $cgi->param('creep_horz') || 0,
creep_vert => $cgi->param('creep_vert') || 0,
units => $cgi->param('units') || 'POINT',
);
if ($profile_id) { # if a label_id was passed in, this is an update to an existing layout
$profile = C4::Labels::Profile->retrieve(profile_id => $profile_id);

View file

@ -53,21 +53,21 @@ if ($op eq 'edit') {
}
elsif ($op eq 'save') {
my @params = ( profile_id => $cgi->param('profile_id') || '',
template_code => $cgi->param('template_code'),
template_desc => $cgi->param('template_desc'),
page_width => $cgi->param('page_width'),
page_height => $cgi->param('page_height'),
label_width => $cgi->param('label_width'),
label_height => $cgi->param('label_height'),
top_text_margin => $cgi->param('top_text_margin'),
left_text_margin=> $cgi->param('left_text_margin'),
top_margin => $cgi->param('top_margin'),
left_margin => $cgi->param('left_margin'),
cols => $cgi->param('cols'),
rows => $cgi->param('rows'),
col_gap => $cgi->param('col_gap'),
row_gap => $cgi->param('row_gap'),
units => $cgi->param('units'),
template_code => $cgi->param('template_code') || 'DEFAULT_TEMPLATE',
template_desc => $cgi->param('template_desc') || 'Default description',
page_width => $cgi->param('page_width') || 0,
page_height => $cgi->param('page_height') || 0,
label_width => $cgi->param('label_width') || 0,
label_height => $cgi->param('label_height') || 0,
top_text_margin => $cgi->param('top_text_margin') || 0,
left_text_margin=> $cgi->param('left_text_margin') || 0,
top_margin => $cgi->param('top_margin') || 0,
left_margin => $cgi->param('left_margin') || 0,
cols => $cgi->param('cols') || 0,
rows => $cgi->param('rows') || 0,
col_gap => $cgi->param('col_gap') || 0,
row_gap => $cgi->param('row_gap') || 0,
units => $cgi->param('units') || 'POINT',
);
if ($template_id) { # if a label_id was passed in, this is an update to an existing layout
$label_template = C4::Labels::Template->retrieve(template_id => $template_id);