|
Lines 67-77
sub age {
Link Here
|
| 67 |
my $age; |
67 |
my $age; |
| 68 |
|
68 |
|
| 69 |
if ( $use_calendar ) { |
69 |
if ( $use_calendar ) { |
| 70 |
my $calendar = Koha::Calendar->new( branchcode => $self->branchcode ); |
70 |
my $calendar = Koha::Calendar->new( branchcode => $self->pickup_library_id ); |
| 71 |
$age = $calendar->days_between( dt_from_string( $self->reservedate ), $today ); |
71 |
$age = $calendar->days_between( dt_from_string( $self->created_date ), $today ); |
| 72 |
} |
72 |
} |
| 73 |
else { |
73 |
else { |
| 74 |
$age = $today->delta_days( dt_from_string( $self->reservedate ) ); |
74 |
$age = $today->delta_days( dt_from_string( $self->created_date ) ); |
| 75 |
} |
75 |
} |
| 76 |
|
76 |
|
| 77 |
$age = $age->in_units( 'days' ); |
77 |
$age = $age->in_units( 'days' ); |
|
Lines 91-101
sub suspend_hold {
Link Here
|
| 91 |
my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef; |
91 |
my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef; |
| 92 |
|
92 |
|
| 93 |
if ( $self->is_found ) { # We can't suspend found holds |
93 |
if ( $self->is_found ) { # We can't suspend found holds |
| 94 |
if ( $self->is_waiting ) { |
94 |
if ( $self->is_waiting or |
| 95 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'W' ); |
95 |
$self->is_in_transit ) { |
| 96 |
} |
96 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => $self->status ); |
| 97 |
elsif ( $self->is_in_transit ) { |
|
|
| 98 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'T' ); |
| 99 |
} |
97 |
} |
| 100 |
elsif ( $self->is_in_processing ) { |
98 |
elsif ( $self->is_in_processing ) { |
| 101 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'P' ); |
99 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'P' ); |
|
Lines 104-120
sub suspend_hold {
Link Here
|
| 104 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( |
102 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( |
| 105 |
'Unhandled data exception on found hold (id=' |
103 |
'Unhandled data exception on found hold (id=' |
| 106 |
. $self->id |
104 |
. $self->id |
| 107 |
. ', found=' |
105 |
. ', status=' |
| 108 |
. $self->found |
106 |
. $self->status |
| 109 |
. ')' ); |
107 |
. ')' ); |
| 110 |
} |
108 |
} |
| 111 |
} |
109 |
} |
| 112 |
|
110 |
|
| 113 |
$self->suspend(1); |
111 |
$self->suspended(1); |
| 114 |
$self->suspend_until($date); |
112 |
$self->suspended_until_date($date); |
| 115 |
$self->store(); |
113 |
$self->store(); |
| 116 |
|
114 |
|
| 117 |
logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper( $self->unblessed ) ) |
115 |
logaction( 'HOLDS', 'SUSPEND', $self->id, Dumper( $self->unblessed ) ) |
| 118 |
if C4::Context->preference('HoldsLog'); |
116 |
if C4::Context->preference('HoldsLog'); |
| 119 |
|
117 |
|
| 120 |
return $self; |
118 |
return $self; |
|
Lines 129-140
my $hold = $hold->resume();
Link Here
|
| 129 |
sub resume { |
127 |
sub resume { |
| 130 |
my ( $self ) = @_; |
128 |
my ( $self ) = @_; |
| 131 |
|
129 |
|
| 132 |
$self->suspend(0); |
130 |
$self->suspended(0); |
| 133 |
$self->suspend_until( undef ); |
131 |
$self->suspended_until_date( undef ); |
| 134 |
|
132 |
|
| 135 |
$self->store(); |
133 |
$self->store(); |
| 136 |
|
134 |
|
| 137 |
logaction( 'HOLDS', 'RESUME', $self->reserve_id, Dumper($self->unblessed) ) |
135 |
logaction( 'HOLDS', 'RESUME', $self->id, Dumper($self->unblessed) ) |
| 138 |
if C4::Context->preference('HoldsLog'); |
136 |
if C4::Context->preference('HoldsLog'); |
| 139 |
|
137 |
|
| 140 |
return $self; |
138 |
return $self; |
|
Lines 151-157
sub delete {
Link Here
|
| 151 |
|
149 |
|
| 152 |
my $deleted = $self->SUPER::delete($self); |
150 |
my $deleted = $self->SUPER::delete($self); |
| 153 |
|
151 |
|
| 154 |
logaction( 'HOLDS', 'DELETE', $self->reserve_id, Dumper($self->unblessed) ) |
152 |
logaction( 'HOLDS', 'DELETE', $self->id, Dumper($self->unblessed) ) |
| 155 |
if C4::Context->preference('HoldsLog'); |
153 |
if C4::Context->preference('HoldsLog'); |
| 156 |
|
154 |
|
| 157 |
return $deleted; |
155 |
return $deleted; |
|
Lines 165-171
sub set_transfer {
Link Here
|
| 165 |
my ( $self ) = @_; |
163 |
my ( $self ) = @_; |
| 166 |
|
164 |
|
| 167 |
$self->priority(0); |
165 |
$self->priority(0); |
| 168 |
$self->found('T'); |
166 |
$self->status('in_transit'); |
| 169 |
$self->store(); |
167 |
$self->store(); |
| 170 |
|
168 |
|
| 171 |
return $self; |
169 |
return $self; |
|
Lines 182-195
sub set_waiting {
Link Here
|
| 182 |
|
180 |
|
| 183 |
my $today = dt_from_string(); |
181 |
my $today = dt_from_string(); |
| 184 |
my $values = { |
182 |
my $values = { |
| 185 |
found => 'W', |
183 |
status => 'waiting', |
| 186 |
waitingdate => $today->ymd, |
184 |
waiting_date => $today->ymd, |
| 187 |
desk_id => $desk_id, |
185 |
desk_id => $desk_id, |
| 188 |
}; |
186 |
}; |
| 189 |
|
187 |
|
| 190 |
my $requested_expiration; |
188 |
my $requested_expiration; |
| 191 |
if ($self->expirationdate) { |
189 |
if ($self->expiration_date) { |
| 192 |
$requested_expiration = dt_from_string($self->expirationdate); |
190 |
$requested_expiration = dt_from_string($self->expiration_date); |
| 193 |
} |
191 |
} |
| 194 |
|
192 |
|
| 195 |
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); |
193 |
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); |
|
Lines 202-213
sub set_waiting {
Link Here
|
| 202 |
my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype; |
200 |
my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype; |
| 203 |
my $daysmode = Koha::CirculationRules->get_effective_daysmode( |
201 |
my $daysmode = Koha::CirculationRules->get_effective_daysmode( |
| 204 |
{ |
202 |
{ |
| 205 |
categorycode => $self->borrower->categorycode, |
203 |
categorycode => $self->patron->categorycode, |
| 206 |
itemtype => $itemtype, |
204 |
itemtype => $itemtype, |
| 207 |
branchcode => $self->branchcode, |
205 |
branchcode => $self->pickup_library_id, |
| 208 |
} |
206 |
} |
| 209 |
); |
207 |
); |
| 210 |
my $calendar = Koha::Calendar->new( branchcode => $self->branchcode, days_mode => $daysmode ); |
208 |
my $calendar = Koha::Calendar->new( branchcode => $self->pickup_library_id, days_mode => $daysmode ); |
| 211 |
|
209 |
|
| 212 |
$expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); |
210 |
$expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); |
| 213 |
} |
211 |
} |
|
Lines 215-221
sub set_waiting {
Link Here
|
| 215 |
# If patron's requested expiration date is prior to the |
213 |
# If patron's requested expiration date is prior to the |
| 216 |
# calculated one, we keep the patron's one. |
214 |
# calculated one, we keep the patron's one. |
| 217 |
my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; |
215 |
my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; |
| 218 |
$values->{expirationdate} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd; |
216 |
$values->{expiration_date} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd; |
| 219 |
|
217 |
|
| 220 |
$self->set($values)->store(); |
218 |
$self->set($values)->store(); |
| 221 |
|
219 |
|
|
Lines 242-248
sub is_pickup_location_valid {
Link Here
|
| 242 |
|
240 |
|
| 243 |
my @pickup_locations; |
241 |
my @pickup_locations; |
| 244 |
|
242 |
|
| 245 |
if ( $self->itemnumber ) { # item-level |
243 |
if ( $self->item_id ) { # item-level |
| 246 |
@pickup_locations = $self->item->pickup_locations({ patron => $self->patron }); |
244 |
@pickup_locations = $self->item->pickup_locations({ patron => $self->patron }); |
| 247 |
} |
245 |
} |
| 248 |
else { # biblio-level |
246 |
else { # biblio-level |
|
Lines 269-275
sub set_pickup_location {
Link Here
|
| 269 |
|
267 |
|
| 270 |
if ( $self->is_pickup_location_valid({ library_id => $params->{library_id} }) ) { |
268 |
if ( $self->is_pickup_location_valid({ library_id => $params->{library_id} }) ) { |
| 271 |
# all good, set the new pickup location |
269 |
# all good, set the new pickup location |
| 272 |
$self->branchcode( $params->{library_id} )->store; |
270 |
$self->pickup_library_id( $params->{library_id} )->store; |
| 273 |
} |
271 |
} |
| 274 |
else { |
272 |
else { |
| 275 |
Koha::Exceptions::Hold::InvalidPickupLocation->throw; |
273 |
Koha::Exceptions::Hold::InvalidPickupLocation->throw; |
|
Lines 290-296
sub set_processing {
Link Here
|
| 290 |
my ( $self ) = @_; |
288 |
my ( $self ) = @_; |
| 291 |
|
289 |
|
| 292 |
$self->priority(0); |
290 |
$self->priority(0); |
| 293 |
$self->found('P'); |
291 |
$self->status('processing'); |
| 294 |
$self->store(); |
292 |
$self->store(); |
| 295 |
|
293 |
|
| 296 |
return $self; |
294 |
return $self; |
|
Lines 305-314
Returns true if hold is waiting, in transit or in processing
Link Here
|
| 305 |
sub is_found { |
303 |
sub is_found { |
| 306 |
my ($self) = @_; |
304 |
my ($self) = @_; |
| 307 |
|
305 |
|
| 308 |
return 0 unless $self->found(); |
306 |
if ( |
| 309 |
return 1 if $self->found() eq 'W'; |
307 |
$self->status eq 'waiting' |
| 310 |
return 1 if $self->found() eq 'T'; |
308 |
or $self->status eq 'in_transit' |
| 311 |
return 1 if $self->found() eq 'P'; |
309 |
or $self->status eq 'processing' |
|
|
310 |
) |
| 311 |
{ |
| 312 |
return 1; |
| 313 |
} |
| 314 |
|
| 315 |
return 0; |
| 312 |
} |
316 |
} |
| 313 |
|
317 |
|
| 314 |
=head3 is_waiting |
318 |
=head3 is_waiting |
|
Lines 320-327
Returns true if hold is a waiting hold
Link Here
|
| 320 |
sub is_waiting { |
324 |
sub is_waiting { |
| 321 |
my ($self) = @_; |
325 |
my ($self) = @_; |
| 322 |
|
326 |
|
| 323 |
my $found = $self->found; |
327 |
return $self->status eq 'waiting'; |
| 324 |
return $found && $found eq 'W'; |
|
|
| 325 |
} |
328 |
} |
| 326 |
|
329 |
|
| 327 |
=head3 is_in_transit |
330 |
=head3 is_in_transit |
|
Lines 333-340
Returns true if hold is a in_transit hold
Link Here
|
| 333 |
sub is_in_transit { |
336 |
sub is_in_transit { |
| 334 |
my ($self) = @_; |
337 |
my ($self) = @_; |
| 335 |
|
338 |
|
| 336 |
return 0 unless $self->found(); |
339 |
return $self->status eq 'in_transit'; |
| 337 |
return $self->found() eq 'T'; |
|
|
| 338 |
} |
340 |
} |
| 339 |
|
341 |
|
| 340 |
=head3 is_in_processing |
342 |
=head3 is_in_processing |
|
Lines 346-353
Returns true if hold is a in_processing hold
Link Here
|
| 346 |
sub is_in_processing { |
348 |
sub is_in_processing { |
| 347 |
my ($self) = @_; |
349 |
my ($self) = @_; |
| 348 |
|
350 |
|
| 349 |
return 0 unless $self->found(); |
351 |
return $self->status eq 'processing'; |
| 350 |
return $self->found() eq 'P'; |
|
|
| 351 |
} |
352 |
} |
| 352 |
|
353 |
|
| 353 |
=head3 is_cancelable_from_opac |
354 |
=head3 is_cancelable_from_opac |
|
Lines 378-384
the hold item's holding branch
Link Here
|
| 378 |
sub is_at_destination { |
379 |
sub is_at_destination { |
| 379 |
my ($self) = @_; |
380 |
my ($self) = @_; |
| 380 |
|
381 |
|
| 381 |
return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() ); |
382 |
return $self->is_waiting() && ( $self->pickup_library_id() eq $self->item()->holdingbranch() ); |
| 382 |
} |
383 |
} |
| 383 |
|
384 |
|
| 384 |
=head3 biblio |
385 |
=head3 biblio |
|
Lines 390-396
Returns the related Koha::Biblio object for this hold
Link Here
|
| 390 |
sub biblio { |
391 |
sub biblio { |
| 391 |
my ($self) = @_; |
392 |
my ($self) = @_; |
| 392 |
|
393 |
|
| 393 |
$self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() ); |
394 |
$self->{_biblio} ||= Koha::Biblios->find( $self->biblio_id ); |
| 394 |
|
395 |
|
| 395 |
return $self->{_biblio}; |
396 |
return $self->{_biblio}; |
| 396 |
} |
397 |
} |
|
Lines 417-423
Returns the related Koha::Item object for this Hold
Link Here
|
| 417 |
sub item { |
418 |
sub item { |
| 418 |
my ($self) = @_; |
419 |
my ($self) = @_; |
| 419 |
|
420 |
|
| 420 |
$self->{_item} ||= Koha::Items->find( $self->itemnumber() ); |
421 |
$self->{_item} ||= Koha::Items->find( $self->item_id ); |
| 421 |
|
422 |
|
| 422 |
return $self->{_item}; |
423 |
return $self->{_item}; |
| 423 |
} |
424 |
} |
|
Lines 431-437
Returns the related Koha::Library object for this Hold
Link Here
|
| 431 |
sub branch { |
432 |
sub branch { |
| 432 |
my ($self) = @_; |
433 |
my ($self) = @_; |
| 433 |
|
434 |
|
| 434 |
$self->{_branch} ||= Koha::Libraries->find( $self->branchcode() ); |
435 |
$self->{_branch} ||= Koha::Libraries->find( $self->pickup_library_id ); |
| 435 |
|
436 |
|
| 436 |
return $self->{_branch}; |
437 |
return $self->{_branch}; |
| 437 |
} |
438 |
} |
|
Lines 459-465
Returns the related Koha::Patron object for this Hold
Link Here
|
| 459 |
sub borrower { |
460 |
sub borrower { |
| 460 |
my ($self) = @_; |
461 |
my ($self) = @_; |
| 461 |
|
462 |
|
| 462 |
$self->{_borrower} ||= Koha::Patrons->find( $self->borrowernumber() ); |
463 |
$self->{_borrower} ||= Koha::Patrons->find( $self->patron_id ); |
| 463 |
|
464 |
|
| 464 |
return $self->{_borrower}; |
465 |
return $self->{_borrower}; |
| 465 |
} |
466 |
} |
|
Lines 473-482
my $bool = $hold->is_suspended();
Link Here
|
| 473 |
sub is_suspended { |
474 |
sub is_suspended { |
| 474 |
my ( $self ) = @_; |
475 |
my ( $self ) = @_; |
| 475 |
|
476 |
|
| 476 |
return $self->suspend(); |
477 |
return $self->suspended(); |
| 477 |
} |
478 |
} |
| 478 |
|
479 |
|
| 479 |
|
|
|
| 480 |
=head3 cancel |
480 |
=head3 cancel |
| 481 |
|
481 |
|
| 482 |
my $cancel_hold = $hold->cancel( |
482 |
my $cancel_hold = $hold->cancel( |
|
Lines 487-496
my $cancel_hold = $hold->cancel(
Link Here
|
| 487 |
); |
487 |
); |
| 488 |
|
488 |
|
| 489 |
Cancel a hold: |
489 |
Cancel a hold: |
| 490 |
- The hold will be moved to the old_reserves table with a priority=0 |
490 |
- The hold will be marked as completed, status 'cancelled' and a priority=0 |
| 491 |
- The priority of other holds will be updated |
491 |
- The priority of other holds will be updated |
| 492 |
- The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set |
492 |
- The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set |
| 493 |
- The canceled hold will have the cancellation reason added to old_reserves.cancellation_reason if one is passed in |
493 |
- The canceled hold will have the cancellation reason added to cancellation_reason if one is passed in |
| 494 |
- a CANCEL HOLDS log will be done if the pref HoldsLog is on |
494 |
- a CANCEL HOLDS log will be done if the pref HoldsLog is on |
| 495 |
|
495 |
|
| 496 |
=cut |
496 |
=cut |
|
Lines 499-508
sub cancel {
Link Here
|
| 499 |
my ( $self, $params ) = @_; |
499 |
my ( $self, $params ) = @_; |
| 500 |
$self->_result->result_source->schema->txn_do( |
500 |
$self->_result->result_source->schema->txn_do( |
| 501 |
sub { |
501 |
sub { |
| 502 |
$self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) ); |
502 |
$self->set( |
| 503 |
$self->priority(0); |
503 |
{ |
| 504 |
$self->cancellation_reason( $params->{cancellation_reason} ); |
504 |
completed_date => dt_from_string->strftime('%Y-%m-%d %H:%M:%S'), |
| 505 |
$self->store(); |
505 |
completed => 1, |
|
|
506 |
priority => 0, |
| 507 |
status => 'cancelled', |
| 508 |
cancellation_reason => $params->{cancellation_reason}, |
| 509 |
} |
| 510 |
)->store(); |
| 506 |
|
511 |
|
| 507 |
if ( $params->{cancellation_reason} ) { |
512 |
if ( $params->{cancellation_reason} ) { |
| 508 |
my $letter = C4::Letters::GetPreparedLetter( |
513 |
my $letter = C4::Letters::GetPreparedLetter( |
|
Lines 513-522
sub cancel {
Link Here
|
| 513 |
lang => $self->borrower->lang, |
518 |
lang => $self->borrower->lang, |
| 514 |
tables => { |
519 |
tables => { |
| 515 |
branches => $self->borrower->branchcode, |
520 |
branches => $self->borrower->branchcode, |
| 516 |
borrowers => $self->borrowernumber, |
521 |
borrowers => $self->patron_id, |
| 517 |
items => $self->itemnumber, |
522 |
items => $self->item_id, |
| 518 |
biblio => $self->biblionumber, |
523 |
biblio => $self->biblio_id, |
| 519 |
biblioitems => $self->biblionumber, |
524 |
biblioitems => $self->biblio_id, |
| 520 |
reserves => $self->unblessed, |
525 |
reserves => $self->unblessed, |
| 521 |
} |
526 |
} |
| 522 |
); |
527 |
); |
|
Lines 524-548
sub cancel {
Link Here
|
| 524 |
if ($letter) { |
529 |
if ($letter) { |
| 525 |
C4::Letters::EnqueueLetter( |
530 |
C4::Letters::EnqueueLetter( |
| 526 |
{ |
531 |
{ |
| 527 |
letter => $letter, |
532 |
letter => $letter, |
| 528 |
borrowernumber => $self->borrowernumber, |
533 |
borrowernumber => $self->patron_id, |
| 529 |
message_transport_type => 'email', |
534 |
message_transport_type => 'email', |
| 530 |
} |
535 |
} |
| 531 |
); |
536 |
); |
| 532 |
} |
537 |
} |
| 533 |
} |
538 |
} |
| 534 |
|
539 |
|
| 535 |
$self->_move_to_old; |
|
|
| 536 |
$self->SUPER::delete(); # Do not add a DELETE log |
| 537 |
|
| 538 |
# now fix the priority on the others.... |
540 |
# now fix the priority on the others.... |
| 539 |
C4::Reserves::_FixPriority({ biblionumber => $self->biblionumber }); |
541 |
C4::Reserves::_FixPriority({ biblionumber => $self->biblio_id }); |
| 540 |
|
542 |
|
| 541 |
# and, if desired, charge a cancel fee |
543 |
# and, if desired, charge a cancel fee |
| 542 |
my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); |
544 |
my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); |
| 543 |
if ( $charge && $params->{'charge_cancel_fee'} ) { |
545 |
if ( $charge && $params->{'charge_cancel_fee'} ) { |
| 544 |
my $account = |
546 |
my $account = |
| 545 |
Koha::Account->new( { patron_id => $self->borrowernumber } ); |
547 |
Koha::Account->new( { patron_id => $self->patron_id } ); |
| 546 |
$account->add_debit( |
548 |
$account->add_debit( |
| 547 |
{ |
549 |
{ |
| 548 |
amount => $charge, |
550 |
amount => $charge, |
|
Lines 550-581
sub cancel {
Link Here
|
| 550 |
interface => C4::Context->interface, |
552 |
interface => C4::Context->interface, |
| 551 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
553 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
| 552 |
type => 'RESERVE_EXPIRED', |
554 |
type => 'RESERVE_EXPIRED', |
| 553 |
item_id => $self->itemnumber |
555 |
item_id => $self->item_id |
| 554 |
} |
556 |
} |
| 555 |
); |
557 |
); |
| 556 |
} |
558 |
} |
| 557 |
|
559 |
|
| 558 |
C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, Dumper($self->unblessed) ) |
560 |
C4::Log::logaction( 'HOLDS', 'CANCEL', $self->id, Dumper($self->unblessed) ) |
| 559 |
if C4::Context->preference('HoldsLog'); |
561 |
if C4::Context->preference('HoldsLog'); |
| 560 |
} |
562 |
} |
| 561 |
); |
563 |
); |
| 562 |
return $self; |
564 |
return $self; |
| 563 |
} |
565 |
} |
| 564 |
|
566 |
|
| 565 |
=head3 _move_to_old |
|
|
| 566 |
|
| 567 |
my $is_moved = $hold->_move_to_old; |
| 568 |
|
| 569 |
Move a hold to the old_reserve table following the same pattern as Koha::Patron->move_to_deleted |
| 570 |
|
| 571 |
=cut |
| 572 |
|
| 573 |
sub _move_to_old { |
| 574 |
my ($self) = @_; |
| 575 |
my $hold_infos = $self->unblessed; |
| 576 |
return Koha::Old::Hold->new( $hold_infos )->store; |
| 577 |
} |
| 578 |
|
| 579 |
=head3 to_api_mapping |
567 |
=head3 to_api_mapping |
| 580 |
|
568 |
|
| 581 |
This method returns the mapping for representing a Koha::Hold object |
569 |
This method returns the mapping for representing a Koha::Hold object |
|
Lines 585-608
on the API.
Link Here
|
| 585 |
|
573 |
|
| 586 |
sub to_api_mapping { |
574 |
sub to_api_mapping { |
| 587 |
return { |
575 |
return { |
| 588 |
reserve_id => 'hold_id', |
576 |
id => 'hold_id' |
| 589 |
borrowernumber => 'patron_id', |
|
|
| 590 |
reservedate => 'hold_date', |
| 591 |
biblionumber => 'biblio_id', |
| 592 |
branchcode => 'pickup_library_id', |
| 593 |
notificationdate => undef, |
| 594 |
reminderdate => undef, |
| 595 |
cancellationdate => 'cancellation_date', |
| 596 |
reservenotes => 'notes', |
| 597 |
found => 'status', |
| 598 |
itemnumber => 'item_id', |
| 599 |
waitingdate => 'waiting_date', |
| 600 |
expirationdate => 'expiration_date', |
| 601 |
lowestPriority => 'lowest_priority', |
| 602 |
suspend => 'suspended', |
| 603 |
suspend_until => 'suspended_until', |
| 604 |
itemtype => 'item_type', |
| 605 |
item_level_hold => 'item_level', |
| 606 |
}; |
577 |
}; |
| 607 |
} |
578 |
} |
| 608 |
|
579 |
|
|
Lines 613-619
sub to_api_mapping {
Link Here
|
| 613 |
=cut |
584 |
=cut |
| 614 |
|
585 |
|
| 615 |
sub _type { |
586 |
sub _type { |
| 616 |
return 'Reserve'; |
587 |
return 'Hold'; |
| 617 |
} |
588 |
} |
| 618 |
|
589 |
|
| 619 |
=head1 AUTHORS |
590 |
=head1 AUTHORS |
|
Lines 621-626
sub _type {
Link Here
|
| 621 |
Kyle M Hall <kyle@bywatersolutions.com> |
592 |
Kyle M Hall <kyle@bywatersolutions.com> |
| 622 |
Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
593 |
Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
| 623 |
Martin Renvoize <martin.renvoize@ptfs-europe.com> |
594 |
Martin Renvoize <martin.renvoize@ptfs-europe.com> |
|
|
595 |
Tomás Cohen Arazu <tomascohen@theke.io> |
| 624 |
|
596 |
|
| 625 |
=cut |
597 |
=cut |
| 626 |
|
598 |
|