}
($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
}
}
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) {
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 = ();
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({
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
- <a href="/cgi-bin/koha/labels/labels-home.pl">Labels</a> ›
+ <a href="/cgi-bin/koha/labels/labels-home.pl">Labels Home</a> ›
+ <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Mange Label Batches</a> ›
Manage Batch Number <!-- TMPL_VAR NAME="batch_id" -->
</div>
<div id="doc3" class="yui-t2">
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
- <a href="/cgi-bin/koha/labels/label-home.pl">Labels</a> ›
+ <a href="/cgi-bin/koha/labels/label-home.pl">Labels Home</a> ›
+ <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=layout">Mange Label Layouts</a> ›
<!-- TMPL_IF NAME="layout_id" -->Edit<!-- TMPL_ELSE -->Create<!-- /TMPL_IF --> Label Layout
</div>
<div id="doc3" class="yui-t2">
</ol>
</fieldset>
<fieldset class="action">
- <input type="submit" value="Submit" /><a class="cancel" href="/cgi-bin/koha/labels/label-layout.pl">Cancel</a>
+ <span class="yui-button yui-link-button"><span class="first-child"><input type="submit" value="Save" /></span></span>
+ <span class="yui-button yui-link-button"><span class="first-child"><input type="button" value="Cancel" onclick="window.location='/cgi-bin/koha/labels/label-manage.pl?label_element=layout';" /></span></span>
<input type="hidden" name="op" value="save" />
<input type="hidden" name="layout_id" value="<!-- TMPL_VAR NAME="layout_id" -->" />
</fieldset>
</ol>
</fieldset>
<fieldset class="action">
- <input type="submit" value="Submit" /><a class="cancel" href="/cgi-bin/koha/labels/label-manage.pl?label_element=profile">Cancel</a>
+ <span class="yui-button yui-link-button"><span class="first-child"><input type="submit" value="Save" /></span></span>
+ <span class="yui-button yui-link-button"><span class="first-child"><input type="button" value="Cancel" onclick="window.location='/cgi-bin/koha/labels/label-manage.pl?label_element=profile';" /></span></span>
<input type="hidden" name="op" value="save" />
<input type="hidden" name="profile_id" value="<!-- TMPL_VAR NAME="profile_id" -->" />
</fieldset>
</div>
<div class="yui-g">
<fieldset class="action">
- <input type="submit" value="Submit" /><a class="cancel" href="/cgi-bin/koha/labels/label-manage.pl?label_element=template">Cancel</a>
+ <span class="yui-button yui-link-button"><span class="first-child"><input type="submit" value="Save" /></span></span>
+ <span class="yui-button yui-link-button"><span class="first-child"><input type="button" value="Cancel" onclick="window.location='/cgi-bin/koha/labels/label-manage.pl?label_element=template';" /></span></span>
<input type="hidden" name="op" value="save" />
<!-- TMPL_IF NAME="template_id" -->
<input type="hidden" name="template_id" value="<!-- TMPL_VAR NAME="template_id" -->" />
<title>Koha › Tools › Labels › Manage Label Elements</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="greybox.inc" -->
+ <!-- Uncomment the following script line to enable firebug lite for use on IE -->
+ <!-- <script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script> -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
function DeleteConfirm() {
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) {
- return GB_showCenter('Export Labels', "/cgi-bin/koha/labels/label-print.pl?" + getstr, 700, 800);
-// window.location = "/cgi-bin/koha/labels/label-print.pl?" + getstr;
- }
- else {
- return; // abort export
- }
+ return GB_showCenter('Export Labels', "/cgi-bin/koha/labels/label-print.pl?" + getstr, 700, 800);
};
function selected_layout(op) {
var selected = new Array;
if (document.layouts.action.checked){
return(document.layouts.action.value);
}
- //var x=document.getElementsByName("action");
- //if (x[0].checked) {
- // alert(x[0].value);
- // return(x[0].value);
- //};
};
alert("Please select a <!-- TMPL_VAR NAME="label_element" -->.");
return (-1);
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
- <a href="/cgi-bin/koha/labels/labels-home.pl">Labels</a> ›
+ <a href="/cgi-bin/koha/labels/label-home.pl">Labels Home</a> ›
Manage Label <!-- TMPL_VAR NAME="label_element_title" -->
</div>
<div id="doc3" class="yui-t2">
<div class="yui-gc">
<div class="yui-u first" id="manage-label-layouts">
<div class="hint">Current Branch: <!-- TMPL_VAR NAME="LoginBranchname" --></div>
+ <!-- TMPL_IF NAME="table_loop" -->
<form name="layouts">
<h2>Currently Available <!-- TMPL_VAR NAME="label_element_title" --></h2>
<table>
<!-- TMPL_LOOP NAME="text_fields" -->
<!-- TMPL_IF NAME="select_field" -->
<td align="center"><input type="checkbox" name="action" value="<!-- TMPL_VAR NAME="field_value" -->"></td>
- <!-- TMPL_ELSE -->
+ <!-- TMPL_ELSIF NAME="field_value" -->
<td><!-- TMPL_VAR NAME="field_value" --></td>
+ <!-- TMPL_ELSE -->
+ <td> </td>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</tr>
<!-- TMPL_IF NAME="print" --><span class="yui-button yui-link-button"><span class="first-child"><input type="button" id="print" onclick="Xport()" value="Export"></span></span><!-- /TMPL_IF -->
</div>
</form>
+ <!-- TMPL_ELSE -->
+ <h2>There Are No <!-- TMPL_VAR NAME="label_element_title" --> Currently Available.</h2>
+ <div class="hint"><h3>Use the toolbar above to create a new <!-- TMPL_VAR NAME="label_element" -->.</h3></div>
+ <!-- /TMPL_IF -->
</div>
<!-- TMPL_IF NAME="error" -->
<div class="yui-u">
<form>
<div align="center">
<div class="message">
- <h2>Click on the following link(s) to download the exported batch(es).</h2>
+ <b>Click on the following link(s) to download the exported batch(es).</b>
</div>
</div>
<fieldset class="rows">
<div align="center">
<div class="message">
<!-- TMPL_IF NAME="label_ids" -->
- <h2>Exporting <!-- TMPL_VAR NAME="label_count" --> label(s).</h2>
+ <b>Exporting <!-- TMPL_VAR NAME="label_count" --> label(s).</b>
<!-- TMPL_ELSIF NAME="item_numbers"-->
- <h2>Exporting <!-- TMPL_VAR NAME="item_count" --> label(s).</h2>
+ <b>Exporting <!-- TMPL_VAR NAME="item_count" --> label(s).</b>
<!-- TMPL_ELSE -->
- <h2><!-- TMPL_VAR NAME="multi_batch_count" --> batch(es) to export.</h2>
+ <b><!-- TMPL_VAR NAME="multi_batch_count" --> batch(es) to export.</b>
<!-- /TMPL_IF -->
</div>
</div>
{_barcode => {label => 'Barcode', link_field => 0}},
{select => {label => 'Select', value => '_label_id'}},
];
-my $op = $cgi->param('op') || undef;
+my $op = $cgi->param('op') || 'edit';
my $batch_id = $cgi->param('element_id') || $cgi->param('batch_id') || undef;
my @label_ids = $cgi->param('label_id') if $cgi->param('label_id');
my @item_numbers = $cgi->param('item_number') if $cgi->param('item_number');
}
if ($op eq 'edit') {
- syslog("LOG_ERR", "labels/label-edit-layout.pl : Error performing '%s': No 'layout_id' passed in.", $op) unless ($layout);
+ syslog("LOG_ERR", "labels/label-edit-layout.pl : Error performing '%s': No 'layout_id' passed in.", $op) unless ($layout_id);
$layout = C4::Labels::Layout->retrieve(layout_id => $layout_id);
}
use Sys::Syslog qw(syslog);
use CGI;
use HTML::Template::Pro;
+use Data::Dumper;
use C4::Auth qw(get_template_and_user);
use C4::Output qw(output_html_with_http_headers);
my $error = 0;
my $db_rows = {};
-my $display_columns = { layout => [ #db column => display column
- {layout_id => {label => 'Layout ID', link_field => 0}},
- {layout_name => {label => 'Layout', link_field => 0}},
- {barcode_type => {label => 'Barcode Type', link_field => 0}},
- {printing_type => {label => 'Print Type', link_field => 0}},
- {format_string => {label => 'Fields to Print', link_field => 0}},
- {select => {label => 'Select', value => 'layout_id'}},
+my $display_columns = { layout => [ # db column => {col label is link?
+ {layout_id => {label => 'Layout ID', link_field => 0}},
+ {layout_name => {label => 'Layout', link_field => 0}},
+ {barcode_type => {label => 'Barcode Type', link_field => 0}},
+ {printing_type => {label => 'Print Type', link_field => 0}},
+ {format_string => {label => 'Fields to Print',link_field => 0}},
+ {select => {label => 'Select', value => 'layout_id'}},
],
- template => [ {template_id => {label => 'Template ID', link_field => 0}},
- {template_code => {label => 'Template Name', link_field => 0}},
- {template_desc => {label => 'Description', link_field => 0}},
- {select => {label => 'Select', value => 'template_id'}},
+ template => [ {template_id => {label => 'Template ID', link_field => 0}},
+ {template_code => {label => 'Template Name', link_field => 0}},
+ {template_desc => {label => 'Description', link_field => 0}},
+ {select => {label => 'Select', value => 'template_id'}},
],
- profile => [ {profile_id => {label => 'Profile ID', link_field => 0}},
- {printer_name => {label => 'Printer Name', link_field => 0}},
- {paper_bin => {label => 'Paper Bin', link_field => 0}},
- {_template_code => {label => 'Template Name', link_field => 0}}, # this display column does not have a corrisponding db column in the profile table, hence the underscore
- {select => {label => 'Select', value => 'profile_id'}},
+ profile => [ {profile_id => {label => 'Profile ID', link_field => 0}},
+ {printer_name => {label => 'Printer Name', link_field => 0}},
+ {paper_bin => {label => 'Paper Bin', link_field => 0}},
+ {_template_code => {label => 'Template Name', link_field => 0}}, # this display column does not have a corrisponding db column in the profile table, hence the underscore
+ {select => {label => 'Select', value => 'profile_id'}},
],
- batch => [ {batch_id => {label => 'Batch ID', link_field => 0}},
- {_item_count => {label => 'Item Count', link_field => 0}},
- {select => {label => 'Select', value => 'batch_id'}},
+ batch => [ {batch_id => {label => 'Batch ID', link_field => 0}},
+ {_item_count => {label => 'Item Count', link_field => 0}},
+ {select => {label => 'Select', value => 'batch_id'}},
],
};
-my $label_element = $cgi->param('label_element');
-my $op = $cgi->param('op');
-my $element_id = $cgi->param('element_id');
+my $label_element = $cgi->param('label_element') || undef;
+my $op = $cgi->param('op') || 'none';
+my $element_id = $cgi->param('element_id') || undef;
my $branch_code = ($label_element eq 'batch' ? get_branch_code_from_name($template->param('LoginBranchname')) : '');
if ($label_element eq 'layout') {$db_rows = get_all_layouts();}
elsif ($label_element eq 'template') {$db_rows = get_all_templates();}
elsif ($label_element eq 'profile') {$db_rows = get_all_profiles();}
-elsif ($label_element eq 'batch') {$db_rows = get_batch_summary(filter => "branch_code=\'$branch_code\'");}
+elsif ($label_element eq 'batch') {$db_rows = get_batch_summary(filter => "branch_code=\'$branch_code\' OR branch_code=\'NB\'");}
else {} # FIXME: Some error trapping code
my $table = html_table($display_columns->{$label_element}, $db_rows);