Bugzilla – Attachment 30592 Details for
Bug 12732
Allow sorting by basket creation date to the late orders table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12732 - Sort late orders by basket creation or closing date
Bug-12732---Sort-late-orders-by-basket-creation-or.patch (text/plain), 7.32 KB, created by
simith.doliveira
on 2014-08-07 18:23:11 UTC
(
hide
)
Description:
Bug 12732 - Sort late orders by basket creation or closing date
Filename:
MIME Type:
Creator:
simith.doliveira
Created:
2014-08-07 18:23:11 UTC
Size:
7.32 KB
patch
obsolete
>From 1d923a09365efeb51e95725e2d11fe8c2821d343 Mon Sep 17 00:00:00 2001 >From: simith <simith@inlibro.com> >Date: Thu, 7 Aug 2014 14:19:52 -0400 >Subject: [PATCH] Bug 12732 - Sort late orders by basket creation or closing > date > >This fix permits to sort late orders by basket creation or closing date > >Modified: > >installer/data/mysql/sysprefs.sql -AcqLateOrderUseCreationDate preference added >koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref -AcqLateOrderUseCreationDate preference added >koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt -Change "Order date" column >acqui/lateorders.pl - >C4/Acquisition.pm -Change sql > >Testing: > >I Apply the patch >II Run updatedatabase.pl > >0) Create 2 orders each one with different baskets; >1) Change the first basket date (table aqbasket, column creationdate and closedate) to 2014-07-13; >2) Change the second basket creationdate to 2014-07-12 and closedate to 2014-07-14; >3) Set AcqLateOrderUseCreationDate to Don't use the creation date of the basket to sort late order; >4) Validate sort by "close date" (second basket came first) and "Order close date" column; >5) Set AcqLateOrderUseCreationDate to Do use the creation date of the basket to sort late order; >6) Validate sort by "creation date" (first basket came first) and "Order creation date" column; > >sponsored by the CCSR ( http://www.ccsr.qc.ca ) >--- > C4/Acquisition.pm | 13 ++++++++----- > acqui/lateorders.pl | 1 + > installer/data/mysql/sysprefs.sql | 1 + > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 2 +- > .../prog/en/modules/admin/preferences/acquisitions.pref | 7 +++++++ > 5 files changed, 18 insertions(+), 6 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 0cff235..1a7c196 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2117,11 +2117,14 @@ sub GetLateOrders { > #BEWARE, order of parenthesis and LEFT JOIN is important for speed > my $dbdriver = C4::Context->config("db_scheme") || "mysql"; > >+ my $lateOrderSort = C4::Context->preference("AcqLateOrderUseCreationDate"); >+ my $aqbasketSortField = ( $lateOrderSort eq 'creation' ? 'creationdate' : 'closedate' ); >+ > my @query_params = (); > my $select = " > SELECT aqbasket.basketno, > aqorders.ordernumber, >- DATE(aqbasket.closedate) AS orderdate, >+ DATE(aqbasket.${aqbasketSortField}) AS orderdate, > aqbasket.basketname AS basketname, > aqbasket.basketgroupid AS basketgroupid, > aqbasketgroups.name AS basketgroupname, >@@ -2159,10 +2162,10 @@ sub GetLateOrders { > $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 >+ DATEDIFF(CAST(now() AS date),${aqbasketSortField}) AS latesince > "; > if ( defined $delay ) { >- $from .= " AND (closedate <= DATE_SUB(CAST(now() AS date),INTERVAL ? DAY)) " ; >+ $from .= " AND (${aqbasketSortField} <= DATE_SUB(CAST(now() AS date),INTERVAL ? DAY)) " ; > push @query_params, $delay; > } > $having = " >@@ -2175,10 +2178,10 @@ sub GetLateOrders { > $select .= " > aqorders.quantity AS quantity, > aqorders.quantity * aqorders.rrp AS subtotal, >- (CAST(now() AS date) - closedate) AS latesince >+ (CAST(now() AS date) - ${aqbasketSortField}) AS latesince > "; > if ( defined $delay ) { >- $from .= " AND (closedate <= (CAST(now() AS date) -(INTERVAL ? DAY)) "; >+ $from .= " AND (${aqbasketSortField} <= (CAST(now() AS date) -(INTERVAL ? DAY)) "; > push @query_params, $delay; > } > } >diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl >index d43dbbe..974f75f 100755 >--- a/acqui/lateorders.pl >+++ b/acqui/lateorders.pl >@@ -172,5 +172,6 @@ $template->param( > estimateddeliverydateto => $estimateddeliverydateto, > total => $total, > intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), >+ lateOrderSort => C4::Context->preference("AcqLateOrderUseCreationDate"), > ); > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 03a3f1e..c857f61 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -2,6 +2,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AcqCreateItem','ordering','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'), > ('AcqEnableFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to invoice records.','YesNo'), > ('AcqItemSetSubfieldsWhenReceived','','','Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar")','Free'), >+('AcqLateOrderUseCreationDate', 'closing', 'creation|closing', 'Change late order default sort.', 'Choice'); > ('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'), > ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'), > ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >index efa0db6..a1a3947 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >@@ -111,7 +111,7 @@ $(document).ready(function() { > [% ELSE %] > <th></th> > [% END %] >- <th class="title-string">Order date</th> >+ <th class="title-string">Order [% lateOrderSort %] date</th> > <th class="title-string">Estimated delivery date</th> > <th>Vendor</th> > <th class="anti-the">Information</th> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >index ac57f95..a6e9d11 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >@@ -57,6 +57,13 @@ Acquisitions: > type: textarea > - "You can use the following fields: price, quantity, budget_code, discount, sort1, sort2" > - "<br/>For example:<br/>price: 947$a|947$c<br/>quantity: 969$h<br/>budget_code: 922$a" >+ - >+ - pref: AcqLateOrderUseCreationDate >+ choices: >+ creation: Do >+ closing: Don't >+ - Use the creation date of the basket to sort late order. >+ > Printing: > - > - Use the >-- >1.9.1
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 12732
:
30592
|
30794
|
31064
|
32298
|
32301
|
32303
|
58232
|
58233
|
153617
|
153618
|
154633
|
156280
|
156291
|
156292