@@ -, +, @@ --- C4/Creators/Layout.pm | 2 ++ C4/Labels/Label.pm | 16 ++++++++++++++-- .../bug-12194-add-column-oblique_title.sql | 10 ++++++++++ .../prog/en/modules/labels/label-edit-layout.tt | 19 ++++++++++++++++++- labels/label-create-pdf.pl | 3 +++ labels/label-edit-layout.pl | 2 ++ 6 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug-12194-add-column-oblique_title.sql --- a/C4/Creators/Layout.pm +++ a/C4/Creators/Layout.pm @@ -33,6 +33,7 @@ sub _check_params { 'printing_type', 'layout_name', 'guidebox', + 'oblique_title', 'font', 'font_size', 'callnum_split', @@ -78,6 +79,7 @@ sub new { printing_type => 'BAR', layout_name => 'DEFAULT', guidebox => 0, + oblique_title => 1, font => 'TR', font_size => 3, callnum_split => 0, --- a/C4/Labels/Label.pm +++ a/C4/Labels/Label.pm @@ -35,6 +35,7 @@ sub _check_params { 'barcode_type', 'printing_type', 'guidebox', + 'oblique_title', 'font', 'font_size', 'callnum_split', @@ -326,6 +327,7 @@ sub new { barcode_type => $params{'barcode_type'}, printing_type => $params{'printing_type'}, guidebox => $params{'guidebox'}, + oblique_title => $params{'oblique_title'}, font => $params{'font'}, font_size => $params{'font_size'}, callnum_split => $params{'callnum_split'}, @@ -408,8 +410,18 @@ sub draw_label_text { else { $field->{'data'} = _get_barcode_data($field->{'code'},$item,$record); } - #FIXME: We should not force the title to oblique; this should be selectible in the layout configuration - ($field->{'code'} eq 'title') ? (($font =~ /T/) ? ($font = 'TI') : ($font = ($font . 'O'))) : ($font = $font); + # Find apropriate font it oblique title selected, except main font is oblique + if ( ( $field->{'code'} eq 'title' ) and ( $self->{'oblique_title'} == 1 ) ) { + if ( $font =~ /^TB$/ ) { + $font .= 'I'; + } + elsif ( $font =~ /^TR$/ ) { + $font = 'TI'; + } + elsif ( $font !~ /^T/ and $font !~ /O$/ ) { + $font .= 'O'; + } + } my $field_data = $field->{'data'}; if ($field_data) { $field_data =~ s/\n//g; --- a/installer/data/mysql/atomicupdate/bug-12194-add-column-oblique_title.sql +++ a/installer/data/mysql/atomicupdate/bug-12194-add-column-oblique_title.sql @@ -0,0 +1,10 @@ +ALTER TABLE creator_layouts ADD COLUMN oblique_title INT(1) NULL DEFAULT 1 AFTER guidebox; + +-- $DBversion = "3.21.00.XXX"; +-- if ( CheckVersion($DBversion) ) { +-- $dbh->do(q| +-- ALTER TABLE creator_layouts ADD COLUMN oblique_title INT(1) NULL DEFAULT 1 AFTER guidebox +-- |); +-- print "Upgrade to $DBversion done (Bug 12194: Add column oblique_title to layouts)\n"; +-- SetVersion($DBversion); +-- } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-layout.tt @@ -25,6 +25,15 @@ $('#layout_string').hide(); } } + function checkOblique() { + var font = document.getElementById("font"); + var selectedfont = font.options[font.selectedIndex].value; + if ( selectedfont.match("I$") || selectedfont.match("O$") ) { + document.getElementById("oblique_title").disabled = true; + } else { + document.getElementById("oblique_title").disabled = false; + } + } //]]> @@ -164,7 +173,7 @@
  • - [% FOREACH font_type IN font_types %] [% IF ( font_type.selected ) %] @@ -178,6 +187,14 @@
  • +
  • + + [% IF ( oblique_title ) %] + + [% ELSE %] + + [% END %] +
  • --- a/labels/label-create-pdf.pl +++ a/labels/label-create-pdf.pl @@ -139,6 +139,7 @@ foreach my $item (@{$items}) { barcode_type => $layout->get_attr('barcode_type'), printing_type => 'BIB', guidebox => $layout->get_attr('guidebox'), + oblique_title => $layout->get_attr('oblique_title'), font => $layout->get_attr('font'), font_size => $layout->get_attr('font_size'), callnum_split => $layout->get_attr('callnum_split'), @@ -162,6 +163,7 @@ foreach my $item (@{$items}) { barcode_type => $layout->get_attr('barcode_type'), printing_type => 'BAR', guidebox => $layout->get_attr('guidebox'), + oblique_title => $layout->get_attr('oblique_title'), font => $layout->get_attr('font'), font_size => $layout->get_attr('font_size'), callnum_split => $layout->get_attr('callnum_split'), @@ -188,6 +190,7 @@ foreach my $item (@{$items}) { barcode_type => $layout->get_attr('barcode_type'), printing_type => $layout->get_attr('printing_type'), guidebox => $layout->get_attr('guidebox'), + oblique_title => $layout->get_attr('oblique_title'), font => $layout->get_attr('font'), font_size => $layout->get_attr('font_size'), callnum_split => $layout->get_attr('callnum_split'), --- a/labels/label-edit-layout.pl +++ a/labels/label-edit-layout.pl @@ -107,6 +107,7 @@ elsif ($op eq 'save') { printing_type => $cgi->param('printing_type') || 'BAR', layout_name => $cgi->param('layout_name') || 'DEFAULT', guidebox => ($cgi->param('guidebox') ? 1 : 0), + oblique_title => ($cgi->param('oblique_title') ? 1 : 0), font => $cgi->param('font') || 'TR', font_size => $cgi->param('font_size') || 3, callnum_split => ($cgi->param('callnum_split') ? 1 : 0), @@ -145,6 +146,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'), --