From 4b089e1eee51629b807d768f04c0d327460c4c3b Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Tue, 1 Jan 2008 14:52:05 -0600 Subject: [PATCH] updates to acqui - first of several commits bug fixes to display and save publishercode and purchase order numbers. use invoice number in place of parcel code fix template apparently allowing user to modify biblio details on add/mod order removing CGI scrolling_list Signed-off-by: Joshua Ferraro --- C4/Acquisition.pm | 25 +++++------ acqui/addorder.pl | 5 ++- acqui/basket.pl | 4 +- acqui/neworderbiblio.pl | 1 - acqui/neworderempty.pl | 21 +++------- acqui/orderreceive.pl | 9 ++-- acqui/parcel.pl | 26 ++++++++---- catalogue/showmarc.pl | 2 +- .../prog/en/modules/acqui/histsearch.tmpl | 4 +- .../prog/en/modules/acqui/neworderbiblio.tmpl | 24 ++++++++--- .../prog/en/modules/acqui/neworderempty.tmpl | 41 ++++++++++++------- .../prog/en/modules/acqui/parcel.tmpl | 10 ++--- .../prog/en/modules/acqui/parcels.tmpl | 27 ++++++------ 13 files changed, 112 insertions(+), 87 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index a1f204372e..594bfcef9f 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -270,20 +270,20 @@ sub GetOrders { my $dbh = C4::Context->dbh; my $query =" SELECT aqorderbreakdown.*, - biblio.*,biblioitems.*, + biblio.*,biblioitems.publishercode, aqorders.*, aqbookfund.bookfundname, biblio.title FROM aqorders LEFT JOIN aqorderbreakdown ON aqorders.ordernumber=aqorderbreakdown.ordernumber - LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber - LEFT JOIN biblioitems ON biblioitems.biblioitemnumber=aqorders.biblioitemnumber LEFT JOIN aqbookfund ON aqbookfund.bookfundid=aqorderbreakdown.bookfundid + LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber + LEFT JOIN biblioitems ON biblioitems.biblionumber=biblio.biblionumber WHERE basketno=? AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') "; - $orderby = "biblioitems.publishercode" unless $orderby; + $orderby = "biblioitems.publishercode,biblio.title" unless $orderby; $query .= " ORDER BY $orderby"; my $sth = $dbh->prepare($query); $sth->execute($basketno); @@ -400,7 +400,7 @@ sub NewOrder { $listprice, $booksellerid, $authorisedby, $notes, $bookfund, $bibitemnum, $rrp, $ecost, $gst, $budget, $cost, $sub, - $invoice, $sort1, $sort2 + $invoice, $sort1, $sort2, $purchaseorder ) = @_; @@ -438,15 +438,15 @@ sub NewOrder { my $query = " INSERT INTO aqorders ( biblionumber,title,basketno,quantity,listprice,notes, - biblioitemnumber,rrp,ecost,gst,unitprice,subscription,sort1,sort2,budgetdate,entrydate) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,$budget,now() ) + biblioitemnumber,rrp,ecost,gst,unitprice,subscription,sort1,sort2,budgetdate,entrydate,purchaseordernumber) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,$budget,now(),? ) "; my $sth = $dbh->prepare($query); $sth->execute( $bibnum, $title, $basketno, $quantity, $listprice, $notes, $bibitemnum, $rrp, $ecost, $gst, - $cost, $sub, $sort1, $sort2 + $cost, $sub, $sort1, $sort2, $purchaseorder ); $sth->finish; @@ -490,7 +490,7 @@ sub ModOrder { $title, $ordnum, $quantity, $listprice, $bibnum, $basketno, $supplier, $who, $notes, $bookfund, $bibitemnum, $rrp, $ecost, $gst, $budget, - $cost, $invoice, $sort1, $sort2 + $cost, $invoice, $sort1, $sort2, $purchaseorder ) = @_; my $dbh = C4::Context->dbh; @@ -499,14 +499,15 @@ sub ModOrder { SET title=?, quantity=?,listprice=?,basketno=?, rrp=?,ecost=?,unitprice=?,booksellerinvoicenumber=?, - notes=?,sort1=?, sort2=? + notes=?,sort1=?, sort2=?, purchaseordernumber=? WHERE ordernumber=? AND biblionumber=? "; my $sth = $dbh->prepare($query); $sth->execute( $title, $quantity, $listprice, $basketno, $rrp, $ecost, $cost, $invoice, $notes, $sort1, - $sort2, $ordnum, $bibnum + $sort2, $purchaseorder, + $ordnum, $bibnum ); $sth->finish; $query = " @@ -893,7 +894,7 @@ sub GetParcels { my $dbh = C4::Context->dbh; my $strsth =" SELECT aqorders.booksellerinvoicenumber, - datereceived, + datereceived,purchaseordernumber, count(DISTINCT biblionumber) AS biblio, sum(quantity) AS itemsexpected, sum(quantityreceived) AS itemsreceived diff --git a/acqui/addorder.pl b/acqui/addorder.pl index c90719ea7c..1bd80a17cd 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -165,6 +165,7 @@ my $gst = $input->param('GST'); my $budget = $input->param('budget'); my $cost = $input->param('cost'); my $sub = $input->param('sub'); +my $purchaseorder = $input->param('purchaseordernumber'); my $invoice = $input->param('invoice'); my $publishercode = $input->param('publishercode'); my $suggestionid = $input->param('suggestionid'); @@ -210,7 +211,7 @@ if ( $quantity ne '0' ) { $biblionumber, $basketno, $booksellerid, $loggedinuser, $notes, $bookfund, $bibitemnum, $rrp, $ecost, $gst, $budget, $cost, - $invoice, $sort1, $sort2 + $invoice, $sort1, $sort2, $purchaseorder ); } else { # else, it's a new line @@ -219,7 +220,7 @@ if ( $quantity ne '0' ) { $listprice, $booksellerid, $loggedinuser, $notes, $bookfund, $bibitemnum, $rrp, $ecost, $gst, $budget, $cost, $sub, - $invoice, $sort1, $sort2 + $invoice, $sort1, $sort2, $purchaseorder ); } } diff --git a/acqui/basket.pl b/acqui/basket.pl index d127ca152c..9aba35121a 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -132,7 +132,6 @@ my $gist_est; # GST my $grand_total_est; # $subttotal + $gist my $qty_total; - my @books_loop; for ( my $i = 0 ; $i < $count ; $i++ ) { my $rrp = $results[$i]->{'listprice'}; @@ -152,7 +151,8 @@ for ( my $i = 0 ; $i < $count ; $i++ ) { $line{color} = 'white'; $toggle = 0; } - $line{basketno} = $basketno; + $line{publishercode} = $results[$i]->{'publishercode'}; + $line{basketno} = $basketno; $line{i} = $i; $line{rrp} = sprintf( "%.2f", $line{'rrp'} ); $line{ecost} = sprintf( "%.2f", $line{'ecost'} ); diff --git a/acqui/neworderbiblio.pl b/acqui/neworderbiblio.pl index d38dd6bf43..6fb6f7c53f 100755 --- a/acqui/neworderbiblio.pl +++ b/acqui/neworderbiblio.pl @@ -111,7 +111,6 @@ for(my $i=0;$i<$hits;$i++) { %resultsloop=%$biblio; $resultsloop{highlight} = ($i % 2)?(1):(0); $resultsloop{booksellerid} = $booksellerid; - push @results, \%resultsloop; } diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 97fc39ce01..809301560d 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -89,6 +89,7 @@ my $count = scalar @booksellers; my $ordnum = $input->param('ordnum'); my $biblionumber = $input->param('biblionumber'); my $basketno = $input->param('basketno'); +my $purchaseorder= $input->param('purchaseordernumber'); my $suggestionid = $input->param('suggestionid'); # my $donation = $input->param('donation'); my $close = $input->param('close'); @@ -151,23 +152,10 @@ for ( my $i = 0 ; $i < $count ; $i++ ) { my $itemtypes = GetItemTypes; my @itemtypesloop; -my %itemtypesloop; foreach my $thisitemtype (sort keys %$itemtypes) { - push @itemtypesloop, $itemtypes->{$thisitemtype}->{'itemtype'}; - $itemtypesloop{$itemtypes->{$thisitemtype}->{'itemtype'}} = $itemtypes->{$thisitemtype}->{'description'}; + push @itemtypesloop, { itemtype => $itemtypes->{$thisitemtype}->{'itemtype'} , desc => $itemtypes->{$thisitemtype}->{'description'} } ; } -my $CGIitemtype = CGI::scrolling_list( - -name => 'format', - -id => 'format', - -values => \@itemtypesloop, - -default => $data->{'itemtype'}, - -labels => \%itemtypesloop, - -size => 1, - -tabindex=>'', - -multiple => 0 -); - # build branches list my $onlymine=C4::Context->preference('IndependantBranches') && C4::Context->userenv && @@ -182,7 +170,7 @@ foreach my $thisbranch ( sort keys %$branches ) { ); push @branchloop, \%row; } -$template->param( branchloop => \@branchloop ); +$template->param( branchloop => \@branchloop , itypeloop => \@itemtypesloop ); # build bookfund list my $borrower= GetMember($loggedinuser); @@ -278,6 +266,7 @@ $template->param( authorisedbyname => $borrower->{'firstname'} . " " . $borrower->{'surname'}, biblioitemnumber => $data->{'biblioitemnumber'}, itemtype => $data->{'itemtype'}, + itemtype_desc => $itemtypes->{$data->{'itemtype'}}->{description}, discount => $booksellers[0]->{'discount'}, listincgst => $booksellers[0]->{'listincgst'}, listprice => $booksellers[0]->{'listprice'}, @@ -293,7 +282,6 @@ $template->param( title => $data->{'title'}, author => $data->{'author'}, copyrightdate => $data->{'copyrightdate'}, - CGIitemtype => $CGIitemtype, CGIbookfund => $CGIbookfund, isbn => $data->{'isbn'}, seriestitle => $data->{'seriestitle'}, @@ -303,6 +291,7 @@ $template->param( total => $data->{ecost}*$data->{quantity}, invoice => $data->{'booksellerinvoicenumber'}, ecost => $data->{'ecost'}, + purchaseordernumber => $data->{'purchaseordernumber'}, notes => $data->{'notes'}, publishercode => $data->{'publishercode'}, # donation => $donation diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index cc2c67377a..cc62fe43fe 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -76,7 +76,7 @@ my $search = $input->param('recieve'); my $invoice = $input->param('invoice'); my $freight = $input->param('freight'); my $biblionumber = $input->param('biblionumber'); -my $daterecieved = $input->param('daterecieved') || format_date(join "-",Date::Calc::Today()); +my $daterecieved = C4::Dates->new($input->param('datereceived'),'iso') || C4::Dates->new(); my $catview = $input->param('catview'); my $gst = $input->param('gst'); @@ -191,7 +191,7 @@ if ( $count == 1 ) { ecost => $results[0]->{'ecost'}, unitprice => $results[0]->{'unitprice'}, invoice => $invoice, - daterecieved => $daterecieved, + daterecieved => $daterecieved->output(), ); } else { @@ -200,7 +200,7 @@ else { my %line = %{ $results[$i] }; $line{invoice} = $invoice; - $line{daterecieved} = $daterecieved; + $line{daterecieved} = $daterecieved->output(); $line{freight} = $freight; $line{gst} = $gst; $line{title} = $results[$i]->{'title'}; @@ -211,11 +211,10 @@ else { $template->param( loop => \@loop, date => format_date($date), - daterecieved => $daterecieved, + daterecieved => $daterecieved->output(), name => $booksellers[0]->{'name'}, supplierid => $supplierid, invoice => $invoice, - daterecieved => $daterecieved, ); } diff --git a/acqui/parcel.pl b/acqui/parcel.pl index c6a1fe0ec1..f26ef08035 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -72,7 +72,7 @@ my $count = scalar @booksellers; my $invoice=$input->param('invoice') || ''; my $freight=$input->param('freight'); my $gst=$input->param('gst'); -my $datereceived=format_date_in_iso($input->param('datereceived')) || format_date(join "-",Date::Calc::Today()); +my $datereceived=C4::Dates->new($input->param('datereceived'),'iso') || C4::Dates->new(); my $code=$input->param('code'); my ($template, $loggedinuser, $cookie) @@ -83,7 +83,7 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {acquisition => 1}, debug => 1, }); -my @parcelitems=GetParcel($supplierid,$invoice,$datereceived); +my @parcelitems=GetParcel($supplierid,$invoice,$datereceived->output('iso')); my $countlines = scalar @parcelitems; my $totalprice=0; @@ -94,8 +94,9 @@ my $tototal; my $toggle; my @loop_received = (); for (my $i=0;$i<$countlines;$i++){ - $total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) - $parcelitems[$i]->{'unitprice'}+=0; + #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) + $total=($parcelitems[$i]->{'unitprice'} ) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) + $parcelitems[$i]->{'unitprice'}+=0; my %line; if ($toggle==0){ $line{color}='#EEEEEE'; @@ -111,10 +112,19 @@ for (my $i=0;$i<$countlines;$i++){ $line{supplierid} = $supplierid; push @loop_received, \%line; $totalprice+=$parcelitems[$i]->{'unitprice'}; - $totalfreight+=$parcelitems[$i]->{'freight'}; +#double FIXME - totalfreight is redefined later. + + # FIXME - each order in a parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget.. + if ( $i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) { + warn "FREIGHT CHARGE MISMATCH!!"; + } + $totalfreight=$parcelitems[$i]->{'freight'}; + #$totalfreight+=$parcelitems[$i]->{'freight'}; + $totalfreight=$parcelitems[$i]->{'freight'}; $totalquantity+=$parcelitems[$i]->{'quantityreceived'}; $tototal+=$total; } + my $pendingorders = GetPendingOrders($supplierid); my $countpendings = scalar @$pendingorders; @@ -143,13 +153,13 @@ for (my $i=0;$i<$countpendings;$i++){ $line{supplierid} = $supplierid; push @loop_orders, \%line; } - +$freight = $totalfreight unless $freight; $totalfreight=$freight; $tototal=$tototal+$freight; $template->param(invoice => $invoice, - datereceived => $datereceived, - formatteddatereceived => format_date($datereceived), + datereceived => $datereceived->output('iso'), + formatteddatereceived => $datereceived->output(), name => $booksellers[0]->{'name'}, supplierid => $supplierid, gst => $gst, diff --git a/catalogue/showmarc.pl b/catalogue/showmarc.pl index 4b959fe217..6239b7162a 100755 --- a/catalogue/showmarc.pl +++ b/catalogue/showmarc.pl @@ -67,7 +67,7 @@ my $style_doc = $parser->parse_file($xslfile); my $stylesheet = $xslt->parse_stylesheet($style_doc); my $results = $stylesheet->transform($source); my $newxmlrecord = $stylesheet->output_string($results); -warn $newxmlrecord; +#warn $newxmlrecord; print "Content-type: text/html\n\n"; print $newxmlrecord; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl index 0c449aaad0..0dcf6f9055 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl @@ -89,7 +89,7 @@ - + @@ -125,4 +125,4 @@ - \ No newline at end of file + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tmpl index d3ab7b4943..da90dc7a89 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tmpl @@ -1,5 +1,6 @@ Koha › Acquisitions › Search Existing Records + @@ -39,21 +40,32 @@
BasketParcelParcel / Invoice Summary Supplier Placed on
- + + + + + + +
SummarySummaryPublisherCopyright 
-

-

, - - - - - ; +

+ by ,

+

- : ;

+ + ; + + + + " title="MARC" rel="gb_page_center[600,500]">View MARC + &basketno=&biblionumber=" title="order this one !"> Order diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl index 3e71a5e0fc..88704ea5d0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl @@ -120,17 +120,17 @@ if (quantity ==0) { " value="" />
  1. - + Title - " /> + " /> " />
  2. - - Author: + + Author: " /> @@ -138,8 +138,8 @@ if (quantity ==0) {
  3. - - Publisher: + + Publisher: " /> @@ -147,7 +147,7 @@ if (quantity ==0) {
  4. - + Copyright date: " /> @@ -156,11 +156,20 @@ if (quantity ==0) {
  5. - - + + Item type: + " /> + + + +
  6. - + ISBN: " /> @@ -169,16 +178,16 @@ if (quantity ==0) {
  7. - + Series: - " /> + " /> " />
  8. - + " />
  9. +
  10. + + " /> +
  11. - " /> (usually empty) + " /> (Fill when receiving)
  12. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl index f959545f46..9dda33eece 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl @@ -37,17 +37,18 @@
    + - - - - + + + + - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tmpl index 80e02038b7..f7d8e36676 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tmpl @@ -39,20 +39,11 @@
    Quantity Basket/Order Summary View RecordQTY orderedEst CostACTUALQTY receivedQty orderedEst costActual cost TOTAL
    &biblionumber=&daterecieved=&invoice=&gst=&freight=&supplierid="> ">  /   ">
    ISBN: @@ -58,7 +59,6 @@
    &biblionumber=&daterecieved=&invoice=&gst=&freight=&supplierid=">
    - - - - - - - - - + - +
    LineCodeDate ReceivedItem CountBiblio countItems expected
    " />" />" /> " />

    " />

     

    + + + + + + + + + - +
    LineDate ReceivedInvoice /Parcel CodeItem CountBiblio countItems expected
    - - &datereceived=&invoice="> + + -- 2.39.5