Bugzilla – Attachment 16474 Details for
Bug 7295
list of librarian managing a basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8037 - Add holds and funds to items already received in parcel.pl
Bug-8037---Add-holds-and-funds-to-items-already-re.patch (text/plain), 10.15 KB, created by
Paul Poulain
on 2013-03-20 10:11:18 UTC
(
hide
)
Description:
Bug 8037 - Add holds and funds to items already received in parcel.pl
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2013-03-20 10:11:18 UTC
Size:
10.15 KB
patch
obsolete
>From ea2988b59b0b43dc7db6bf6b5bf29f76a9bfe211 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 28 Mar 2012 13:33:36 -0400 >Subject: [PATCH] Bug 8037 - Add holds and funds to items already received in parcel.pl > >Adds a column to indicate holds on recieved items, as well as adding >a new column for fund and showing the subtotals per fund above >the total subtotal. > >Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr> > >http://bugs.koha-community.org/show_bug.cgi?id=7295 >--- > C4/Acquisition.pm | 3 +- > C4/Budgets.pm | 25 ++++++++++ > C4/Reserves.pm | 12 ++++- > acqui/parcel.pl | 7 ++- > .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 50 +++++++++++++++----- > 5 files changed, 81 insertions(+), 16 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 4a9eae6..e7a58d8 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2339,9 +2339,10 @@ sub GetInvoiceDetails { > my $invoice = $sth->fetchrow_hashref; > > $query = qq{ >- SELECT aqorders.*, biblio.* >+ SELECT aqorders.*, biblio.*, aqorders_items.itemnumber > FROM aqorders > LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber >+ LEFT JOIN aqorders_items ON aqorders.ordernumber = aqorders_items.ordernumber > WHERE invoiceid = ? > }; > $sth = $dbh->prepare($query); >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index 7b553e6..1989ec2 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -34,6 +34,7 @@ BEGIN { > @EXPORT = qw( > > &GetBudget >+ &GetBudgetByOrderNumber > &GetBudgets > &GetBudgetHierarchy > &AddBudget >@@ -649,6 +650,30 @@ sub GetBudget { > return $result; > } > >+=head2 GetBudgetByOrderNumber >+ >+ &GetBudgetByOrderNumber($ordernumber); >+ >+get a specific budget by order number >+ >+=cut >+ >+# ------------------------------------------------------------------- >+sub GetBudgetByOrderNumber { >+ my ( $ordernumber ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = " >+ SELECT aqbudgets.* >+ FROM aqbudgets, aqorders >+ WHERE ordernumber=? >+ AND aqorders.budget_id = aqbudgets.budget_id >+ "; >+ my $sth = $dbh->prepare($query); >+ $sth->execute( $ordernumber ); >+ my $result = $sth->fetchrow_hashref; >+ return $result; >+} >+ > =head2 GetChildBudgetsSpent > > &GetChildBudgetsSpent($budget-id); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index ba12cf5..309dc00 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -256,9 +256,12 @@ of the reserves and an arrayref pointing to the reserves for C<$biblionumber>. > sub GetReservesFromBiblionumber { > my ($biblionumber) = shift or return (0, []); > my ($all_dates) = shift; >+ my ($itemnumber) = shift; >+ warn "ITEMNUMBER: $itemnumber"; > my $dbh = C4::Context->dbh; > > # Find the desired items in the reserves >+ my @params; > my $query = " > SELECT branchcode, > timestamp AS rtimestamp, >@@ -276,12 +279,17 @@ sub GetReservesFromBiblionumber { > suspend_until > FROM reserves > WHERE biblionumber = ? "; >+ push( @params, $biblionumber ); > unless ( $all_dates ) { >- $query .= "AND reservedate <= CURRENT_DATE()"; >+ $query .= " AND reservedate <= CURRENT_DATE() "; >+ } >+ if ( $itemnumber ) { >+ $query .= " AND ( itemnumber IS NULL OR itemnumber = ? )"; >+ push( @params, $itemnumber ); > } > $query .= "ORDER BY priority"; > my $sth = $dbh->prepare($query); >- $sth->execute($biblionumber); >+ $sth->execute( @params ); > my @results; > my $i = 0; > while ( my $data = $sth->fetchrow_hashref ) { >diff --git a/acqui/parcel.pl b/acqui/parcel.pl >index 15578a9..bb88222 100755 >--- a/acqui/parcel.pl >+++ b/acqui/parcel.pl >@@ -67,6 +67,7 @@ use CGI; > use C4::Output; > use C4::Dates qw/format_date format_date_in_iso/; > use C4::Suggestions; >+use C4::Reserves qw/GetReservesFromBiblionumber/; > use JSON; > > my $input=new CGI; >@@ -180,6 +181,9 @@ for my $item ( @parcelitems ) { > $line{invoice} = $invoice->{invoicenumber}; > $line{total} = sprintf($cfstr, $total); > $line{booksellerid} = $invoice->{booksellerid}; >+ my ($count) = &GetReservesFromBiblionumber($line{biblionumber},undef,$item->{itemnumber}); >+ $line{holds} = $count; >+ $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} ); > $totalprice += $item->{'unitprice'}; > $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} ); > my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller ); >@@ -197,7 +201,8 @@ for my $item ( @parcelitems ) { > > if ( $line{parent_ordernumber} != $line{ordernumber} ) { > if ( grep { $_->{ordernumber} == $line{parent_ordernumber} } >- @parcelitems ) >+ @parcelitems >+ ) > { > $line{cannot_cancel} = 1; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index fae8473..0d85390 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -1,3 +1,4 @@ >+[% USE currency = format('%.2f') -%] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Acquisitions › [% IF ( date ) %] > Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% formatteddatereceived %][% ELSE %]Receive orders from [% name %][% END %]</title> >@@ -40,12 +41,14 @@ > "iCookieDuration": 60*60*24*1000, // 1000 days > "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], > "aoColumnDefs": [ >- { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false }, >+ { "aTargets": [ 4, -1 ], "bSortable": false, "bSearchable": false }, > ], > "aoColumns": [ > { "sType": "num-html" }, > { "sType": "num-html" }, > { "sType": "html" }, >+ { "sType": "html" }, >+ null, > null, > null, > null, >@@ -270,36 +273,57 @@ > > > [% IF ( loop_received ) %] >+ [% SET funds = {} %] >+ [% SET estimated_total = 0 %] >+ >+ [% FOREACH loop_receive IN loop_received %] >+ [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %] >+ [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%] >+ [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %] >+ [% END %] >+ > <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform"> > <table id="receivedt"> > <thead> > <tr> >- <th>Basket</th> >- <th>Order line</th> >- <th>Summary</th> >- <th>View record</th> >- <th>Quantity</th> >- <th>Est cost</th> >- <th>Actual cost</th> >- <th>TOTAL</th> >+ <th>Basket</th> >+ <th>Order Line</th> >+ <th>Holds</th> >+ <th>Summary</th> >+ <th>View record</th> >+ <th>Quantity</th> >+ <th>Fund</th> >+ <th>Est cost</th> >+ <th>Actual cost</th> >+ <th>TOTAL</th> > <th></th> > </tr> > </thead> > <tfoot> >+ [% FOREACH key IN funds.keys.sort %] >+ <tr> >+ <td colspan="6" class="total"> </td> >+ <td><i>Subtotal for</i> [% key %]</td> >+ <td>[% currency( funds.$key.estimated ) %]</td> >+ <td>[% currency( funds.$key.actual ) %]</td> >+ <td> </td> >+ <td> </td> >+ </tr> >+ [% END %] > <tr> >- <th colspan="7" class="total">Total tax exc.</th> >+ <th colspan="9" class="total">Total tax exc.</th> > <th>[% total_gste %]</th> > <th></th> > </tr> > [% FOREACH book_foot IN book_foot_loop %] > <tr> >- <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th> >+ <th colspan="9">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th> > <th>[% book_foot.value %]</th> > <th></th> > </tr> > [% END %] > <tr> >- <th colspan="7" class="total">Total tax inc.</th> >+ <th colspan="9" class="total">Total tax inc.</th> > <th>[% total_gsti %]</th> > <th></th> > </tr> >@@ -309,6 +333,7 @@ > <tr> > <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td> > <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td> >+ <td>[% IF loop_receive.holds %]<span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.holds %]</a></span>[% END %]</td> > <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a> > [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %] > [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %] >@@ -321,6 +346,7 @@ > </td> > <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> > <td>[% loop_receive.quantityreceived %]</td> >+ <td>[% loop_receive.budget.budget_name %]</td> > <td>[% loop_receive.ecost %]</td> > <td>[% loop_receive.unitprice %]</td> > <td>[% loop_receive.total %]</td> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7295
:
9309
|
9943
|
10227
|
10885
|
10886
|
11282
|
11283
|
13210
|
13211
|
14515
|
14516
|
16398
|
16399
|
16474
|
16497
|
16498
|
17358
|
17359
|
17360
|
17361
|
17706
|
17707
|
17708
|
18338
|
18339
|
18340
|
19751
|
19752
|
19753
|
19754
|
20769
|
20770
|
20771