From e5cd4004b55a7f1b343f0ff5439f39acfc6dff2b Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 29 Apr 2008 10:20:55 -0500 Subject: [PATCH] BUGFIX labels - Adding labels was failing because of faulty "type" selection. Signed-off-by: Joshua Ferraro --- .../prog/en/modules/labels/result.tmpl | 18 ++++++++++-------- labels/label-manager.pl | 10 +++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl index 71035fe140..df752d7327 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl @@ -30,7 +30,9 @@ function add_item(itemnum,batch_id,type_id){ } else { getstr = "itemnumber="+itemnum; } - var myurl = "label-manager.pl?op=add&batch_id="+batch_id+"&type="+type_id+"&"+getstr; + var myurl = "label-manager.pl?op=add&batch_id="+batch_id+ + // "&type="+type_id+ // The template variable NAME="TYPE" is RESERVED ('opac' or 'intranet'). + "&"+getstr; window.opener.location.href = myurl; } function add_item3(i_itemnumber){ @@ -48,17 +50,17 @@ function add_item3(i_itemnumber){

- &=&resultsperpage=&type=intranet&op=do_search&batch_id="><< + &=&resultsperpage=&op=do_search&batch_id="><< - =&resultsperpage=&type=intranet&op=do_search&batch_id="> + =&resultsperpage=&op=do_search&batch_id="> - &=&&resultsperpage=&type=intranet&op=do_search&batch_id=">>> + &=&&resultsperpage=&op=do_search&batch_id=">>>

@@ -98,7 +100,7 @@ function add_item3(i_itemnumber){
- ',, ''); return false" href="/cgi-bin/koha/barcodes/label-manager.pl?itemnumber=&batch_id=&type=&op=add">Add + ',, ''); return false" href="/cgi-bin/koha/barcodes/label-manager.pl?itemnumber=&batch_id=&op=add">Add @@ -109,17 +111,17 @@ function add_item3(i_itemnumber){

diff --git a/labels/label-manager.pl b/labels/label-manager.pl index 3bd54e0514..eab45b0749 100755 --- a/labels/label-manager.pl +++ b/labels/label-manager.pl @@ -40,10 +40,10 @@ my $startlabel = $query->param('startlabel'); my $printingtype = $query->param('printingtype'); my $guidebox = $query->param('guidebox'); my $fontsize = $query->param('fontsize'); -my $formatstring = $query->param('formatstring'); +my $formatstring = $query->param('formatstring'); +my $batch_type = $query->param('type') || 'labels'; my @itemnumber; -($query->param('type') eq 'labels') ? (@itemnumber = $query->param('itemnumber')) : (@itemnumber = $query->param('borrowernumber')); -my $batch_type = $query->param('type'); +($batch_type eq 'labels') ? (@itemnumber = $query->param('itemnumber')) : (@itemnumber = $query->param('borrowernumber')); # little block for displaying active layout/template/batch in templates # ---------- @@ -112,7 +112,7 @@ elsif ( $op eq 'add_layout' ) { # FIXME: The trinary conditionals here really need to be replaced with a more robust form of db abstraction -fbcit elsif ( $op eq 'add' ) { # add item - my $query2 = "INSERT INTO $batch_type ( " . (($batch_type eq 'labels') ? 'itemnumber' : 'borrowernumber') . ", batch_id ) values ( ?,? )"; + my $query2 = "INSERT INTO labels (itemnumber, batch_id) values ( ?,? )"; my $sth2 = $dbh->prepare($query2); for my $inum (@itemnumber) { # warn "INSERTing " . (($batch_type eq 'labels') ? 'itemnumber' : 'borrowernumber') . ":$inum for batch $batch_id"; @@ -181,7 +181,7 @@ if (scalar @messages) { $template->param(message_loop => \@complex); } $template->param( - type => $batch_type, + type => $batch_type, # FIXME: type is an otherwise RESERVED template variable with 2 valid values: 'opac' and 'intranet' batch_id => $batch_id, batch_count => scalar @resultsloop, active_layout_name => $active_layout_name, -- 2.39.5