diff --git a/C4/Labels/Lib.pm b/C4/Labels/Lib.pm index 4a918ac28b..f2e205630e 100644 --- a/C4/Labels/Lib.pm +++ b/C4/Labels/Lib.pm @@ -37,6 +37,7 @@ BEGIN { get_label_types get_font_types get_text_justification_types + get_label_output_formats get_column_names get_table_names get_unit_values @@ -125,6 +126,11 @@ my $unit_values = [ {type => 'CM', desc => 'SI Centimeters', value => 28.3464567, selected => 0}, ]; +my $label_output_formats = [ + {type => 'pdf', desc => 'PDF File'}, + {type => 'csv', desc => 'CSV File'}, +]; + =head2 C4::Labels::Lib::get_all_templates() This function returns a reference to a hash containing all templates upon success and 1 upon failure. Errors are logged to the syslog. @@ -164,8 +170,11 @@ sub get_all_templates { =cut sub get_all_layouts { + my %params = @_; my @layouts = (); - my $query = "SELECT * FROM labels_layouts;"; + #my $query = "SELECT * FROM labels_layouts;"; + my $query = "SELECT " . ($params{'field_list'} ? $params{'field_list'} : '*') . " FROM labels_layouts"; + $query .= ($params{'filter'} ? " WHERE $params{'filter'};" : ';'); my $sth = C4::Context->dbh->prepare($query); $sth->execute(); if ($sth->err) { @@ -369,6 +378,20 @@ sub get_unit_values { return $unit_values; } +=head2 C4::Labels::Lib::get_label_output_formats() + + This function returns a reference to an array of hashes containing all label output formats along with their description. + + examples: + + my $label_output_formats = get_label_output_formats(); + +=cut + +sub get_label_output_formats { + return $label_output_formats; +} + =head2 C4::Labels::Lib::get_column_names($table_name) Return an arrayref of an array containing the column names of the supplied table. diff --git a/C4/Labels/PDF.pm b/C4/Labels/PDF.pm index d95ba213ae..b661d45046 100644 --- a/C4/Labels/PDF.pm +++ b/C4/Labels/PDF.pm @@ -40,6 +40,8 @@ sub new { _InitVars() if ($opts{InitVars} == 0); _InitVars($opts{InitVars}) if ($opts{InitVars} > 0); delete($opts{InitVars}); + prDocDir($opts{'DocDir'}) if $opts{'DocDir'}; + delete($opts{'DocDir'}); prFile(%opts); bless ($self, $type); return $self; @@ -74,12 +76,6 @@ sub Doc { prDoc(%params); } -sub DocDir { - my $self = shift; - my $directoryName = shift; - prDocDir($directoryName); -} - sub DocForm { my $self = shift; my %params = @_; diff --git a/C4/Labels/Template.pm b/C4/Labels/Template.pm index 5410d99cd5..977fae90d9 100644 --- a/C4/Labels/Template.pm +++ b/C4/Labels/Template.pm @@ -90,8 +90,7 @@ sub _conv_points { sub _apply_profile { my $self = shift; - my $profile_id = shift; - my $profile = C4::Labels::Profile->retrieve(profile_id => $profile_id, convert => 1); + my $profile = C4::Labels::Profile->retrieve(profile_id => $self->{'profile_id'}, convert => 1); $self->{'top_margin'} = $self->{'top_margin'} + $profile->get_attr('offset_vert'); # controls vertical offset $self->{'left_margin'} = $self->{'left_margin'} + $profile->get_attr('offset_horz'); # controls horizontal offset $self->{'label_height'} = $self->{'label_height'} + $profile->get_attr('creep_vert'); # controls vertical creep @@ -179,7 +178,7 @@ sub retrieve { } my $self = $sth->fetchrow_hashref; $self = _conv_points($self) if (($opts{convert} && $opts{convert} == 1) || $opts{profile_id}); - $self = _apply_profile($self, $opts{profile_id}) if $opts{profile_id}; + $self = _apply_profile($self) if $opts{profile_id}; $self->{'tmpl_stat'} = 1; bless ($self, $type); return $self; diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index 5324c70ae1..deef8775bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -227,6 +227,11 @@ table { border-right : 1px solid #BCBCBC; } +table.borderless { + border-collapse : separate; + border: 0 none; +} + #label-search-results { width: 700px; } @@ -241,6 +246,11 @@ td { background-color : White; } +td.borderless { + border-collapse : separate; + border : 0 none; +} + th { background-color : #E8E8E8; font-weight : bold; 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 609b32fe81..40874a08e7 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 @@ -31,12 +31,45 @@ function Print() { var element_id = selected_layout("print"); if (element_id>-1) { - window.location = "/cgi-bin/koha/labels/label-edit-.pl?op=edit&element_id=" + element_id; + window.location = "/cgi-bin/koha/labels/label-print.pl?batch_id=" + element_id; } else { return; // no layout selected }; }; + + + function Xport() { + batches= new Array; + if(document.layouts.action.length > 0) { + for (var i=0; i < document.layouts.action.length; i++) { + if (document.layouts.action[i].checked) { + batches.push("batch_id=" + document.layouts.action[i].value); + } + } + if (batches.length < 1) { + alert("Please select at least one batch to export."); + return; // no batch selected + } + getstr = batches.join("&"); + } + else if (document.layouts.action.checked) { + getstr = "batch_id="+document.layouts.action.value; + } + else { + alert("Please select at least one batch to export."); + return; // no batch selected + } + var msg = "Are you sure you want to export the selected batch(s)?" + var answer = confirm(msg); + if (answer) { + window.location = "/cgi-bin/koha/labels/label-print.pl?" + getstr; + } + else { + return; // abort export + } + }; + function selected_layout(op) { var selected = new Array; if (document.layouts.action.length) { @@ -112,13 +145,13 @@
|
- - - - - - - - - - |
- - |
- |
- - |
- |
-