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

(-)a/C4/Reserves.pm (-5 / +21 lines)
Lines 187-196 sub AddReserve { Link Here
187
    my $itemtype       = $params->{itemtype};
187
    my $itemtype       = $params->{itemtype};
188
    my $non_priority   = $params->{non_priority};
188
    my $non_priority   = $params->{non_priority};
189
189
190
    $resdate = output_pref( { str => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' })
190
    if ( C4::Context->preference('HourBasedHolds') ){
191
        or output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
191
        if ( $resdate ){
192
192
            $resdate = dt_from_string( $resdate )->set_second( 00 );
193
    $expdate = output_pref({ str => $expdate, dateonly => 1, dateformat => 'iso' });
193
        } else {
194
            $resdate = dt_from_string();
195
        }
196
        if ( $expdate ){
197
            $expdate = dt_from_string( $expdate )->set_second( 59 );
198
        }
199
    } else {
200
        # add hour and minute components
201
        if ( $resdate ){
202
            $resdate = dt_from_string( $resdate )->set({ hour => 00, minute => 00, second => 00 });
203
        } else {
204
            $resdate = dt_from_string();
205
        }
206
        if ( $expdate ){
207
            $expdate = dt_from_string( $expdate )->set({ hour => 23, minute => 59, second => 59 });
208
        }
209
    }
194
210
195
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
211
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
196
    # of the document, we force the value $priority and $found .
212
    # of the document, we force the value $priority and $found .
Lines 906-912 sub CancelExpiredReserves { Link Here
906
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
922
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
907
923
908
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
924
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
909
    my $params = { expirationdate => { '<', $dtf->format_date($today) } };
925
    my $params = { expirationdate => { '<', $today } };
910
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
926
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
911
927
912
    # FIXME To move to Koha::Holds->search_expired (?)
928
    # 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 (-5 / +13 lines)
Lines 108-121 Link Here
108
            </td>
108
            </td>
109
109
110
            <td>[% hold.notes | html | html_line_break %]</td>
110
            <td>[% hold.notes | html | html_line_break %]</td>
111
            <td>
111
112
            [% IF Koha.Preference('HourBasedHolds') %]
112
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
113
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
113
                    <input type="text" class="datepicker" value="[% hold.date | $KohaDates %]" required="required" size="10" name="reservedate" />
114
                    <td><input type="text" class="holdstablefrom" value="[% hold.date | $KohaDates with_hours = 1 | html %]" required="required" size="15" name="reservedate" /></td>
114
                [% ELSE %]
115
                [% ELSE %]
115
                    [% hold.date | $KohaDates %]
116
                    <td>[% hold.date | $KohaDates with_hours = 1 | html %]</td>
116
                [% END %]
117
                [% END %]
117
            </td>
118
                <td><input type="text" class="holdstableto" value="[% hold.expirationdate | $KohaDates with_hours = 1 | html %]" size="15" name="expirationdate" /></td>
118
            <td><input type="text" class="datepickerto" value="[% hold.expirationdate | $KohaDates %]" size="10" name="expirationdate" /></td>
119
            [% ELSE %]
120
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
121
                    <td><input type="text" class="datepicker" value="[% hold.date | $KohaDates | html %]" required="required" size="10" name="reservedate" /></td>
122
                [% ELSE %]
123
                    <td>[% hold.date | $KohaDates | html %]</td>
124
                [% END %]
125
                <td><input type="text" class="datepicker" value="[% hold.expirationdate | $KohaDates | html %]" size="10" name="expirationdate" /></td>
126
            [% END %]
119
127
120
            <td>
128
            <td>
121
                [% IF ( hold.found ) %]
129
                [% IF ( hold.found ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-4 / +27 lines)
Lines 439-445 Link Here
439
                            [% IF ( reserve_in_future ) %]
439
                            [% IF ( reserve_in_future ) %]
440
                                <li>
440
                                <li>
441
                                    <label for="from">Hold starts on date:</label>
441
                                    <label for="from">Hold starts on date:</label>
442
                                    <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
442
                                    [% IF Koha.Preference('HourBasedHolds') %]
443
                                        <input name="reserve_date" id="from" size="15" type="text">
444
                                    [% ELSE %]
445
                                        <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
446
                                    [% END %]
443
                                    <input type="hidden" class="datepickerfrom_hidden" />
447
                                    <input type="hidden" class="datepickerfrom_hidden" />
444
                                    <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
448
                                    <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
445
                                </li>
449
                                </li>
Lines 447-453 Link Here
447
451
448
                            <li>
452
                            <li>
449
                                <label for="to">Hold expires on date:</label>
453
                                <label for="to">Hold expires on date:</label>
450
                                <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
454
                                [% IF Koha.Preference('HourBasedHolds') %]
455
                                    <input name="expiration_date" id="to" size="15" type="text">
456
                                [% ELSE %]
457
                                    <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
458
                                [% END %]
451
                                <input type="hidden" class="datepickerto_hidden" />
459
                                <input type="hidden" class="datepickerto_hidden" />
452
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
460
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
453
                            </li>
461
                            </li>
Lines 985-990 Link Here
985
    [% INCLUDE 'columns_settings.inc' %]
993
    [% INCLUDE 'columns_settings.inc' %]
986
    [% Asset.js("lib/hc-sticky.js") | $raw %]
994
    [% Asset.js("lib/hc-sticky.js") | $raw %]
987
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
995
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
996
    [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
997
    [% INCLUDE 'timepicker.inc' %]
988
    <script>
998
    <script>
989
        var Sticky;
999
        var Sticky;
990
        var biblionumber = "[% biblionumber | $raw %]";
1000
        var biblionumber = "[% biblionumber | $raw %]";
Lines 1054-1060 Link Here
1054
            [% END %]
1064
            [% END %]
1055
1065
1056
            [% IF AutoResumeSuspendedHolds %]
1066
            [% IF AutoResumeSuspendedHolds %]
1057
                $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
1067
                [% IF Koha.Preference('HourBasedHolds') %]
1068
                    $(".suspend_until_datepicker").datepicker("option", "minDate", 1);
1069
                    $("#from, #to, .holdstablefrom, .holdstableto").datetimepicker({
1070
                         onClose: function(dateText, inst) {
1071
                            validate_date(dateText, inst);
1072
                        },
1073
                        minDate: 0,
1074
                        hour: 23,
1075
                        minute: 59
1076
                    }).on("change", function(e) {
1077
                        if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
1078
                    });
1079
                [% ELSE %]
1080
                    $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
1081
                [% END %]
1058
            [% END %]
1082
            [% END %]
1059
1083
1060
            $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1084
            $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1061
- 

Return to bug 24718