From 7fcff602f5fe294e78e3012fc12d600e43ca2443 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 28 Oct 2011 14:43:43 -0400 Subject: [PATCH] Bug 7113: Standardize vendor id name in templates and scripts New revision updates for current master and cleans up new instances introduced by recent commits. Signed-off-by: Katrin Fischer 2 problems found, fixing those in follo up patches: - late orders don't allow more than 1 order to be selected - basketgroups: 'Edit vendor' does the same as 'Manage orders' --- acqui/basket.pl | 8 +++---- acqui/basketheader.pl | 4 ++-- acqui/booksellers.pl | 14 +++++------ acqui/finishreceive.pl | 6 ++--- acqui/lateorders.pl | 13 +++++----- acqui/newordersuggestion.pl | 6 ++--- acqui/orderreceive.pl | 12 +++++----- acqui/parcel.pl | 18 +++++++------- acqui/parcels.pl | 10 ++++---- acqui/supplier.pl | 18 +++++++------- acqui/updatesupplier.pl | 8 +++---- admin/aqcontract.pl | 4 ++-- .../prog/en/includes/acquisitions-toolbar.inc | 24 +++++++++---------- .../en/includes/suggestions-add-search.inc | 4 ++-- .../prog/en/modules/acqui/addorderiso2709.tt | 2 +- .../prog/en/modules/acqui/basket.tt | 4 ++-- .../prog/en/modules/acqui/basketgroup.tt | 8 +++---- .../prog/en/modules/acqui/basketheader.tt | 2 +- .../prog/en/modules/acqui/booksellers.tt | 8 +++---- .../prog/en/modules/acqui/histsearch.tt | 4 ++-- .../prog/en/modules/acqui/lateorders.tt | 14 +++++------ .../prog/en/modules/acqui/neworderbiblio.tt | 2 +- .../prog/en/modules/acqui/neworderempty.tt | 2 +- .../en/modules/acqui/newordersuggestion.tt | 6 ++--- .../prog/en/modules/acqui/ordered.tt | 4 ++-- .../prog/en/modules/acqui/orderreceive.tt | 6 ++--- .../prog/en/modules/acqui/parcel.tt | 24 +++++++++---------- .../prog/en/modules/acqui/parcels.tt | 20 ++++++++-------- .../prog/en/modules/acqui/spent.tt | 6 ++--- .../prog/en/modules/acqui/supplier.tt | 12 +++++----- .../prog/en/modules/acqui/uncertainprice.tt | 4 ++-- .../prog/en/modules/acqui/z3950_search.tt | 3 ++- .../prog/en/modules/admin/aqcontract.tt | 2 +- .../prog/en/modules/catalogue/moredetail.tt | 2 +- 34 files changed, 143 insertions(+), 141 deletions(-) diff --git a/acqui/basket.pl b/acqui/basket.pl index bd7d45da41..7864fee0d1 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -54,7 +54,7 @@ basket.pl The basket number. -=item supplierid +=item booksellerid the supplier this script have to display the basket. @@ -66,7 +66,7 @@ the supplier this script have to display the basket. my $query = new CGI; my $basketno = $query->param('basketno'); -my $booksellerid = $query->param('supplierid'); +my $booksellerid = $query->param('booksellerid'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -82,7 +82,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $basket = GetBasket($basketno); # FIXME : what about the "discount" percentage? -# FIXME : the query->param('supplierid') below is probably useless. The bookseller is always known from the basket +# FIXME : the query->param('booksellerid') below is probably useless. The bookseller is always known from the basket # if no booksellerid in parameter, get it from basket # warn "=>".$basket->{booksellerid}; $booksellerid = $basket->{booksellerid} unless $booksellerid; @@ -164,7 +164,7 @@ if ( $op eq 'delete_confirm' ) { basketgroupid => $basketgroupid } ); print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1'); } else { - print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?supplierid=' . $booksellerid); + print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid); } exit; } else { diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index d204a4e5c9..b33e4ef694 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -33,9 +33,9 @@ notes to the supplier, local notes, and the contractnumber, which identifies the =over 4 -=item supplierid +=item booksellerid -C<$supplierid> is the id of the supplier we add the basket to. +C<$booksellerid> is the id of the supplier we add the basket to. =item basketid diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 634eb93d57..d7c64dbda7 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -41,7 +41,7 @@ C<$supplier> is the string with which we search for a supplier =back -=item id or supplierid +=item id or booksellerid The id of the supplier whose baskets we will display @@ -74,11 +74,11 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( #parameters my $supplier = $query->param('supplier'); -my $id = $query->param('id') || $query->param('supplierid'); +my $booksellerid = $query->param('booksellerid'); my @suppliers; -if ($id) { - push @suppliers, GetBookSellerFromId($id); +if ($booksellerid) { + push @suppliers, GetBookSellerFromId($booksellerid); } else { @suppliers = GetBookSeller($supplier); } @@ -87,7 +87,7 @@ my $supplier_count = @suppliers; if ( $supplier_count == 1 ) { $template->param( supplier_name => $suppliers[0]->{'name'}, - id => $suppliers[0]->{'id'} + booksellerid => $suppliers[0]->{'booksellerid'} ); } @@ -136,7 +136,7 @@ for my $vendor (@suppliers) { push @{$loop_suppliers}, { loop_basket => $loop_basket, - supplierid => $vendor->{id}, + booksellerid => $vendor->{id}, name => $vendor->{name}, active => $vendor->{active}, }; @@ -144,7 +144,7 @@ for my $vendor (@suppliers) { } $template->param( loop_suppliers => $loop_suppliers, - supplier => ( $id || $supplier ), + supplier => ( $booksellerid || $supplier ), count => $supplier_count, ); diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 0f2f070c60..90a85fe885 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -48,7 +48,7 @@ my $datereceived=$input->param('datereceived'); my $replacement=$input->param('rrp'); my $gst=$input->param('gst'); my $freight=$input->param('freight'); -my $supplierid = $input->param('supplierid'); +my $booksellerid = $input->param('booksellerid'); my $cnt=0; my $error_url_str; my $ecost = $input->param('ecost'); @@ -99,7 +99,7 @@ if ($quantityrec > $origquantityrec ) { update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber ); -print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str"); +print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&booksellerid=$booksellerid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str"); ################################ End of script ################################ @@ -107,7 +107,7 @@ sub update_item { my ( $itemnumber ) = @_; ModItem( { - booksellerid => $supplierid, + booksellerid => $booksellerid, dateaccessioned => $datereceived, price => $unitprice, replacementprice => $replacement, diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl index 55031ecc9b..86b13002a9 100755 --- a/acqui/lateorders.pl +++ b/acqui/lateorders.pl @@ -29,7 +29,7 @@ given on input arg. =over 4 -=item supplierid +=item booksellerid To know on which supplier this script have to display late order. =item delay @@ -64,7 +64,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ debug => 1, }); -my $supplierid = $input->param('supplierid') || undef; # we don't want "" or 0 +my $booksellerid = $input->param('booksellerid') || undef; # we don't want "" or 0 my $delay = $input->param('delay'); my $branch = $input->param('branch'); my $op = $input->param('op'); @@ -95,15 +95,16 @@ if ($op and $op eq "send_alert"){ my %supplierlist = GetBooksellersWithLateOrders($delay); my (@sloopy); # supplier loop foreach (keys %supplierlist){ - push @sloopy, (($supplierid and $supplierid eq $_ ) ? + push @sloopy, (($booksellerid and $booksellerid eq $_ ) ? {id=>$_, name=>$supplierlist{$_}, selected=>1} : {id=>$_, name=>$supplierlist{$_}} ) ; } $template->param(SUPPLIER_LOOP => \@sloopy); -$template->param(Supplier=>$supplierlist{$supplierid}) if ($supplierid); -$template->param(SupplierId=>$supplierid) if ($supplierid); -my @lateorders = GetLateOrders($delay,$supplierid,$branch); +$template->param(Supplier=>$supplierlist{$booksellerid}) if ($booksellerid); +$template->param(booksellerid=>$booksellerid) if ($booksellerid); + +my @lateorders = GetLateOrders($delay,$booksellerid,$branch); my $total; foreach (@lateorders){ diff --git a/acqui/newordersuggestion.pl b/acqui/newordersuggestion.pl index b65e4ea624..f33d012536 100755 --- a/acqui/newordersuggestion.pl +++ b/acqui/newordersuggestion.pl @@ -100,7 +100,7 @@ my $input = new CGI; # getting the CGI params my $basketno = $input->param('basketno'); -my $supplierid = $input->param('booksellerid'); +my $booksellerid = $input->param('booksellerid'); my $author = $input->param('author'); my $title = $input->param('title'); my $publishercode = $input->param('publishercode'); @@ -134,11 +134,11 @@ my $suggestions_loop = title => $title, publishercode => $publishercode, STATUS => 'ACCEPTED'}); -my $vendor = GetBookSellerFromId($supplierid); +my $vendor = GetBookSellerFromId($booksellerid); $template->param( suggestions_loop => $suggestions_loop, basketno => $basketno, - supplierid => $supplierid, + booksellerid => $booksellerid, name => $vendor->{'name'}, "op_$op" => 1, ); diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 451f858ae2..659c10368a 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -34,7 +34,7 @@ It permit to write a new order as 'received'. =over 4 -=item supplierid +=item booksellerid to know on what supplier this script has to display receive order. @@ -81,7 +81,7 @@ use C4::Suggestions; my $input = new CGI; my $dbh = C4::Context->dbh; -my $supplierid = $input->param('supplierid'); +my $booksellerid = $input->param('booksellerid'); my $ordernumber = $input->param('ordernumber'); my $search = $input->param('receive'); my $invoice = $input->param('invoice'); @@ -91,7 +91,7 @@ my $datereceived = $input->param('datereceived'); $datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new(); -my $bookseller = GetBookSellerFromId($supplierid); +my $bookseller = GetBookSellerFromId($booksellerid); my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $results = SearchOrder($ordernumber,$search); @@ -148,7 +148,7 @@ if ( $count == 1 ) { biblionumber => @$results[0]->{'biblionumber'}, ordernumber => @$results[0]->{'ordernumber'}, biblioitemnumber => @$results[0]->{'biblioitemnumber'}, - supplierid => @$results[0]->{'booksellerid'}, + booksellerid => @$results[0]->{'booksellerid'}, freight => $freight, gst => $gst, name => $bookseller->{'name'}, @@ -187,13 +187,13 @@ else { $line{gst} = $gst; $line{title} = @$results[$i]->{'title'}; $line{author} = @$results[$i]->{'author'}; - $line{supplierid} = $supplierid; + $line{booksellerid} = $booksellerid; push @loop, \%line; } $template->param( loop => \@loop, - supplierid => $supplierid, + booksellerid => $booksellerid, ); } my $op = $input->param('op'); diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 46582d3f1e..5d0d16492b 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -34,7 +34,7 @@ It allows to write an order as 'received' when he arrives. =over 4 -=item supplierid +=item booksellerid To know the supplier this script has to show orders. @@ -71,8 +71,8 @@ use C4::Suggestions; use JSON; my $input=new CGI; -my $supplierid=$input->param('supplierid'); -my $bookseller=GetBookSellerFromId($supplierid); +my $booksellerid=$input->param('booksellerid'); +my $bookseller=GetBookSellerFromId($booksellerid); my $invoice=$input->param('invoice') || ''; my $freight=$input->param('freight'); @@ -102,7 +102,7 @@ if($input->param('format') eq "json"){ my @datas; my $search = $input->param('search') || ''; - my $supplier = $input->param('supplierid') || ''; + my $supplier = $input->param('booksellerid') || ''; my $basketno = $input->param('basketno') || ''; my $orderno = $input->param('orderno') || ''; @@ -155,7 +155,7 @@ if( scalar(@rcv_err) ) { } my $cfstr = "%.2f"; # currency format string -- could get this from currency table. -my @parcelitems = GetParcel($supplierid, $invoice, $datereceived->output('iso')); +my @parcelitems = GetParcel($booksellerid, $invoice, $datereceived->output('iso')); my $countlines = scalar @parcelitems; my $totalprice = 0; my $totalfreight = 0; @@ -174,7 +174,7 @@ for (my $i = 0 ; $i < $countlines ; $i++) { $line{invoice} = $invoice; $line{gst} = $gst; $line{total} = sprintf($cfstr, $total); - $line{supplierid} = $supplierid; + $line{booksellerid} = $booksellerid; push @loop_received, \%line; $totalprice += $parcelitems[$i]->{'unitprice'}; $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'}); @@ -195,7 +195,7 @@ for (my $i = 0 ; $i < $countlines ; $i++) { $tototal += $total; } -my $pendingorders = GetPendingOrders($supplierid); +my $pendingorders = GetPendingOrders($booksellerid); my $countpendings = scalar @$pendingorders; # pending orders totals @@ -219,7 +219,7 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{invoice} = $invoice; $line{gst} = $gst; $line{total} = $total; - $line{supplierid} = $supplierid; + $line{booksellerid} = $booksellerid; $ordergrandtotal += $line{ecost} * $line{quantity}; my $biblionumber = $line{'biblionumber'}; @@ -302,7 +302,7 @@ $template->param( invoicedatereceived => $datereceived->output('iso'), formatteddatereceived => $datereceived->output(), name => $bookseller->{'name'}, - supplierid => $supplierid, + booksellerid => $booksellerid, gst => $gst, freight => $freight, invoice => $invoice, diff --git a/acqui/parcels.pl b/acqui/parcels.pl index 915b1e8aa7..173c0c8ef2 100755 --- a/acqui/parcels.pl +++ b/acqui/parcels.pl @@ -35,7 +35,7 @@ It allows to write an order/parcels as 'received' when he arrives. =over 4 -=item supplierid +=item booksellerid To know the supplier this script has to show orders. @@ -77,7 +77,7 @@ use C4::Acquisition; use C4::Bookseller qw/ GetBookSellerFromId /; my $input = CGI->new; -my $supplierid = $input->param('supplierid'); +my $booksellerid = $input->param('booksellerid'); my $order = $input->param('orderby') || 'datereceived desc'; my $startfrom = $input->param('startfrom'); my $code = $input->param('filter'); @@ -96,8 +96,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $bookseller = GetBookSellerFromId($supplierid); -my @parcels = GetParcels( $supplierid, $order, $code, $datefrom, $dateto ); +my $bookseller = GetBookSellerFromId($booksellerid); +my @parcels = GetParcels( $booksellerid, $order, $code, $datefrom, $dateto ); my $count_parcels = @parcels; # multi page display gestion @@ -136,7 +136,7 @@ $template->param( name => $bookseller->{'name'}, DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), datereceived_today => C4::Dates->new()->output(), - supplierid => $supplierid, + booksellerid => $booksellerid, GST => C4::Context->preference('gist'), ); diff --git a/acqui/supplier.pl b/acqui/supplier.pl index 3faa560f25..8896b3b442 100755 --- a/acqui/supplier.pl +++ b/acqui/supplier.pl @@ -32,7 +32,7 @@ It allows to edit & save information about this bookseller. =over 4 -=item supplierid +=item booksellerid To know the bookseller this script has to display details. @@ -53,10 +53,10 @@ use C4::Bookseller qw( GetBookSellerFromId DelBookseller ); use C4::Budgets; my $query = CGI->new; -my $id = $query->param('supplierid'); +my $booksellerid = $query->param('booksellerid'); my $supplier = {}; -if ($id) { - $supplier = GetBookSellerFromId($id); +if ($booksellerid) { + $supplier = GetBookSellerFromId($booksellerid); } my $op = $query->param('op') || 'display'; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -77,7 +77,7 @@ $tax_rate *= 100; #build array for currencies if ( $op eq 'display' ) { - my $contracts = GetContract( { booksellerid => $id } ); + my $contracts = GetContract( { booksellerid => $booksellerid } ); for ( @{$contracts} ) { $_->{contractstartdate} = format_date( $_->{contractstartdate} ); @@ -85,7 +85,7 @@ if ( $op eq 'display' ) { } $template->param( - id => $id, + booksellerid => $booksellerid, name => $supplier->{'name'}, postal => $supplier->{'postal'}, address1 => $supplier->{'address1'}, @@ -117,7 +117,7 @@ if ( $op eq 'display' ) { contracts => $contracts, ); } elsif ( $op eq 'delete' ) { - DelBookseller($id); + DelBookseller($booksellerid); print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl'); exit; } else { @@ -145,7 +145,7 @@ if ( $op eq 'display' ) { my $gstrate = defined $supplier->{gstrate} ? $supplier->{gstrate} * 100 : ''; $template->param( - id => $id, + booksellerid => $booksellerid, name => $supplier->{'name'}, postal => $supplier->{'postal'}, address1 => $supplier->{'address1'}, @@ -165,7 +165,7 @@ if ( $op eq 'display' ) { contnotes => $supplier->{'contnotes'}, notes => $supplier->{'notes'}, # set active ON by default for supplier add (id empty for add) - active => $id ? $supplier->{'active'} : 1, + active => $booksellerid ? $supplier->{'active'} : 1, gstreg => $supplier->{'gstreg'}, listincgst => $supplier->{'listincgst'}, invoiceincgst => $supplier->{'invoiceincgst'}, diff --git a/acqui/updatesupplier.pl b/acqui/updatesupplier.pl index bd59c6b95a..3e79362dfd 100755 --- a/acqui/updatesupplier.pl +++ b/acqui/updatesupplier.pl @@ -69,7 +69,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user( my $supplier=$input->param('supplier'); #print startpage; my %data; -$data{'id'}=$input->param('id'); +$data{'booksellerid'}=$input->param('booksellerid'); $data{'name'}=$input->param('company'); $data{'postal'}=$input->param('company_postal'); @@ -109,13 +109,13 @@ if ($gstrate eq '') { $data{'discount'}=$input->param('discount'); $data{'active'}=$input->param('status'); if($data{'name'}) { - if ($data{'id'}){ + if ($data{'booksellerid'}){ ModBookseller(\%data); } else { - $data{id}=AddBookseller(\%data); + $data{booksellerid}=AddBookseller(\%data); } #redirect to booksellers.pl -print $input->redirect("booksellers.pl?id=".$data{id}); +print $input->redirect("booksellers.pl?booksellerid=".$data{booksellerid}); } else { print $input->redirect("supplier.pl?op=enter"); # fail silently. } diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl index 7126c9952f..9d3f0acec5 100755 --- a/admin/aqcontract.pl +++ b/admin/aqcontract.pl @@ -111,7 +111,7 @@ elsif ( $op eq 'add_validate' ) { }); } - print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid"); + print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?booksellerid=$booksellerid"); exit; # END $OP eq ADD_VALIDATE @@ -138,7 +138,7 @@ elsif ( $op eq 'delete_confirmed' ) { DelContract( { contractnumber => $contractnumber } ); - print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid"); + print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?booksellerid=$booksellerid"); exit; # END $OP eq DELETE_CONFIRMED diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc index f81b3037b9..37cdf7c182 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc @@ -22,18 +22,18 @@ var manageorders = [ [% IF ( CAN_user_acquisition_order_manage ) %] - { text: _("New basket"), url: "/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% id %]&op=add_form"}, - { text: _("Baskets"), url: "/cgi-bin/koha/acqui/booksellers.pl?supplierid=[% id %]"}, - { text: _("Basket groups"), url: "/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% id %]"}, + { text: _("New basket"), url: "/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% booksellerid %]&op=add_form"}, + { text: _("Baskets"), url: "/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid %]"}, + { text: _("Basket groups"), url: "/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]"}, [% END %] - { text: _("Receive shipments"), url: "/cgi-bin/koha/acqui/parcels.pl?supplierid=[% id %]" }, + { text: _("Receive shipments"), url: "/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% booksellerid %]" }, [% IF ( basketno ) %] - { text: _("Uncertain prices"), url: "/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% id %]&basketno=[% basketno %]&owner=1"} + { text: _("Uncertain prices"), url: "/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]&owner=1"} [% ELSE %] - { text: _("Uncertain prices"), url: "/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% id %]&owner=1"} + { text: _("Uncertain prices"), url: "/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&owner=1"} [% END %] ] - [% IF ( id ) %] + [% IF ( booksellerid ) %] [% IF ( basketcount ) %] new YAHOO.widget.Button({type: "menu", label: _("Manage orders"), name: "manageorders", menu: manageorders, container: "toolbar-list"}); [% END %] @@ -43,13 +43,13 @@ //]]>