From 38817fb300e27882262c7a3ff071711342116fb1 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Fri, 14 Aug 2009 00:07:35 -0400 Subject: [PATCH] [31/40] Misc bugfixes and cosmetic cleanup. --- C4/Labels/Label.pm | 16 ++++--- C4/Labels/Lib.pm | 1 + .../prog/en/includes/labels-toolbar.inc | 8 ++-- .../en/modules/labels/label-edit-batch.tmpl | 3 +- .../en/modules/labels/label-edit-layout.tmpl | 6 ++- .../en/modules/labels/label-edit-profile.tmpl | 3 +- .../modules/labels/label-edit-template.tmpl | 3 +- .../prog/en/modules/labels/label-manage.tmpl | 28 +++++------ .../prog/en/modules/labels/label-print.tmpl | 8 ++-- labels/label-edit-batch.pl | 2 +- labels/label-edit-layout.pl | 2 +- labels/label-manage.pl | 47 ++++++++++--------- 12 files changed, 67 insertions(+), 60 deletions(-) diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm index 0d4d520cc8..0b35f39309 100644 --- a/C4/Labels/Label.pm +++ b/C4/Labels/Label.pm @@ -349,8 +349,10 @@ sub draw_label_text { } ($field->{'code'} eq 'title') ? (($font =~ /T/) ? ($font = 'TI') : ($font = ($font . 'O'))) : ($font = $font); my $field_data = $field->{'data'}; - $field_data =~ s/\n//g; - $field_data =~ s/\r//g; + if ($field_data) { + $field_data =~ s/\n//g; + $field_data =~ s/\r//g; + } my @label_lines; my @callnumber_list = ('itemcallnumber', '050a', '050b', '082a', '952o'); # Fields which hold call number data FIXME: ( 060? 090? 092? 099? ) if ((grep {$field->{'code'} =~ m/$_/} @callnumber_list) and ($self->{'printing_type'} eq 'BIB') and ($self->{'callnum_split'})) { # If the field contains the call number, we do some sp @@ -368,10 +370,12 @@ sub draw_label_text { } } else { - $field_data =~ s/\/$//g; # Here we will strip out all trailing '/' in fields other than the call number... - $field_data =~ s/\(/\\\(/g; # Escape '(' and ')' for the pdf object stream... - $field_data =~ s/\)/\\\)/g; - eval{local($Text::Wrap::columns) = $self->{'text_wrap_cols'};}; + if ($field_data) { + $field_data =~ s/\/$//g; # Here we will strip out all trailing '/' in fields other than the call number... + $field_data =~ s/\(/\\\(/g; # Escape '(' and ')' for the pdf object stream... + $field_data =~ s/\)/\\\)/g; + } + eval{$Text::Wrap::columns = $self->{'text_wrap_cols'};}; my @line = split(/\n/ ,wrap('', '', $field_data)); # If this is a title field, limit to two lines; all others limit to one... FIXME: this is rather arbitrary if ($field->{'code'} eq 'title' && scalar(@line) >= 2) { diff --git a/C4/Labels/Lib.pm b/C4/Labels/Lib.pm index 613166ddec..b253cbf5f1 100644 --- a/C4/Labels/Lib.pm +++ b/C4/Labels/Lib.pm @@ -441,6 +441,7 @@ sub get_table_names { sub html_table { my $headers = shift; my $data = shift; + return undef if scalar(@$data) == 0; # no need to generate a table if there is not data to display my $table = []; my $fields = []; my @headers = (); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/labels-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/labels-toolbar.inc index 44be9ae447..28003f9378 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/labels-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/labels-toolbar.inc @@ -13,22 +13,22 @@ function yuiToolbar() { var layouts = [ {text: _("Manage Layouts"), url: "/cgi-bin/koha/labels/label-manage.pl?label_element=layout" }, - {text: _("New Layout"), url: "/cgi-bin/koha/labels/label-edit-layout.pl" } + {text: _("New Layout"), url: "/cgi-bin/koha/labels/label-edit-layout.pl?op=new" } ]; var templates = [ {text: _("Manage Templates"), url: "/cgi-bin/koha/labels/label-manage.pl?label_element=template" }, - {text: _("New Template"), url: "/cgi-bin/koha/labels/label-edit-template.pl" } + {text: _("New Template"), url: "/cgi-bin/koha/labels/label-edit-template.pl?op=new" } ]; var profiles = [ {text: _("Manage Profiles"), url: "/cgi-bin/koha/labels/label-manage.pl?label_element=profile" }, - {text: _("New Profile"), url: "/cgi-bin/koha/labels/label-edit-profile.pl" } + {text: _("New Profile"), url: "/cgi-bin/koha/labels/label-edit-profile.pl?op=new" } ]; var batches = [ {text: _("Manage Batches"), url: "/cgi-bin/koha/labels/label-manage.pl?label_element=batch" }, - {text: _("New Batch"), url: "/cgi-bin/koha/labels/label-edit-batch.pl" } + {text: _("New Batch"), url: "/cgi-bin/koha/labels/label-edit-batch.pl?op=new" } ]; new YAHOO.widget.Button({ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl index 8863213c06..efd5d121db 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl @@ -9,7 +9,8 @@
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tmpl index 0834cb51d6..5981dbca7f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tmpl @@ -25,7 +25,8 @@
@@ -158,7 +159,8 @@
- Cancel + + " />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tmpl index d4cbdbe7cf..f3e32b0389 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tmpl @@ -82,7 +82,8 @@
- Cancel + + " />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tmpl index aa2ff6132c..367e1f545c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-template.tmpl @@ -117,7 +117,8 @@
- Cancel + + " /> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl index 2413a6471a..3e94a84165 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl @@ -2,6 +2,8 @@ Koha › Tools › Labels › Manage Label Elements + +