Browse Source

Bug 30718: Use flatpickr's altInput

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

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

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

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

13
C4/Acquisition.pm

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

1
C4/Barcodes/annual.pm

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

1
C4/Barcodes/hbyymmincr.pm

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

34
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,
});
}
}

23
C4/ILSDI/Services.pm

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

8
C4/Items.pm

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

2
C4/Letters.pm

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

1
C4/Members.pm

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

6
C4/Overdues.pm

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

3
C4/Reports/Guided.pm

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

15
C4/Reserves.pm

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

1
C4/Search/History.pm

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

45
C4/Serials.pm

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

6
Koha/Hold.pm

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

6
Koha/Item.pm

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

1
Koha/Patrons/Import.pm

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

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

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

34
Koha/REST/V1/Holds.pm

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

20
Koha/Report.pm

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

8
acqui/duplicate_orders.pl

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

6
acqui/histsearch.pl

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

4
acqui/invoice.pl

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

15
acqui/invoices.pl

@ -34,7 +34,7 @@ use C4::Output qw( output_html_with_http_headers );
use C4::Acquisition qw( GetInvoices GetInvoice );
use C4::Budgets qw( GetBudget GetBudgets CanUserUseBudget );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Acquisition::Booksellers;
my $input = CGI->new;
@ -62,20 +62,15 @@ my $branch = $input->param('branch');
my $message_id = $input->param('message_id');
my $op = $input->param('op');
$shipmentdatefrom and $shipmentdatefrom = eval { dt_from_string( $shipmentdatefrom ) };
$shipmentdateto and $shipmentdateto = eval { dt_from_string( $shipmentdateto ) };
$billingdatefrom and $billingdatefrom = eval { dt_from_string( $billingdatefrom ) };
$billingdateto and $billingdateto = eval { dt_from_string( $billingdateto ) };
my $invoices = [];
if ( $op and $op eq 'do_search' ) {
@{$invoices} = GetInvoices(
invoicenumber => $invoicenumber,
supplierid => $supplierid,
shipmentdatefrom => $shipmentdatefrom ? output_pref( { str => $shipmentdatefrom, dateformat => 'iso' } ) : undef,
shipmentdateto => $shipmentdateto ? output_pref( { str => $shipmentdateto, dateformat => 'iso' } ) : undef,
billingdatefrom => $billingdatefrom ? output_pref( { str => $billingdatefrom, dateformat => 'iso' } ) : undef,
billingdateto => $billingdateto ? output_pref( { str => $billingdateto, dateformat => 'iso' } ) : undef,
shipmentdatefrom => $shipmentdatefrom,
shipmentdateto => $shipmentdateto,
billingdatefrom => $billingdatefrom,
billingdateto => $billingdateto,
isbneanissn => $isbneanissn,
title => $title,
author => $author,

32
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 )
: ()
)
},

2
acqui/orderreceive.pl

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

7
acqui/parcels.pl

@ -75,7 +75,7 @@ use C4::Acquisition qw( GetInvoices GetInvoice AddInvoice );
use C4::Budgets qw( GetBudgetHierarchy GetBudget CanUserUseBudget );
use Koha::Acquisition::Booksellers;
use Koha::DateUtils qw( output_pref dt_from_string );
use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new;
my $booksellerid = $input->param('booksellerid');
@ -100,7 +100,6 @@ my $invoicenumber = $input->param('invoice');
my $shipmentcost = $input->param('shipmentcost');
my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid');
my $shipmentdate = $input->param('shipmentdate');
$shipmentdate and $shipmentdate = output_pref({ str => $shipmentdate, dateformat => 'iso', dateonly => 1 });
if ( $op and $op eq 'new' ) {
if ( C4::Context->preference('AcqWarnOnDuplicateInvoice') ) {
@ -140,8 +139,8 @@ my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
my @parcels = GetInvoices(
supplierid => $booksellerid,
invoicenumber => $code,
( $datefrom ? ( shipmentdatefrom => output_pref({ dt => dt_from_string($datefrom), dateformat => 'iso' }) ) : () ),
( $dateto ? ( shipmentdateto => output_pref({ dt => dt_from_string($dateto), dateformat => 'iso' }) ) : () ),
( $datefrom ? ( shipmentdatefrom => $datefrom ) : () ),
( $dateto ? ( shipmentdateto => $dateto ) : () ),
order_by => $order
);
my $count_parcels = @parcels;

9
admin/aqbudgetperiods.pl

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

20
admin/aqcontract.pl

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

11
admin/categories.pl

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

5
admin/smart-rules.pl

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

1
cataloguing/additem.pl

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

4
cataloguing/value_builder/barcode.pl

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

4
cataloguing/value_builder/barcode_manual.pl

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

3
cataloguing/value_builder/dateaccessioned.pl

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

4
circ/branchoverdues.pl

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

6
circ/circulation.pl

@ -45,7 +45,7 @@ use Koha::AuthorisedValues;
use Koha::CsvProfiles;
use Koha::Patrons;
use Koha::Patron::Debarments qw( GetDebarments );
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::DateUtils qw( dt_from_string );
use Koha::Plugins;
use Koha::Database;
use Koha::BiblioFrameworks;
@ -159,8 +159,6 @@ for my $barcode ( @$barcodes ) {
my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate');