@@ -, +, @@ --- C4/Acquisition.pm | 13 ++---- C4/Barcodes/annual.pm | 1 + C4/Barcodes/hbyymmincr.pm | 1 + C4/Circulation.pm | 34 +++++++------- C4/ILSDI/Services.pm | 23 +++------- C4/Items.pm | 8 +--- C4/Letters.pm | 2 +- C4/Members.pm | 1 + C4/Overdues.pm | 6 +-- C4/Reports/Guided.pm | 3 +- C4/Reserves.pm | 15 ++----- C4/Search/History.pm | 1 + C4/Serials.pm | 45 ------------------- Koha/Hold.pm | 6 +-- Koha/Item.pm | 6 +-- Koha/Patrons/Import.pm | 1 + Koha/REST/V1/Clubs/Holds.pm | 6 --- Koha/REST/V1/Holds.pm | 34 ++++---------- Koha/Report.pm | 20 ++++----- acqui/duplicate_orders.pl | 8 ++-- acqui/histsearch.pl | 6 +-- acqui/invoice.pl | 4 +- acqui/invoices.pl | 15 +++---- acqui/lateorders.pl | 32 ++++--------- acqui/orderreceive.pl | 2 +- acqui/parcels.pl | 7 ++- admin/aqbudgetperiods.pl | 9 ++-- admin/aqcontract.pl | 20 +++------ admin/categories.pl | 11 ----- admin/smart-rules.pl | 5 --- cataloguing/additem.pl | 1 - cataloguing/value_builder/barcode.pl | 4 +- cataloguing/value_builder/barcode_manual.pl | 4 +- cataloguing/value_builder/dateaccessioned.pl | 3 +- circ/branchoverdues.pl | 4 +- circ/circulation.pl | 6 +-- circ/overdue.pl | 6 +-- circ/renew.pl | 17 ++++--- circ/reserveratios.pl | 9 ++-- circ/returns.pl | 40 ++++++++--------- circ/transferstoreceive.pl | 4 +- circ/waitingreserves.pl | 4 +- clubs/clubs-add-modify.pl | 6 +-- installer/onboarding.pl | 12 ----- .../prog/en/includes/calendar.inc | 7 ++- .../prog/en/includes/filter-orders.inc | 5 +-- .../prog/en/includes/holds_table.inc | 6 +-- .../prog/en/modules/acqui/invoice.tt | 4 +- .../prog/en/modules/acqui/invoices.tt | 8 ++-- .../prog/en/modules/acqui/orderreceive.tt | 2 +- .../prog/en/modules/acqui/parcels.tt | 2 +- .../prog/en/modules/admin/aqbudgetperiods.tt | 8 ++-- .../prog/en/modules/admin/aqcontract.tt | 4 +- .../prog/en/modules/admin/categories.tt | 2 +- .../prog/en/modules/circ/circulation.tt | 4 +- .../circ/circulation_batch_checkouts.tt | 2 +- .../prog/en/modules/circ/overdue.tt | 4 +- .../prog/en/modules/circ/pendingreserves.tt | 4 +- .../prog/en/modules/circ/renew.tt | 2 +- .../prog/en/modules/circ/reserveratios.tt | 4 +- .../prog/en/modules/circ/returns.tt | 4 +- .../prog/en/modules/clubs/clubs-add-modify.tt | 4 +- .../en/modules/reports/cash_register_stats.tt | 4 +- .../prog/en/modules/reserve/request.tt | 2 +- .../en/modules/serials/checkexpiration.tt | 2 +- .../prog/en/modules/serials/claims.tt | 8 ++-- .../prog/en/modules/serials/serials-search.tt | 4 +- .../en/modules/serials/subscription-add.tt | 8 ++-- .../modules/serials/subscription-history.tt | 4 +- .../prog/en/modules/suggestion/suggestion.tt | 6 +-- .../prog/en/modules/tags/review.tt | 4 +- .../en/modules/tools/additional-contents.tt | 4 +- .../prog/en/modules/tools/holidays.tt | 2 +- .../prog/en/modules/tools/inventory.tt | 4 +- koha-tmpl/intranet-tmpl/prog/js/members.js | 2 +- .../bootstrap/en/modules/opac-reserve.tt | 2 +- labels/label-item-search.pl | 17 ++----- members/housebound.pl | 5 +-- members/memberentry.pl | 26 ++--------- misc/cronjobs/fines.pl | 2 +- misc/cronjobs/serialsUpdate.pl | 4 +- misc/cronjobs/staticfines.pl | 4 +- opac/opac-memberentry.pl | 16 +------ opac/opac-reserve.pl | 3 +- opac/opac-suggestions.pl | 3 +- pos/register.pl | 10 +++-- reports/acquisitions_stats.pl | 17 +------ reports/bor_issues_top.pl | 5 --- reports/borrowers_out.pl | 3 -- reports/borrowers_stats.pl | 12 ----- reports/cash_register_stats.pl | 10 ++--- reports/cat_issues_top.pl | 12 +---- reports/dictionary.pl | 9 ---- reports/guided_reports.pl | 20 --------- reports/issues_avg_stats.pl | 18 +------- reports/issues_stats.pl | 12 +---- reports/orders_by_fund.pl | 5 +-- reports/reserves_stats.pl | 11 +---- reserve/modrequest.pl | 5 +-- reserve/request.pl | 8 ++-- serials/serials-edit.pl | 16 ++----- serials/serials-search.pl | 7 ++- serials/showpredictionpattern.pl | 15 +++---- suggestion/suggestion.pl | 1 + t/db_dependent/Reserves.t | 12 ++--- t/db_dependent/Serials.t | 6 +-- tags/review.pl | 25 ++++------- tools/additional-contents.pl | 7 +-- tools/batchMod.pl | 1 - tools/batch_extend_due_dates.pl | 22 +++------ tools/cleanborrowers.pl | 37 +++------------ tools/holidays.pl | 1 + tools/inventory.pl | 4 +- tools/scheduler.pl | 8 +--- 114 files changed, 296 insertions(+), 700 deletions(-) --- a/C4/Acquisition.pm +++ a/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 --- a/C4/Barcodes/annual.pm +++ a/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); --- a/C4/Barcodes/hbyymmincr.pm +++ a/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? --- a/C4/Circulation.pm +++ a/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} ) { + my $highholds = { + num_holds => $check->{outstanding}, + duration => $check->{duration}, + returndate => $check->{due_date}, + }; if ($override_high_holds) { - $alerts{HIGHHOLDS} = { - num_holds => $check->{outstanding}, - duration => $check->{duration}, - returndate => output_pref( { dt => dt_from_string($check->{due_date}), dateformat => 'iso', timeformat => '24hr' }), - }; + $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, }); } } --- a/C4/ILSDI/Services.pm +++ a/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); --- a/C4/Items.pm +++ a/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; } --- a/C4/Letters.pm +++ a/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 }); } --- a/C4/Members.pm +++ a/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; --- a/C4/Overdues.pm +++ a/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( --- a/C4/Reports/Guided.pm +++ a/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; --- a/C4/Reserves.pm +++ a/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; --- a/C4/Search/History.pm +++ a/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, }; --- a/C4/Serials.pm +++ a/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}); --- a/Koha/Hold.pm +++ a/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 ) { --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -165,11 +165,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); } } --- a/Koha/Patrons/Import.pm +++ a/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, --- a/Koha/REST/V1/Clubs/Holds.pm +++ a/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, --- a/Koha/REST/V1/Holds.pm +++ a/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, } ); } --- a/Koha/Report.pm +++ a/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); } --- a/acqui/duplicate_orders.pl +++ a/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') || ''; --- a/acqui/histsearch.pl +++ a/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; --- a/acqui/invoice.pl +++ a/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 ); --- a/acqui/invoices.pl +++ a/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, --- a/acqui/lateorders.pl +++ a/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,25 +70,11 @@ 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) - ? 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}); -} +$estimateddeliverydateto ||= + ( not defined $delay and not defined $estimateddeliverydatefrom ) + ? dt_from_string() + : undef; 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 ) : () ) }, --- a/acqui/orderreceive.pl +++ a/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 { --- a/acqui/parcels.pl +++ a/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; --- a/admin/aqbudgetperiods.pl +++ a/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'); --- a/admin/aqcontract.pl +++ a/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 --- a/admin/categories.pl +++ a/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); --- a/admin/smart-rules.pl +++ a/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; --- a/cataloguing/additem.pl +++ a/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; --- a/cataloguing/value_builder/barcode.pl +++ a/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; --- a/cataloguing/value_builder/barcode_manual.pl +++ a/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; --- a/cataloguing/value_builder/dateaccessioned.pl +++ a/cataloguing/value_builder/dateaccessioned.pl @@ -21,13 +21,12 @@ # along with Koha; if not, see . 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 = <{$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'}; --- a/circ/circulation.pl +++ a/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'), --- a/circ/overdue.pl +++ a/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, --- a/circ/renew.pl +++ a/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' ); --- a/circ/reserveratios.pl +++ a/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' --- a/circ/returns.pl +++ a/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); - # 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{}; + # 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); } } @@ -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); --- a/circ/transferstoreceive.pl +++ a/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, ); --- a/circ/waitingreserves.pl +++ a/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, ); --- a/clubs/clubs-add-modify.pl +++ a/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( --- a/installer/onboarding.pl +++ a/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( { --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ a/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: '', prevArrow: '', 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("") .attr("autocomplete", "off") --- a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc @@ -1,6 +1,5 @@ [% USE Koha %] [% USE Branches %] -[% USE KohaDates %] [% PROCESS 'html_helpers.inc' %]
  1. @@ -106,11 +105,11 @@
  2. - +
    [% INCLUDE 'date-format.inc' %]
  3. - +
    [% INCLUDE 'date-format.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -117,13 +117,13 @@ [% hold.notes | html | html_line_break %] [% IF Koha.Preference('AllowHoldDateInFuture') %] - + [% ELSE %] [% hold.date | $KohaDates %] [% END %] - + [%- IF ( hold.found ) -%] @@ -224,7 +224,7 @@ [% IF Koha.Preference('AutoResumeSuspendedHolds') %] - + [%- ELSE -%] [%- END -%] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -69,7 +69,7 @@ [% IF readonly %] [% shipmentdate | $KohaDates %] [% ELSE %] - +
[% INCLUDE 'date-format.inc' %]
[% END %] @@ -79,7 +79,7 @@ [% IF readonly %] [% billingdate | $KohaDates %] [% ELSE %] - +
[% INCLUDE 'date-format.inc' %]
[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -326,12 +326,12 @@
  1. - +
    [% INCLUDE 'date-format.inc' %]
  2. - +
    [% INCLUDE 'date-format.inc' %]
@@ -343,12 +343,12 @@
  1. - +
    [% INCLUDE 'date-format.inc' %]
  2. - +
    [% INCLUDE 'date-format.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -277,7 +277,7 @@
  1. - +
    [% INCLUDE 'date-format.inc' %]
  2. +
    [% INCLUDE 'date-format.inc' %]
  3. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt @@ -189,14 +189,14 @@
  4. - + Required
    [% INCLUDE 'date-format.inc' %]
  5. - + Required
    [% INCLUDE 'date-format.inc' %]
  6. @@ -259,14 +259,14 @@
    1. - + Required
      [% INCLUDE 'date-format.inc' %]
    2. - + Required
      [% INCLUDE 'date-format.inc' %]
    3. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt @@ -132,12 +132,12 @@
    4.   - + Required
      [% INCLUDE 'date-format.inc' %]
    5.   - + Required
      [% INCLUDE 'date-format.inc' %]
    6. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -157,7 +157,7 @@
    7. - +
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -420,7 +420,7 @@ [% END %] [% IF ( INVALID_DATE ) %] -
  7. The due date "[% INVALID_DATE | html %]" is invalid
  8. +
  9. The due date "[% INVALID_DATE | $KohaDates %]" is invalid
  10. [% END %] [% IF ( UNKNOWN_BARCODE ) %] @@ -680,7 +680,7 @@
    Specify due date [% INCLUDE 'date-format.inc' %]:
    [% IF ( duedatespec ) %] - + [% ELSE %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -113,7 +113,7 @@
    Due date: - +
    [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt @@ -176,11 +176,11 @@
  11. - +
  12. - +
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -271,12 +271,12 @@ - +
  • - +
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -223,7 +223,7 @@
    - +
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt @@ -164,12 +164,12 @@
  • - +
  • - +
  • (inclusive) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -1203,9 +1203,9 @@ [% IF ( riloo.duedate ) %] [% IF ( riloo.return_overdue ) %] - [% riloo.duedate | html %] (overdue) + [% riloo.duedate | $KohaDates as_due_date => 1 %] (overdue) [% ELSE %] - [% riloo.duedate | html %] + [% riloo.duedate | $KohaDates as_due_date => 1 %] [% END %] [% ELSE %] Not checked out --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt @@ -75,12 +75,12 @@
  • - +
  • - +
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt @@ -58,12 +58,12 @@
  • - +
    [% INCLUDE 'date-format.inc' %]
  • - +
    [% INCLUDE 'date-format.inc' %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -793,7 +793,7 @@ [% IF ( itemloo.transfertwhen ) %] In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %], - to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %] + to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | $KohaDates %] [% END %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt @@ -54,7 +54,7 @@ [% END %]
  • - + Required
    [% INCLUDE 'date-format.inc' %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt @@ -166,15 +166,15 @@ [% IF ( missingissue.status44 ) %]Missing (lost)[% END %] [% IF ( missingissue.status7 ) %]Claimed[% END %] - - [% missingissue.planneddate | html %] + + [% missingissue.planneddate | $KohaDates %] [% missingissue.publisheddate | $KohaDates %] [% missingissue.claims_count | html %] - - [% missingissue.claimdate | html %] + + [% missingissue.claimdate | $KohaDates %] [% FOR field IN additional_fields_for_subscription %] [% IF field.authorised_value_category %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -289,7 +289,7 @@
  • - +
  • [% INCLUDE 'additional-fields-entry.inc' available=additional_fields_for_subscription values=additional_field_filters wrap_fieldset=0 %] @@ -404,7 +404,7 @@
  • - +
  • [% FOR field IN additional_fields_for_subscription %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -302,7 +302,7 @@ fieldset.rows table { clear: none; margin: 0; }
  • [% UNLESS (more_than_one_serial) %] - + [% ELSE %] [% firstacquidate | $KohaDates %] @@ -312,7 +312,7 @@ fieldset.rows table { clear: none; margin: 0; } [% IF (more_than_one_serial) %]
  • - +
  • [% END %]
  • @@ -366,11 +366,11 @@ fieldset.rows table { clear: none; margin: 0; }
  • - +
  • - +
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt @@ -41,14 +41,14 @@ Subscription start date - (start date of the 1st subscription) + (start date of the 1st subscription)
    [% INCLUDE 'date-format.inc' %]
    Subscription end date - (if empty, subscription is still active) + (if empty, subscription is still active)
    [% INCLUDE 'date-format.inc' %]
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -500,7 +500,7 @@ - [% INCLUDE 'date-format.inc' %] + [% INCLUDE 'date-format.inc' %] @@ -517,7 +517,7 @@ - [% INCLUDE 'date-format.inc' %] + [% INCLUDE 'date-format.inc' %] @@ -547,7 +547,7 @@
  • - [% INCLUDE 'date-format.inc' %] + [% INCLUDE 'date-format.inc' %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt +++ a/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 ) %]
    [% FOREACH message_loo IN message_loop %] - [% IF ( message_loo.date_from ) %]Error: "Date from" is not a legal value ("[% message_loo.date_from | html %]"). - [% ELSIF ( message_loo.date_to ) %]Error: "Date to" is not a legal value ("[% message_loo.date_to | html %]"). - [% ELSIF ( message_loo.failed_ok ) %]Error: Failed to approve term ([% message_loo.failed_ok | html %]). + [% IF ( message_loo.failed_ok ) %]Error: Failed to approve term ([% message_loo.failed_ok | html %]). [% ELSIF ( message_loo.failed_rej ) %]Error: Failed to reject term ([% message_loo.failed_rej | html %]). [% ELSIF ( message_loo.approver ) %]No match for user ([% message_loo.approver | html %]). FILTER REQUIRES BORROWERNUMBER (not name). [% ELSIF ( message_loo.approved_by ) %]Error: No match for borrowernumber ([% message_loo.approved_by | html %]). --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -224,12 +224,12 @@ [% END %]
  • - +
    [% INCLUDE 'date-format.inc' %]
  • - +
    [% INCLUDE 'date-format.inc' %] [% IF category == 'news' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt +++ a/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 %]"; } /** --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -85,7 +85,7 @@
    Parameters
      -
    1. +
    2. @@ -185,7 +185,7 @@

    3. - + (Skip records marked as seen on or after this date.)
    4. --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ a/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(); --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -424,7 +424,7 @@ [% IF ( itemLoo.dateDue ) %] Due [% itemLoo.dateDue | $KohaDates as_due_date => 1 %] [% ELSIF ( itemLoo.transfertwhen ) %] - In transit from [% Branches.GetName( itemLoo.transfertfrom ) | html %] to [% Branches.GetName( itemLoo.transfertto ) | html %] since [% itemLoo.transfertwhen | html %] + In transit from [% Branches.GetName( itemLoo.transfertfrom ) | html %] to [% Branches.GetName( itemLoo.transfertto ) | html %] since [% itemLoo.transfertwhen | $KohaDates %] [% END %] [% IF ( itemLoo.message ) %] --- a/labels/label-item-search.pl +++ a/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,21 +66,13 @@ 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; - } + $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; - } + $ccl_query .= ' AND ' if ( $ccl_textbox || $datefrom ); + $ccl_query .= "acqdate,le,st-date-normalized=" . $dateto; } my $offset = $startfrom > 1 ? $startfrom - 1 : 0; --- a/members/housebound.pl +++ a/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{}, --- a/members/memberentry.pl +++ a/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 ); } --- a/misc/cronjobs/fines.pl +++ a/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++; --- a/misc/cronjobs/serialsUpdate.pl +++ a/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 ); --- a/misc/cronjobs/staticfines.pl +++ a/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 ); --- a/opac/opac-memberentry.pl +++ a/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'; --- a/opac/opac-reserve.pl +++ a/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; @@ -545,7 +544,7 @@ foreach my $biblioNum (@biblionumbers) { my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itemNum); if ( $transfertwhen && ($transfertwhen ne '') ) { - $itemLoopIter->{transfertwhen} = output_pref({ dt => dt_from_string($transfertwhen), dateonly => 1 }); + $itemLoopIter->{transfertwhen} = $transfertwhen; $itemLoopIter->{transfertfrom} = $transfertfrom; $itemLoopIter->{transfertto} = $transfertto; $itemLoopIter->{nocancel} = 1; --- a/opac/opac-suggestions.pl +++ a/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; } --- a/pos/register.pl +++ a/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' ) { --- a/reports/acquisitions_stats.pl +++ a/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{filter} = @$filters[$i]; $cell{crit} = $i; push @loopfilter, \%cell; } --- a/reports/bor_issues_top.pl +++ a/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]; --- a/reports/borrowers_out.pl +++ a/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"); --- a/reports/borrowers_stats.pl +++ a/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"; } --- a/reports/cash_register_stats.pl +++ a/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 --- a/reports/cat_issues_top.pl +++ a/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{filter} .= @$filters[$i]; $cell{crit} .="Issue From" if ($i==0); $cell{crit} .="Issue To" if ($i==1); $cell{crit} .="Return From" if ($i==2); --- a/reports/dictionary.pl +++ a/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'"; } --- a/reports/guided_reports.pl +++ a/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"; --- a/reports/issues_avg_stats.pl +++ a/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{filter} .= @$filters[$i]; $cell{crit} .="Issue From" if ($i==0); $cell{crit} .="Issue To" if ($i==1); $cell{crit} .="Issue Month" if ($i==2); --- a/reports/issues_stats.pl +++ a/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{filter} = @$filters[$i]; $cell{crit} = $i; push @loopfilter, \%cell; --- a/reports/orders_by_fund.pl +++ a/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'}; --- a/reports/reserves_stats.pl +++ a/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; --- a/reserve/modrequest.pl +++ a/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 { --- a/reserve/request.pl +++ a/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, --- a/serials/serials-edit.pl +++ a/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' ) { --- a/serials/serials-search.pl +++ a/serials/serials-search.pl @@ -88,7 +88,6 @@ for my $field ( @additional_fields ) { } } -my $expiration_date_dt = $expiration_date ? dt_from_string( $expiration_date ) : undef; my @subscriptions; my $mana_statuscode; if ($searched){ @@ -115,7 +114,7 @@ if ($searched){ branch => $branch, additional_fields => \@additional_field_filters, location => $location, - expiration_date => $expiration_date_dt, + expiration_date => $expiration_date, }); } } @@ -133,7 +132,7 @@ if ($mana) { bookseller_filter => $bookseller, branch_filter => $branch, location_filter => $location, - expiration_date_filter => $expiration_date_dt, + expiration_date_filter => $expiration_date, done_searched => $searched, routing => $routing, additional_field_filters => \@additional_field_filters, @@ -187,7 +186,7 @@ else bookseller_filter => $bookseller, branch_filter => $branch, location_filter => $location, - expiration_date_filter => $expiration_date_dt, + expiration_date_filter => $expiration_date, branches_loop => \@branches_loop, done_searched => $searched, routing => $routing, --- a/serials/showpredictionpattern.pl +++ a/serials/showpredictionpattern.pl @@ -36,7 +36,7 @@ use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); use C4::Serials qw( GetSubscription GetFictiveIssueNumber GetSeq GetSubscriptionIrregularities GetNextDate GetNextSeq ); use C4::Serials::Frequency; -use Koha::DateUtils qw( dt_from_string output_pref ); +use Koha::DateUtils qw( dt_from_string ); my $input = CGI->new; my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { @@ -90,16 +90,11 @@ my %pattern = ( every3 => scalar $input->param('every3') // '', ); -$firstacquidate = eval { output_pref( { str => $firstacquidate, dateonly => 1, dateformat => 'iso' } ); } - or output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); +$firstacquidate = $firstacquidate ? dt_from_string($firstacquidate)->ymd : dt_from_string->ymd; -$enddate = eval { output_pref( { str => $enddate, dateonly => 1, dateformat => 'iso' } ); }; +$enddate = dt_from_string($enddate)->ymd; -if($nextacquidate) { - $nextacquidate = eval { output_pref( { str => $nextacquidate, dateonly => 1, dateformat => 'iso' } ); }; -} else { - $nextacquidate = $firstacquidate; -} +$nextacquidate = $nextacquidate ? dt_from_string($nextacquidate)->ymd : $firstacquidate; my $date = $nextacquidate; my %subscription = ( @@ -112,7 +107,7 @@ my %subscription = ( innerloop3 => scalar $input->param('innerloop3') // '', irregularity => '', countissuesperunit => 1, - firstacquidate => $firstacquidate, + firstacquidate => $firstacquidate->ymd, ); my $issuenumber; --- a/suggestion/suggestion.pl +++ a/suggestion/suggestion.pl @@ -165,6 +165,7 @@ if ( $op =~ /save/i ) { else { for my $date_key ( qw( suggesteddate manageddate accepteddate rejecteddate ) ) { + # FIXME Do we need this? $suggestion_only->{$date_key} = dt_from_string( $suggestion_only->{$date_key} ) if $suggestion_only->{$date_key}; } --- a/t/db_dependent/Reserves.t +++ a/t/db_dependent/Reserves.t @@ -356,7 +356,6 @@ $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); my $resdate= dt_from_string(); $resdate->add_duration(DateTime::Duration->new(days => 4)); -$resdate=output_pref($resdate); my $reserve_id = AddReserve( { branchcode => $branch_1, @@ -397,7 +396,7 @@ my $now_reserve_id = AddReserve( borrowernumber => $requesters{$branch_1}, biblionumber => $bibnum, priority => 2, - reservation_date => output_pref(dt_from_string()), + reservation_date => dt_from_string(), } ); my $which_highest; @@ -441,7 +440,6 @@ t::lib::Mocks::mock_preference('ConfirmFutureHolds', 2); t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); $resdate= dt_from_string(); $resdate->add_duration(DateTime::Duration->new(days => 2)); -$resdate=output_pref($resdate); AddReserve( { branchcode => $branch_1, @@ -530,7 +528,7 @@ AddReserve( borrowernumber => $requesters{'CPL2'}, biblionumber => $bibnum, priority => $p, - reservation_date => output_pref($resdate), + reservation_date => $resdate, } ); $p = C4::Reserves::CalculatePriority($bibnum); @@ -564,14 +562,14 @@ AddReserve({ borrowernumber => $borrowernumber_tmp_1, biblionumber => $bibnum, priority => 3, - reservation_date => output_pref($date_in_future) + reservation_date => $date_in_future }); AddReserve({ branchcode => 'CPL', borrowernumber => $borrowernumber_tmp_2, biblionumber => $bibnum, priority => 4, - reservation_date => output_pref($date_in_future) + reservation_date => $date_in_future }); my @r1 = Koha::Holds->search({ borrowernumber => $borrowernumber_tmp_1 })->as_list; my @r2 = Koha::Holds->search({ borrowernumber => $borrowernumber_tmp_2 })->as_list; @@ -729,7 +727,6 @@ is( $status, '', 'MoveReserve filled waiting hold'); # hold from A pos 1, tomorrow, no fut holds: not filled $resdate= dt_from_string(); $resdate->add_duration(DateTime::Duration->new(days => 1)); -$resdate=output_pref($resdate); AddReserve( { branchcode => $branch_1, @@ -773,7 +770,6 @@ is( $status, '', 'MoveReserve filled future waiting hold now'); # hold from A pos 1, today+3, fut holds=2: MoveReserve should not fill it $resdate= dt_from_string(); $resdate->add_duration(DateTime::Duration->new(days => 3)); -$resdate=output_pref($resdate); AddReserve( { branchcode => $branch_1, --- a/t/db_dependent/Serials.t +++ a/t/db_dependent/Serials.t @@ -306,17 +306,17 @@ subtest 'test_updateClaim' => sub { is($result_1, 2, 'Got the expected 2 from update claim with 2 serial ids'); my @late_or_missing_issues_1_0 = C4::Serials::GetLateOrMissingIssues(undef, $serial1->serialid); - is($late_or_missing_issues_1_0[0]->{claimdate}, $today, 'Got the expected first different claim date from update claim'); + is(output_pref({str => $late_or_missing_issues_1_0[0]->{claimdate}, dateonly => 1}), $today, 'Got the expected first different claim date from update claim'); is($late_or_missing_issues_1_0[0]->{claims_count}, $claim_count_1+1, 'Got the expected first claim count from update claim'); is($late_or_missing_issues_1_0[0]->{status}, 7, 'Got the expected first claim status from update claim'); my @late_or_missing_issues_1_1 = C4::Serials::GetLateOrMissingIssues(undef, $serial2->serialid); - is($late_or_missing_issues_1_1[0]->{claimdate}, $today, 'Got the expected second different claim date from update claim'); + is(output_pref({str => $late_or_missing_issues_1_1[0]->{claimdate}, dateonly => 1}), $today, 'Got the expected second different claim date from update claim'); is($late_or_missing_issues_1_1[0]->{claims_count}, $claim_count_1+1, 'Got the expected second claim count from update claim'); is($late_or_missing_issues_1_1[0]->{status}, 7, 'Got the expected second claim status from update claim'); my @late_or_missing_issues_1_2 = C4::Serials::GetLateOrMissingIssues(undef, $serial3->serialid); - is($late_or_missing_issues_1_2[0]->{claimdate}, output_pref({ dt => $claimdate_1, dateonly => 1}), 'Got the expected unchanged claim date from update claim'); + is(output_pref({str => $late_or_missing_issues_1_2[0]->{claimdate}, dateonly => 1}), output_pref({ dt => $claimdate_1, dateonly => 1}), 'Got the expected unchanged claim date from update claim'); is($late_or_missing_issues_1_2[0]->{claims_count}, $claim_count_1, 'Got the expected unchanged claim count from update claim'); is($late_or_missing_issues_1_2[0]->{status}, 3, 'Got the expected unchanged claim status from update claim'); }; --- a/tags/review.pl +++ a/tags/review.pl @@ -26,7 +26,6 @@ use CGI::Cookie; # need to check cookies before having CGI parse the POST re use URI::Escape qw( uri_escape_utf8 ); use C4::Auth qw( check_cookie_auth get_template_and_user ); use C4::Context; -use Koha::DateUtils qw( dt_from_string output_pref ); use C4::Output qw( output_with_http_headers is_ajax pagination_bar output_html_with_http_headers ); use C4::Tags qw( approval_counts @@ -162,23 +161,15 @@ if ($filter = $input->param('tag')) { $template->param(filter_tag=>$filter); $filters{term} = $filter; } -if ($filter = $input->param('from')) { - $date_from = eval { output_pref( { dt => dt_from_string( $filter ), dateonly => 1, dateformat => 'iso' } ); }; - if ( $date_from ) { - $template->param(filter_date_approved_from=>$filter); - $filters{date_approved} = ">=$date_from"; - } else { - push @errors, {date_from=>$filter}; - } +if ( $filter = $input->param('from') ) { + $date_from = $filter; + $template->param( filter_date_approved_from => $filter ); + $filters{date_approved} = ">=$date_from"; } -if ($filter = $input->param('to')) { - $date_to = eval { output_pref( { dt => dt_from_string( $filter ), dateonly => 1, dateformat => 'iso' } ); }; - if ( $date_to ) { - $template->param(filter_date_approved_to=>$filter); - $filters{date_approved} = "<=$date_to"; - } else { - push @errors, {date_to=>$filter}; - } +if ( $filter = $input->param('to') ) { + $date_to = $filter; + $template->param( filter_date_approved_to => $filter ); + $filters{date_approved} = "<=$date_to"; } if ($filter = $input->param('approver')) { # name (or borrowernumber) from input box if ($filter =~ /^\d+$/ and $filter > 0) { --- a/tools/additional-contents.pl +++ a/tools/additional-contents.pl @@ -91,11 +91,8 @@ elsif ( $op eq 'add_validate' ) { my @lang = $cgi->multi_param('lang'); - my $expirationdate; - if ( $cgi->param('expirationdate') ) { - $expirationdate = dt_from_string( scalar $cgi->param('expirationdate') ); - } - my $published_on = dt_from_string( scalar $cgi->param('published_on') ); + my $expirationdate = $cgi->param('expirationdate'); + my $published_on = $cgi->param('published_on'); my $number = $cgi->param('number'); my $original_default = $idnew ? Koha::AdditionalContents->find($idnew) : undef; --- a/tools/batchMod.pl +++ a/tools/batchMod.pl @@ -31,7 +31,6 @@ use List::MoreUtils qw( uniq ); use Encode qw( encode_utf8 ); use Koha::Database; -use Koha::DateUtils qw( dt_from_string ); use Koha::Exception; use Koha::Biblios; use Koha::Items; --- a/tools/batch_extend_due_dates.pl +++ a/tools/batch_extend_due_dates.pl @@ -25,7 +25,7 @@ use CGI; use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); use Koha::Checkouts; -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') // q|form|; @@ -107,19 +107,13 @@ elsif ( $op eq 'list' ) { if ($preview_results) { push( @new_due_dates, - output_pref( + calc_new_due_date( { - dt => calc_new_due_date( - { - due_date => - dt_from_string( $checkout->date_due ), - new_hard_due_date => $new_hard_due_date, - add_days => $due_date_days - } - ), - dateformat => 'iso' + due_date => dt_from_string( $checkout->date_due ), + new_hard_due_date => $new_hard_due_date, + add_days => $due_date_days } - ) + ), ); } else { push( @issue_ids, $checkout->id ); @@ -129,9 +123,7 @@ elsif ( $op eq 'list' ) { if ( $preview_results ) { $template->param( checkouts => $checkouts, - new_hard_due_date => $new_hard_due_date - ? dt_from_string($new_hard_due_date) - : undef, + new_hard_due_date => $new_hard_due_date, due_date_days => $due_date_days, new_due_dates => \@new_due_dates, view => 'list', --- a/tools/cleanborrowers.pl +++ a/tools/cleanborrowers.pl @@ -37,7 +37,6 @@ use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); use C4::Members qw( GetBorrowersToExpunge ); -use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::Old::Checkouts; use Koha::Patron::Categories; use Koha::Patrons; @@ -53,22 +52,12 @@ my $params = $cgi->Vars; my $step = $params->{step} || 1; my $not_borrowed_since = # the date which filter on issue history. - $params->{not_borrowed_since} - ? dt_from_string $params->{not_borrowed_since} - : undef; + $params->{not_borrowed_since}; my $last_issue_date = # the date which filter on borrowers last issue. - $params->{last_issue_date} - ? dt_from_string $params->{last_issue_date} - : undef; -my $borrower_dateexpiry = - $params->{borrower_dateexpiry} - ? dt_from_string $params->{borrower_dateexpiry} - : undef; -my $borrower_lastseen = - $params->{borrower_lastseen} - ? dt_from_string $params->{borrower_lastseen} - : undef; + $params->{last_issue_date}; my $patron_list_id = $params->{patron_list_id}; +my $borrower_dateexpiry = $params->{borrower_dateexpiry}; +my $borrower_lastseen = $params->{borrower_lastseen}; my $borrower_categorycode = $params->{'borrower_categorycode'} || q{}; @@ -211,21 +200,9 @@ sub _get_selection_params { $borrower_categorycode, $patron_list_id, $branch) = @_; my $params = {}; - $params->{not_borrowed_since} = output_pref({ - dt => $not_borrowed_since, - dateformat => 'iso', - dateonly => 1 - }) if $not_borrowed_since; - $params->{expired_before} = output_pref({ - dt => $borrower_dateexpiry, - dateformat => 'iso', - dateonly => 1 - }) if $borrower_dateexpiry; - $params->{last_seen} = output_pref({ - dt => $borrower_lastseen, - dateformat => 'iso', - dateonly => 1 - }) if $borrower_lastseen; + $params->{not_borrowed_since} = $not_borrowed_since; + $params->{expired_before} = $borrower_dateexpiry; + $params->{last_seen} = $borrower_lastseen; $params->{category_code} = $borrower_categorycode if $borrower_categorycode; $params->{patron_list_id} = $patron_list_id if $patron_list_id; --- a/tools/holidays.pl +++ a/tools/holidays.pl @@ -39,6 +39,7 @@ my ($template, $loggedinuser, $cookie) # calendardate - date passed in url for human readability (syspref) # if the url has an invalid date default to 'now.' +# FIXME There is something to improve in the date handling here my $calendarinput_dt = eval { dt_from_string( scalar $input->param('calendardate') ); } || dt_from_string; my $calendardate = output_pref( { dt => $calendarinput_dt, dateonly => 1 } ); --- a/tools/inventory.pl +++ a/tools/inventory.pl @@ -36,7 +36,7 @@ use C4::Reports::Guided qw( ); use C4::Charset qw( NormalizeString ); use Koha::Biblios; -use Koha::DateUtils qw( dt_from_string output_pref ); +use Koha::DateUtils qw( dt_from_string ); use Koha::Database::Columns; use Koha::AuthorisedValues; use Koha::BiblioFrameworks; @@ -247,7 +247,7 @@ if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length } } } - $template->param( date => output_pref ( { str => $date, dateformat => 'iso' } ) ); + $template->param( date => $date ); $template->param( errorloop => \@errorloop ) if (@errorloop); } --- a/tools/scheduler.pl +++ a/tools/scheduler.pl @@ -24,7 +24,7 @@ use C4::Reports::Guided qw( get_saved_reports ); use C4::Auth qw( get_template_and_user ); use CGI qw ( -utf8 ); use C4::Output qw( output_html_with_http_headers ); -use Koha::DateUtils qw( dt_from_string output_pref );; +use Koha::DateUtils qw( dt_from_string );; my $input = CGI->new; my $base; @@ -52,11 +52,7 @@ my $id = $input->param('id'); if ( $mode eq 'job_add' ) { - # Retrieving the date according to the dateformat syspref - my $c4date = output_pref({ dt => dt_from_string( scalar $input->param('startdate') ), dateformat => 'iso', dateonly => 1 }); - - # Formatting it for Schedule::At - my $startdate = join('', (split /-/, $c4date)); + my $startdate = dt_from_string( scalar $input->param('startdate') )->ymd; my $starttime = $input->param('starttime'); $starttime =~ s/\://g; --