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

(-)a/C4/Reserves.pm (+12 lines)
Lines 1974-1979 sub RevertWaitingStatus { Link Here
1974
    WHERE
1974
    WHERE
1975
      reserve_id = ?
1975
      reserve_id = ?
1976
    ";
1976
    ";
1977
    if ( C4::Context->preference('HideReserveExpiration') ){
1978
        $query = "
1979
        UPDATE reserves
1980
        SET
1981
          priority = 1,
1982
          found = NULL,
1983
          waitingdate = NULL,
1984
          expirationdate = NULL
1985
        WHERE
1986
          reserve_id = ?
1987
        ";
1988
    }
1977
    $sth = $dbh->prepare( $query );
1989
    $sth = $dbh->prepare( $query );
1978
    $sth->execute( $reserve->{'reserve_id'} );
1990
    $sth->execute( $reserve->{'reserve_id'} );
1979
1991
(-)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('HideReserveExpiration') ){
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-HideReserveExpiration-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 ( "HideReserveExpiration", 0, NULL, "Hide expiration date in reserves module.", "YesNo" ) });
4
5
    SetVersion( $DBversion );
6
    print "Upgrade to $DBversion done (Bug 24194 - HideReserveExpiration system preference)\n";
7
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 210-215 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
210
('GoogleOpenIDConnectDomain', '', NULL, 'Restrict Google OpenID Connect to this domain (or subdomains of this domain). Leave blank for all Google domains', 'Free'),
210
('GoogleOpenIDConnectDomain', '', NULL, 'Restrict Google OpenID Connect to this domain (or subdomains of this domain). Leave blank for all Google domains', 'Free'),
211
('hidelostitems','0','','If ON, disables display of\"lost\" items in OPAC.','YesNo'),
211
('hidelostitems','0','','If ON, disables display of\"lost\" items in OPAC.','YesNo'),
212
('HidePatronName','0','','If this is switched on, patron\'s cardnumber will be shown instead of their name on the holds and catalog screens','YesNo'),
212
('HidePatronName','0','','If this is switched on, patron\'s cardnumber will be shown instead of their name on the holds and catalog screens','YesNo'),
213
('HideReserveExpiration', 0, NULL, 'Hide expiration date in reserves module.', 'YesNo'),
213
('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'),
214
('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'),
214
('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'),
215
('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'),
215
('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch\'s items to emphasize. If PatronBranch, emphasize the logged in user\'s library\'s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha\'s Apache configuration file.','Choice'),
216
('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch\'s items to emphasize. If PatronBranch, emphasize the logged in user\'s library\'s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha\'s Apache configuration file.','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 157-162 Circulation: Link Here
157
                  yes: Allow
157
                  yes: Allow
158
                  no: "Don't allow"
158
                  no: "Don't allow"
159
            - patrons to submit notes about checked out items.
159
            - patrons to submit notes about checked out items.
160
        -
161
            - pref: HideReserveExpiration
162
              choices:
163
                  yes: Hide
164
                  no: "Don't hide"
165
            - expiration date options for reserves.
160
166
161
    Checkout Policy:
167
    Checkout Policy:
162
        -
168
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-6 / +8 lines)
Lines 455-466 Link Here
455
                                </li>
455
                                </li>
456
                            [% END %]
456
                            [% END %]
457
457
458
                            <li>
458
                            [% IF !Koha.Preference('HideReserveExpiration') %]
459
                                <label for="to">Hold expires on date:</label>
459
                                <li>
460
                                <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
460
                                    <label for="to">Hold expires on date:</label>
461
                                <input type="hidden" class="datepickerto_hidden" />
461
                                    <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
462
                                <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
462
                                    <input type="hidden" class="datepickerto_hidden" />
463
                            </li>
463
                                    <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
464
                                </li>
465
                            [% END %]
464
466
465
                            [% UNLESS ( multi_hold ) %]
467
                            [% UNLESS ( multi_hold ) %]
466
                                <li>
468
                                <li>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-6 / +7 lines)
Lines 267-277 Link Here
267
                                                    </li>
267
                                                    </li>
268
                                                [% END %]
268
                                                [% END %]
269
269
270
                                                <li>
270
                                                [% IF !Koha.Preference('HideReserveExpiration') %]
271
                                                    <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label>
271
                                                    <li>
272
                                                    <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="holddateto" />
272
                                                        <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label>
273
                                                    <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
273
                                                        <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="holddateto" />
274
                                                </li>
274
                                                        <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
275
                                                    </li>
276
                                                [% END %]
275
277
276
                                                [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
278
                                                [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
277
                                                    [% itemtypes = [] %]
279
                                                    [% itemtypes = [] %]
278
- 

Return to bug 24194