# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
use warnings;
use C4::Auth qw(get_template_and_user);
use C4::Output qw(output_html_with_http_headers);
-use C4::Labels::Lib 1.000000 qw(get_barcode_types get_label_types get_font_types get_text_justification_types);
-use C4::Labels::Layout 1.000000;
+use C4::Creators 1.000000;
+use C4::Labels 1.000000;
my $cgi = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
$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, itemcallnumber',
);
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);
$layout->set_attr(@params);
- $layout->save();
+ $layout_id = $layout->save();
}
else { # if no label_id, this is a new layout so insert it
$layout = C4::Labels::Layout->new(@params);
- $layout->save();
+ $layout_id = $layout->save();
}
- print $cgi->redirect("label-manage.pl?label_element=layout");
+ print $cgi->redirect("label-manage.pl?label_element=layout" . ($layout_id == -1 ? "&element_id=$layout_id&op=$op&error=1" : ''));
exit;
}
else { # if we get here, this is a new layout