Bug 31028: Add feedback to the patron on submission
[srvgit] / labels / label-edit-layout.pl
index 150ad3d..f1fc687 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use POSIX;
 
-use C4::Auth qw(get_template_and_user);
-use C4::Output qw(output_html_with_http_headers);
-use C4::Creators;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use C4::Creators qw(
+    get_barcode_types
+    get_font_types
+    get_label_types
+    get_text_justification_types
+);
 use C4::Labels;
 
-my $cgi = new CGI;
+my $cgi = CGI->new;
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
         template_name   => "labels/label-edit-layout.tt",
         query           => $cgi,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { catalogue => 1 },
-        debug           => 1,
     }
 );
 
@@ -103,15 +105,16 @@ elsif  ($op eq 'save') {
         $cgi->param('format_string', $format_string);
     }
     my @params = (
-                    barcode_type    => $cgi->param('barcode_type') || 'CODE39',
-                    printing_type   => $cgi->param('printing_type') || 'BAR',
-                    layout_name     => $cgi->param('layout_name') || 'DEFAULT',
+                    barcode_type    => scalar $cgi->param('barcode_type') || 'CODE39',
+                    printing_type   => scalar $cgi->param('printing_type') || 'BAR',
+                    layout_name     => scalar $cgi->param('layout_name') || 'DEFAULT',
                     guidebox        => ($cgi->param('guidebox') ? 1 : 0),
-                    font            => $cgi->param('font') || 'TR',
-                    font_size       => $cgi->param('font_size') || 3,
+                    oblique_title   => ($cgi->param('oblique_title') ? 1 : 0),
+                    font            => scalar $cgi->param('font') || 'TR',
+                    font_size       => scalar $cgi->param('font_size') || 3,
                     callnum_split   => ($cgi->param('callnum_split') ? 1 : 0),
-                    text_justify    => $cgi->param('text_justify') || 'L',
-                    format_string   => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, itemcallnumber',
+                    text_justify    => scalar $cgi->param('text_justify') || 'L',
+                    format_string   => scalar $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);
@@ -145,6 +148,7 @@ $template->param(
         layout_id       => $layout->get_attr('layout_id') > -1 ? $layout->get_attr('layout_id') : '',
         layout_name     => $layout->get_attr('layout_name'),
         guidebox        => $layout->get_attr('guidebox'),
+        oblique_title   => $layout->get_attr('oblique_title'),
         font_size       => $layout->get_attr('font_size'),
         callnum_split   => $layout->get_attr('callnum_split'),
         format_string   => $layout->get_attr('format_string'),