Bugzilla – Attachment 43377 Details for
Bug 14920
Remove C4::Dates from circ/reserveratios.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14920: Simplify the date management on reserveratios
Bug-14920-Simplify-the-date-management-on-reserver.patch (text/plain), 2.83 KB, created by
Jonathan Druart
on 2015-10-13 10:48:54 UTC
(
hide
)
Description:
Bug 14920: Simplify the date management on reserveratios
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-10-13 10:48:54 UTC
Size:
2.83 KB
patch
obsolete
>From be0cc6e9d3c56ff7812091e8bdba811492034712 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 13 Oct 2015 11:46:18 +0100 >Subject: [PATCH] Bug 14920: Simplify the date management on reserveratios > >Note that the previous patch was wrong, the start date defaulted to yesterday, >the original behavior is to default to last year. > >This patch removes some unecessary variable declarations and tests. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > circ/reserveratios.pl | 27 ++++++++++----------------- > 1 file changed, 10 insertions(+), 17 deletions(-) > >diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl >index 27cc86c..bd51b7c 100755 >--- a/circ/reserveratios.pl >+++ b/circ/reserveratios.pl >@@ -55,18 +55,14 @@ if ($booksellerid && $basketno) { > $template->param( booksellerid => $booksellerid, basketno => $basketno ); > } > >-$startdate = eval { output_pref( { dt => dt_from_string( $startdate ), dateonly => 1, dateformat => 'iso' } ); }; >-$enddate = eval { output_pref( { dt => dt_from_string( $enddate ), dateonly => 1, dateformat => 'iso' } ); }; >+$startdate = eval { dt_from_string( $startdate ) } if $startdate; >+$enddate = eval { dt_from_string( $enddate ) } if $enddate; > >-my $todaysdate_dt = dt_from_string; >-my $todaysdate = output_pref( { dt => $todaysdate_dt, dateonly => 1, dateformat => 'iso' } ); >+my $todaysdate = dt_from_string; > > # A default of the prior years's holds is a reasonable way to pull holds >-my $datelastyear_dt = $todaysdate_dt->subtract( days => 1); >-my $datelastyear = output_pref( { dt => $datelastyear_dt, dateonly => 1, dateformat => 'iso' } ); >- >-$startdate = $datelastyear unless $startdate; > $enddate = $todaysdate unless $enddate; >+$startdate = $todaysdate->clone->subtract( years => 1 ) unless $startdate; > > if (!defined($ratio)) { > $ratio = 3; >@@ -79,16 +75,13 @@ if ($ratio <= 0) { > > my $dbh = C4::Context->dbh; > my $sqldatewhere = ""; >-$debug and warn output_pref({ dt => dt_from_string( $startdate ), dateformat => 'iso', dateonly => 1 }) . "\n" . output_pref({ dt => dt_from_string( $enddate ), dateformat => 'iso', dateonly => 1 }); >+$debug and warn output_pref({ dt => $startdate, dateformat => 'iso', dateonly => 1 }) . "\n" . output_pref({ dt => $enddate, dateformat => 'iso', dateonly => 1 }); > my @query_params = (); >-if ($startdate) { >- $sqldatewhere .= " AND reservedate >= ?"; >- push @query_params, $startdate ; >-} >-if ($enddate) { >- $sqldatewhere .= " AND reservedate <= ?"; >- push @query_params, $enddate; >-} >+ >+$sqldatewhere .= " AND reservedate >= ?"; >+push @query_params, output_pref({ dt => $startdate, dateformat => 'iso' }) ; >+$sqldatewhere .= " AND reservedate <= ?"; >+push @query_params, output_pref({ dt => $enddate, dateformat => 'iso' }); > > my $nfl_comparison = $include_ordered ? '<=' : '='; > my $strsth = >-- >2.1.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 14920
:
42948
|
42949
|
42950
|
43358
|
43360
|
43361
|
43376
| 43377