#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
- my $calendar = Koha::Calendar->new( branchcode => $self->branchcode );
my $expirationdate = $today->clone;
$expirationdate->add(days => $max_pickup_delay);
if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
+ my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype;
+ my $useDaysMode_value = Koha::CirculationRules->get_useDaysMode_effective_value(
+ {
+ categorycode => $self->borrower->categorycode,
+ itemtype => $itemtype,
+ branchcode => $self->branchcode,
+ }
+ );
+ my $calendar = Koha::Calendar->new( branchcode => $self->branchcode, days_mode => $useDaysMode_value );
+
$expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
}
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
interface => C4::Context->interface,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
- type => 'hold_expired',
+ type => 'RESERVE_EXPIRED',
item_id => $self->itemnumber
}
);
return Koha::Old::Hold->new( $hold_infos )->store;
}
-=head3 type
+=head3 to_api_mapping
+
+This method returns the mapping for representing a Koha::Hold object
+on the API.
+
+=cut
+
+sub to_api_mapping {
+ return {
+ reserve_id => 'hold_id',
+ borrowernumber => 'patron_id',
+ reservedate => 'hold_date',
+ biblionumber => 'biblio_id',
+ branchcode => 'pickup_library_id',
+ notificationdate => undef,
+ reminderdate => undef,
+ cancellationdate => 'cancellation_date',
+ reservenotes => 'notes',
+ found => 'status',
+ itemnumber => 'item_id',
+ waitingdate => 'waiting_date',
+ expirationdate => 'expiration_date',
+ lowestPriority => 'lowest_priority',
+ suspend => 'suspended',
+ suspend_until => 'suspended_until',
+ itemtype => 'item_type',
+ item_level_hold => 'item_level',
+ };
+}
+
+=head2 Internal methods
+
+=head3 _type
=cut