Bugzilla – Attachment 110085 Details for
Bug 24718
Introduce hour-based holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24718: Get reservedate and expirationdate to use datetime
Bug-24718-Get-reservedate-and-expirationdate-to-us.patch (text/plain), 9.04 KB, created by
Aleisha Amohia
on 2020-09-15 01:59:28 UTC
(
hide
)
Description:
Bug 24718: Get reservedate and expirationdate to use datetime
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2020-09-15 01:59:28 UTC
Size:
9.04 KB
patch
obsolete
>From 0e67e63d8b100c215270e29b9a9bbb8a22cd2c16 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Mon, 3 Feb 2020 01:31:14 +0000 >Subject: [PATCH] Bug 24718: Get reservedate and expirationdate to use datetime > >Sponsored-by: Waikato Institute of Technology > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Reserves.pm | 26 +++++++++++++++---- > .../bug24718_use_datetime_for_reserves.perl | 15 +++++++++++ > .../intranet-tmpl/prog/en/includes/holds_table.inc | 18 +++++++++---- > .../prog/en/modules/reserve/request.tt | 30 +++++++++++++++++++--- > 4 files changed, 76 insertions(+), 13 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug24718_use_datetime_for_reserves.perl > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 8d7dcbc611..4156b4c856 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -187,10 +187,26 @@ 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' }); >- >- $expdate = output_pref({ str => $expdate, dateonly => 1, dateformat => 'iso' }); >+ if ( C4::Context->preference('HourBasedHolds') ){ >+ if ( $resdate ){ >+ $resdate = dt_from_string( $resdate )->set_second( 00 ); >+ } else { >+ $resdate = dt_from_string(); >+ } >+ if ( $expdate ){ >+ $expdate = dt_from_string( $expdate )->set_second( 59 ); >+ } >+ } else { >+ # add hour and minute components >+ if ( $resdate ){ >+ $resdate = dt_from_string( $resdate )->set({ hour => 00, minute => 00, second => 00 }); >+ } else { >+ $resdate = dt_from_string(); >+ } >+ if ( $expdate ){ >+ $expdate = dt_from_string( $expdate )->set({ hour => 23, minute => 59, second => 59 }); >+ } >+ } > > # 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 . >@@ -906,7 +922,7 @@ sub CancelExpiredReserves { > my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); > > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >- my $params = { expirationdate => { '<', $dtf->format_date($today) } }; >+ my $params = { expirationdate => { '<', $today } }; > $params->{found} = [ { '!=', 'W' }, undef ] unless $expireWaiting; > > # FIXME To move to Koha::Holds->search_expired (?) >diff --git a/installer/data/mysql/atomicupdate/bug24718_use_datetime_for_reserves.perl b/installer/data/mysql/atomicupdate/bug24718_use_datetime_for_reserves.perl >new file mode 100644 >index 0000000000..f07fd091ed >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug24718_use_datetime_for_reserves.perl >@@ -0,0 +1,15 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ if( column_exists( 'reserves', 'reservedate' ) ) { >+ $dbh->do(q{ALTER TABLE reserves MODIFY column reservedate datetime}); >+ } >+ >+ if( column_exists( 'reserves', 'expirationdate' ) ) { >+ $dbh->do(q{ALTER TABLE reserves MODIFY column expirationdate datetime}); >+ } >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 24718 - Use datetime for reserves.reservedate and reserves.expirationdate)\n"; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index f3aed75062..a88a6f10f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -108,14 +108,22 @@ > </td> > > <td>[% hold.notes | html | html_line_break %]</td> >- <td> >+ >+ [% IF Koha.Preference('HourBasedHolds') %] > [% IF Koha.Preference('AllowHoldDateInFuture') %] >- <input type="text" class="datepicker" value="[% hold.date | $KohaDates %]" required="required" size="10" name="reservedate" /> >+ <td><input type="text" class="holdstablefrom" value="[% hold.date | $KohaDates with_hours = 1 | html %]" required="required" size="15" name="reservedate" /></td> > [% ELSE %] >- [% hold.date | $KohaDates %] >+ <td>[% hold.date | $KohaDates with_hours = 1 | html %]</td> > [% END %] >- </td> >- <td><input type="text" class="datepickerto" value="[% hold.expirationdate | $KohaDates %]" size="10" name="expirationdate" /></td> >+ <td><input type="text" class="holdstableto" value="[% hold.expirationdate | $KohaDates with_hours = 1 | html %]" size="15" name="expirationdate" /></td> >+ [% ELSE %] >+ [% IF Koha.Preference('AllowHoldDateInFuture') %] >+ <td><input type="text" class="datepicker" value="[% hold.date | $KohaDates | html %]" required="required" size="10" name="reservedate" /></td> >+ [% ELSE %] >+ <td>[% hold.date | $KohaDates | html %]</td> >+ [% END %] >+ <td><input type="text" class="datepicker" value="[% hold.expirationdate | $KohaDates | html %]" size="10" name="expirationdate" /></td> >+ [% END %] > > <td> > [% IF ( hold.found ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 984a71c415..3623d99056 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -439,7 +439,11 @@ > [% IF ( reserve_in_future ) %] > <li> > <label for="from">Hold starts on date:</label> >- <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" > >+ [% IF Koha.Preference('HourBasedHolds') %] >+ <input name="reserve_date" id="from" size="15" type="text"> >+ [% ELSE %] >+ <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" > >+ [% END %] > <input type="hidden" class="datepickerfrom_hidden" /> > <a href="#" id="clear-date-from" class="clear-date">Clear date</a> > </li> >@@ -447,7 +451,11 @@ > > <li> > <label for="to">Hold expires on date:</label> >- <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" /> >+ [% IF Koha.Preference('HourBasedHolds') %] >+ <input name="expiration_date" id="to" size="15" type="text"> >+ [% ELSE %] >+ <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" /> >+ [% END %] > <input type="hidden" class="datepickerto_hidden" /> > <a href="#" id="clear-date-to" class="clear-date">Clear date</a> > </li> >@@ -985,6 +993,8 @@ > [% INCLUDE 'columns_settings.inc' %] > [% Asset.js("lib/hc-sticky.js") | $raw %] > [% Asset.js("js/circ-patron-search-results.js") | $raw %] >+ [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %] >+ [% INCLUDE 'timepicker.inc' %] > <script> > var Sticky; > var biblionumber = "[% biblionumber | $raw %]"; >@@ -1054,7 +1064,21 @@ > [% END %] > > [% IF AutoResumeSuspendedHolds %] >- $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1); >+ [% IF Koha.Preference('HourBasedHolds') %] >+ $(".suspend_until_datepicker").datepicker("option", "minDate", 1); >+ $("#from, #to, .holdstablefrom, .holdstableto").datetimepicker({ >+ onClose: function(dateText, inst) { >+ validate_date(dateText, inst); >+ }, >+ minDate: 0, >+ hour: 23, >+ minute: 59 >+ }).on("change", function(e) { >+ if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} >+ }); >+ [% ELSE %] >+ $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1); >+ [% END %] > [% END %] > > $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden"); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24718
:
99540
|
99541
|
99542
|
99543
|
99544
|
99545
|
99548
|
103521
|
103522
|
103549
|
103550
|
103551
|
103552
|
103553
|
103554
|
103555
|
106270
|
106271
|
106272
|
106273
|
106274
|
106275
|
110084
|
110085
|
110086
|
110087
|
110088
|
110089
|
110090
|
110091
|
110098
|
110137
|
110161
|
110303
|
126559
|
126560
|
126561
|
126562
|
126563
|
126564
|
148293
|
148294
|
148295
|
148296
|
148297
|
148298
|
162474
|
162475
|
162476
|
162477
|
162478
|
162479