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

(-)a/C4/Reserves.pm (-8 / +20 lines)
Lines 1987-2000 sub RevertWaitingStatus { Link Here
1987
    $sth = $dbh->prepare( $query );
1987
    $sth = $dbh->prepare( $query );
1988
    $sth->execute( $reserve->{'biblionumber'} );
1988
    $sth->execute( $reserve->{'biblionumber'} );
1989
1989
1990
    $hold->set(
1990
    if ( C4::Context->preference('DisableReserveExpiration') ){
1991
        {
1991
        $hold->set(
1992
            priority    => 1,
1992
            {
1993
            found       => undef,
1993
                priority    => 1,
1994
            waitingdate => undef,
1994
                found       => undef,
1995
            itemnumber  => $hold->item_level_hold ? $hold->itemnumber : undef,
1995
                waitingdate => undef,
1996
        }
1996
                expirationdate => undef,
1997
    )->store();
1997
                itemnumber  => $hold->item_level_hold ? $hold->itemnumber : undef,
1998
            }
1999
        )->store();
2000
    } else {
2001
        $hold->set(
2002
            {
2003
                priority    => 1,
2004
                found       => undef,
2005
                waitingdate => undef,
2006
                itemnumber  => $hold->item_level_hold ? $hold->itemnumber : undef,
2007
            }
2008
        )->store();
2009
    }
1998
2010
1999
    _FixPriority( { biblionumber => $reserve->{biblionumber} } );
2011
    _FixPriority( { biblionumber => $reserve->{biblionumber} } );
2000
2012
(-)a/Koha/Hold.pm (-16 / +18 lines)
Lines 171-197 sub set_waiting { Link Here
171
        waitingdate => $today->ymd,
171
        waitingdate => $today->ymd,
172
    };
172
    };
173
173
174
    my $requested_expiration;
174
    unless ( C4::Context->preference('DisableReserveExpiration') ){
175
    if ($self->expirationdate) {
175
        my $requested_expiration;
176
        $requested_expiration = dt_from_string($self->expirationdate);
176
        if ($self->expirationdate) {
177
    }
177
            $requested_expiration = dt_from_string($self->expirationdate);
178
        }
179
180
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
181
        my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
182
        my $calendar = Koha::Calendar->new( branchcode => $self->branchcode );
178
183
179
    my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
184
        my $expirationdate = $today->clone;
180
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
185
        $expirationdate->add(days => $max_pickup_delay);
181
    my $calendar = Koha::Calendar->new( branchcode => $self->branchcode );
182
186
183
    my $expirationdate = $today->clone;
187
        if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
184
    $expirationdate->add(days => $max_pickup_delay);
188
            $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
189
        }
185
190
186
    if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
191
        # If patron's requested expiration date is prior to the
187
        $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
192
        # calculated one, we keep the patron's one.
193
        my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0;
194
        $values->{expirationdate} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd;
188
    }
195
    }
189
196
190
    # If patron's requested expiration date is prior to the
191
    # calculated one, we keep the patron's one.
192
    my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0;
193
    $values->{expirationdate} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd;
194
195
    $self->set($values)->store();
197
    $self->set($values)->store();
196
198
197
    return $self;
199
    return $self;
(-)a/installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl (+7 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ( "DisableReserveExpiration", 0, NULL, "Disable the use of expiration date in reserves module.", "YesNo" ) });
4
5
    SetVersion( $DBversion );
6
    print "Upgrade to $DBversion done (Bug 24194 - DisableReserveExpiration system preference)\n";
7
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 155-160 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
155
('DefaultToLoggedInLibraryNoticesSlips',  '0', NULL ,  'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.',  'YesNo'),
155
('DefaultToLoggedInLibraryNoticesSlips',  '0', NULL ,  'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.',  'YesNo'),
156
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
156
('DefaultToLoggedInLibraryOverdueTriggers',  '0', NULL ,  'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.',  'YesNo'),
157
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
157
('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
158
('DisableReserveExpiration', 0, NULL, 'Disable the use of expiration date in reserves module.', 'YesNo'),
158
('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','Choice'),
159
('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','Choice'),
159
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
160
('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
160
('displayFacetCount','0',NULL,NULL,'YesNo'),
161
('displayFacetCount','0',NULL,NULL,'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 156-161 Circulation: Link Here
156
                  yes: Allow
156
                  yes: Allow
157
                  no: "Don't allow"
157
                  no: "Don't allow"
158
            - patrons to submit notes about checked out items.
158
            - patrons to submit notes about checked out items.
159
        -
160
            - pref: DisableReserveExpiration
161
              choices:
162
                  yes: Disable
163
                  no: "Don't disable"
164
            - the use of expiration dates in reserves.
159
165
160
    Checkout Policy:
166
    Checkout Policy:
161
        -
167
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-6 / +8 lines)
Lines 453-464 Link Here
453
                                </li>
453
                                </li>
454
                            [% END %]
454
                            [% END %]
455
455
456
                            <li>
456
                            [% IF !Koha.Preference('DisableReserveExpiration') %]
457
                                <label for="to">Hold expires on date:</label>
457
                                <li>
458
                                <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
458
                                    <label for="to">Hold expires on date:</label>
459
                                <input type="hidden" class="datepickerto_hidden" />
459
                                    <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
460
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
460
                                    <input type="hidden" class="datepickerto_hidden" />
461
                            </li>
461
                                    <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
462
                                </li>
463
                            [% END %]
462
464
463
                            [% UNLESS ( multi_hold ) %]
465
                            [% UNLESS ( multi_hold ) %]
464
                                <li>
466
                                <li>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-6 / +7 lines)
Lines 278-288 Link Here
278
                                                    </li>
278
                                                    </li>
279
                                                [% END %]
279
                                                [% END %]
280
280
281
                                                <li>
281
                                                [% IF !Koha.Preference('DisableReserveExpiration') %]
282
                                                    <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label>
282
                                                    <li>
283
                                                    <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="holddateto" />
283
                                                        <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label>
284
                                                    <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
284
                                                        <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="holddateto" />
285
                                                </li>
285
                                                        <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
286
                                                    </li>
287
                                                [% END %]
286
288
287
                                                [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
289
                                                [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
288
                                                    [% itemtypes = [] %]
290
                                                    [% itemtypes = [] %]
289
- 

Return to bug 24194