Browse Source

Bug 30718: Use flatpickr's altInput

The idea rely on the KohaDates TT plugin for the date formatting. We
should not have any output_pref calls in pl or pm (there are some
exceptions, for ILSDI for instance).

Also flatpickr will deal with the places where dates are inputed. We
will pass the raw SQL value (what we call 'iso' in Koha::DateUtils), and
the controller will receive the same value, no need to additional
conversion.
Note that DBIC has the capability to auto-deflate DateTime objects,
which makes things way easier. We can either pass the value we receive
from the controller, or pass a DT object to our methods.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Jonathan Druart 2 years ago
committed by Tomas Cohen Arazi
parent
commit
48bf9b1d91
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 13
      C4/Acquisition.pm
  2. 1
      C4/Barcodes/annual.pm
  3. 1
      C4/Barcodes/hbyymmincr.pm
  4. 30
      C4/Circulation.pm
  5. 23
      C4/ILSDI/Services.pm
  6. 8
      C4/Items.pm
  7. 2
      C4/Letters.pm
  8. 1
      C4/Members.pm
  9. 6
      C4/Overdues.pm
  10. 3
      C4/Reports/Guided.pm
  11. 15
      C4/Reserves.pm
  12. 1
      C4/Search/History.pm
  13. 45
      C4/Serials.pm
  14. 6
      Koha/Hold.pm
  15. 6
      Koha/Item.pm
  16. 1
      Koha/Patrons/Import.pm
  17. 6
      Koha/REST/V1/Clubs/Holds.pm
  18. 34
      Koha/REST/V1/Holds.pm
  19. 20
      Koha/Report.pm
  20. 8
      acqui/duplicate_orders.pl
  21. 6
      acqui/histsearch.pl
  22. 4
      acqui/invoice.pl
  23. 15
      acqui/invoices.pl
  24. 28
      acqui/lateorders.pl
  25. 2
      acqui/orderreceive.pl
  26. 7
      acqui/parcels.pl
  27. 9
      admin/aqbudgetperiods.pl
  28. 20
      admin/aqcontract.pl
  29. 11
      admin/categories.pl
  30. 5
      admin/smart-rules.pl
  31. 1
      cataloguing/additem.pl
  32. 4
      cataloguing/value_builder/barcode.pl
  33. 4
      cataloguing/value_builder/barcode_manual.pl
  34. 3
      cataloguing/value_builder/dateaccessioned.pl
  35. 4
      circ/branchoverdues.pl
  36. 6
      circ/circulation.pl
  37. 6
      circ/overdue.pl
  38. 17
      circ/renew.pl
  39. 9
      circ/reserveratios.pl
  40. 28
      circ/returns.pl
  41. 4
      circ/transferstoreceive.pl
  42. 4
      circ/waitingreserves.pl
  43. 6
      clubs/clubs-add-modify.pl
  44. 12
      installer/onboarding.pl
  45. 7
      koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
  46. 5
      koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc
  47. 6
      koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc
  48. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt
  49. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
  50. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt
  51. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt
  52. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
  53. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt
  54. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
  55. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
  56. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt
  57. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
  58. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt
  59. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt
  60. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
  61. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
  62. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt
  63. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt
  64. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
  65. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt
  66. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt
  67. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt
  68. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
  69. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt
  70. 6
      koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
  71. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt
  72. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
  73. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt
  74. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt
  75. 2
      koha-tmpl/intranet-tmpl/prog/js/members.js
  76. 9
      labels/label-item-search.pl
  77. 5
      members/housebound.pl
  78. 26
      members/memberentry.pl
  79. 2
      misc/cronjobs/fines.pl
  80. 4
      misc/cronjobs/serialsUpdate.pl
  81. 4
      misc/cronjobs/staticfines.pl
  82. 16
      opac/opac-memberentry.pl
  83. 1
      opac/opac-reserve.pl
  84. 3
      opac/opac-suggestions.pl
  85. 10
      pos/register.pl
  86. 15
      reports/acquisitions_stats.pl
  87. 5
      reports/bor_issues_top.pl
  88. 3
      reports/borrowers_out.pl
  89. 12
      reports/borrowers_stats.pl
  90. 10
      reports/cash_register_stats.pl
  91. 10
      reports/cat_issues_top.pl
  92. 9
      reports/dictionary.pl
  93. 20
      reports/guided_reports.pl
  94. 16
      reports/issues_avg_stats.pl
  95. 10
      reports/issues_stats.pl
  96. 5
      reports/orders_by_fund.pl
  97. 11
      reports/reserves_stats.pl
  98. 5
      reserve/modrequest.pl
  99. 8
      reserve/request.pl
  100. 16
      serials/serials-edit.pl

13
C4/Acquisition.pm

@ -27,7 +27,7 @@ use C4::Biblio qw( GetMarcFromKohaField GetMarcStructure IsMarcStructureInternal
use C4::Contract qw( GetContract );
use C4::Log qw( logaction );
use C4::Templates qw(gettemplate);
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Acquisition::Baskets;
use Koha::Acquisition::Booksellers;
use Koha::Acquisition::Orders;
@ -1374,13 +1374,8 @@ sub ModReceiveOrder {
my $received_items = $params->{received_items};
my $dbh = C4::Context->dbh;
$datereceived = output_pref(
{
dt => ( $datereceived ? dt_from_string( $datereceived ) : dt_from_string ),
dateformat => 'iso',
dateonly => 1,
}
);
$datereceived = $datereceived ? dt_from_string( $datereceived ) : dt_from_string;
$datereceived = $datereceived->ymd;
my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
if ($suggestionid) {
@ -2728,7 +2723,7 @@ sub CloseInvoice {
Reopen an invoice
Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => output_pref({ dt=>dt_from_string, dateonly=>1, otputpref=>'iso' }))
Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => $closedate );
=cut

1
C4/Barcodes/annual.pm

@ -24,6 +24,7 @@ use Carp qw( carp );
use C4::Context;
# FIXME We should certainly remove output_pref from here
use Koha::DateUtils qw( dt_from_string output_pref );
use vars qw(@ISA);

1
C4/Barcodes/hbyymmincr.pm

@ -23,6 +23,7 @@ use Carp qw( carp );
use C4::Context;
# FIXME We should certainly remove output_pref from here
use Koha::DateUtils qw( dt_from_string output_pref );
use constant WIDTH => 4; # FIXME: too small for sizeable or multi-branch libraries?

30
C4/Circulation.pm

@ -24,7 +24,6 @@ use POSIX qw( floor );
use YAML::XS;
use Encode;
use Koha::DateUtils qw( dt_from_string output_pref );
use C4::Context;
use C4::Stats qw( UpdateStats );
use C4::Reserves qw( CheckReserves CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest ItemsAnyAvailableAndNotRestricted );
@ -43,7 +42,7 @@ use Koha::Account;
use Koha::AuthorisedValues;
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
use Koha::Biblioitems;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Calendar;
use Koha::Checkouts;
use Koha::Illrequests;
@ -798,7 +797,7 @@ sub CanBookBeIssued {
my $now = dt_from_string();
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron_unblessed );
if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now
$needsconfirmation{INVALID_DATE} = output_pref($duedate);
$needsconfirmation{INVALID_DATE} = $duedate;
}
my $fees = Koha::Charges::Fees->new(
@ -1235,19 +1234,16 @@ sub CanBookBeIssued {
my $check = checkHighHolds( $item_object, $patron );
if ( $check->{exceeded} ) {
if ($override_high_holds) {
$alerts{HIGHHOLDS} = {
my $highholds = {
num_holds => $check->{outstanding},
duration => $check->{duration},
returndate => output_pref( { dt => dt_from_string($check->{due_date}), dateformat => 'iso', timeformat => '24hr' }),
returndate => $check->{due_date},
};
if ($override_high_holds) {
$alerts{HIGHHOLDS} = $highholds;
}
else {
$needsconfirmation{HIGHHOLDS} = {
num_holds => $check->{outstanding},
duration => $check->{duration},
returndate => output_pref( { dt => dt_from_string($check->{due_date}), dateformat => 'iso', timeformat => '24hr' }),
};
$needsconfirmation{HIGHHOLDS} = $highholds;
}
}
}
@ -1462,8 +1458,8 @@ 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 DateTime object, unfortunately.
=item C<$issuedate> is a DateTime object for the date to issue the item (optional).
Defaults to today.
AddIssue does the following things :
@ -1635,8 +1631,8 @@ sub AddIssue {
my $issue_attributes = {
borrowernumber => $borrower->{'borrowernumber'},
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'),
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'),
issuedate => $issuedate,
date_due => $datedue,
branchcode => C4::Context->userenv->{'branch'},
onsite_checkout => $onsite_checkout,
auto_renew => $auto_renew ? 1 : 0,
@ -4423,7 +4419,7 @@ sub _CalculateAndUpdateFine {
itemnumber => $issue->itemnumber,
borrowernumber => $issue->borrowernumber,
amount => $amount,
due => output_pref($datedue),
due => $datedue,
});
}
elsif ($return_date) {
@ -4436,7 +4432,7 @@ sub _CalculateAndUpdateFine {
itemnumber => $issue->itemnumber,
borrowernumber => $issue->borrowernumber,
amount => 0,
due => output_pref($datedue),
due => $datedue,
});
}
}

23
C4/ILSDI/Services.pm

@ -694,6 +694,7 @@ sub RenewLoan {
# Hashref building
my $out;
$out->{'renewals'} = $issue->renewals_count;
# FIXME Unusual date formatting
$out->{date_due} = dt_from_string($issue->date_due)->strftime('%Y-%m-%d %H:%M');
$out->{'success'} = $renewal[0];
$out->{'error'} = $renewal[1];
@ -774,15 +775,8 @@ sub HoldTitle {
return { code => 'libraryNotPickupLocation' } unless $destination->pickup_location;
return { code => 'cannotBeTransferred' } unless $biblio->can_be_transferred({ to => $destination });
my $resdate;
if ( $cgi->param('start_date') ) {
$resdate = $cgi->param('start_date');
}
my $expdate;
if ( $cgi->param('expiry_date') ) {
$expdate = $cgi->param('expiry_date');
}
my $resdate = $cgi->param('start_date');
my $expdate = $cgi->param('expiry_date');
# Add the reserve
# $branch, $borrowernumber, $biblionumber,
@ -876,15 +870,8 @@ sub HoldItem {
my $canitembereserved = C4::Reserves::CanItemBeReserved( $patron, $item, $branch )->{status};
return { code => $canitembereserved } unless $canitembereserved eq 'OK';
my $resdate;
if ( $cgi->param('start_date') ) {
$resdate = $cgi->param('start_date');
}
my $expdate;
if ( $cgi->param('expiry_date') ) {
$expdate = $cgi->param('expiry_date');
}
my $resdate = $cgi->param('start_date');
my $expdate = $cgi->param('expiry_date');
# Add the reserve
my $priority = C4::Reserves::CalculatePriority($biblionumber);

8
C4/Items.pm

@ -51,7 +51,6 @@ use Carp qw( croak );
use C4::Context;
use C4::Koha;
use C4::Biblio qw( GetMarcStructure TransformMarcToKoha );
use Koha::DateUtils qw( dt_from_string output_pref );
use MARC::Record;
use C4::ClassSource qw( GetClassSort GetClassSources GetClassSource );
use C4::Log qw( logaction );
@ -60,7 +59,7 @@ use DateTime::Format::MySQL;
# debugging; so please don't remove this
use Koha::AuthorisedValues;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Database;
use Koha::Biblios;
@ -403,10 +402,8 @@ The last optional parameter allows for passing skip_record_index through to the
sub ModDateLastSeen {
my ( $itemnumber, $leave_item_lost, $params ) = @_;
my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
my $item = Koha::Items->find($itemnumber);
$item->datelastseen($today);
$item->datelastseen(dt_from_string);
$item->itemlost(0) unless $leave_item_lost;
$item->store({ log_action => 0, skip_record_index => $params->{skip_record_index}, skip_holds_queue => $params->{skip_holds_queue} });
}
@ -587,7 +584,6 @@ sub GetItemsForInventory {
}
if ($datelastseen) {
$datelastseen = output_pref({ str => $datelastseen, dateformat => 'iso', dateonly => 1 });
push @where_strings, '(datelastseen < ? OR datelastseen IS NULL)';
push @bind_params, $datelastseen;
}

2
C4/Letters.pm

@ -29,7 +29,6 @@ use C4::Members;
use C4::Log qw( logaction );
use C4::SMS;
use C4::Templates;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::SMS::Providers;
use Koha::Email;
@ -788,6 +787,7 @@ sub _parseletter {
# in callers ( by changing / formatting values )
my $values = $values_in ? { %$values_in } : {};
# FIXME Dates formatting must be done in notice's templates
if ( $table eq 'borrowers' && $values->{'dateexpiry'} ){
$values->{'dateexpiry'} = output_pref({ dt => dt_from_string( $values->{'dateexpiry'} ), dateonly => 1 });
}

1
C4/Members.pm

@ -596,6 +596,7 @@ sub IssueSlip {
# FIXME We keep newdate and timestamp for backward compatibility (from GetNewsToDisplay)
# But we should remove them and adjust the existing templates in a db rev
# FIXME This must be formatted in the notice template
my $published_on_dt = output_pref({ dt => dt_from_string( $all->{published_on} ), dateonly => 1 });
$all->{newdate} = $published_on_dt;
$all->{timestamp} = $published_on_dt;

6
C4/Overdues.pm

@ -31,6 +31,7 @@ use C4::Accounts;
use C4::Context;
use Koha::Account::Lines;
use Koha::Account::Offsets;
use Koha::DateUtils qw( output_pref );
use Koha::Libraries;
use Koha::Recalls;
use Koha::Logger;
@ -512,7 +513,7 @@ has the book on loan.
C<$amount> is the current amount owed by the patron.
C<$due> is the due date formatted to the currently specified date format
C<$due> is the date
C<&UpdateFine> looks up the amount currently owed on the given item
and sets it to C<$amount>, creating, if necessary, a new entry in the
@ -552,7 +553,6 @@ sub UpdateFine {
my $accountline;
my $total_amount_other = 0.00;
my $due_qr = qr/$due/;
# Cycle through the fines and
# - find line that relates to the requested $itemnum
# - accumulate fines for other items
@ -610,7 +610,7 @@ sub UpdateFine {
items => $itemnum,
},
) };
my $desc = $letter ? $letter->{content} : "Item $itemnum - due $due";
my $desc = $letter ? $letter->{content} : sprintf("Item %s - due %s", $itemnum, output_pref($due) );
my $account = Koha::Account->new({ patron_id => $borrowernumber });
$accountline = $account->add_debit(

3
C4/Reports/Guided.pm

@ -25,7 +25,7 @@ use JSON qw( from_json );
use C4::Context;
use C4::Templates qw/themelanguage/;
use C4::Koha qw( GetAuthorisedValues );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Patrons;
use Koha::Reports;
use C4::Output;
@ -753,7 +753,6 @@ sub get_saved_reports {
my (@cond,@args);
if ($filter) {
if (my $date = $filter->{date}) {
$date = eval { output_pref( { dt => dt_from_string( $date ), dateonly => 1, dateformat => 'iso' }); };
push @cond, "DATE(last_modified) = ? OR
DATE(last_run) = ?";
push @args, $date, $date;

15
C4/Reserves.pm

@ -38,7 +38,7 @@ use Koha::Biblios;
use Koha::Calendar;
use Koha::CirculationRules;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Hold;
use Koha::Holds;
use Koha::ItemTypes;
@ -194,10 +194,7 @@ sub AddReserve {
my $itemtype = $params->{itemtype};
my $non_priority = $params->{non_priority};
$resdate = output_pref( { str => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' })
or output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
$patron_expiration_date = output_pref({ str => $patron_expiration_date, dateonly => 1, dateformat => 'iso' });
$resdate ||= dt_from_string;
# if we have an item selectionned, and the pickup branch is the same as the holdingbranch
# of the document, we force the value $priority and $found .
@ -1124,7 +1121,7 @@ sub ModReserve {
if C4::Context->preference('HoldsLog');
# The only column that can be updated for a found hold is the expiration date
$hold->expirationdate(dt_from_string($date))->store();
$hold->expirationdate($date)->store();
}
elsif ($rank =~ /^\d+/ and $rank > 0) {
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
@ -1148,7 +1145,6 @@ sub ModReserve {
if ( defined( $suspend_until ) ) {
if ( $suspend_until ) {
$suspend_until = eval { dt_from_string( $suspend_until ) };
$hold->suspend_hold( $suspend_until );
} else {
# If the hold is suspended leave the hold suspended, but convert it to an indefinite hold.
@ -1523,8 +1519,6 @@ be cleared when it is unsuspended.
sub ToggleSuspend {
my ( $reserve_id, $suspend_until ) = @_;
$suspend_until = dt_from_string($suspend_until) if ($suspend_until);
my $hold = Koha::Holds->find( $reserve_id );
if ( $hold->is_suspended ) {
@ -1558,9 +1552,6 @@ sub SuspendAll {
my $suspend_until = $params{'suspend_until'} || undef;
my $suspend = defined( $params{'suspend'} ) ? $params{'suspend'} : 1;
$suspend_until = eval { dt_from_string($suspend_until) }
if ( defined($suspend_until) );
return unless ( $borrowernumber || $biblionumber );
my $params;

1
C4/Search/History.pm

@ -51,6 +51,7 @@ sub add_to_session {
query_cgi => $query_cgi,
total => "$total",
type => $type,
# FIXME We shouldn't store the formatted date
time => output_pref( { dt => $now, dateformat => 'iso', timeformat => '24hr' } ),
id => $id,
};

45
C4/Serials.pm

@ -38,7 +38,6 @@ use C4::Serials::Frequency qw( GetSubscriptionFrequency );
use C4::Serials::Numberpattern;
use Koha::AdditionalFieldValues;
use Koha::Biblios;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Serial;
use Koha::Subscriptions;
use Koha::Subscription::Histories;
@ -427,23 +426,11 @@ sub GetSubscriptionsFromBiblionumber {
$sth->execute($biblionumber);
my @res;
while ( my $subs = $sth->fetchrow_hashref ) {
$subs->{startdate} = output_pref( { dt => dt_from_string( $subs->{startdate} ), dateonly => 1 } );
$subs->{histstartdate} = output_pref( { dt => dt_from_string( $subs->{histstartdate} ), dateonly => 1 } );
if ( defined $subs->{histenddate} ) {
$subs->{histenddate} = output_pref( { dt => dt_from_string( $subs->{histenddate} ), dateonly => 1 } );
} else {
$subs->{histenddate} = "";
}
$subs->{opacnote} //= "";
$subs->{ "periodicity" . $subs->{periodicity} } = 1;
$subs->{ "numberpattern" . $subs->{numberpattern} } = 1;
$subs->{ "status" . $subs->{'status'} } = 1;
if (not defined $subs->{enddate} ) {
$subs->{enddate} = '';
} else {
$subs->{enddate} = output_pref( { dt => dt_from_string( $subs->{enddate}), dateonly => 1 } );
}
$subs->{'abouttoexpire'} = abouttoexpire( $subs->{'subscriptionid'} );
$subs->{'subscriptionexpired'} = HasSubscriptionExpired( $subs->{'subscriptionid'} );
$subs->{cannotedit} = not can_edit_subscription( $subs );
@ -677,13 +664,6 @@ sub GetSerials {
while ( my $line = $sth->fetchrow_hashref ) {
$line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list
for my $datefield ( qw( planneddate publisheddate) ) {
if ($line->{$datefield} && $line->{$datefield}!~m/^00/) {
$line->{$datefield} = output_pref( { dt => dt_from_string( $line->{$datefield} ), dateonly => 1 } );
} else {
$line->{$datefield} = q{};
}
}
push @serials, $line;
}
@ -700,13 +680,6 @@ sub GetSerials {
while ( ( my $line = $sth->fetchrow_hashref ) && $counter < $count ) {
$counter++;
$line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list
for my $datefield ( qw( planneddate publisheddate) ) {
if ($line->{$datefield} && $line->{$datefield}!~m/^00/) {
$line->{$datefield} = output_pref( { dt => dt_from_string( $line->{$datefield} ), dateonly => 1 } );
} else {
$line->{$datefield} = q{};
}
}
push @serials, $line;
}
@ -751,15 +724,6 @@ sub GetSerials2 {
while ( my $line = $sth->fetchrow_hashref ) {
$line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list
# Format dates for display
for my $datefield ( qw( planneddate publisheddate ) ) {
if (!defined($line->{$datefield}) || $line->{$datefield} =~m/^00/) {
$line->{$datefield} = q{};
}
else {
$line->{$datefield} = output_pref( { dt => dt_from_string( $line->{$datefield} ), dateonly => 1 } );
}
}
push @serials, $line;
}
return @serials;
@ -1900,15 +1864,6 @@ sub GetLateOrMissingIssues {
$sth->execute( EXPECTED, LATE, CLAIMED );
my @issuelist;
while ( my $line = $sth->fetchrow_hashref ) {
if ($line->{planneddate} && $line->{planneddate} !~/^0+\-/) {
$line->{planneddateISO} = $line->{planneddate};
$line->{planneddate} = output_pref( { dt => dt_from_string( $line->{"planneddate"} ), dateonly => 1 } );
}
if ($line->{claimdate} && $line->{claimdate} !~/^0+\-/) {
$line->{claimdateISO} = $line->{claimdate};
$line->{claimdate} = output_pref( { dt => dt_from_string( $line->{"claimdate"} ), dateonly => 1 } );
}
$line->{"status".$line->{status}} = 1;
my $subscription_object = Koha::Subscriptions->find($line->{subscriptionid});

6
Koha/Hold.pm

@ -85,14 +85,14 @@ sub age {
=head3 suspend_hold
my $hold = $hold->suspend_hold( $suspend_until_dt );
my $hold = $hold->suspend_hold( $suspend_until );
=cut
sub suspend_hold {
my ( $self, $dt ) = @_;
my ( $self, $date ) = @_;
my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef;
$date &&= dt_from_string($date)->truncate( to => 'day' )->datetime;
if ( $self->is_found ) { # We can't suspend found holds
if ( $self->is_waiting ) {

6
Koha/Item.pm

@ -166,11 +166,7 @@ sub store {
&& !$pre_mod_item->$field )
{
my $field_on = "${field}_on";
$self->$field_on(
DateTime::Format::MySQL->format_datetime(
dt_from_string()
)
);
$self->$field_on(dt_from_string);
}
}

1
Koha/Patrons/Import.pm

@ -57,6 +57,7 @@ Further pod documentation needed here.
=cut
has 'today_iso' => ( is => 'ro', lazy => 1,
# FIXME We shouldn't need to call output_pref here, passing a DateTime object should work
default => sub { output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } ); }, );
has 'text_csv' => ( is => 'rw', lazy => 1,

6
Koha/REST/V1/Clubs/Holds.pm

@ -26,7 +26,6 @@ use Koha::Patrons;
use Koha::Holds;
use Koha::Clubs;
use Koha::Club::Hold;
use Koha::DateUtils qw( dt_from_string output_pref );
use Scalar::Util qw( blessed );
use Try::Tiny qw( catch try );
@ -103,11 +102,6 @@ sub add {
);
}
# AddReserve expects date to be in syspref format
if ($expiration_date) {
$expiration_date = output_pref( dt_from_string( $expiration_date, 'rfc3339' ) );
}
my $club_hold = Koha::Club::Hold::add(
{
club_id => $club_id,

34
Koha/REST/V1/Holds.pm

@ -26,7 +26,7 @@ use C4::Reserves;
use Koha::Items;
use Koha::Patrons;
use Koha::Holds;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use List::MoreUtils qw( any );
use Try::Tiny qw( catch try );
@ -183,11 +183,6 @@ sub add {
my $priority = C4::Reserves::CalculatePriority($biblio_id);
# AddReserve expects date to be in syspref format
if ($expiration_date) {
$expiration_date = output_pref( { dt => dt_from_string($expiration_date, 'iso'), dateformat => 'iso', dateonly => 1 } );
}
my $hold_id = C4::Reserves::AddReserve(
{
branchcode => $pickup_library_id,
@ -280,19 +275,14 @@ sub edit {
$pickup_library_id //= $hold->branchcode;
my $priority = $body->{priority} // $hold->priority;
# suspended_until can also be set to undef
my $suspended_until =
exists $body->{suspended_until}
? dt_from_string( $body->{suspended_until}, 'rfc3339' )
: $hold->suspend_until && dt_from_string( $hold->suspend_until, 'iso' );
my $suspended_until = $body->{suspended_until} || $hold->suspend_until;
my $params = {
reserve_id => $hold_id,
branchcode => $pickup_library_id,
rank => $priority,
suspend_until => $suspended_until
? output_pref({ dt => $suspended_until, dateformat => 'iso', dateonly => 1 })
: '',
itemnumber => $hold->itemnumber
suspend_until => $suspended_until,
itemnumber => $hold->itemnumber,
};
C4::Reserves::ModReserve($params);
@ -356,23 +346,15 @@ sub suspend {
}
return try {
my $date = ($end_date) ? dt_from_string( $end_date, 'iso' ) : undef;
$hold->suspend_hold($date);
$hold->suspend_hold($end_date);
$hold->discard_changes;
$c->res->headers->location( $c->req->url->to_string );
my $suspend_end_date;
if ($hold->suspend_until) {
$suspend_end_date = output_pref({
dt => dt_from_string( $hold->suspend_until, 'iso' ),
dateformat => 'iso',
dateonly => 1
}
);
}
my $suspend_until = $end_date ? dt_from_string($hold->suspend_until)->ymd : undef;
return $c->render(
status => 201,
openapi => {
end_date => $suspend_end_date
end_date => $suspend_until,
}
);
}

20
Koha/Report.pm

@ -20,7 +20,7 @@ use Modern::Perl;
use Koha::Database;
use Koha::Reports;
use Koha::DateUtils qw( dt_from_string output_pref );
#use Koha::DateUtils qw( dt_from_string output_pref );
use base qw(Koha::Object);
#
@ -159,15 +159,15 @@ sub prep_report {
# if there are special regexp chars, we must \ them
$split[ $i * 2 + 1 ] =~ s/(\||\?|\.|\*|\(|\)|\%)/\\$1/g;
if ( $split[ $i * 2 + 1 ] =~ /\|\s*date\s*$/ ) {
$quoted = output_pref(
{
dt => dt_from_string($quoted),
dateformat => 'iso',
dateonly => 1
}
) if $quoted;
}
#if ( $split[ $i * 2 + 1 ] =~ /\|\s*date\s*$/ ) {
# $quoted = output_pref(
# {
# dt => dt_from_string($quoted),
# dateformat => 'iso',
# dateonly => 1
# }
# ) if $quoted;
#}
unless ( $split[ $i * 2 + 1 ] =~ /\|\s*list\s*$/ && $quoted ) {
$quoted = C4::Context->dbh->quote($quoted);
}

8
acqui/duplicate_orders.pl

@ -28,7 +28,7 @@ use C4::Budgets qw( GetBudgetHierarchy GetBudget CanUserUseBudget GetBudgetPerio
use Koha::Acquisition::Baskets;
use Koha::Acquisition::Currencies;
use Koha::Acquisition::Orders;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new;
my $basketno = $input->param('basketno');
@ -76,10 +76,8 @@ unless ( $input->param('from') ) {
# Fill the form with year-1
$from_placed_on->set_time_zone('floating')->subtract( years => 1 );
}
$filters->{from_placed_on} =
output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } ),
$filters->{to_placed_on} =
output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } ),
$filters->{from_placed_on} = $from_placed_on;
$filters->{to_placed_on} = $to_placed_on;
my ( @result_order_loop, @selected_order_loop );
my @ordernumbers = split ',', scalar $input->param('ordernumbers') || '';

6
acqui/histsearch.pl

@ -55,7 +55,7 @@ use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Acquisition qw( GetHistory );
use Koha::AdditionalFields;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new;
my $do_search = $input->param('do_search') || 0;
@ -98,8 +98,8 @@ unless ( $input->param('from') ) {
# Fill the form with year-1
$from_placed_on->set_time_zone('floating')->subtract( years => 1 );
}
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
$filters->{from_placed_on} = $from_placed_on;
$filters->{to_placed_on} = $to_placed_on;
my $additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } );
$template->param( available_additional_fields => $additional_fields );
my @additional_field_filters;

4
acqui/invoice.pl

@ -102,8 +102,8 @@ elsif ( $op && $op eq 'mod' ) {
ModInvoice(
invoiceid => $invoiceid,
invoicenumber => $invoicenumber,
shipmentdate => scalar output_pref( { str => scalar $input->param('shipmentdate'), dateformat => 'iso', dateonly => 1 } ),
billingdate => scalar output_pref( { str => scalar $input->param('billingdate'), dateformat => 'iso', dateonly => 1 } ),
shipmentdate => scalar $input->param('shipmentdate'),
billingdate => scalar $input->param('billingdate'),
shipmentcost => $shipmentcost,
shipmentcost_budgetid => $shipment_budget_id
);

15
acqui/invoices.pl

@ -34,7 +34,7 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Acquisition qw( GetInvoices GetInvoice );
use C4::Budgets qw( GetBudget GetBudgets CanUserUseBudget );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Acquisition::Booksellers;
my $input = CGI->new;
@ -62,20 +62,15 @@ my $branch = $input->param('branch');
my $message_id = $input->param('message_id');
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' ) {
@{$invoices} = GetInvoices(
invoicenumber => $invoicenumber,
supplierid => $supplierid,
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,
shipmentdatefrom => $shipmentdatefrom,
shipmentdateto => $shipmentdateto,
billingdatefrom => $billingdatefrom,
billingdateto => $billingdateto,
isbneanissn => $isbneanissn,
title => $title,
author => $author,

28
acqui/lateorders.pl

@ -49,7 +49,7 @@ use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Context;
use C4::Letters qw( SendAlerts GetLetters );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Acquisition::Orders qw( filter_by_lates );
use Koha::CsvProfiles;
@ -70,26 +70,12 @@ my $delay = $input->param('delay') // 0;
my $estimateddeliverydatefrom = $input->param('estimateddeliverydatefrom');
my $estimateddeliverydateto = $input->param('estimateddeliverydateto');
my $estimateddeliverydatefrom_dt =
$estimateddeliverydatefrom
? dt_from_string($estimateddeliverydatefrom)
: undef;
# Get the "date to" param. If it is not defined and $delay is not defined too, it is the today's date.
my $estimateddeliverydateto_dt = $estimateddeliverydateto
? dt_from_string($estimateddeliverydateto)
: ( not defined $delay and not defined $estimateddeliverydatefrom)
$estimateddeliverydateto ||=
( not defined $delay and not defined $estimateddeliverydatefrom )
? dt_from_string()
: undef;
# Format the output of "date from" and "date to"
if ($estimateddeliverydatefrom_dt) {
$estimateddeliverydatefrom = output_pref({dt => $estimateddeliverydatefrom_dt, dateonly => 1});
}
if ($estimateddeliverydateto_dt) {
$estimateddeliverydateto = output_pref({dt => $estimateddeliverydateto_dt, dateonly => 1});
}
my $branch = $input->param('branch');
my $op = $input->param('op');
@ -123,13 +109,13 @@ my @lateorders = Koha::Acquisition::Orders->filter_by_lates(
{
delay => $delay,
(
$estimateddeliverydatefrom_dt
? ( estimated_from => $estimateddeliverydatefrom_dt )
$estimateddeliverydatefrom
? ( estimated_from => $estimateddeliverydatefrom )
: ()
),
(
$estimateddeliverydateto_dt
? ( estimated_to => $estimateddeliverydateto_dt )
$estimateddeliverydateto
? ( estimated_to => $estimateddeliverydateto )
: ()
)
},

2
acqui/orderreceive.pl

@ -119,7 +119,7 @@ my $creator = Koha::Patrons->find( $order->created_by );
my $budget = GetBudget( $order->budget_id );
my $datereceived = $order->datereceived ? dt_from_string( $order->datereceived ) : dt_from_string;
my $datereceived = $order->datereceived || dt_from_string;
# get option values for TaxRates syspref
my @gst_values = map {

7
acqui/parcels.pl

@ -75,7 +75,7 @@ use C4::Acquisition qw( GetInvoices GetInvoice AddInvoice );
use C4::Budgets qw( GetBudgetHierarchy GetBudget CanUserUseBudget );
use Koha::Acquisition::Booksellers;
use Koha::DateUtils qw( output_pref dt_from_string );
use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new;
my $booksellerid = $input->param('booksellerid');
@ -100,7 +100,6 @@ my $invoicenumber = $input->param('invoice');
my $shipmentcost = $input->param('shipmentcost');
my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid');
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') ) {
@ -140,8 +139,8 @@ my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
my @parcels = GetInvoices(
supplierid => $booksellerid,
invoicenumber => $code,
( $datefrom ? ( shipmentdatefrom => output_pref({ dt => dt_from_string($datefrom), dateformat => 'iso' }) ) : () ),
( $dateto ? ( shipmentdateto => output_pref({ dt => dt_from_string($dateto), dateformat => 'iso' }) ) : () ),
( $datefrom ? ( shipmentdatefrom => $datefrom ) : () ),
( $dateto ? ( shipmentdateto => $dateto ) : () ),
order_by => $order
);
my $count_parcels = @parcels;

9
admin/aqbudgetperiods.pl

@ -47,7 +47,6 @@ script to administer the budget periods table
use Modern::Perl;
use CGI qw ( -utf8 );
use Koha::DateUtils qw( dt_from_string );
use JSON qw( encode_json );
use Koha::Database;
use C4::Koha;
@ -72,8 +71,8 @@ my $op = $input->param('op')||"else";
# get only the columns of aqbudgetperiods in budget_period_hashref
my @columns = Koha::Database->new()->schema->source('Aqbudgetperiod')->columns;
my $budget_period_hashref = { map { join(' ',@columns) =~ /$_/ ? ( $_ => scalar $input->param($_) ) : () } keys( %{$input->Vars()} ) } ;
$budget_period_hashref->{budget_period_startdate} = dt_from_string( scalar $input->param('budget_period_startdate') );
$budget_period_hashref->{budget_period_enddate} = dt_from_string( scalar $input->param('budget_period_enddate') );
$budget_period_hashref->{budget_period_startdate} = $input->param('budget_period_startdate');
$budget_period_hashref->{budget_period_enddate} = $input->param('budget_period_enddate');
$searchfield =~ s/\,//g;
@ -190,8 +189,8 @@ elsif ( $op eq 'duplicate_form'){
elsif ( $op eq 'duplicate_budget' ){
die "please specify a budget period id\n" if( !defined $budget_period_id || $budget_period_id eq '' );
my $budget_period_startdate = dt_from_string scalar $input->param('budget_period_startdate');
my $budget_period_enddate = dt_from_string scalar $input->param('budget_period_enddate');
my $budget_period_startdate = $input->param('budget_period_startdate');
my $budget_period_enddate = $input->param('budget_period_enddate');
my $budget_period_description = $input->param('budget_period_description');
my $amount_change_percentage = $input->param('amount_change_percentage');
my $amount_change_round_increment = $input->param('amount_change_round_increment');

20
admin/aqcontract.pl

@ -32,7 +32,7 @@ use C4::Contract qw(
GetContracts
ModContract
);
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Acquisition::Booksellers;
@ -96,8 +96,8 @@ elsif ( $op eq 'add_validate' ) {
my $is_a_modif = $input->param("is_a_modif");
my $contractstart_dt = eval { dt_from_string( scalar $input->param('contractstartdate') ); };
my $contractend_dt = eval { dt_from_string( scalar $input->param('contractenddate') ); };
my $contractstart_dt = $input->param('contractstartdate');
my $contractend_dt = $input->param('contractenddate');
unless ( $contractstart_dt and $contractend_dt ) {
my $today = dt_from_string;
$contractstart_dt ||= $today;
@ -106,8 +106,8 @@ elsif ( $op eq 'add_validate' ) {
if ( $is_a_modif ) {
ModContract({
contractstartdate => eval { output_pref({ dt => dt_from_string( $contractstart_dt ), dateformat => 'iso', dateonly => 1 } ); },
contractenddate => eval { output_pref({ dt => dt_from_string( $contractend_dt ), dateformat => 'iso', dateonly => 1 } ); },
contractstartdate => $contractstart_dt,
contractenddate => $contractend_dt,
contractname => scalar $input->param('contractname'),
contractdescription => scalar $input->param('contractdescription'),
booksellerid => scalar $input->param('booksellerid'),
@ -118,8 +118,8 @@ elsif ( $op eq 'add_validate' ) {
contractname => scalar $input->param('contractname'),
contractdescription => scalar $input->param('contractdescription'),
booksellerid => scalar $input->param('booksellerid'),
contractstartdate => eval { output_pref({ dt => dt_from_string( scalar $input->param('contractstartdate') ), dateformat => 'iso', dateonly => 1 } ); },
contractenddate => eval { output_pref({ dt => dt_from_string( scalar $input->param('contractenddate') ), dateformat => 'iso', dateonly => 1 } ); },
contractstartdate => scalar $input->param('contractstartdate'),
contractenddate => scalar $input->param('contractenddate'),
});
}
@ -165,12 +165,6 @@ if ( $op eq 'list' ) {
# get contracts
my @contracts = @{GetContracts( { booksellerid => $booksellerid } )};
# format dates
for my $contract ( @contracts ) {
$contract->{contractstartdate} = output_pref({ dt => dt_from_string( $contract->{contractstartdate} ), dateonly => 1 });
$contract->{contractenddate} = output_pref({ dt => dt_from_string( $contract->{contractenddate} ), dateonly => 1 }),
}
$template->param(loop => \@contracts);
#---- END $OP eq DEFAULT

11
admin/categories.pl

@ -27,7 +27,6 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Form::MessagingPreferences;
use Koha::Patrons;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Patron::Categories;
use Koha::Libraries;
@ -89,16 +88,6 @@ elsif ( $op eq 'add_validate' ) {
my $is_a_modif = $input->param("is_a_modif");
if ($enrolmentperioddate) {
$enrolmentperioddate = output_pref(
{
dt => dt_from_string($enrolmentperioddate),
dateformat => 'iso',
dateonly => 1,
}
);
}
if ($is_a_modif) {
my $category = Koha::Patron::Categories->find( $categorycode );
$category->categorycode($categorycode);

5
admin/smart-rules.pl

@ -23,7 +23,6 @@ use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use Koha::Exception;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Database;
use Koha::Logger;
use Koha::Libraries;
@ -272,8 +271,6 @@ elsif ($op eq 'add') {
my $no_auto_renewal_after = $input->param('no_auto_renewal_after');
$no_auto_renewal_after = q{} if $no_auto_renewal_after =~ /^\s*$/;
my $no_auto_renewal_after_hard_limit = $input->param('no_auto_renewal_after_hard_limit') || q{};
$no_auto_renewal_after_hard_limit = eval { dt_from_string( scalar $no_auto_renewal_after_hard_limit ) } if ( $no_auto_renewal_after_hard_limit );
$no_auto_renewal_after_hard_limit = output_pref( { dt => $no_auto_renewal_after_hard_limit, dateonly => 1, dateformat => 'iso' } ) if ( $no_auto_renewal_after_hard_limit );
my $reservesallowed = strip_non_numeric( scalar $input->param('reservesallowed') );
my $holds_per_record = strip_non_numeric( scalar $input->param('holds_per_record') );
my $holds_per_day = strip_non_numeric( scalar $input->param('holds_per_day') );
@ -282,8 +279,6 @@ elsif ($op eq 'add') {
my $daysmode = $input->param('daysmode');
my $lengthunit = $input->param('lengthunit');
my $hardduedate = $input->param('hardduedate') || q{};
$hardduedate = eval { dt_from_string( scalar $hardduedate ) } if ( $hardduedate );
$hardduedate = output_pref( { dt => $hardduedate, dateonly => 1, dateformat => 'iso' } ) if ( $hardduedate );
my $hardduedatecompare = $input->param('hardduedatecompare');
my $rentaldiscount = $input->param('rentaldiscount') || 0;
my $opacitemholds = $input->param('opacitemholds') || 0;

1
cataloguing/additem.pl

@ -35,7 +35,6 @@ use C4::Context;
use C4::Circulation qw( barcodedecode LostItem );
use C4::Barcodes;
use C4::Barcodes::ValueBuilder;
use Koha::DateUtils qw( dt_from_string );
use Koha::Biblios;
use Koha::Items;
use Koha::ItemTypes;

4
cataloguing/value_builder/barcode.pl

@ -25,7 +25,7 @@ use Modern::Perl;
use C4::Context;
use C4::Barcodes::ValueBuilder;
use C4::Biblio qw( GetMarcFromKohaField );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Algorithm::CheckDigits qw( CheckDigits );
@ -35,7 +35,7 @@ my $builder = sub {
my %args;
# find today's date
($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
($args{year}, $args{mon}, $args{day}) = split('-', dt_from_string()->ymd());
($args{tag},$args{subfield}) = GetMarcFromKohaField( "items.barcode" );
my $nextnum;

4
cataloguing/value_builder/barcode_manual.pl

@ -25,7 +25,7 @@ use Modern::Perl;
use C4::Context;
use C4::Barcodes::ValueBuilder;
use C4::Biblio qw( GetMarcFromKohaField );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
my $builder = sub {
my ( $params ) = @_;
@ -36,7 +36,7 @@ my $builder = sub {
$args{dbh} = $dbh;
# find today's date
($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
($args{year}, $args{mon}, $args{day}) = split('-', dt_from_string()->ymd());
($args{tag},$args{subfield}) = GetMarcFromKohaField( "items.barcode" );
my $nextnum;

3
cataloguing/value_builder/dateaccessioned.pl

@ -21,13 +21,12 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Koha::DateUtils qw( dt_from_string output_pref flatpickr_date_format );
use Koha::DateUtils qw( flatpickr_date_format );
my $builder = sub {
my ( $params ) = @_;
my $function_name = $params->{id};
my $date = output_pref({ dt => dt_from_string, dateonly => 1 });
my $dateformat = flatpickr_date_format();
my $res = <<END_OF_JS;

4
circ/branchoverdues.pl

@ -24,7 +24,6 @@ use C4::Auth qw( get_template_and_user );
use C4::Overdues qw( GetOverduesForBranch );
use C4::Biblio qw( GetMarcFromKohaField GetMarcStructure );
use C4::Koha qw( GetAuthorisedValues );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::BiblioFrameworks;
=head1 branchoverdues.pl
@ -71,8 +70,7 @@ if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
# now display infos
foreach my $num (@getoverdues) {
my %overdueforbranch;
my $dt = dt_from_string($num->{date_due}, 'sql');
$overdueforbranch{'date_due'} = output_pref($dt);
$overdueforbranch{'date_due'} = $num->{date_due};
$overdueforbranch{'title'} = $num->{'title'};
$overdueforbranch{'subtitle'} = $num->{'subtitle'};
$overdueforbranch{'medium'} = $num->{'medium'};

6
circ/circulation.pl

@ -45,7 +45,7 @@ use Koha::AuthorisedValues;
use Koha::CsvProfiles;
use Koha::Patrons;
use Koha::Patron::Debarments qw( GetDebarments );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Plugins;
use Koha::Database;
use Koha::BiblioFrameworks;
@ -159,8 +159,6 @@ 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' }); }
if ( $duedatespec );
my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec || $session->param('stickyduedate');
if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) {
undef $restoreduedatespec;
@ -628,7 +626,7 @@ $template->param(
SpecifyDueDate => $duedatespec_allow,
PatronAutoComplete => C4::Context->preference("PatronAutoComplete"),
debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }),
todaysdate => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ),
todaysdate => dt_from_string()->set(hour => 23)->set(minute => 59),
has_modifications => $has_modifications,
override_high_holds => $override_high_holds,
nopermission => scalar $query->param('nopermission'),

6
circ/overdue.pl

@ -25,7 +25,7 @@ use C4::Output qw( output_html_with_http_headers );
use CGI qw(-oldstyle_urls -utf8);
use C4::Auth qw( get_template_and_user );
use Text::CSV_XS;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Patron::Attribute::Types;
use DateTime;
use DateTime::Format::MySQL;
@ -337,7 +337,7 @@ if ($noreport) {
branchcode => $data->{branchcode},
barcode => $data->{barcode},
itemnum => $data->{itemnumber},
issuedate => output_pref({ dt => dt_from_string( $data->{issuedate} ), dateonly => 1 }),
issuedate => $data->{issuedate},
biblionumber => $data->{biblionumber},
title => $data->{title},
subtitle => $data->{subtitle},
@ -374,7 +374,7 @@ if ($noreport) {
$new_cgi->delete('op');
$template->param(
todaysdate => output_pref($today_dt),
todaysdate => $today_dt,
overdueloop => \@overduedata,
nnoverdue => scalar(@overduedata),
noverdue_is_plural => scalar(@overduedata) != 1,

17
circ/renew.pl

@ -24,7 +24,7 @@ use C4::Context;
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate AddRenewal );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Database;
use Koha::BiblioFrameworks;
@ -92,13 +92,12 @@ if ($barcode) {
}
if ($can_renew) {
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
my $date_due;
if ( $cgi->param('renewonholdduedate') ) {
$date_due = dt_from_string( scalar $cgi->param('renewonholdduedate'));
}
if ( C4::Context->preference('SpecifyDueDate') && $hard_due_date ) {
$date_due = dt_from_string( $hard_due_date );
}
my $date_due =
( C4::Context->preference('SpecifyDueDate')
&& $hard_due_date )
? $hard_due_date
: $cgi->param('renewonholdduedate');
$date_due = AddRenewal(
undef,
$item->itemnumber(),
@ -133,7 +132,7 @@ if ($barcode) {
);
}
$template->param( hard_due_date => ($hard_due_date ? output_pref({ str => $hard_due_date, dateformat => 'iso' }) : undef) );
$template->param( hard_due_date => $hard_due_date );
# Checking if there is a Fast Cataloging Framework
$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' );

9
circ/reserveratios.pl

@ -27,7 +27,7 @@ use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use C4::Acquisition qw/GetOrdersByBiblionumber/;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Acquisition::Baskets;
my $input = CGI->new;
@ -62,9 +62,6 @@ if ( $basketno ){
}
}
$startdate = eval { dt_from_string( $startdate ) } if $startdate;
$enddate = eval { dt_from_string( $enddate ) } if $enddate;
my $todaysdate = dt_from_string;
# A default of the prior years's holds is a reasonable way to pull holds
@ -85,9 +82,9 @@ my $sqldatewhere = "";
my @query_params = ();
$sqldatewhere .= " AND reservedate >= ?";
push @query_params, output_pref({ dt => $startdate, dateformat => 'iso' }) ;
push @query_params, $startdate;
$sqldatewhere .= " AND reservedate <= ?";
push @query_params, output_pref({ dt => $enddate, dateformat => 'iso' });
push @query_params, $enddate;
my $include_aqorders_qty =
$effective_create_items eq 'receiving'

28
circ/returns.pl

@ -47,7 +47,7 @@ use Koha::AuthorisedValues;
use Koha::BiblioFrameworks;
use Koha::Calendar;
use Koha::Checkouts;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Holds;
use Koha::Items;
use Koha::Item::Transfers;
@ -215,28 +215,21 @@ my $dest = $query->param('dest');
#dropbox: get last open day (today - 1)
my $dropboxdate = Koha::Checkouts::calculate_dropbox_date();
my $return_date_override = $query->param('return_date_override');
my $return_date_override_dt;
my $return_date_override_remember =
$query->param('return_date_override_remember');
my $return_date_override = $query->param('return_date_override') || q{};
if ($return_date_override) {
if ( C4::Context->preference('SpecifyReturnDate') ) {
$return_date_override_dt = eval {dt_from_string( $return_date_override ) };
if ( $return_date_override_dt ) {
# note that we've overriden the return date
$template->param( return_date_was_overriden => 1 );
my $return_date_override_remember =
$query->param('return_date_override_remember');
# Save the original format if we are remembering for this series
$template->param(
return_date_override => $return_date_override,
return_date_override_remember => 1
) if ($return_date_override_remember);
$return_date_override =
DateTime::Format::MySQL->format_datetime( $return_date_override_dt );
}
}
else {
$return_date_override = q{};
}
}
@ -327,7 +320,10 @@ if ($barcode) {
barcode => $barcode,
);
my $return_date = $dropboxmode ? $dropboxdate : $return_date_override_dt;
my $return_date =
$dropboxmode
? $dropboxdate
: dt_from_string( $return_date_override );
# Block return if multi-part and confirm has not been received
my $needs_confirm =
@ -762,7 +758,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
$ri{day} = $duedate->day();
$ri{hour} = $duedate->hour();
$ri{minute} = $duedate->minute();
$ri{duedate} = output_pref($duedate);
$ri{duedate} = $duedate;
my $patron = Koha::Patrons->find( $riborrowernumber{$_} );
unless ( $dropboxmode ) {
$ri{return_overdue} = 1 if (DateTime->compare($duedate, dt_from_string()) == -1);

4
circ/transferstoreceive.pl

@ -31,7 +31,7 @@ use C4::Reserves;
use Koha::Items;
use Koha::ItemTypes;
use Koha::Libraries;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::BiblioFrameworks;
use Koha::Patrons;
@ -129,7 +129,7 @@ while ( my $library = $libraries->next ) {
$template->param(
branchesloop => \@branchesloop,
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
show_date => dt_from_string,
TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'),
latetransfers => $latetransfers ? 1 : 0,
);

4
circ/waitingreserves.pl

@ -26,7 +26,7 @@ use C4::Auth qw( get_template_and_user );
use C4::Items qw( ModItemTransfer );
use Date::Calc qw( Date_to_Days Today );
use C4::Reserves qw( ModReserve ModReserveCancelAll );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::BiblioFrameworks;
use Koha::Items;
use Koha::ItemTypes;
@ -127,7 +127,7 @@ $template->param(
overcount => scalar @over_loop,
cancel_reqs_count => $holds_with_cancellation_requests->count,
cancel_reqs => $holds_with_cancellation_requests,
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
show_date => dt_from_string,
tab => $tab,
);

6
clubs/clubs-add-modify.pl

@ -55,10 +55,8 @@ my $club_template_id = $cgi->param('club_template_id');
my $club_template = $club->club_template() || Koha::Club::Templates->find($club_template_id);
$club_template_id ||= $club_template->id();
my $date_start = $cgi->param('date_start');
$date_start = $date_start ? dt_from_string($date_start) : undef;
my $date_end = $cgi->param('date_end');
$date_end = $date_end ? dt_from_string($date_end) : undef;
my $date_start = $cgi->param('date_start') || undef;
my $date_end = $cgi->param('date_end') || undef;
if ( $cgi->param('name') ) { # Update or create club
$club->set(

12
installer/onboarding.pl

@ -26,7 +26,6 @@ use C4::Members qw( checkcardnumber );
use Koha::Patrons;
use Koha::Libraries;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Patrons;
use Koha::Patron::Categories;
use Koha::ItemTypes;
@ -100,17 +99,6 @@ if ( $step == 2 ) {
my $enrolmentperiod = $input->param('enrolmentperiod');
my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
#Converts the string into a date format
if ($enrolmentperioddate) {
$enrolmentperioddate = output_pref(
{
dt => dt_from_string($enrolmentperioddate),
dateformat => 'DateTime',
dateonly => 1,
}
);
}
#Adds a new patron category to the database
$category = Koha::Patron::Category->new(
{

7
koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc

@ -35,7 +35,10 @@
flatpickr.l10ns.default.months = flatpickr_months;
flatpickr.setDefaults({
allowInput: true,
dateFormat: flatpickr_dateformat_string,
dateFormat: "Y-m-d",
altInput: true,
altFormat: flatpickr_dateformat_string,
altInputClass: 'flatpickr-input',
nextArrow: '<i class="fa fa-fw fa-arrow-right"></i>',
prevArrow: '<i class="fa fa-fw fa-arrow-left"></i>',
time_24hr: flatpickr_timeformat,
@ -46,7 +49,7 @@
},
onReady: function( selectedDates, dateStr, instance ){
/* When flatpickr instance is created, automatically append a "clear date" link */
$(instance.input)
$(instance.input).siblings('input.flatpickr')
/* Add a wrapper element so that we can prevent the clear button from wrapping */
.wrap("<span class='flatpickr_wrapper'></span>")
.attr("autocomplete", "off")

5
koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc

@ -1,6 +1,5 @@
[% USE Koha %]
[% USE Branches %]
[% USE KohaDates %]
[% PROCESS 'html_helpers.inc' %]
<ol>
<li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% filters.title | html %]" /></li>
@ -106,11 +105,11 @@
</li>
<li><label for="from">From: </label>
<input type="text" size="10" id="from" name="from" value="[% filters.from_placed_on | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input type="text" size="10" id="from" name="from" value="[% filters.from_placed_on | html %]" class="flatpickr" data-date_to="to" />
<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="[% filters.to_placed_on | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="to" name="to" value="[% filters.to_placed_on | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
</ol>

6
koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc

@ -117,13 +117,13 @@
<td>[% hold.notes | html | html_line_break %]</td>
<td>
[% IF Koha.Preference('AllowHoldDateInFuture') %]
<input type="text" class="flatpickr" value="[% hold.date | $KohaDates %]" required="required" size="10" name="reservedate" />
<input type="text" class="flatpickr" value="[% hold.date | html %]" required="required" size="10" name="reservedate" />
[% ELSE %]
[% hold.date | $KohaDates %]
[% END %]
</td>
<td>
<input type="text" class="flatpickr" data-flatpickr-futuredate="true" value="[% hold.expirationdate | $KohaDates %]" size="10" name="expirationdate" />
<input type="text" class="flatpickr" data-flatpickr-futuredate="true" value="[% hold.expirationdate | html %]" size="10" name="expirationdate" />
</td>
<td>
[%- IF ( hold.found ) -%]
@ -224,7 +224,7 @@
[% IF Koha.Preference('AutoResumeSuspendedHolds') %]
<label for="suspend_until_[% hold.reserve_id | html %]">[% IF ( hold.suspend ) %] on [% ELSE %] until [% END %]</label>
<input type="text" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" size="10" value="[% hold.suspend_until | $KohaDates %]" class="flatpickr" data-flatpickr-futuredate="true" />
<input type="text" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" size="10" value="[% hold.suspend_until | html %]" class="flatpickr" data-flatpickr-futuredate="true" />
[%- ELSE -%]
<input type="hidden" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" value=""/>
[%- END -%]

4
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt

@ -69,7 +69,7 @@
[% IF readonly %]
[% shipmentdate | $KohaDates %]
[% ELSE %]
<input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
[% END %]
</li>
@ -79,7 +79,7 @@
[% IF readonly %]
[% billingdate | $KohaDates %]
[% ELSE %]
<input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
[% END %]
</li>

8
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt

@ -326,12 +326,12 @@
<ol>
<li>
<label for="shipmentdatefrom">From:</label>
<input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="flatpickr" data-date_to="shipmentdateto" />
<input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | html %]" class="flatpickr" data-date_to="shipmentdateto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="shipmentdateto">To:</label>
<input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="flatpickr" />
<input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
</ol>
@ -343,12 +343,12 @@
<ol>
<li>
<label for="billingdatefrom">From:</label>
<input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="flatpickr" data-date_to="billingdateto" />
<input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | html %]" class="flatpickr" data-date_to="billingdateto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="billingdateto">To:</label>
<input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="flatpickr" />
<input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
</ol>

2
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt

@ -277,7 +277,7 @@
<ol>
<li>
<label for="datereceived">Date received: </label>
<input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><label for="bookfund">Fund: </label><select id="bookfund" name="bookfund">

2
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt

@ -163,7 +163,7 @@
</li> -->
<li>
<label for="shipmentdate">Shipment date: </label>
<input type="text" id="shipmentdate" name="shipmentdate" maxlength="10" size="10" value="[% shipmentdate_today | $KohaDates %]" class="flatpickr" />
<input type="text" id="shipmentdate" name="shipmentdate" maxlength="10" size="10" value="[% shipmentdate_today | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>

8
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt

@ -189,14 +189,14 @@
<li>
<label class="required" for="from">Start date: </label>
<input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label class="required" for="to">End date: </label>
<input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
@ -259,14 +259,14 @@
<ol>
<li>
<label class="required" for="from">Start date: </label>
<input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label class="required" for="to">End date: </label>
<input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>

4
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt

@ -132,12 +132,12 @@
<input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="[% contractdescription | html %]" />
</li>
<li><label for="from" class="required">Start date:</label> &nbsp;
<input type="text" name="contractstartdate" id="from" value="[% contractstartdate | $KohaDates %]" maxlength="10" size="10" class="flatpickr" data-date_to="to" />
<input type="text" name="contractstartdate" id="from" value="[% contractstartdate | html %]" maxlength="10" size="10" class="flatpickr" data-date_to="to" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><label for="to" class="required">End date:</label> &nbsp;
<input type="text" name="contractenddate" id="to" value="[% contractenddate | $KohaDates %]" maxlength="10" size="10" class="flatpickr" />
<input type="text" name="contractenddate" id="to" value="[% contractenddate | html %]" maxlength="10" size="10" class="flatpickr" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>

2
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt

@ -157,7 +157,7 @@
</li>
<li>
<label for="enrolmentperioddate">Until date: </label>
<input type="text" class="enrollmentperiod flatpickr" data-flatpickr-futuredate="true" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
<input type="text" class="enrollmentperiod flatpickr" data-flatpickr-futuredate="true" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | html %]" />
</li>
</ol>
</fieldset>

4
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt

@ -420,7 +420,7 @@
[% END %]
[% IF ( INVALID_DATE ) %]
<li>The due date &quot;[% INVALID_DATE | html %]&quot; is invalid</li>
<li>The due date &quot;[% INVALID_DATE | $KohaDates %]&quot; is invalid</li>
[% END %]
[% IF ( UNKNOWN_BARCODE ) %]
@ -680,7 +680,7 @@
<div id="specify-due-date" class="circ-setting">
<div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
[% IF ( duedatespec ) %]
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" />
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" />
[% ELSE %]
<input type="text" size="20" id="duedatespec" name="duedatespec" value="" />
[% END %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt

@ -113,7 +113,7 @@
<fieldset class="rows">
<legend>Due date: </legend>
<label for="duedatespec">Hard due date [% INCLUDE 'date-format.inc' %]:</label>
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" class="flatpickr" data-flatpickr-enable-time="true" />
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" class="flatpickr" data-flatpickr-enable-time="true" />
</fieldset>
[% END %]
<input type="hidden" name="op" value="show" />

4
koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt

@ -176,11 +176,11 @@
<li class="date_due_filter">
<label for="from">From:</label>
<input type="text" id="from" name="dateduefrom" size="10" value="[% filters.dateduefrom | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input type="text" id="from" name="dateduefrom" size="10" value="[% filters.dateduefrom | html %]" class="flatpickr" data-date_to="to" />
</li>
<li class="date_due_filter">
<label for="to">To:</label>
<input type="text" id="to" name="datedueto" size="10" value="[% filters.datedueto | $KohaDates %]" class="flatpickr" />
<input type="text" id="to" name="datedueto" size="10" value="[% filters.datedueto | html %]" class="flatpickr" />
</li>
</ol>
</fieldset>

4
koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt

@ -271,12 +271,12 @@
<label for="from">
Start date:
</label>
<input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input type="text" size="10" id="from" name="from" value="[% from | html %]" class="flatpickr" data-date_to="to" />
</li>
<li><label for="to">
End date:
</label>
<input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="to" name="to" value="[% to | html %]" class="flatpickr" />
</li>
</ol>

2
koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt

@ -223,7 +223,7 @@
<div class="circ-settings show">
<div class="date-select" id="renew_date_override_fields">
<div><label for="hard_due_date" class="hint">Renewal due date [% INCLUDE 'date-format.inc' %]:</label></div>
<input type="text" size="20" id="hard_due_date" name="hard_due_date" value="[% hard_due_date | $KohaDates with_hours => 1 %]" class="flatpickr" data-flatpickr-futuredate="true" data-flatpickr-enable-time="true" />
<input type="text" size="20" id="hard_due_date" name="hard_due_date" value="[% hard_due_date | html %]" class="flatpickr" data-flatpickr-futuredate="true" data-flatpickr-enable-time="true" />
</div> <!-- /.date-select -->
</div>
</fieldset>

4
koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt

@ -164,12 +164,12 @@
<li>
<label for="from">Start date:</label>
<input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input type="text" size="10" id="from" name="from" value="[% from | html %]" class="flatpickr" data-date_to="to" />
</li>
<li>
<label for="to">End date:</label>
<input size="10" id="to" name="to" value="[% to | $KohaDates %]" type="text" class="flatpickr" />
<input size="10" id="to" name="to" value="[% to | html %]" type="text" class="flatpickr" />
</li>
</ol>
(inclusive)

4
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

@ -1203,9 +1203,9 @@
<td class="ci-duedate">
[% IF ( riloo.duedate ) %]
[% IF ( riloo.return_overdue ) %]
<span class="overdue">[% riloo.duedate | html %] (overdue)</span>
<span class="overdue">[% riloo.duedate | $KohaDates as_due_date => 1 %] (overdue)</span>
[% ELSE %]
[% riloo.duedate | html %]
[% riloo.duedate | $KohaDates as_due_date => 1 %]
[% END %]
[% ELSE %]
<span>Not checked out</span>

4
koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt

@ -75,12 +75,12 @@
<li>
<label for="from">Start date:</label>
<input name="date_start" id="from" size="10" class="flatpickr" data-date_to="to" value="[% club.date_start | $KohaDates %]">
<input name="date_start" id="from" size="10" class="flatpickr" data-date_to="to" value="[% club.date_start | html %]">
</li>
<li>
<label for="to">End date:</label>
<input name="date_end" id="to" size="10" class="flatpickr" value="[% club.date_end | $KohaDates %]" >
<input name="date_end" id="to" size="10" class="flatpickr" value="[% club.date_end | html %]" >
</li>
<li>

4
koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt

@ -58,12 +58,12 @@
<br>
<li>
<label for="from">From: </label>
<input type="text" size="10" id="from" name="from" value="[% beginDate | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input type="text" size="10" id="from" name="from" value="[% beginDate | html %]" class="flatpickr" data-date_to="to" />
<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="[% endDate | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="to" name="to" value="[% endDate | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>

2
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt

@ -793,7 +793,7 @@
<td>
[% IF ( itemloo.transfertwhen ) %]
<span>In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]</span>
to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | $KohaDates %]</span>
[% END %]
[% END %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt

@ -54,7 +54,7 @@
[% END %]
<li><label for="date" class="required">Expiring before:</label>
<input id="date" type="text" name="date" size="10" value="[% date | $KohaDates %]" class="required focus flatpickr" required="required" />
<input id="date" type="text" name="date" size="10" value="[% date | html %]" class="required focus flatpickr" required="required" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div></li>
</ol>

8
koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt

@ -166,15 +166,15 @@
[% IF ( missingissue.status44 ) %]<span class="status-missing_lost">Missing (lost)</span>[% END %]
[% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
</td>
<td class="planneddate" data-order="[% missingissue.planneddateISO | html %]">
[% missingissue.planneddate | html %]
<td class="planneddate" data-order="[% missingissue.planneddate | html %]">
[% missingissue.planneddate | $KohaDates %]
</td>
<td class="publisheddate" data-order="[% missingissue.publisheddate | html %]">
[% missingissue.publisheddate | $KohaDates %]
</td>
<td>[% missingissue.claims_count | html %]</td>
<td data-order="[% missingissue.claimdateISO | html %]">
[% missingissue.claimdate | html %]
<td data-order="[% missingissue.claimdate | html %]">
[% missingissue.claimdate | $KohaDates %]
</td>
[% FOR field IN additional_fields_for_subscription %]
[% IF field.authorised_value_category %]

4
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt

@ -289,7 +289,7 @@
</li>
<li class="local">
<label for="to">Expires before:</label>
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="flatpickr" />
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | html %]" size="10" maxlength="10" class="flatpickr" />
</li>
[% INCLUDE 'additional-fields-entry.inc' available=additional_fields_for_subscription values=additional_field_filters wrap_fieldset=0 %]
</ol>
@ -404,7 +404,7 @@
</li>
<li>
<label for="to">Expires before:</label>
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="flatpickr" />
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | html %]" size="10" maxlength="10" class="flatpickr" />
</li>
[% FOR field IN additional_fields_for_subscription %]

8
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt

@ -302,7 +302,7 @@ fieldset.rows table { clear: none; margin: 0; }
<li>
<label for="acqui_date" class="required">First issue publication date:</label>
[% UNLESS (more_than_one_serial) %]
<input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]" class="flatpickr required" required="required" />
<input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | html %]" class="flatpickr required" required="required" />
[% ELSE %]
[% firstacquidate | $KohaDates %]
<input type="hidden" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]"/>
@ -312,7 +312,7 @@ fieldset.rows table { clear: none; margin: 0; }
[% IF (more_than_one_serial) %]
<li>
<label for="nextacquidate">Next issue publication date:</label>
<input type="text" size="10" id="nextacquidate" name="nextacquidate" value="[% nextacquidate | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="nextacquidate" name="nextacquidate" value="[% nextacquidate | html %]" class="flatpickr" />
</li>
[% END %]
<li>
@ -366,11 +366,11 @@ fieldset.rows table { clear: none; margin: 0; }
</li>
<li>
<label for="from" class="required"> Subscription start date:</label>
<input type="text" size="10" id="from" name="startdate" value="[% startdate | $KohaDates %]" class="flatpickr required" data-date_to="to" required="required" />
<input type="text" size="10" id="from" name="startdate" value="[% startdate | html %]" class="flatpickr required" data-date_to="to" required="required" />
</li>
<li>
<label for="to">Subscription end date:</label>
<input type="text" size="10" id="to" name="enddate" value="[% enddate | $KohaDates %]" class="flatpickr" />
<input type="text" size="10" id="to" name="enddate" value="[% enddate | html %]" class="flatpickr" />
</li>
<li>
<label for="numberpattern" class="required">Numbering pattern:</label>

4
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt

@ -41,14 +41,14 @@
<tr>
<td>Subscription start date</td>
<td>
<input type="text" size="10" name="histstartdate" value="[% histstartdate | $KohaDates %]" class="flatpickr" data-date_to="histenddate" /> (start date of the 1st subscription)
<input type="text" size="10" name="histstartdate" value="[% histstartdate | html %]" class="flatpickr" data-date_to="histenddate" /> (start date of the 1st subscription)
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</td>
</tr>
<tr>
<td>Subscription end date</td>
<td>
<input type="text" size="10" id="histenddate" name="histenddate" value="[% histenddate | $KohaDates %]" class="flatpickr" />(if empty, subscription is still active)
<input type="text" size="10" id="histenddate" name="histenddate" value="[% histenddate | html %]" class="flatpickr" />(if empty, subscription is still active)
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</td>
</tr>

6
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt

@ -500,7 +500,7 @@
<label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label>
</th>
<td>
<input type="text" id="suggesteddate" name="suggesteddate" class="flatpickr" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/> [% INCLUDE 'date-format.inc' %]
<input type="text" id="suggesteddate" name="suggesteddate" class="flatpickr" size="10" maxlength="10" value="[% suggesteddate | html %]"/> [% INCLUDE 'date-format.inc' %]
</td>
<td id="tdsuggestedby">
<input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>
@ -517,7 +517,7 @@
<label for="accepteddate">Accepted on:</label>
</th>
<td>
<input type="text" id="accepteddate" name="accepteddate" class="flatpickr" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]
<input type="text" id="accepteddate" name="accepteddate" class="flatpickr" size="10" maxlength="10" value="[% accepteddate | html %]" />[% INCLUDE 'date-format.inc' %]
</td>
<td>
<input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>
@ -547,7 +547,7 @@
</li>
<li>
<label for="managedon">Managed on:</label>
<input type="text" id="managedon" name="manageddate" class="flatpickr" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]
<input type="text" id="managedon" name="manageddate" class="flatpickr" size="10" maxlength="10" value="[% manageddate | html %]" />[% INCLUDE 'date-format.inc' %]
</li>
<li>
<label for="managedby_name">by:</label>

4
koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt

@ -64,9 +64,7 @@ tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
[% IF ( message_loop ) %]
<div class="dialog alert" id="main_error">
[% FOREACH message_loo IN message_loop %]
[% IF ( message_loo.date_from ) %]<strong>Error: </strong><span>"Date from" is not a legal value ("[% message_loo.date_from | html %]").</span>
[% ELSIF ( message_loo.date_to ) %]<strong>Error: </strong><span>"Date to" is not a legal value ("[% message_loo.date_to | html %]").</span>
[% ELSIF ( message_loo.failed_ok ) %]<strong>Error: </strong><span>Failed to approve term ([% message_loo.failed_ok | html %]).</span>
[% IF ( message_loo.failed_ok ) %]<strong>Error: </strong><span>Failed to approve term ([% message_loo.failed_ok | html %]).</span>
[% ELSIF ( message_loo.failed_rej ) %]<strong>Error: </strong><span>Failed to reject term ([% message_loo.failed_rej | html %]).</span>
[% ELSIF ( message_loo.approver ) %]<span>No match for user ([% message_loo.approver | html %]). FILTER REQUIRES BORROWERNUMBER (not name).</span>
[% ELSIF ( message_loo.approved_by ) %]<strong>Error: </strong><span>No match for borrowernumber ([% message_loo.approved_by | html %]).</span>

4
koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt

@ -236,12 +236,12 @@
[% END %]
<li>
<label for="from">Publication date: </label>
<input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | $KohaDates %]" class="flatpickr" data-date_to="to" />
<input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | html %]" class="flatpickr" data-date_to="to" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="to">Expiration date: </label>
<input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | $KohaDates %]" class="flatpickr" />
<input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | html %]" class="flatpickr" />
<div class="hint">
[% INCLUDE 'date-format.inc' %]
[% IF category == 'news' %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt

@ -484,7 +484,7 @@
function changeBranch () {
var branch = $("#branch option:selected").val();
location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate | html %]";
location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate | $KohaDates %]";
}
/**

4
koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt

@ -85,7 +85,7 @@
<fieldset class="rows">
<legend>Parameters</legend>
<ol>
<li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="flatpickr" /></li>
<li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | html %]" class="flatpickr" /></li>
<li><label for="compareinv2barcd">Compare barcodes list to results: </label><input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" disabled /></li>
<li><label for="dont_checkin">Do not check in items scanned during inventory: </label><input type="checkbox" name="dont_checkin" id="dont_checkin" disabled /></li>
<li><label for="out_of_order">Check barcodes list for items shelved out of order: </label><input type="checkbox" name="out_of_order" id="out_of_order" disabled /></li>
@ -185,7 +185,7 @@
<li>
<br/>
<label for="datelastseen">Last inventory date:</label>
<input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates %]" class="flatpickr" />
<input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | html %]" class="flatpickr" />
(Skip records marked as seen on or after this date.)
</li>
<li>

2
koha-tmpl/intranet-tmpl/prog/js/members.js

@ -128,7 +128,7 @@ function select_user(borrowernumber, borrower, relationship) {
function CalculateAge(dateofbirth) {
var today = new Date();
var dob = Date_from_syspref(dateofbirth);
var dob = new Date(dateofbirth);
var age = {};
age.year = today.getFullYear() - dob.getFullYear();

9
labels/label-item-search.pl

@ -30,7 +30,6 @@ use C4::Biblio qw( TransformMarcToKoha );
use C4::Creators::Lib qw( html_table );
use Koha::Logger;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Items;
use Koha::ItemTypes;
use Koha::SearchEngine::Search;
@ -67,22 +66,14 @@ if ( $op eq "do_search" ) {
$dateto = $query->param('dateto');
if ($datefrom) {
$datefrom = eval { dt_from_string ( $datefrom ) };
if ($datefrom) {
$datefrom = output_pref( { dt => $datefrom, dateonly => 1, dateformat => 'iso' } );
$ccl_query .= ' AND ' if $ccl_textbox;
$ccl_query .= "acqdate,ge,st-date-normalized=" . $datefrom;
}
}
if ($dateto) {
$dateto = eval { dt_from_string ( $dateto ) };
if ($dateto) {
$dateto = output_pref( { dt => $dateto, dateonly => 1, dateformat => 'iso' } );
$ccl_query .= ' AND ' if ( $ccl_textbox || $datefrom );
$ccl_query .= "acqdate,le,st-date-normalized=" . $dateto;
}
}
my $offset = $startfrom > 1 ? $startfrom - 1 : 0;
my $searcher = Koha::SearchEngine::Search->new({index => 'biblios'});

5
members/housebound.pl

@ -30,7 +30,6 @@ use C4::Auth qw( get_template_and_user );
use C4::Context;
use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers );
use DateTime;
use Koha::DateUtils qw( dt_from_string );
use Koha::Libraries;
use Koha::Patrons;
use Koha::Patron::Categories;
@ -124,7 +123,7 @@ if ( $method eq 'updateconfirm' and $houseboundprofile ) {
# simple display.
$visit->set({
borrowernumber => scalar $input->param('borrowernumber') // q{},
appointment_date => dt_from_string($input->param('date') // q{}),
appointment_date => scalar $input->param('date') // q{},
day_segment => scalar $input->param('segment') // q{},
chooser_brwnumber => scalar $input->param('chooser') // q{},
deliverer_brwnumber => scalar $input->param('deliverer') // q{},
@ -138,7 +137,7 @@ if ( $method eq 'updateconfirm' and $houseboundprofile ) {
# to simple display.
my $visit = Koha::Patron::HouseboundVisit->new({
borrowernumber => scalar $input->param('borrowernumber') // q{},
appointment_date => dt_from_string($input->param('date') // q{}),
appointment_date => scalar $input->param('date') // q{},
day_segment => scalar $input->param('segment') // q{},
chooser_brwnumber => scalar $input->param('chooser') // q{},
deliverer_brwnumber => scalar $input->param('deliverer') // q{},

26
members/memberentry.pl

@ -37,7 +37,7 @@ use Koha::AuthorisedValues;
use Koha::Email;
use Koha::Patron::Debarments qw( AddDebarment DelDebarment GetDebarments );
use Koha::Cities;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Libraries;
use Koha::Patrons;
use Koha::Patron::Attribute::Types;
@ -191,19 +191,6 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' )
}
}
foreach (qw(dateenrolled dateexpiry dateofbirth password_expiration_date)) {
next unless exists $newdata{$_};
my $userdate = $newdata{$_} or next;
my $formatteddate = eval { output_pref({ dt => dt_from_string( $userdate ), dateformat => 'iso', dateonly => 1 } ); };
if ( $formatteddate ) {
$newdata{$_} = $formatteddate;
} else {
$template->param( "ERROR_$_" => 1 );
push(@errors,"ERROR_$_");
}
}
# check permission to modify login info.
if (ref($borrower_data) && ($category->category_type eq 'S') && ! (C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) ) {
$NoUpdateLogin = 1;
@ -761,10 +748,10 @@ if ($nok) {
#Formatting data for display
if (!defined($data{'dateenrolled'}) or $data{'dateenrolled'} eq ''){
$data{'dateenrolled'} = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
$data{'dateenrolled'} = dt_from_string;
}
if ( $op eq 'duplicate' ) {
$data{'dateenrolled'} = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
$data{'dateenrolled'} = dt_from_string;
$data{dateexpiry} = $category->get_expiry_date( $data{dateenrolled} );
}
if (C4::Context->preference('uppercasesurnames')) {
@ -772,13 +759,6 @@ if (C4::Context->preference('uppercasesurnames')) {
$data{'contactname'} &&= uc( $data{'contactname'} );
}
foreach (qw(dateenrolled dateexpiry dateofbirth password_expiration_date)) {
if ( $data{$_} ) {
$data{$_} = eval { output_pref({ dt => dt_from_string( $data{$_} ), dateonly => 1 } ); }; # back to syspref for display
}
$template->param( $_ => $data{$_});
}
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
patron_attributes_form( $template, $extended_patron_attributes, $op );
}

2
misc/cronjobs/fines.pl

@ -163,7 +163,7 @@ for my $overdue ( @{$overdues} ) {
itemnumber => $overdue->{itemnumber},
borrowernumber => $overdue->{borrowernumber},
amount => $amount,
due => output_pref($datedue),
due => $datedue,
}
);
$updated++;

4
misc/cronjobs/serialsUpdate.pl

@ -25,7 +25,7 @@ use C4::Context;
use C4::Serials qw( GetSubscription GetNextDate ModSerialStatus );
use C4::Serials::Frequency;
use C4::Log qw( cronlogaction );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Date::Calc qw( check_date Date_to_Days );
use Getopt::Long qw( GetOptions );
@ -113,7 +113,7 @@ while ( my $issue = $sth->fetchrow_hashref ) {
if ( $subscription && $publisheddate ) {
my $freqdata = GetSubscriptionFrequency($subscription->{'periodicity'});
my $nextpublisheddate = GetNextDate( $subscription, $publisheddate, $freqdata );
my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
my $today = dt_from_string->ymd;
if ( $nextpublisheddate && $today ) {
my ( $year, $month, $day ) = split( /-/, $nextpublisheddate );

4
misc/cronjobs/staticfines.pl

@ -36,7 +36,7 @@ use C4::Calendar qw(); # don't need any exports from Calendar
use C4::Log qw( cronlogaction );
use Getopt::Long qw( GetOptions );
use List::MoreUtils qw( none );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Patrons;
my $help = 0;
@ -126,7 +126,7 @@ if (defined $borrowernumberlimit) {
my $overdueItemsCounted = 0;
my %calendars = ();
$today = dt_from_string;
$today_iso = output_pref( { dt => $today, dateonly => 1, dateformat => 'iso' } );
$today_iso = $today->ymd;
my ($tyear, $tmonth, $tday) = split( /-/, $today_iso );
$today_days = Date_to_Days( $tyear, $tmonth, $tday );

16
opac/opac-memberentry.pl

@ -35,7 +35,7 @@ use Koha::Patron::Consent;
use Koha::Patron::Modification;
use Koha::Patron::Modifications;
use C4::Scrubber;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Email;
use Koha::Libraries;
use Koha::Patron::Attribute::Types;
@ -545,20 +545,6 @@ sub ParseCgiForBorrower {
}
}
if ( defined $borrower{'dateofbirth'} ) {
my $dob_dt;
$dob_dt = eval { dt_from_string( $borrower{'dateofbirth'} ); }
if ( $borrower{'dateofbirth'} );
if ( $dob_dt ) {
$borrower{'dateofbirth'} = output_pref( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' } );
}
else {
# Trigger validation
$borrower{'dateofbirth'} = undef;
}
}
# Replace checkbox 'agreed' by datetime in gdpr_proc_consent
$borrower{gdpr_proc_consent} = dt_from_string if $borrower{gdpr_proc_consent} && $borrower{gdpr_proc_consent} eq 'agreed';

1
opac/opac-reserve.pl

@ -34,7 +34,6 @@ use C4::Overdues;
use Koha::AuthorisedValues;
use Koha::Biblios;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::CirculationRules;
use Koha::Items;
use Koha::ItemTypes;

3
opac/opac-suggestions.pl

@ -37,7 +37,7 @@ use Koha::AuthorisedValues;
use Koha::Libraries;
use Koha::Patrons;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new;
my $op = $input->param('op') || 'else';
@ -151,7 +151,6 @@ my $patrons_total_suggestions_count = 0;
if ( $borrowernumber ){
if ( C4::Context->preference("MaxTotalSuggestions") ne '' && C4::Context->preference("NumberOfSuggestionDays") ne '' ) {
my $suggesteddate_from = dt_from_string()->subtract(days=>C4::Context->preference("NumberOfSuggestionDays"));
$suggesteddate_from = output_pref({ dt => $suggesteddate_from, dateformat => 'iso', dateonly => 1 });
$patrons_total_suggestions_count = Koha::Suggestions->search({ suggestedby => $borrowernumber, suggesteddate => { '>=' => $suggesteddate_from } })->count;
}

10
pos/register.pl

@ -26,7 +26,7 @@ use C4::Context;
use Koha::Account::Lines;
use Koha::Cash::Registers;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new();
@ -96,10 +96,12 @@ else {
}
}
);
$template->param( past_accountlines => $past_accountlines );
$template->param( trange_f => output_pref({dt => $start, dateonly => 1}));
$template->param(
past_accountlines => $past_accountlines,
trange_f => $start,
);
}
$template->param( trange_t => output_pref({dt => $end, dateonly => 1}));
$template->param( trange_t => $end, );
my $op = $input->param('op') // '';
if ( $op eq 'cashup' ) {

15
reports/acquisitions_stats.pl

@ -27,7 +27,6 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Koha qw( GetAuthorisedValues );
use C4::Biblio qw( GetMarcSubfieldStructureFromKohaField );
use Koha::ItemTypes;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Libraries;
=head1 NAME
@ -46,14 +45,6 @@ my $fullreportname = "reports/acquisitions_stats.tt";
my $line = $input->param("Line");
my $column = $input->param("Column");
my @filters = $input->multi_param("Filter");
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[0] );
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[1] );
$filters[2] = eval { output_pref( { dt => dt_from_string( $filters[2]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[2] );
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[3] );
my $podsp = $input->param("PlacedOnDisplay");
my $rodsp = $input->param("ReceivedOnDisplay");
my $calc = $input->param("Cellvalue");
@ -235,13 +226,7 @@ sub calculate {
if ( ( ( $i == 1 ) or ( $i == 3 ) ) and ( @$filters[ $i - 1 ] ) ) {
$cell{err} = 1 if ( @$filters[$i] lt @$filters[ $i - 1 ] );
}
# format the dates filters, otherwise just fill as is
if ($i >= 4) {
$cell{filter} = @$filters[$i];
} else {
$cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
if ( @$filters[$i] );
}
$cell{crit} = $i;
push @loopfilter, \%cell;
}

5
reports/bor_issues_top.pl

@ -25,7 +25,6 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Context;
use C4::Reports qw( GetDelimiterChoices );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::ItemTypes;
use Koha::Patron::Categories;
@ -43,9 +42,6 @@ my $do_it = $input->param('do_it');
my $limit = $input->param("Limit");
my $column = $input->param("Criteria");
my @filters = $input->multi_param("Filter");
foreach ( @filters[0..3] ) {
$_ and $_ = eval { output_pref( { dt => dt_from_string ( $_ ), dateonly => 1, dateformat => 'iso' }); };
}
my $output = $input->param("output");
my $basename = $input->param("basename");
my ($template, $borrowernumber, $cookie)
@ -143,7 +139,6 @@ sub calculate {
if (($i==1) and (@$filters[$i-1])) {
$cell{err} = 1 if (@$filters[$i]<@$filters[$i-1]) ;
}
# format the dates filters, otherwise just fill as is
$cell{filter} .= @$filters[$i];
defined ($cellmap[$i]) and
$cell{crit} .= $cellmap[$i];

3
reports/borrowers_out.pl

@ -25,7 +25,6 @@ use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Reports qw( GetDelimiterChoices );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Patron::Categories;
=head1 NAME
@ -44,8 +43,6 @@ my $fullreportname = "reports/borrowers_out.tt";
my $limit = $input->param("Limit");
my $column = $input->param("Criteria");
my @filters = $input->multi_param("Filter");
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[1] );
my $output = $input->param("output");
my $basename = $input->param("basename");

12
reports/borrowers_stats.pl

@ -27,7 +27,6 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Reports qw( GetDelimiterChoices );
use Koha::AuthorisedValues;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Libraries;
use Koha::Patron::Attribute::Types;
use Koha::Patron::Categories;
@ -48,10 +47,6 @@ my $fullreportname = "reports/borrowers_stats.tt";
my $line = $input->param("Line");
my $column = $input->param("Column");
my @filters = $input->multi_param("Filter");
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[3] );
$filters[4] = eval { output_pref ({ dt => dt_from_string( $filters[4]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[4] );
my $digits = $input->param("digits");
our $period = $input->param("period");
my $borstat = $input->param("status");
@ -190,13 +185,6 @@ sub calculate {
foreach my $i (0 .. scalar @$filters) {
my %cell;
if ( @$filters[$i] ) {
if ($i == 3 or $i == 4) {
$cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
if ( @$filters[$i] );
} else {
$cell{filter} = @$filters[$i];
}
if ( $i == 0) { $cell{crit} = "Cat code"; }
elsif ( $i == 1 ) { $cell{crit} = "ZIP/Postal code"; }
elsif ( $i == 2 ) { $cell{crit} = "Branch code"; }

10
reports/cash_register_stats.pl

@ -22,7 +22,7 @@ use C4::Context;
use C4::Reports qw( GetDelimiterChoices );
use C4::Output qw( output_html_with_http_headers );
use DateTime;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Text::CSV::Encoded;
use List::Util qw( any );
@ -51,8 +51,8 @@ $template->param(
);
#Initialize date pickers to today
my $fromDate = dt_from_string;
my $toDate = dt_from_string;
my $fromDate = $input->param("from") || dt_from_string;
my $toDate = $input->param("to") || dt_from_string;
my @debit_types =
Koha::Account::DebitTypes->search()->as_list;
@ -62,10 +62,6 @@ my $registerid;
if ($do_it) {
$fromDate = output_pref({ dt => eval { dt_from_string(scalar $input->param("from")) } || dt_from_string,
dateformat => 'sql', dateonly => 1 }); #for sql query
$toDate = output_pref({ dt => eval { dt_from_string(scalar $input->param("to")) } || dt_from_string,
dateformat => 'sql', dateonly => 1 }); #for sql query
my $whereTType = q{};
my @extra_params; # if we add conditions to the select we need extra params

10
reports/cat_issues_top.pl

@ -25,7 +25,6 @@ use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Koha qw( GetAuthorisedValues );
use C4::Reports qw( GetDelimiterChoices );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::ItemTypes;
=head1 NAME
@ -42,9 +41,6 @@ my $fullreportname = "reports/cat_issues_top.tt";
my $limit = $input->param("Limit");
my $column = $input->param("Criteria");
my @filters = $input->multi_param("Filter");
foreach ( @filters[0..3] ) {
$_ and $_ = eval { output_pref( { dt => dt_from_string ( $_ ), dateonly => 1, dateformat => 'iso' } ); };
}
my $output = $input->param("output");
my $basename = $input->param("basename");
@ -165,13 +161,7 @@ sub calculate {
if (($i==1) and (@$filters[$i-1])) {
$cell{err} = 1 if (@$filters[$i]<@$filters[$i-1]) ;
}
# format the dates filters, otherwise just fill as is
if ($i>=2) {
$cell{filter} .= @$filters[$i];
} else {
$cell{filter} .= eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
if ( @$filters[$i] );
}
$cell{crit} .="Issue From" if ($i==0);
$cell{crit} .="Issue To" if ($i==1);
$cell{crit} .="Return From" if ($i==2);

9
reports/dictionary.pl

@ -137,9 +137,6 @@ elsif ( $phase eq 'New Term step 5' ) {
$tmp_hash{'name'} = $crit;
$tmp_hash{'value'} = $value;
push @criteria_loop, \%tmp_hash;
my $value_dt = eval { dt_from_string( $value ) };
$value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } )
if ( $value_dt );
$query_criteria .= " AND $crit='$value'";
}
@ -151,9 +148,6 @@ elsif ( $phase eq 'New Term step 5' ) {
$tmp_hash{'name'} = "$crit Start";
$tmp_hash{'value'} = $value;
push @criteria_loop, \%tmp_hash;
my $value_dt = eval { dt_from_string( $value ) };
$value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } )
if ( $value_dt );
$query_criteria .= " AND $crit >= '$value'";
}
@ -163,9 +157,6 @@ elsif ( $phase eq 'New Term step 5' ) {
$tmp_hash{'name'} = "$crit End";
$tmp_hash{'value'} = $value;
push @criteria_loop, \%tmp_hash;
my $value_dt = eval { dt_from_string( $value ) };
$value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } )
if ( $value_dt );
$query_criteria .= " AND $crit <= '$value'";
}

20
reports/guided_reports.pl

@ -30,7 +30,6 @@ use C4::Output qw( pagination_bar output_html_with_http_headers );
use C4::Context;
use Koha::Caches;
use C4::Log qw( logaction );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::AuthorisedValue;
use Koha::AuthorisedValues;
use Koha::BiblioFrameworks;
@ -401,32 +400,13 @@ elsif ( $phase eq 'Choose these criteria' ) {
# If value is not defined, then it may be range values
if (!defined $value) {
my $fromvalue = $input->param( "from_" . $crit . "_value" );
my $tovalue = $input->param( "to_" . $crit . "_value" );
# If the range values are dates
my $fromvalue_dt;
$fromvalue_dt = eval { dt_from_string( $fromvalue ); } if ( $fromvalue );
my $tovalue_dt;
$tovalue_dt = eval { dt_from_string( $tovalue ); } if ($tovalue);
if ( $fromvalue_dt && $tovalue_dt ) {
$fromvalue = output_pref( { dt => dt_from_string( $fromvalue_dt ), dateonly => 1, dateformat => 'iso' } );
$tovalue = output_pref( { dt => dt_from_string( $tovalue_dt ), dateonly => 1, dateformat => 'iso' } );
}
if ($fromvalue && $tovalue) {
$query_criteria .= " AND $crit >= '$fromvalue' AND $crit <= '$tovalue'";
}
} else {
# If value is a date
my $value_dt;
$value_dt = eval { dt_from_string( $value ); } if ( $value );
if ( $value_dt ) {
$value = output_pref( { dt => dt_from_string( $value_dt ), dateonly => 1, dateformat => 'iso' } );
}
# don't escape runtime parameters, they'll be at runtime
if ($value =~ /<<.*>>/) {
$query_criteria .= " AND $crit=$value";

16
reports/issues_avg_stats.pl

@ -24,7 +24,6 @@ use CGI qw ( -utf8 );
use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Reports qw( GetDelimiterChoices );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::ItemTypes;
use Koha::Patron::Categories;
use Date::Calc qw( Delta_Days );
@ -43,15 +42,6 @@ my $fullreportname = "reports/issues_avg_stats.tt";
my $line = $input->param("Line");
my $column = $input->param("Column");
my @filters = $input->multi_param("Filter");
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[0] );
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[1] );
$filters[2] = eval { output_pref( { dt => dt_from_string( $filters[2]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[2] );
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[3] );
my $podsp = $input->param("IssueDisplay");
my $rodsp = $input->param("ReturnDisplay");
@ -186,13 +176,7 @@ sub calculate {
if (($i==1) and (@$filters[$i-1])) {
$cell{err} = 1 if (@$filters[$i]<@$filters[$i-1]) ;
}
# format the dates filters, otherwise just fill as is
if ($i>=4) {
$cell{filter} .= @$filters[$i];
} else {
$cell{filter} .= eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
if ( @$filters[$i] );
}
$cell{crit} .="Issue From" if ($i==0);
$cell{crit} .="Issue To" if ($i==1);
$cell{crit} .="Issue Month" if ($i==2);

10
reports/issues_stats.pl

@ -28,7 +28,6 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Reports qw( GetDelimiterChoices );
use Koha::AuthorisedValues;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::ItemTypes;
use Koha::Patron::Attribute::Types;
@ -48,10 +47,6 @@ my $do_it = $input->param('do_it');
my $line = $input->param("Line");
my $column = $input->param("Column");
my @filters = $input->multi_param("Filter");
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[0] );
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[1] );
my $podsp = $input->param("DisplayBy");
my $type = $input->param("PeriodTypeSel");
my $daysel = $input->param("PeriodDaySel");
@ -220,12 +215,7 @@ sub calculate {
$cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
}
# format the dates filters, otherwise just fill as is
if ($i>=2) {
$cell{filter} = @$filters[$i];
} else {
$cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
if ( @$filters[$i] );
}
$cell{crit} = $i;
push @loopfilter, \%cell;

5
reports/orders_by_fund.pl

@ -33,7 +33,6 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Budgets qw( GetBudgetsReport GetBudgetHierarchy );
use C4::Acquisition qw( GetBasket get_rounded_price );
use Koha::Biblios;
use Koha::DateUtils qw( dt_from_string output_pref );
my $query = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@ -106,9 +105,7 @@ if ( $get_orders ) {
$order->{'total_rrp'} = get_rounded_price($order->{'quantity'}) * $order->{'rrp'};
$order->{'total_ecost'} = get_rounded_price($order->{'quantity'}) * $order->{'ecost'};
# Format the dates and currencies correctly
$order->{'datereceived'} = output_pref(dt_from_string($order->{'datereceived'}));
$order->{'entrydate'} = output_pref(dt_from_string($order->{'entrydate'}));
# Format the currencies correctly
$total_quantity += $order->{'quantity'};
$total_rrp += $order->{'total_rrp'};
$total_ecost += $order->{'total_ecost'};

11
reports/reserves_stats.pl

@ -28,7 +28,6 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Reports qw( GetDelimiterChoices );
use C4::Members;
use Koha::AuthorisedValues;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::ItemTypes;
use Koha::Libraries;
use Koha::Patron::Categories;
@ -170,21 +169,13 @@ sub calculate {
my @loopfilter;
foreach my $filter ( keys %$filters_hashref ) {
$filters_hashref->{$filter} =~ s/\*/%/;
if ( $filter =~ /date/ ) {
$filters_hashref->{$filter} =
eval { output_pref( { dt => dt_from_string( $filters_hashref->{$filter} ), dateonly => 1, dateformat => 'iso' }); };
}
}
#display
@loopfilter = map {
{
crit => $_,
filter => (
$_ =~ /date/
? eval { output_pref( { dt => dt_from_string( $filters_hashref->{$_} ), dateonly => 1 }); }
: $filters_hashref->{$_}
)
filter => $filters_hashref->{$_},
}
} sort keys %$filters_hashref;

5
reserve/modrequest.pl

@ -31,7 +31,6 @@ use Try::Tiny;
use C4::Output;
use C4::Reserves qw( ModReserve ModReserveCancelAll );
use C4::Auth qw( get_template_and_user );
use Koha::DateUtils qw( dt_from_string );
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
my $query = CGI->new;
@ -77,14 +76,14 @@ else {
my $params = {
rank => $rank[$i],
reserve_id => $reserve_id[$i],
expirationdate => $expirationdates[$i] ? dt_from_string($expirationdates[$i]) : undef,
expirationdate => $expirationdates[$i] || undef,
branchcode => $branch[$i],
itemnumber => $itemnumber[$i],
defined $suspend_until ? ( suspend_until => $suspend_until ) : (),
cancellation_reason => $cancellation_reason,
};
if (C4::Context->preference('AllowHoldDateInFuture')) {
$params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
$params->{reservedate} = $reservedates[$i] || undef;
}
try {

8
reserve/request.pl

@ -38,11 +38,10 @@ use C4::Items qw( get_hostitemnumbers_of );
use C4::Koha qw( getitemtypeimagelocation );
use C4::Serials qw( CountSubscriptionFromBiblionumber );
use C4::Circulation qw( GetTransfers _GetCircControlBranch GetBranchItemRule );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use C4::Search qw( enabled_staff_search_views );
use Koha::Biblios;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Checkouts;
use Koha::Holds;
use Koha::CirculationRules;
@ -90,7 +89,6 @@ my $messages;
my $exceeded_maxreserves;
my $exceeded_holds_per_record;
my $date = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
my $action = $input->param('action');
$action ||= q{};
@ -456,7 +454,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
GetTransfers($item_object->itemnumber); # FIXME replace with get_transfer
if ( defined $transfertwhen && $transfertwhen ne '' ) {
$item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 });
$item->{transfertwhen} = $transfertwhen;
$item->{transfertfrom} = $transfertfrom;
$item->{transfertto} = $transfertto;
$item->{nocancel} = 1;
@ -663,7 +661,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
$template->param(
itemdata_enumchron => $itemdata_enumchron,
itemdata_ccode => $itemdata_ccode,
date => $date,
date => dt_from_string,
biblionumber => $biblionumber,
findborrower => $findborrower,
biblio => $biblio,

16
serials/serials-edit.pl

@ -72,7 +72,7 @@ use C4::Context;
use C4::Serials qw( GetSerials GetSerials2 GetSerialInformation HasSubscriptionExpired GetSubscription abouttoexpire NewIssue ModSerialStatus GetPreviousSerialid AddItem2Serial );
use C4::Search qw( enabled_staff_search_views );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Items;
use Koha::Serial::Items;
@ -128,7 +128,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my @serialdatalist;
my %processedserialid;
my $today = output_pref( { dt => dt_from_string, dateonly => 1 } );
my $today = dt_from_string;
foreach my $serialid (@serialids) {
@ -140,14 +140,6 @@ foreach my $serialid (@serialids) {
{
my $serinfo = GetSerialInformation($serialid); #TODO duplicates work done by GetSerials2 above
for my $d ( qw( publisheddate planneddate )){
if ( $serinfo->{$d} =~m/^00/ ) {
$serinfo->{$d} = q{};
}
else {
$serinfo->{$d} = output_pref( { dt => dt_from_string( $serinfo->{$d} ), dateonly => 1 } );
}
}
$serinfo->{arriveddate} = $today;
$serinfo->{'editdisable'} = (
@ -216,10 +208,10 @@ if ( $op and $op eq 'serialchangestatus' ) {
my ($plan_date, $pub_date);
if (defined $planneddates[$i] && $planneddates[$i] ne 'XXX') {
$plan_date = eval { output_pref( { dt => dt_from_string( $planneddates[$i] ), dateonly => 1, dateformat => 'iso' } ); };
$plan_date = $planneddates[$i];
}
if (defined $publisheddates[$i] && $publisheddates[$i] ne 'XXX') {
$pub_date = eval { output_pref( { dt => dt_from_string( $publisheddates[$i] ), dateonly => 1, dateformat => 'iso' } ); };
$pub_date = $publisheddates[$i];
}
if ( $serialids[$i] && $serialids[$i] eq 'NEW' ) {

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save