use C4::Auth; # get_template_and_user
use C4::Output;
use C4::Acquisition;
-use C4::Dates;
use C4::Debug;
use C4::Branch;
use C4::Koha;
+use Koha::DateUtils;
my $input = new CGI;
my $title = $input->param( 'title');
my $basketgroupname = $input->param('basketgroupname');
my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' );
my $do_search = $input->param('do_search') || 0;
-my $from_placed_on = C4::Dates->new($input->param('from'));
-my $to_placed_on = C4::Dates->new($input->param('to'));
my $budget = $input->param( 'budget' );
my $orderstatus = $input->param( 'orderstatus' );
my $ordernumber = $input->param( 'ordernumber' );
my $search_children_too = $input->param( 'search_children_too' );
my @created_by = $input->param('created_by');
-if ( not $input->param('from') ) {
- # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
- # We would use a function like Add_Delta_YM(-1, 0, 0);
- $$from_placed_on{dmy_arrayref}[5] -= 1;
+my $from_placed_on = eval { dt_from_string( $input->param('from') ) } || dt_from_string;
+my $to_placed_on = eval { dt_from_string( $input->param('to') ) } || dt_from_string;
+unless ( $input->param('from') ) {
+ # Fill the form with year-1
+ $from_placed_on->subtract( years => 1 );
}
my $dbh = C4::Context->dbh;
}
);
-my ( $from_iso, $to_iso, $d );
-if ( $d = $input->param('from') ) {
- $from_iso = C4::Dates->new($d)->output('iso');
-}
-if ( $d = $input->param('iso') ) {
- $to_iso = C4::Dates->new($d)->output('iso');
-}
-
my $order_loop;
# If we're supplied any value then we do a search. Otherwise we don't.
if ($do_search) {
isbn => $isbn,
ean => $ean,
name => $name,
- from_placed_on => $from_iso,
- to_placed_on => $to_iso,
+ from_placed_on => output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } ),
+ to_placed_on => output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } ),
basket => $basket,
booksellerinvoicenumber => $booksellerinvoicenumber,
basketgroupname => $basketgroupname,
);
}
-my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
-my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
-
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
my $bp_loop = $budgetperiods;
for my $bp ( @{$budgetperiods} ) {
basketgroupname => $basketgroupname,
ordernumber => $ordernumber,
search_children_too => $search_children_too,
- from_placed_on => $from_date,
- to_placed_on => $to_date,
+ from_placed_on => $from_placed_on,
+ to_placed_on => $to_placed_on,
orderstatus => $orderstatus,
budget_id => $budget,
bp_loop => $bp_loop,
use C4::Budgets;
use Koha::Acquisition::Bookseller;
+use Koha::DateUtils;
use Koha::Misc::Files;
my $input = new CGI;
}
}
elsif ( $op && $op eq 'mod' ) {
- my $shipmentdate = $input->param('shipmentdate');
- my $billingdate = $input->param('billingdate');
my $shipmentcost = $input->param('shipmentcost');
my $shipment_budget_id = $input->param('shipment_budget_id');
ModInvoice(
invoiceid => $invoiceid,
- shipmentdate => C4::Dates->new($shipmentdate)->output("iso"),
- billingdate => C4::Dates->new($billingdate)->output("iso"),
+ shipmentdate => output_pref( { str => $input->param('shipmentdate'), dateformat => 'iso', dateonly => 1 } ),
+ billingdate => output_pref( { str => $input->param('billingdate'), dateformat => 'iso', dateonly => 1 } ),
shipmentcost => $shipmentcost,
shipmentcost_budgetid => $shipment_budget_id
);
use C4::Acquisition qw/GetInvoices/;
use C4::Branch qw/GetBranches/;
use C4::Budgets;
+use Koha::DateUtils;
my $input = CGI->new;
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
my $branch = $input->param('branch');
my $op = $input->param('op');
+$shipmentdatefrom and $shipmentdatefrom = eval { dt_from_string( $shipmentdatefrom ) };
+$shipmentdateto and $shipmentdateto = eval { dt_from_string( $shipmentdateto ) };
+$billingdatefrom and $billingdatefrom = eval { dt_from_string( $billingdatefrom ) };
+$billingdateto and $billingdateto = eval { dt_from_string( $billingdateto ) };
+
my $invoices = [];
if ( $op and $op eq 'do_search' ) {
- my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output('iso');
- my $shipmentdateto_iso = C4::Dates->new($shipmentdateto)->output('iso');
- my $billingdatefrom_iso = C4::Dates->new($billingdatefrom)->output('iso');
- my $billingdateto_iso = C4::Dates->new($billingdateto)->output('iso');
@{$invoices} = GetInvoices(
invoicenumber => $invoicenumber,
supplierid => $supplierid,
- shipmentdatefrom => $shipmentdatefrom_iso,
- shipmentdateto => $shipmentdateto_iso,
- billingdatefrom => $billingdatefrom_iso,
- billingdateto => $billingdateto_iso,
+ shipmentdatefrom => $shipmentdatefrom ? output_pref( { str => $shipmentdatefrom, dateformat => 'iso' } ) : undef,
+ shipmentdateto => $shipmentdateto ? output_pref( { str => $shipmentdateto, dateformat => 'iso' } ) : undef,
+ billingdatefrom => $billingdatefrom ? output_pref( { str => $billingdatefrom, dateformat => 'iso' } ) : undef,
+ billingdateto => $billingdateto ? output_pref( { str => $billingdateto, dateformat => 'iso' } ) : undef,
isbneanissn => $isbneanissn,
title => $title,
author => $author,
invoicenumber => $invoicenumber,
booksellerid => $supplierid,
suppliername => $suppliername,
+ shipmentdatefrom => $shipmentdatefrom,
+ shipmentdateto => $shipmentdateto,
billingdatefrom => $billingdatefrom,
billingdateto => $billingdateto,
isbneanissn => $isbneanissn,
use C4::Items;
use CGI qw ( -utf8 );
use C4::Output;
-use C4::Dates qw/format_date format_date_in_iso/;
use C4::Suggestions;
use C4::Reserves qw/GetReservesFromBiblionumber/;
use Koha::Acquisition::Bookseller;
+use Koha::DateUtils;
use JSON;
my $booksellerid = $invoice->{booksellerid};
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
-my $datereceived = C4::Dates->new();
my @orders = @{ $invoice->{orders} };
my $countlines = scalar @orders;
invoiceid => $invoice->{invoiceid},
invoice => $invoice->{invoicenumber},
invoiceclosedate => $invoice->{closedate},
- datereceived => $datereceived->output('iso'),
- invoicedatereceived => $datereceived->output('iso'),
- formatteddatereceived => $datereceived->output(),
+ datereceived => dt_from_string,
name => $bookseller->{'name'},
booksellerid => $bookseller->{id},
loop_received => \@loop_received,
);
my $invoicenumber = $input->param('invoice');
-my $shipmentdate = $input->param('shipmentdate');
my $shipmentcost = $input->param('shipmentcost');
my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid');
-if($shipmentdate) {
- $shipmentdate = C4::Dates->new($shipmentdate)->output('iso');
-}
+my $shipmentdate = $input->param('shipmentdate');
+$shipmentdate and $shipmentdate = output_pref({ str => $shipmentdate, dateformat => 'iso', dateonly => 1 });
if ( $op and $op eq 'new' ) {
if ( C4::Context->preference('AcqWarnOnDuplicateInvoice') ) {
dateto => $dateto,
resultsperpage => $resultsperpage,
name => $bookseller->{'name'},
- shipmentdate_today => C4::Dates->new()->output(),
+ shipmentdate_today => dt_from_string,
booksellerid => $booksellerid,
GST => C4::Context->preference('gist'),
budgets => $budget_loop,
use C4::Context;
use C4::Acquisition;
use C4::Members;
-use C4::Dates qw/format_date_in_iso/;
-use Date::Calc qw/Today/;
my $input = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
</li>
<li><label for="from">From: </label>
- <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
+ <input type="text" size="10" id="from" name="from" value="[% from_placed_on | $KohaDates %]" class="datepickerfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><label for="to">To: </label>
- <input type="text" size="10" id="to" name="to" value="[% to_placed_on %]" class="datepickerto" />
+ <input type="text" size="10" id="to" name="to" value="[% to_placed_on | $KohaDates %]" class="datepickerto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
</ol>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid %]">
<li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]"><i class="fa fa-search"></i> Details</a></li>
[% IF invoice.closedate %]
- <li><a href="invoice.pl?op=reopen&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-refresh"></i> Reopen</a></li>
+ <li><a href="invoice.pl?op=reopen&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-refresh"></i> Reopen</a></li>
[% ELSE %]
- <li><a href="invoice.pl?op=close&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-times-circle"></i> Close</a></li>
+ <li><a href="invoice.pl?op=close&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-times-circle"></i> Close</a></li>
[% END %]
[% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
- <li><a href="invoice.pl?op=delete&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-remove"></i> Delete</a></li>
+ <li><a href="invoice.pl?op=delete&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-remove"></i> Delete</a></li>
[% END %]
</ul>
</div>
[% IF booksellerid %]
<li>Vendor: [% suppliername %]</li>
[% END %]
- [% IF ( billingdatefrom ) %]
+ [% IF shipmentdatefrom %]
+ <li>Shipment date:
+ [% IF shipmentdateto %]
+ From [% shipmentdatefrom | $KohaDates %]
+ To [% shipmentdateto | $KohaDates %]
+ [% ELSE %]
+ All since [% shipmentdatefrom | $KohaDates %]
+ [% END %]
+ </li>
+ [% ELSE %]
+ [% IF shipmentdateto %]
+ <li>Shipment date:
+ All until [% shipmentdateto | $KohaDates %]
+ </li>
+ [% END %]
+ [% END %]
+ [% IF billingdatefrom %]
<li>Billing date:
- [% IF ( billingdateto ) %]
- From [% billingdatefrom %]
- To [% billingdateto %]
+ [% IF billingdateto %]
+ From [% billingdatefrom | $KohaDates %]
+ To [% billingdateto | $KohaDates %]
[% ELSE %]
- All since [% billingdatefrom %]
+ All since [% billingdatefrom | $KohaDates %]
[% END %]
</li>
[% ELSE %]
- [% IF ( billingdateto ) %]
+ [% IF billingdateto %]
<li>Billing date:
- All until [% billingdateto %]
+ All until [% billingdateto | $KohaDates %]
</li>
[% END %]
[% END %]
<ol>
<li>
<label for="shipmentdatefrom">From:</label>
- <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom %]" class="datepicker" />
+ <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="datepicker" />
</li>
<li>
<label for="shipmentdateto">To:</label>
- <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto %]" class="datepicker" />
+ <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="datepicker" />
</li>
</ol>
</fieldset>
<ol>
<li>
<label for="billingdatefrom">From:</label>
- <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom %]" class="datepicker" />
+ <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="datepicker" />
</li>
<li>
<label for="billingdateto">To:</label>
- <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto %]" class="datepicker" />
+ <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="datepicker" />
</li>
</ol>
</fieldset>
[% USE Koha %]
+[% USE KohaDates %]
[% USE Price %]
[% USE currency = format('%.2f') -%]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions › [% IF ( date ) %]
- Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% formatteddatereceived %][% ELSE %]Receive orders from [% name %][% END %]</title>
+ Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% datereceived | $KohaDates %][% ELSE %]Receive orders from [% name %][% END %]</title>
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> ›
- [% IF ( datereceived ) %]
+ [% IF datereceived %]
Receipt summary for <i>[% name %]</i>
[% IF ( invoice ) %]
<i>[ [% invoice %] ]</i>
[% END %]
- on <i>[% formatteddatereceived %]</i>
+ on <i>[% datereceived | $KohaDates %]</i>
[% ELSE %]
Receive orders from [% name %]
[% END %]
</div>
[% END %]
<h1>
- [% IF ( datereceived ) %]
- Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% formatteddatereceived %]</i>
+ [% IF datereceived %]
+ Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
[% ELSE %]
Receive orders from [% name %]
[% END %]
[% UNLESS no_orders_to_display %]
<div id="acqui_receive_summary">
-<p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p>
+<p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
</div>
[% UNLESS (invoiceclosedate) %]
<div id="acqui_receive_search">
</li> -->
<li>
<label for="shipmentdate">Shipment date: </label>
- <input type="text" id="shipmentdate" name="shipmentdate" maxlength="10" size="10" value="[% shipmentdate_today %]" class="datepicker" />
+ <input type="text" id="shipmentdate" name="shipmentdate" maxlength="10" size="10" value="[% shipmentdate_today | $KohaDates %]" class="datepicker" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>