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;
=head2 CanBookBeIssued
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower,
- $barcode, $duedatespec, $inprocess, $ignore_reserves );
+ $barcode, $duedate, $inprocess, $ignore_reserves );
Check if a book can be issued.
=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
$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.
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
$needsconfirmation{'resbranchname'} = $branchname;
- $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'});
+ $needsconfirmation{'resreservedate'} = $res->{'reservedate'};
}
}
}
=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 :
# 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;
}
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.
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
my $item = GetItem( $itemnumber, $barcode )
or return;
- my $pulldate = C4::Dates->new();
-
return C4::Letters::GetPreparedLetter (
module => 'circulation',
letter_code => 'TRANSFERSLIP',
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;
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{};
$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';
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
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);
}
);
if ( $borrower->{debarred} ne "9999-12-31" ) {
- $template->param( 'userdebarreddate' =>
- C4::Dates::format_date( $borrower->{debarred} ) );
+ $template->param( 'userdebarreddate' => $borrower->{debarred} );
}
}
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,
</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 />
[% 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 ) %]
[% 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 %]
[% 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 %]
<span class="circ-hlt"> Restricted:</span> Patron's account is restricted
[% IF ( userdebarreddate ) %]
- until [% userdebarreddate %]
+ until [% userdebarreddate | $KohaDates %]
[% END %]
[% IF ( debarredcomment ) %]