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

(-)a/C4/Reserves.pm (-5 / +21 lines)
Lines 184-193 sub AddReserve { Link Here
184
    my $found          = $params->{found};
184
    my $found          = $params->{found};
185
    my $itemtype       = $params->{itemtype};
185
    my $itemtype       = $params->{itemtype};
186
186
187
    $resdate = output_pref( { str => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' })
187
    if ( C4::Context->preference('HourBasedHolds') ){
188
        or output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
188
        if ( $resdate ){
189
189
            $resdate = dt_from_string( $resdate )->set_second( 00 );
190
    $expdate = output_pref({ str => $expdate, dateonly => 1, dateformat => 'iso' });
190
        } else {
191
            $resdate = dt_from_string();
192
        }
193
        if ( $expdate ){
194
            $expdate = dt_from_string( $expdate )->set_second( 59 );
195
        }
196
    } else {
197
        # add hour and minute components
198
        if ( $resdate ){
199
            $resdate = dt_from_string( $resdate )->set({ hour => 00, minute => 00, second => 00 });
200
        } else {
201
            $resdate = dt_from_string();
202
        }
203
        if ( $expdate ){
204
            $expdate = dt_from_string( $expdate )->set({ hour => 23, minute => 59, second => 59 });
205
        }
206
    }
191
207
192
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
208
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
193
    # of the document, we force the value $priority and $found .
209
    # of the document, we force the value $priority and $found .
Lines 884-890 sub CancelExpiredReserves { Link Here
884
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
900
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
885
901
886
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
902
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
887
    my $params = { expirationdate => { '<', $dtf->format_date($today) } };
903
    my $params = { expirationdate => { '<', $today } };
888
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
904
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
889
905
890
    # FIXME To move to Koha::Holds->search_expired (?)
906
    # 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 450-456 Link Here
450
                            [% IF ( reserve_in_future ) %]
450
                            [% IF ( reserve_in_future ) %]
451
                                <li>
451
                                <li>
452
                                    <label for="from">Hold starts on date:</label>
452
                                    <label for="from">Hold starts on date:</label>
453
                                    <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
453
                                    [% IF Koha.Preference('HourBasedHolds') %]
454
                                        <input name="reserve_date" id="from" size="15" type="text">
455
                                    [% ELSE %]
456
                                        <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
457
                                    [% END %]
454
                                    <input type="hidden" class="datepickerfrom_hidden" />
458
                                    <input type="hidden" class="datepickerfrom_hidden" />
455
                                    <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
459
                                    <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
456
                                </li>
460
                                </li>
Lines 458-464 Link Here
458
462
459
                            <li>
463
                            <li>
460
                                <label for="to">Hold expires on date:</label>
464
                                <label for="to">Hold expires on date:</label>
461
                                <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
465
                                [% IF Koha.Preference('HourBasedHolds') %]
466
                                    <input name="expiration_date" id="to" size="15" type="text">
467
                                [% ELSE %]
468
                                    <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
469
                                [% END %]
462
                                <input type="hidden" class="datepickerto_hidden" />
470
                                <input type="hidden" class="datepickerto_hidden" />
463
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
471
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
464
                            </li>
472
                            </li>
Lines 950-955 Link Here
950
    [% INCLUDE 'calendar.inc' %]
958
    [% INCLUDE 'calendar.inc' %]
951
    [% INCLUDE 'columns_settings.inc' %]
959
    [% INCLUDE 'columns_settings.inc' %]
952
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
960
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
961
    [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
962
    [% INCLUDE 'timepicker.inc' %]
953
    <script>
963
    <script>
954
        var biblionumber = "[% biblionumber | $raw %]";
964
        var biblionumber = "[% biblionumber | $raw %]";
955
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
965
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
Lines 1005-1011 Link Here
1005
            [% END %]
1015
            [% END %]
1006
1016
1007
            [% IF AutoResumeSuspendedHolds %]
1017
            [% IF AutoResumeSuspendedHolds %]
1008
                $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
1018
                [% IF Koha.Preference('HourBasedHolds') %]
1019
                    $(".suspend_until_datepicker").datepicker("option", "minDate", 1);
1020
                    $("#from, #to, .holdstablefrom, .holdstableto").datetimepicker({
1021
                         onClose: function(dateText, inst) {
1022
                            validate_date(dateText, inst);
1023
                        },
1024
                        minDate: 0,
1025
                        hour: 23,
1026
                        minute: 59
1027
                    }).on("change", function(e) {
1028
                        if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
1029
                    });
1030
                [% ELSE %]
1031
                    $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
1032
                [% END %]
1009
            [% END %]
1033
            [% END %]
1010
1034
1011
            $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1035
            $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1012
- 

Return to bug 24718