Bugzilla – Attachment 103592 Details for
Bug 24161
Add ability to track the claim dates of later orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24161: Remove GetLateOrders
Bug-24161-Remove-GetLateOrders.patch (text/plain), 6.45 KB, created by
PTFS Europe Sandboxes
on 2020-04-23 12:22:05 UTC
(
hide
)
Description:
Bug 24161: Remove GetLateOrders
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2020-04-23 12:22:05 UTC
Size:
6.45 KB
patch
obsolete
>From 521cdf602f918c939510fe430ad8f0ddd6cefdd1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 8 Jan 2020 21:45:09 +0100 >Subject: [PATCH] Bug 24161: Remove GetLateOrders > >Sponsored-by: Cork Institute of Technology > >Signed-off-by: Angela O'Connor Desmond <angela.oconnordesmond@staff.ittralee.ie> >--- > C4/Acquisition.pm | 130 +----------------------------------------------------- > 1 file changed, 1 insertion(+), 129 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index e9f288d5fd..ca6058abb2 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -67,7 +67,7 @@ BEGIN { > &GetBasketgroups &ReOpenBasketgroup > > &DelOrder &ModOrder &GetOrder &GetOrders &GetOrdersByBiblionumber >- &GetLateOrders &GetOrderFromItemnumber >+ &GetOrderFromItemnumber > &SearchOrders &GetHistory &GetRecentAcqui > &ModReceiveOrder &CancelReceipt > &TransferOrder >@@ -2073,134 +2073,6 @@ sub GetParcels { > > #------------------------------------------------------------# > >-=head3 GetLateOrders >- >- @results = &GetLateOrders; >- >-Searches for bookseller with late orders. >- >-return: >-the table of supplier with late issues. This table is full of hashref. >- >-=cut >- >-sub GetLateOrders { >- my $delay = shift; >- my $supplierid = shift; >- my $branch = shift; >- my $estimateddeliverydatefrom = shift; >- my $estimateddeliverydateto = shift; >- >- my $dbh = C4::Context->dbh; >- >- #BEWARE, order of parenthesis and LEFT JOIN is important for speed >- my $dbdriver = C4::Context->config("db_scheme") || "mysql"; >- >- my @query_params = (); >- my $select = " >- SELECT aqbasket.basketno, >- aqorders.ordernumber AS ordernumber, >- DATE(aqbasket.closedate) AS orderdate, >- aqbasket.basketname AS basketname, >- aqbasket.basketgroupid AS basketgroupid, >- aqbasketgroups.name AS basketgroupname, >- aqorders.rrp AS unitpricesupplier, >- aqorders.ecost AS unitpricelib, >- aqorders.claims_count AS claims_count, >- aqorders.claimed_date AS claimed_date, >- aqorders.order_internalnote AS internalnote, >- aqorders.order_vendornote AS vendornote, >- aqbudgets.budget_name AS budget, >- borrowers.branchcode AS branch, >- aqbooksellers.name AS supplier, >- aqbooksellers.id AS supplierid, >- biblio.author, biblio.title, >- biblioitems.publishercode AS publisher, >- biblioitems.publicationyear, >- biblioitems.isbn AS isbn, >- ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate, >- "; >- my $from = " >- FROM >- aqorders LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber >- LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber >- LEFT JOIN aqbudgets ON aqorders.budget_id = aqbudgets.budget_id, >- aqbasket LEFT JOIN borrowers ON aqbasket.authorisedby = borrowers.borrowernumber >- LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id >- LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid = aqbasketgroups.id >- WHERE aqorders.basketno = aqbasket.basketno >- AND ( datereceived IS NULL >- OR aqorders.quantityreceived < aqorders.quantity >- ) >- AND aqbasket.closedate IS NOT NULL >- AND aqorders.datecancellationprinted IS NULL >- "; >- if ($dbdriver eq "mysql") { >- $select .= " >- aqorders.quantity - COALESCE(aqorders.quantityreceived,0) AS quantity, >- (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal, >- DATEDIFF(CAST(now() AS date),closedate) AS latesince >- "; >- if ( defined $delay ) { >- $from .= " AND (closedate <= DATE_SUB(CAST(now() AS date),INTERVAL ? DAY)) " ; >- push @query_params, $delay; >- } >- $from .= " AND aqorders.quantity - COALESCE(aqorders.quantityreceived,0) <> 0"; >- } else { >- # FIXME: account for IFNULL as above >- $select .= " >- aqorders.quantity AS quantity, >- aqorders.quantity * aqorders.rrp AS subtotal, >- (CAST(now() AS date) - closedate) AS latesince >- "; >- if ( defined $delay ) { >- $from .= " AND (closedate <= (CAST(now() AS date) -(INTERVAL ? DAY)) "; >- push @query_params, $delay; >- } >- $from .= " AND aqorders.quantity <> 0"; >- } >- if (defined $supplierid) { >- $from .= ' AND aqbasket.booksellerid = ? '; >- push @query_params, $supplierid; >- } >- if (defined $branch) { >- $from .= ' AND borrowers.branchcode LIKE ? '; >- push @query_params, $branch; >- } >- >- if ( defined $estimateddeliverydatefrom or defined $estimateddeliverydateto ) { >- $from .= ' AND aqbooksellers.deliverytime IS NOT NULL '; >- } >- if ( defined $estimateddeliverydatefrom ) { >- $from .= ' AND ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) >= ?'; >- push @query_params, $estimateddeliverydatefrom; >- } >- if ( defined $estimateddeliverydateto ) { >- $from .= ' AND ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) <= ?'; >- push @query_params, $estimateddeliverydateto; >- } >- if ( defined $estimateddeliverydatefrom and not defined $estimateddeliverydateto ) { >- $from .= ' AND ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) <= CAST(now() AS date)'; >- } >- if (C4::Context->preference("IndependentBranches") >- && !C4::Context->IsSuperLibrarian() ) { >- $from .= ' AND borrowers.branchcode LIKE ? '; >- push @query_params, C4::Context->userenv->{branch}; >- } >- $from .= " AND orderstatus <> 'cancelled' "; >- my $query = "$select $from \nORDER BY latesince, basketno, borrowers.branchcode, supplier"; >- $debug and print STDERR "GetLateOrders query: $query\nGetLateOrders args: " . join(" ",@query_params); >- my $sth = $dbh->prepare($query); >- $sth->execute(@query_params); >- my @results; >- while (my $data = $sth->fetchrow_hashref) { >- push @results, $data; >- } >- return @results; >-} >- >-#------------------------------------------------------------# >- > =head3 GetHistory > > \@order_loop = GetHistory( %params ); >-- >2.11.0
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 24161
:
97114
|
97115
|
97116
|
97117
|
97118
|
97119
|
97470
|
97471
|
97472
|
98280
|
98522
|
98523
|
98524
|
98525
|
98526
|
98527
|
102111
|
102112
|
102113
|
102114
|
102115
|
102116
|
102220
|
102222
|
103567
|
103568
|
103569
|
103570
|
103571
|
103588
|
103589
|
103590
|
103591
|
103592
|
103593
|
103594
|
103595
|
104190
|
104191
|
104207
|
104208
|
104209
|
104210
|
104211
|
104212
|
104213
|
104214
|
104215
|
104216
|
104258
|
104259
|
104265
|
104826
|
104848