|
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 283-289
sub set_pickup_location {
Link Here
|
| 283 |
) |
281 |
) |
| 284 |
{ |
282 |
{ |
| 285 |
# all good, set the new pickup location |
283 |
# all good, set the new pickup location |
| 286 |
$self->branchcode( $params->{library_id} )->store; |
284 |
$self->pickup_library_id( $params->{library_id} )->store; |
| 287 |
} |
285 |
} |
| 288 |
else { |
286 |
else { |
| 289 |
Koha::Exceptions::Hold::InvalidPickupLocation->throw; |
287 |
Koha::Exceptions::Hold::InvalidPickupLocation->throw; |
|
Lines 304-310
sub set_processing {
Link Here
|
| 304 |
my ( $self ) = @_; |
302 |
my ( $self ) = @_; |
| 305 |
|
303 |
|
| 306 |
$self->priority(0); |
304 |
$self->priority(0); |
| 307 |
$self->found('P'); |
305 |
$self->status('processing'); |
| 308 |
$self->store(); |
306 |
$self->store(); |
| 309 |
|
307 |
|
| 310 |
return $self; |
308 |
return $self; |
|
Lines 319-328
Returns true if hold is waiting, in transit or in processing
Link Here
|
| 319 |
sub is_found { |
317 |
sub is_found { |
| 320 |
my ($self) = @_; |
318 |
my ($self) = @_; |
| 321 |
|
319 |
|
| 322 |
return 0 unless $self->found(); |
320 |
if ( |
| 323 |
return 1 if $self->found() eq 'W'; |
321 |
$self->status eq 'waiting' |
| 324 |
return 1 if $self->found() eq 'T'; |
322 |
or $self->status eq 'in_transit' |
| 325 |
return 1 if $self->found() eq 'P'; |
323 |
or $self->status eq 'processing' |
|
|
324 |
) |
| 325 |
{ |
| 326 |
return 1; |
| 327 |
} |
| 328 |
|
| 329 |
return 0; |
| 326 |
} |
330 |
} |
| 327 |
|
331 |
|
| 328 |
=head3 is_waiting |
332 |
=head3 is_waiting |
|
Lines 334-341
Returns true if hold is a waiting hold
Link Here
|
| 334 |
sub is_waiting { |
338 |
sub is_waiting { |
| 335 |
my ($self) = @_; |
339 |
my ($self) = @_; |
| 336 |
|
340 |
|
| 337 |
my $found = $self->found; |
341 |
return $self->status eq 'waiting'; |
| 338 |
return $found && $found eq 'W'; |
|
|
| 339 |
} |
342 |
} |
| 340 |
|
343 |
|
| 341 |
=head3 is_in_transit |
344 |
=head3 is_in_transit |
|
Lines 347-354
Returns true if hold is a in_transit hold
Link Here
|
| 347 |
sub is_in_transit { |
350 |
sub is_in_transit { |
| 348 |
my ($self) = @_; |
351 |
my ($self) = @_; |
| 349 |
|
352 |
|
| 350 |
return 0 unless $self->found(); |
353 |
return $self->status eq 'in_transit'; |
| 351 |
return $self->found() eq 'T'; |
|
|
| 352 |
} |
354 |
} |
| 353 |
|
355 |
|
| 354 |
=head3 is_in_processing |
356 |
=head3 is_in_processing |
|
Lines 360-367
Returns true if hold is a in_processing hold
Link Here
|
| 360 |
sub is_in_processing { |
362 |
sub is_in_processing { |
| 361 |
my ($self) = @_; |
363 |
my ($self) = @_; |
| 362 |
|
364 |
|
| 363 |
return 0 unless $self->found(); |
365 |
return $self->status eq 'processing'; |
| 364 |
return $self->found() eq 'P'; |
|
|
| 365 |
} |
366 |
} |
| 366 |
|
367 |
|
| 367 |
=head3 is_cancelable_from_opac |
368 |
=head3 is_cancelable_from_opac |
|
Lines 392-398
the hold item's holding branch
Link Here
|
| 392 |
sub is_at_destination { |
393 |
sub is_at_destination { |
| 393 |
my ($self) = @_; |
394 |
my ($self) = @_; |
| 394 |
|
395 |
|
| 395 |
return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() ); |
396 |
return $self->is_waiting() && ( $self->pickup_library_id() eq $self->item()->holdingbranch() ); |
| 396 |
} |
397 |
} |
| 397 |
|
398 |
|
| 398 |
=head3 biblio |
399 |
=head3 biblio |
|
Lines 404-410
Returns the related Koha::Biblio object for this hold
Link Here
|
| 404 |
sub biblio { |
405 |
sub biblio { |
| 405 |
my ($self) = @_; |
406 |
my ($self) = @_; |
| 406 |
|
407 |
|
| 407 |
$self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() ); |
408 |
$self->{_biblio} ||= Koha::Biblios->find( $self->biblio_id ); |
| 408 |
|
409 |
|
| 409 |
return $self->{_biblio}; |
410 |
return $self->{_biblio}; |
| 410 |
} |
411 |
} |
|
Lines 431-437
Returns the related Koha::Item object for this Hold
Link Here
|
| 431 |
sub item { |
432 |
sub item { |
| 432 |
my ($self) = @_; |
433 |
my ($self) = @_; |
| 433 |
|
434 |
|
| 434 |
$self->{_item} ||= Koha::Items->find( $self->itemnumber() ); |
435 |
$self->{_item} ||= Koha::Items->find( $self->item_id ); |
| 435 |
|
436 |
|
| 436 |
return $self->{_item}; |
437 |
return $self->{_item}; |
| 437 |
} |
438 |
} |
|
Lines 445-451
Returns the related Koha::Library object for this Hold
Link Here
|
| 445 |
sub branch { |
446 |
sub branch { |
| 446 |
my ($self) = @_; |
447 |
my ($self) = @_; |
| 447 |
|
448 |
|
| 448 |
$self->{_branch} ||= Koha::Libraries->find( $self->branchcode() ); |
449 |
$self->{_branch} ||= Koha::Libraries->find( $self->pickup_library_id ); |
| 449 |
|
450 |
|
| 450 |
return $self->{_branch}; |
451 |
return $self->{_branch}; |
| 451 |
} |
452 |
} |
|
Lines 473-479
Returns the related Koha::Patron object for this Hold
Link Here
|
| 473 |
sub borrower { |
474 |
sub borrower { |
| 474 |
my ($self) = @_; |
475 |
my ($self) = @_; |
| 475 |
|
476 |
|
| 476 |
$self->{_borrower} ||= Koha::Patrons->find( $self->borrowernumber() ); |
477 |
$self->{_borrower} ||= Koha::Patrons->find( $self->patron_id ); |
| 477 |
|
478 |
|
| 478 |
return $self->{_borrower}; |
479 |
return $self->{_borrower}; |
| 479 |
} |
480 |
} |
|
Lines 487-496
my $bool = $hold->is_suspended();
Link Here
|
| 487 |
sub is_suspended { |
488 |
sub is_suspended { |
| 488 |
my ( $self ) = @_; |
489 |
my ( $self ) = @_; |
| 489 |
|
490 |
|
| 490 |
return $self->suspend(); |
491 |
return $self->suspended(); |
| 491 |
} |
492 |
} |
| 492 |
|
493 |
|
| 493 |
|
|
|
| 494 |
=head3 cancel |
494 |
=head3 cancel |
| 495 |
|
495 |
|
| 496 |
my $cancel_hold = $hold->cancel( |
496 |
my $cancel_hold = $hold->cancel( |
|
Lines 501-510
my $cancel_hold = $hold->cancel(
Link Here
|
| 501 |
); |
501 |
); |
| 502 |
|
502 |
|
| 503 |
Cancel a hold: |
503 |
Cancel a hold: |
| 504 |
- The hold will be moved to the old_reserves table with a priority=0 |
504 |
- The hold will be marked as completed, status 'cancelled' and a priority=0 |
| 505 |
- The priority of other holds will be updated |
505 |
- The priority of other holds will be updated |
| 506 |
- The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set |
506 |
- The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set |
| 507 |
- The canceled hold will have the cancellation reason added to old_reserves.cancellation_reason if one is passed in |
507 |
- The canceled hold will have the cancellation reason added to cancellation_reason if one is passed in |
| 508 |
- a CANCEL HOLDS log will be done if the pref HoldsLog is on |
508 |
- a CANCEL HOLDS log will be done if the pref HoldsLog is on |
| 509 |
|
509 |
|
| 510 |
=cut |
510 |
=cut |
|
Lines 513-522
sub cancel {
Link Here
|
| 513 |
my ( $self, $params ) = @_; |
513 |
my ( $self, $params ) = @_; |
| 514 |
$self->_result->result_source->schema->txn_do( |
514 |
$self->_result->result_source->schema->txn_do( |
| 515 |
sub { |
515 |
sub { |
| 516 |
$self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) ); |
516 |
$self->set( |
| 517 |
$self->priority(0); |
517 |
{ |
| 518 |
$self->cancellation_reason( $params->{cancellation_reason} ); |
518 |
completed_date => dt_from_string->strftime('%Y-%m-%d %H:%M:%S'), |
| 519 |
$self->store(); |
519 |
completed => 1, |
|
|
520 |
priority => 0, |
| 521 |
status => 'cancelled', |
| 522 |
cancellation_reason => $params->{cancellation_reason}, |
| 523 |
} |
| 524 |
)->store(); |
| 520 |
|
525 |
|
| 521 |
if ( $params->{cancellation_reason} ) { |
526 |
if ( $params->{cancellation_reason} ) { |
| 522 |
my $letter = C4::Letters::GetPreparedLetter( |
527 |
my $letter = C4::Letters::GetPreparedLetter( |
|
Lines 527-536
sub cancel {
Link Here
|
| 527 |
lang => $self->borrower->lang, |
532 |
lang => $self->borrower->lang, |
| 528 |
tables => { |
533 |
tables => { |
| 529 |
branches => $self->borrower->branchcode, |
534 |
branches => $self->borrower->branchcode, |
| 530 |
borrowers => $self->borrowernumber, |
535 |
borrowers => $self->patron_id, |
| 531 |
items => $self->itemnumber, |
536 |
items => $self->item_id, |
| 532 |
biblio => $self->biblionumber, |
537 |
biblio => $self->biblio_id, |
| 533 |
biblioitems => $self->biblionumber, |
538 |
biblioitems => $self->biblio_id, |
| 534 |
reserves => $self->unblessed, |
539 |
reserves => $self->unblessed, |
| 535 |
} |
540 |
} |
| 536 |
); |
541 |
); |
|
Lines 538-562
sub cancel {
Link Here
|
| 538 |
if ($letter) { |
543 |
if ($letter) { |
| 539 |
C4::Letters::EnqueueLetter( |
544 |
C4::Letters::EnqueueLetter( |
| 540 |
{ |
545 |
{ |
| 541 |
letter => $letter, |
546 |
letter => $letter, |
| 542 |
borrowernumber => $self->borrowernumber, |
547 |
borrowernumber => $self->patron_id, |
| 543 |
message_transport_type => 'email', |
548 |
message_transport_type => 'email', |
| 544 |
} |
549 |
} |
| 545 |
); |
550 |
); |
| 546 |
} |
551 |
} |
| 547 |
} |
552 |
} |
| 548 |
|
553 |
|
| 549 |
$self->_move_to_old; |
|
|
| 550 |
$self->SUPER::delete(); # Do not add a DELETE log |
| 551 |
|
| 552 |
# now fix the priority on the others.... |
554 |
# now fix the priority on the others.... |
| 553 |
C4::Reserves::_FixPriority({ biblionumber => $self->biblionumber }); |
555 |
C4::Reserves::_FixPriority({ biblionumber => $self->biblio_id }); |
| 554 |
|
556 |
|
| 555 |
# and, if desired, charge a cancel fee |
557 |
# and, if desired, charge a cancel fee |
| 556 |
my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); |
558 |
my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); |
| 557 |
if ( $charge && $params->{'charge_cancel_fee'} ) { |
559 |
if ( $charge && $params->{'charge_cancel_fee'} ) { |
| 558 |
my $account = |
560 |
my $account = |
| 559 |
Koha::Account->new( { patron_id => $self->borrowernumber } ); |
561 |
Koha::Account->new( { patron_id => $self->patron_id } ); |
| 560 |
$account->add_debit( |
562 |
$account->add_debit( |
| 561 |
{ |
563 |
{ |
| 562 |
amount => $charge, |
564 |
amount => $charge, |
|
Lines 564-575
sub cancel {
Link Here
|
| 564 |
interface => C4::Context->interface, |
566 |
interface => C4::Context->interface, |
| 565 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
567 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
| 566 |
type => 'RESERVE_EXPIRED', |
568 |
type => 'RESERVE_EXPIRED', |
| 567 |
item_id => $self->itemnumber |
569 |
item_id => $self->item_id |
| 568 |
} |
570 |
} |
| 569 |
); |
571 |
); |
| 570 |
} |
572 |
} |
| 571 |
|
573 |
|
| 572 |
C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, Dumper($self->unblessed) ) |
574 |
C4::Log::logaction( 'HOLDS', 'CANCEL', $self->id, Dumper($self->unblessed) ) |
| 573 |
if C4::Context->preference('HoldsLog'); |
575 |
if C4::Context->preference('HoldsLog'); |
| 574 |
} |
576 |
} |
| 575 |
); |
577 |
); |
|
Lines 628-647
sub _set_default_expirationdate {
Link Here
|
| 628 |
dt_from_string( $self->reservedate )->add( $timeunit => $period ) ); |
630 |
dt_from_string( $self->reservedate )->add( $timeunit => $period ) ); |
| 629 |
} |
631 |
} |
| 630 |
|
632 |
|
| 631 |
=head3 _move_to_old |
|
|
| 632 |
|
| 633 |
my $is_moved = $hold->_move_to_old; |
| 634 |
|
| 635 |
Move a hold to the old_reserve table following the same pattern as Koha::Patron->move_to_deleted |
| 636 |
|
| 637 |
=cut |
| 638 |
|
| 639 |
sub _move_to_old { |
| 640 |
my ($self) = @_; |
| 641 |
my $hold_infos = $self->unblessed; |
| 642 |
return Koha::Old::Hold->new( $hold_infos )->store; |
| 643 |
} |
| 644 |
|
| 645 |
=head3 to_api_mapping |
633 |
=head3 to_api_mapping |
| 646 |
|
634 |
|
| 647 |
This method returns the mapping for representing a Koha::Hold object |
635 |
This method returns the mapping for representing a Koha::Hold object |
|
Lines 651-674
on the API.
Link Here
|
| 651 |
|
639 |
|
| 652 |
sub to_api_mapping { |
640 |
sub to_api_mapping { |
| 653 |
return { |
641 |
return { |
| 654 |
reserve_id => 'hold_id', |
642 |
id => 'hold_id' |
| 655 |
borrowernumber => 'patron_id', |
|
|
| 656 |
reservedate => 'hold_date', |
| 657 |
biblionumber => 'biblio_id', |
| 658 |
branchcode => 'pickup_library_id', |
| 659 |
notificationdate => undef, |
| 660 |
reminderdate => undef, |
| 661 |
cancellationdate => 'cancellation_date', |
| 662 |
reservenotes => 'notes', |
| 663 |
found => 'status', |
| 664 |
itemnumber => 'item_id', |
| 665 |
waitingdate => 'waiting_date', |
| 666 |
expirationdate => 'expiration_date', |
| 667 |
lowestPriority => 'lowest_priority', |
| 668 |
suspend => 'suspended', |
| 669 |
suspend_until => 'suspended_until', |
| 670 |
itemtype => 'item_type', |
| 671 |
item_level_hold => 'item_level', |
| 672 |
}; |
643 |
}; |
| 673 |
} |
644 |
} |
| 674 |
|
645 |
|
|
Lines 679-685
sub to_api_mapping {
Link Here
|
| 679 |
=cut |
650 |
=cut |
| 680 |
|
651 |
|
| 681 |
sub _type { |
652 |
sub _type { |
| 682 |
return 'Reserve'; |
653 |
return 'Hold'; |
| 683 |
} |
654 |
} |
| 684 |
|
655 |
|
| 685 |
=head1 AUTHORS |
656 |
=head1 AUTHORS |
|
Lines 687-692
sub _type {
Link Here
|
| 687 |
Kyle M Hall <kyle@bywatersolutions.com> |
658 |
Kyle M Hall <kyle@bywatersolutions.com> |
| 688 |
Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
659 |
Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
| 689 |
Martin Renvoize <martin.renvoize@ptfs-europe.com> |
660 |
Martin Renvoize <martin.renvoize@ptfs-europe.com> |
|
|
661 |
Tomás Cohen Arazu <tomascohen@theke.io> |
| 690 |
|
662 |
|
| 691 |
=cut |
663 |
=cut |
| 692 |
|
664 |
|