Bugzilla – Attachment 44137 Details for
Bug 14903
Remove C4::Dates from circ/circulation.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14903 - Remove C4::Dates from circ/circulation.pl (and more)
Bug-14903---Remove-C4Dates-from-circcirculationpl-.patch (text/plain), 13.87 KB, created by
Jonathan Druart
on 2015-10-29 08:35:12 UTC
(
hide
)
Description:
Bug 14903 - Remove C4::Dates from circ/circulation.pl (and more)
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-10-29 08:35:12 UTC
Size:
13.87 KB
patch
obsolete
>From c5ae637cc3ef4873e3b902f2c12674cc8d215efe Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Fri, 9 Oct 2015 18:48:30 +0200 >Subject: [PATCH] Bug 14903 - Remove C4::Dates from circ/circulation.pl (and > more) > >Patch to remove deprectated C4::Dates from: >- circ/circulation.pl >- C4/Circulation.pm >- koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt > >To test: >- Apply patch >- Go to the checkout site (Home > Circulation > Checkouts) >- Verify that data displays properly (including for users with a card > that expires in the near future, see syspref 'NotifyBorrowerDeparture') >- Search for regressions >- prove -v t/db_dependent/Circulation.t > >(Amended following comment #9 / #11 25.10.2015 /mv) > >Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Circulation.pm | 23 +++++++++---------- > circ/circulation.pl | 26 ++++++++++------------ > .../prog/en/modules/circ/circulation.tt | 12 +++++----- > 3 files changed, 28 insertions(+), 33 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 43b8f93..18cc9d5 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -22,14 +22,13 @@ package C4::Circulation; > use strict; > #use warnings; FIXME - Bug 2505 > use DateTime; >+use Koha::DateUtils; > use C4::Context; > use C4::Stats; > use C4::Reserves; > use C4::Biblio; > use C4::Items; > use C4::Members; >-use C4::Dates; >-use C4::Dates qw(format_date); > use C4::Accounts; > use C4::ItemCirculationAlertPreference; > use C4::Message; >@@ -657,7 +656,7 @@ sub itemissues { > =head2 CanBookBeIssued > > ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, >- $barcode, $duedatespec, $inprocess, $ignore_reserves ); >+ $barcode, $duedate, $inprocess, $ignore_reserves ); > > Check if a book can be issued. > >@@ -669,7 +668,7 @@ C<$issuingimpossible> and C<$needsconfirmation> are some hashref. > > =item C<$barcode> is the bar code of the book being issued. > >-=item C<$duedatespec> is a C4::Dates object. >+=item C<$duedates> is a DateTime object. > > =item C<$inprocess> boolean switch > =item C<$ignore_reserves> boolean switch >@@ -1035,7 +1034,7 @@ sub CanBookBeIssued { > $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; > $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; > $needsconfirmation{'resbranchname'} = $branchname; >- $needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'}); >+ $needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; > } > elsif ( $restype eq "Reserved" ) { > # The item is on reserve for someone else. >@@ -1045,7 +1044,7 @@ sub CanBookBeIssued { > $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; > $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; > $needsconfirmation{'resbranchname'} = $branchname; >- $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'}); >+ $needsconfirmation{'resreservedate'} = $res->{'reservedate'}; > } > } > } >@@ -1212,13 +1211,13 @@ Issue a book. Does no check, they are done in CanBookBeIssued. If we reach this > > =item C<$barcode> is the barcode of the item being issued. > >-=item C<$datedue> is a C4::Dates object for the max date of return, i.e. the date due (optional). >+=item C<$datedue> is a DateTime object for the max date of return, i.e. the date due (optional). > Calculated if empty. > > =item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional). > > =item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional). >-Defaults to today. Unlike C<$datedue>, NOT a C4::Dates object, unfortunately. >+Defaults to today. Unlike C<$datedue>, NOT a DateTime object, unfortunately. > > AddIssue does the following things : > >@@ -1905,7 +1904,7 @@ sub AddReturn { > # define circControlBranch only if dropbox mode is set > # don't allow dropbox mode to create an invalid entry in issues (issuedate > today) > # FIXME: check issuedate > returndate, factoring in holidays >- #$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );; >+ > $circControlBranch = _GetCircControlBranch($item,$borrower); > $issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0; > } >@@ -2851,7 +2850,7 @@ C<$itemnumber> is the number of the item to renew. > C<$branch> is the library where the renewal took place (if any). > The library that controls the circ policies for the renewal is retrieved from the issues record. > >-C<$datedue> can be a C4::Dates object used to set the due date. >+C<$datedue> can be a DateTime object used to set the due date. > > C<$lastreneweddate> is an optional ISO-formatted date used to set issues.lastreneweddate. If > this parameter is not supplied, lastreneweddate is set to the current date. >@@ -3435,7 +3434,7 @@ $newdatedue = CalcDateDue($startdate,$itemtype,$branchcode,$borrower); > > this function calculates the due date given the start date and configured circulation rules, > checking against the holidays calendar as per the 'useDaysMode' syspref. >-C<$startdate> = C4::Dates object representing start date of loan period (assumed to be today) >+C<$startdate> = DateTime object representing start date of loan period (assumed to be today) > C<$itemtype> = itemtype code of item in question > C<$branch> = location whose calendar to use > C<$borrower> = Borrower object >@@ -3877,8 +3876,6 @@ sub TransferSlip { > my $item = GetItem( $itemnumber, $barcode ) > or return; > >- my $pulldate = C4::Dates->new(); >- > return C4::Letters::GetPreparedLetter ( > module => 'circulation', > letter_code => 'TRANSFERSLIP', >diff --git a/circ/circulation.pl b/circ/circulation.pl >index d42be29..1812061 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -30,7 +30,6 @@ use DateTime::Duration; > use C4::Output; > use C4::Print; > use C4::Auth qw/:DEFAULT get_session haspermission/; >-use C4::Dates qw/format_date/; > use C4::Branch; # GetBranches > use C4::Koha; # GetPrinter > use C4::Circulation; >@@ -175,6 +174,8 @@ for my $barcode ( @$barcodes ) { > > my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate'); > my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate'); >+$duedatespec = eval { output_pref( { dt => dt_from_string( $duedatespec ), dateformat => 'iso' }); }; >+ > my $issueconfirmed = $query->param('issueconfirmed'); > my $cancelreserve = $query->param('cancelreserve'); > my $print = $query->param('print') || q{}; >@@ -202,18 +203,15 @@ if( $onsite_checkout && !$duedatespec_allow ) { > $datedue = output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' }); > $datedue .= ' 23:59:00'; > } elsif( $duedatespec_allow ) { >- if ($duedatespec) { >- if ($duedatespec =~ C4::Dates->regexp('syspref')) { >- $datedue = dt_from_string($duedatespec); >- } else { >+ if ($datedue) { >+ $datedue = eval { dt_from_string( $datedue ) }; >+ if (! $datedue ) { > $invalidduedate = 1; >- $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); >+ $template->param( IMPOSSIBLE=>1, INVALID_DATE=>$datedue ); > } > } > } > >-our $todaysdate = C4::Dates->new->output('iso'); >- > # check and see if we should print > if ( @$barcodes == 0 && $print eq 'maybe' ) { > $print = 'yes'; >@@ -295,7 +293,7 @@ if ($borrowernumber) { > noissues => ($force_allow_issue) ? 0 : "1", > forceallow => $force_allow_issue, > expired => "1", >- renewaldate => format_date("$renew_year-$renew_month-$renew_day") >+ renewaldate => "$renew_year-$renew_month-$renew_day", > ); > } > # check for NotifyBorrowerDeparture >@@ -304,8 +302,9 @@ if ($borrowernumber) { > Date_to_Days( $today_year, $today_month, $today_day ) ) > { > # borrower card soon to expire warn librarian >- $template->param("warndeparture" => format_date($borrower->{dateexpiry}), >- flagged => "1",); >+ $template->param( "warndeparture" => $borrower->{dateexpiry} , >+ flagged => "1" >+ ); > if (C4::Context->preference('ReturnBeforeExpiry')){ > $template->param("returnbeforeexpiry" => 1); > } >@@ -323,8 +322,7 @@ if ($borrowernumber) { > ); > > if ( $borrower->{debarred} ne "9999-12-31" ) { >- $template->param( 'userdebarreddate' => >- C4::Dates::format_date( $borrower->{debarred} ) ); >+ $template->param( 'userdebarreddate' => $borrower->{debarred} ); > } > } > >@@ -590,7 +588,7 @@ $template->param( > printer => $printer, > printername => $printer, > was_renewed => $query->param('was_renewed') ? 1 : 0, >- expiry => format_date($borrower->{'dateexpiry'}), >+ expiry => $borrower->{'dateexpiry'}, > roadtype => $roadtype, > amountold => $amountold, > barcodes => $barcodes, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 4573c0d..322a082 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -190,7 +190,7 @@ $(document).ready(function() { > </form> > </div> > >-[% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% expiry %]</div>[% END %] >+[% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% expiry | $KohaDates %]</div>[% END %] > > [% IF additional_materials %] > <div id="materials" class="dialog message">Note about the accompanying materials: <br /> >@@ -237,11 +237,11 @@ $(document).ready(function() { > [% END %] > > [% IF ( RESERVE_WAITING ) %] >- <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been waiting for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate %]</li> >+ <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been waiting for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate | $KohaDates %]</li> > [% END %] > > [% IF ( RESERVED ) %] >- <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been on hold for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate %]</li> >+ <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been on hold for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate | $KohaDates %]</li> > [% END %] > > [% IF ( ISSUED_TO_ANOTHER ) %] >@@ -724,7 +724,7 @@ No patron matched <span class="ex">[% message %]</span> > > [% IF ( warndeparture ) %] > <li><span class="circ-hlt">Expiration:</span> Patron's card will expire soon. >- Patron's card expires on [% expiry %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% borrowernumber %]&categorycode=[% categorycode %]">Edit Details</a> >+ Patron's card expires on [% expiry | $KohaDates %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% borrowernumber %]&categorycode=[% categorycode %]">Edit Details</a> > > </li> > [% END %] >@@ -737,7 +737,7 @@ No patron matched <span class="ex">[% message %]</span> > > [% IF ( expired ) %] > <li><span class="circ-hlt">Expiration:</span> Patron's card has expired. >- [% IF ( expiry ) %]Patron's card expired on [% expiry %][% END %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% borrowernumber %]&categorycode=[% categorycode %]">Edit Details</a> >+ [% IF ( expiry ) %]Patron's card expired on [% expiry | $KohaDates %][% END %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% borrowernumber %]&categorycode=[% categorycode %]">Edit Details</a> > > </li> > [% END %] >@@ -755,7 +755,7 @@ No patron matched <span class="ex">[% message %]</span> > <span class="circ-hlt"> Restricted:</span> Patron's account is restricted > > [% IF ( userdebarreddate ) %] >- until [% userdebarreddate %] >+ until [% userdebarreddate | $KohaDates %] > [% END %] > > [% IF ( debarredcomment ) %] >-- >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 14903
:
42895
|
42989
|
43303
|
43958
|
44072
|
44096
|
44131
| 44137 |
44138