View | Details | Raw Unified | Return to bug 14903
Collapse All | Expand All

(-)a/C4/Circulation.pm (-13 / +10 lines)
Lines 22-35 package C4::Circulation; Link Here
22
use strict;
22
use strict;
23
#use warnings; FIXME - Bug 2505
23
#use warnings; FIXME - Bug 2505
24
use DateTime;
24
use DateTime;
25
use Koha::DateUtils;
25
use C4::Context;
26
use C4::Context;
26
use C4::Stats;
27
use C4::Stats;
27
use C4::Reserves;
28
use C4::Reserves;
28
use C4::Biblio;
29
use C4::Biblio;
29
use C4::Items;
30
use C4::Items;
30
use C4::Members;
31
use C4::Members;
31
use C4::Dates;
32
use C4::Dates qw(format_date);
33
use C4::Accounts;
32
use C4::Accounts;
34
use C4::ItemCirculationAlertPreference;
33
use C4::ItemCirculationAlertPreference;
35
use C4::Message;
34
use C4::Message;
Lines 603-609 sub itemissues { Link Here
603
=head2 CanBookBeIssued
602
=head2 CanBookBeIssued
604
603
605
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
604
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
606
                      $barcode, $duedatespec, $inprocess, $ignore_reserves );
605
                      $barcode, $duedate, $inprocess, $ignore_reserves );
607
606
608
Check if a book can be issued.
607
Check if a book can be issued.
609
608
Lines 615-621 C<$issuingimpossible> and C<$needsconfirmation> are some hashref. Link Here
615
614
616
=item C<$barcode> is the bar code of the book being issued.
615
=item C<$barcode> is the bar code of the book being issued.
617
616
618
=item C<$duedatespec> is a C4::Dates object.
617
=item C<$duedates> is a DateTime object.
619
618
620
=item C<$inprocess> boolean switch
619
=item C<$inprocess> boolean switch
621
=item C<$ignore_reserves> boolean switch
620
=item C<$ignore_reserves> boolean switch
Lines 980-986 sub CanBookBeIssued { Link Here
980
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
979
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
981
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
980
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
982
                    $needsconfirmation{'resbranchname'} = $branchname;
981
                    $needsconfirmation{'resbranchname'} = $branchname;
983
                    $needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'});
982
                    $needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'};
984
                }
983
                }
985
                elsif ( $restype eq "Reserved" ) {
984
                elsif ( $restype eq "Reserved" ) {
986
                    # The item is on reserve for someone else.
985
                    # The item is on reserve for someone else.
Lines 990-996 sub CanBookBeIssued { Link Here
990
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
989
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
991
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
990
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
992
                    $needsconfirmation{'resbranchname'} = $branchname;
991
                    $needsconfirmation{'resbranchname'} = $branchname;
993
                    $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'});
992
                    $needsconfirmation{'resreservedate'} = $res->{'reservedate'};
994
                }
993
                }
995
            }
994
            }
996
        }
995
        }
Lines 1157-1169 Issue a book. Does no check, they are done in CanBookBeIssued. If we reach this Link Here
1157
1156
1158
=item C<$barcode> is the barcode of the item being issued.
1157
=item C<$barcode> is the barcode of the item being issued.
1159
1158
1160
=item C<$datedue> is a C4::Dates object for the max date of return, i.e. the date due (optional).
1159
=item C<$datedue> is a DateTime object for the max date of return, i.e. the date due (optional).
1161
Calculated if empty.
1160
Calculated if empty.
1162
1161
1163
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional).
1162
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional).
1164
1163
1165
=item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional).
1164
=item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional).
1166
Defaults to today.  Unlike C<$datedue>, NOT a C4::Dates object, unfortunately.
1165
Defaults to today.  Unlike C<$datedue>, NOT a DateTime object, unfortunately.
1167
1166
1168
AddIssue does the following things :
1167
AddIssue does the following things :
1169
1168
Lines 1853-1859 sub AddReturn { Link Here
1853
            # define circControlBranch only if dropbox mode is set
1852
            # define circControlBranch only if dropbox mode is set
1854
            # don't allow dropbox mode to create an invalid entry in issues (issuedate > today)
1853
            # don't allow dropbox mode to create an invalid entry in issues (issuedate > today)
1855
            # FIXME: check issuedate > returndate, factoring in holidays
1854
            # FIXME: check issuedate > returndate, factoring in holidays
1856
            #$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );;
1855
1857
            $circControlBranch = _GetCircControlBranch($item,$borrower);
1856
            $circControlBranch = _GetCircControlBranch($item,$borrower);
1858
            $issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0;
1857
            $issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0;
1859
        }
1858
        }
Lines 2789-2795 C<$itemnumber> is the number of the item to renew. Link Here
2789
C<$branch> is the library where the renewal took place (if any).
2788
C<$branch> is the library where the renewal took place (if any).
2790
           The library that controls the circ policies for the renewal is retrieved from the issues record.
2789
           The library that controls the circ policies for the renewal is retrieved from the issues record.
2791
2790
2792
C<$datedue> can be a C4::Dates object used to set the due date.
2791
C<$datedue> can be a DateTime object used to set the due date.
2793
2792
2794
C<$lastreneweddate> is an optional ISO-formatted date used to set issues.lastreneweddate.  If
2793
C<$lastreneweddate> is an optional ISO-formatted date used to set issues.lastreneweddate.  If
2795
this parameter is not supplied, lastreneweddate is set to the current date.
2794
this parameter is not supplied, lastreneweddate is set to the current date.
Lines 3373-3379 $newdatedue = CalcDateDue($startdate,$itemtype,$branchcode,$borrower); Link Here
3373
3372
3374
this function calculates the due date given the start date and configured circulation rules,
3373
this function calculates the due date given the start date and configured circulation rules,
3375
checking against the holidays calendar as per the 'useDaysMode' syspref.
3374
checking against the holidays calendar as per the 'useDaysMode' syspref.
3376
C<$startdate>   = C4::Dates object representing start date of loan period (assumed to be today)
3375
C<$startdate>   = DateTime object representing start date of loan period (assumed to be today)
3377
C<$itemtype>  = itemtype code of item in question
3376
C<$itemtype>  = itemtype code of item in question
3378
C<$branch>  = location whose calendar to use
3377
C<$branch>  = location whose calendar to use
3379
C<$borrower> = Borrower object
3378
C<$borrower> = Borrower object
Lines 3815-3822 sub TransferSlip { Link Here
3815
    my $item =  GetItem( $itemnumber, $barcode )
3814
    my $item =  GetItem( $itemnumber, $barcode )
3816
      or return;
3815
      or return;
3817
3816
3818
    my $pulldate = C4::Dates->new();
3819
3820
    return C4::Letters::GetPreparedLetter (
3817
    return C4::Letters::GetPreparedLetter (
3821
        module => 'circulation',
3818
        module => 'circulation',
3822
        letter_code => 'TRANSFERSLIP',
3819
        letter_code => 'TRANSFERSLIP',
(-)a/circ/circulation.pl (-14 / +10 lines)
Lines 30-36 use DateTime::Duration; Link Here
30
use C4::Output;
30
use C4::Output;
31
use C4::Print;
31
use C4::Print;
32
use C4::Auth qw/:DEFAULT get_session haspermission/;
32
use C4::Auth qw/:DEFAULT get_session haspermission/;
33
use C4::Dates qw/format_date/;
34
use C4::Branch; # GetBranches
33
use C4::Branch; # GetBranches
35
use C4::Koha;   # GetPrinter
34
use C4::Koha;   # GetPrinter
36
use C4::Circulation;
35
use C4::Circulation;
Lines 166-183 if( $onsite_checkout && !$duedatespec_allow ) { Link Here
166
    $datedue = output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
165
    $datedue = output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
167
    $datedue .= ' 23:59:00';
166
    $datedue .= ' 23:59:00';
168
} elsif( $duedatespec_allow ) {
167
} elsif( $duedatespec_allow ) {
169
    if ($duedatespec) {
168
    if ($datedue) {
170
        if ($duedatespec =~ C4::Dates->regexp('syspref')) {
169
        $datedue = eval { dt_from_string( $datedue ) };
171
                $datedue = dt_from_string($duedatespec);
170
        if (! $datedue ) {
172
        } else {
173
            $invalidduedate = 1;
171
            $invalidduedate = 1;
174
            $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
172
            $template->param( IMPOSSIBLE=>1, INVALID_DATE=>$datedue );
175
        }
173
        }
176
    }
174
    }
177
}
175
}
178
176
179
our $todaysdate = C4::Dates->new->output('iso');
180
181
# check and see if we should print
177
# check and see if we should print
182
if ( $barcode eq '' && $print eq 'maybe' ) {
178
if ( $barcode eq '' && $print eq 'maybe' ) {
183
    $print = 'yes';
179
    $print = 'yes';
Lines 259-265 if ($borrowernumber) { Link Here
259
            noissues => ($force_allow_issue) ? 0 : "1",
255
            noissues => ($force_allow_issue) ? 0 : "1",
260
            forceallow => $force_allow_issue,
256
            forceallow => $force_allow_issue,
261
            expired => "1",
257
            expired => "1",
262
            renewaldate => format_date("$renew_year-$renew_month-$renew_day")
258
            renewaldate => "$renew_year-$renew_month-$renew_day",
263
        );
259
        );
264
    }
260
    }
265
    # check for NotifyBorrowerDeparture
261
    # check for NotifyBorrowerDeparture
Lines 268-275 if ($borrowernumber) { Link Here
268
            Date_to_Days( $today_year, $today_month, $today_day ) ) 
264
            Date_to_Days( $today_year, $today_month, $today_day ) ) 
269
    {
265
    {
270
        # borrower card soon to expire warn librarian
266
        # borrower card soon to expire warn librarian
271
        $template->param("warndeparture" => format_date($borrower->{dateexpiry}),
267
        $template->param( "warndeparture" => $borrower->{dateexpiry} ,
272
        flagged       => "1",);
268
                          flagged         => "1"
269
                        );
273
        if (C4::Context->preference('ReturnBeforeExpiry')){
270
        if (C4::Context->preference('ReturnBeforeExpiry')){
274
            $template->param("returnbeforeexpiry" => 1);
271
            $template->param("returnbeforeexpiry" => 1);
275
        }
272
        }
Lines 287-294 if ($borrowernumber) { Link Here
287
        );
284
        );
288
285
289
        if ( $borrower->{debarred} ne "9999-12-31" ) {
286
        if ( $borrower->{debarred} ne "9999-12-31" ) {
290
            $template->param( 'userdebarreddate' =>
287
            $template->param( 'userdebarreddate' => $borrower->{debarred} );
291
                  C4::Dates::format_date( $borrower->{debarred} ) );
292
        }
288
        }
293
    }
289
    }
294
290
Lines 531-537 $template->param( Link Here
531
    printer           => $printer,
527
    printer           => $printer,
532
    printername       => $printer,
528
    printername       => $printer,
533
    was_renewed       => $query->param('was_renewed') ? 1 : 0,
529
    was_renewed       => $query->param('was_renewed') ? 1 : 0,
534
    expiry            => format_date($borrower->{'dateexpiry'}),
530
    expiry            => $borrower->{'dateexpiry'},
535
    roadtype          => $roadtype,
531
    roadtype          => $roadtype,
536
    amountold         => $amountold,
532
    amountold         => $amountold,
537
    barcode           => $barcode,
533
    barcode           => $barcode,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-7 / +6 lines)
Lines 190-196 $(document).ready(function() { Link Here
190
</form>
190
</form>
191
</div>
191
</div>
192
192
193
[% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% expiry %]</div>[% END %]
193
[% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% expiry | KohaDates %]</div>[% END %]
194
194
195
[% IF additional_materials %]
195
[% IF additional_materials %]
196
    <div id="materials" class="dialog message">Note about the accompanying materials: <br />
196
    <div id="materials" class="dialog message">Note about the accompanying materials: <br />
Lines 237-247 $(document).ready(function() { Link Here
237
[% END %]
237
[% END %]
238
238
239
[% IF ( RESERVE_WAITING ) %]
239
[% IF ( RESERVE_WAITING ) %]
240
    <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>
240
    <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>
241
[% END %]
241
[% END %]
242
242
243
[% IF ( RESERVED ) %]
243
[% IF ( RESERVED ) %]
244
    <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>
244
    <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>
245
[% END %]
245
[% END %]
246
246
247
[% IF ( ISSUED_TO_ANOTHER ) %]
247
[% IF ( ISSUED_TO_ANOTHER ) %]
Lines 720-726 No patron matched <span class="ex">[% message %]</span> Link Here
720
720
721
			[% IF ( warndeparture ) %]
721
			[% IF ( warndeparture ) %]
722
			<li><span class="circ-hlt">Expiration:</span> Patron's card will expire soon.
722
			<li><span class="circ-hlt">Expiration:</span> Patron's card will expire soon.
723
            Patron's card expires on [% expiry %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
723
            Patron's card expires on [% expiry | KohaDates %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
724
724
725
			</li>
725
			</li>
726
			[% END %]
726
			[% END %]
Lines 733-739 No patron matched <span class="ex">[% message %]</span> Link Here
733
733
734
			[% IF ( expired ) %]
734
			[% IF ( expired ) %]
735
			<li><span class="circ-hlt">Expiration:</span> Patron's card has expired.
735
			<li><span class="circ-hlt">Expiration:</span> Patron's card has expired.
736
            [% IF ( expiry ) %]Patron's card expired on [% expiry %][% END %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
736
            [% IF ( expiry ) %]Patron's card expired on [% expiry | KohaDates %][% END %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
737
737
738
			</li>
738
			</li>
739
			[% END %]
739
			[% END %]
Lines 751-757 No patron matched <span class="ex">[% message %]</span> Link Here
751
                   <span class="circ-hlt"> Restricted:</span> Patron's account is restricted
751
                   <span class="circ-hlt"> Restricted:</span> Patron's account is restricted
752
752
753
                   [% IF ( userdebarreddate ) %]
753
                   [% IF ( userdebarreddate ) %]
754
                       until [% userdebarreddate %]
754
                       until [% userdebarreddate | KohaDates %]
755
                   [% END %]
755
                   [% END %]
756
756
757
                   [% IF ( debarredcomment ) %]
757
                   [% IF ( debarredcomment ) %]
758
- 

Return to bug 14903