View | Details | Raw Unified | Return to bug 24718
Collapse All | Expand All

(-)a/C4/Reserves.pm (-5 / +21 lines)
Lines 185-194 sub AddReserve { Link Here
185
    my $found          = $params->{found};
185
    my $found          = $params->{found};
186
    my $itemtype       = $params->{itemtype};
186
    my $itemtype       = $params->{itemtype};
187
187
188
    $resdate = output_pref( { str => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' })
188
    if ( C4::Context->preference('HourBasedHolds') ){
189
        or output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
189
        if ( $resdate ){
190
190
            $resdate = dt_from_string( $resdate )->set_second( 00 );
191
    $expdate = output_pref({ str => $expdate, dateonly => 1, dateformat => 'iso' });
191
        } else {
192
            $resdate = dt_from_string();
193
        }
194
        if ( $expdate ){
195
            $expdate = dt_from_string( $expdate )->set_second( 59 );
196
        }
197
    } else {
198
        # add hour and minute components
199
        if ( $resdate ){
200
            $resdate = dt_from_string( $resdate )->set({ hour => 00, minute => 00, second => 00 });
201
        } else {
202
            $resdate = dt_from_string();
203
        }
204
        if ( $expdate ){
205
            $expdate = dt_from_string( $expdate )->set({ hour => 23, minute => 59, second => 59 });
206
        }
207
    }
192
208
193
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
209
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
194
    # of the document, we force the value $priority and $found .
210
    # of the document, we force the value $priority and $found .
Lines 886-892 sub CancelExpiredReserves { Link Here
886
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
902
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
887
903
888
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
904
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
889
    my $params = { expirationdate => { '<', $dtf->format_date($today) } };
905
    my $params = { expirationdate => { '<', $today } };
890
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
906
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
891
907
892
    # FIXME To move to Koha::Holds->search_expired (?)
908
    # FIXME To move to Koha::Holds->search_expired (?)
(-)a/installer/data/mysql/atomicupdate/bug24718_use_datetime_for_reserves.perl (+15 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    if( column_exists( 'reserves', 'reservedate' ) ) {
5
        $dbh->do(q{ALTER TABLE reserves MODIFY column reservedate datetime});
6
    }
7
8
    if( column_exists( 'reserves', 'expirationdate' ) ) {
9
        $dbh->do(q{ALTER TABLE reserves MODIFY column expirationdate datetime});
10
    }
11
12
    # Always end with this (adjust the bug info)
13
    SetVersion( $DBversion );
14
    print "Upgrade to $DBversion done (Bug 24718 - Use datetime for reserves.reservedate and reserves.expirationdate)\n";
15
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-6 / +12 lines)
Lines 106-120 Link Here
106
            </td>
106
            </td>
107
107
108
            <td>[% hold.notes | html %]</td>
108
            <td>[% hold.notes | html %]</td>
109
            <td>
109
            [% IF Koha.Preference('HourBasedHolds') %]
110
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
110
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
111
                    <input type="text" class="datepicker" value="[% hold.date | $KohaDates %]" required="required" size="10" name="reservedate" />
111
                    <td><input type="text" class="holdstablefrom" value="[% hold.date | $KohaDates with_hours = 1 | html %]" required="required" size="15" name="reservedate" /></td>
112
                [% ELSE %]
112
                [% ELSE %]
113
                    [% hold.date | $KohaDates %]
113
                    <td>[% hold.date | $KohaDates with_hours = 1 | html %]</td>
114
                [% END %]
114
                [% END %]
115
            </td>
115
                <td><input type="text" class="holdstableto" value="[% hold.expirationdate | $KohaDates with_hours = 1 | html %]" size="15" name="expirationdate" /></td>
116
            <td><input type="text" class="datepicker" value="[% hold.expirationdate | $KohaDates %]" size="10" name="expirationdate" /></td>
116
            [% ELSE %]
117
117
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
118
                    <td><input type="text" class="datepicker" value="[% hold.date | $KohaDates | html %]" required="required" size="10" name="reservedate" /></td>
119
                [% ELSE %]
120
                    <td>[% hold.date | $KohaDates | html %]</td>
121
                [% END %]
122
                <td><input type="text" class="datepicker" value="[% hold.expirationdate | $KohaDates | html %]" size="10" name="expirationdate" /></td>
123
            [% END %]
118
            <td>
124
            <td>
119
                [% IF ( hold.found ) %]
125
                [% IF ( hold.found ) %]
120
                    [% IF ( hold.atdestination ) %]
126
                    [% IF ( hold.atdestination ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-4 / +27 lines)
Lines 435-441 Link Here
435
                            [% IF ( reserve_in_future ) %]
435
                            [% IF ( reserve_in_future ) %]
436
                                <li>
436
                                <li>
437
                                    <label for="from">Hold starts on date:</label>
437
                                    <label for="from">Hold starts on date:</label>
438
                                    <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
438
                                    [% IF Koha.Preference('HourBasedHolds') %]
439
                                        <input name="reserve_date" id="from" size="15" type="text">
440
                                    [% ELSE %]
441
                                        <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
442
                                    [% END %]
439
                                    <input type="hidden" class="datepickerfrom_hidden" />
443
                                    <input type="hidden" class="datepickerfrom_hidden" />
440
                                    <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
444
                                    <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
441
                                </li>
445
                                </li>
Lines 443-449 Link Here
443
447
444
                            <li>
448
                            <li>
445
                                <label for="to">Hold expires on date:</label>
449
                                <label for="to">Hold expires on date:</label>
446
                                <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
450
                                [% IF Koha.Preference('HourBasedHolds') %]
451
                                    <input name="expiration_date" id="to" size="15" type="text">
452
                                [% ELSE %]
453
                                    <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
454
                                [% END %]
447
                                <input type="hidden" class="datepickerto_hidden" />
455
                                <input type="hidden" class="datepickerto_hidden" />
448
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
456
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
449
                            </li>
457
                            </li>
Lines 935-940 Link Here
935
    [% INCLUDE 'calendar.inc' %]
943
    [% INCLUDE 'calendar.inc' %]
936
    [% INCLUDE 'columns_settings.inc' %]
944
    [% INCLUDE 'columns_settings.inc' %]
937
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
945
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
946
    [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
947
    [% INCLUDE 'timepicker.inc' %]
938
    <script>
948
    <script>
939
        var biblionumber = "[% biblionumber | $raw %]";
949
        var biblionumber = "[% biblionumber | $raw %]";
940
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
950
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
Lines 995-1001 Link Here
995
            [% END %]
1005
            [% END %]
996
1006
997
            [% IF AutoResumeSuspendedHolds %]
1007
            [% IF AutoResumeSuspendedHolds %]
998
                $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
1008
                [% IF Koha.Preference('HourBasedHolds') %]
1009
                    $(".suspend_until_datepicker").datepicker("option", "minDate", 1);
1010
                    $("#from, #to, .holdstablefrom, .holdstableto").datetimepicker({
1011
                         onClose: function(dateText, inst) {
1012
                            validate_date(dateText, inst);
1013
                        },
1014
                        minDate: 0,
1015
                        hour: 23,
1016
                        minute: 59
1017
                    }).on("change", function(e) {
1018
                        if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
1019
                    });
1020
                [% ELSE %]
1021
                    $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
1022
                [% END %]
999
            [% END %]
1023
            [% END %]
1000
1024
1001
            $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1025
            $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1002
- 

Return to bug 24718