|
Lines 66-76
sub age {
Link Here
|
| 66 |
my $age; |
66 |
my $age; |
| 67 |
|
67 |
|
| 68 |
if ( $use_calendar ) { |
68 |
if ( $use_calendar ) { |
| 69 |
my $calendar = Koha::Calendar->new( branchcode => $self->branchcode ); |
69 |
my $calendar = Koha::Calendar->new( branchcode => $self->pickup_library_id ); |
| 70 |
$age = $calendar->days_between( dt_from_string( $self->reservedate ), $today ); |
70 |
$age = $calendar->days_between( dt_from_string( $self->created_date ), $today ); |
| 71 |
} |
71 |
} |
| 72 |
else { |
72 |
else { |
| 73 |
$age = $today->delta_days( dt_from_string( $self->reservedate ) ); |
73 |
$age = $today->delta_days( dt_from_string( $self->created_date ) ); |
| 74 |
} |
74 |
} |
| 75 |
|
75 |
|
| 76 |
$age = $age->in_units( 'days' ); |
76 |
$age = $age->in_units( 'days' ); |
|
Lines 90-100
sub suspend_hold {
Link Here
|
| 90 |
my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef; |
90 |
my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef; |
| 91 |
|
91 |
|
| 92 |
if ( $self->is_found ) { # We can't suspend found holds |
92 |
if ( $self->is_found ) { # We can't suspend found holds |
| 93 |
if ( $self->is_waiting ) { |
93 |
if ( $self->is_waiting or |
| 94 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'W' ); |
94 |
$self->is_in_transit ) { |
| 95 |
} |
95 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => $self->status ); |
| 96 |
elsif ( $self->is_in_transit ) { |
|
|
| 97 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'T' ); |
| 98 |
} |
96 |
} |
| 99 |
elsif ( $self->is_in_processing ) { |
97 |
elsif ( $self->is_in_processing ) { |
| 100 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'P' ); |
98 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'P' ); |
|
Lines 103-119
sub suspend_hold {
Link Here
|
| 103 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( |
101 |
Koha::Exceptions::Hold::CannotSuspendFound->throw( |
| 104 |
'Unhandled data exception on found hold (id=' |
102 |
'Unhandled data exception on found hold (id=' |
| 105 |
. $self->id |
103 |
. $self->id |
| 106 |
. ', found=' |
104 |
. ', status=' |
| 107 |
. $self->found |
105 |
. $self->status |
| 108 |
. ')' ); |
106 |
. ')' ); |
| 109 |
} |
107 |
} |
| 110 |
} |
108 |
} |
| 111 |
|
109 |
|
| 112 |
$self->suspend(1); |
110 |
$self->suspended(1); |
| 113 |
$self->suspend_until($date); |
111 |
$self->suspended_until_date($date); |
| 114 |
$self->store(); |
112 |
$self->store(); |
| 115 |
|
113 |
|
| 116 |
logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper( $self->unblessed ) ) |
114 |
logaction( 'HOLDS', 'SUSPEND', $self->id, Dumper( $self->unblessed ) ) |
| 117 |
if C4::Context->preference('HoldsLog'); |
115 |
if C4::Context->preference('HoldsLog'); |
| 118 |
|
116 |
|
| 119 |
return $self; |
117 |
return $self; |
|
Lines 128-139
my $hold = $hold->resume();
Link Here
|
| 128 |
sub resume { |
126 |
sub resume { |
| 129 |
my ( $self ) = @_; |
127 |
my ( $self ) = @_; |
| 130 |
|
128 |
|
| 131 |
$self->suspend(0); |
129 |
$self->suspended(0); |
| 132 |
$self->suspend_until( undef ); |
130 |
$self->suspended_until_date( undef ); |
| 133 |
|
131 |
|
| 134 |
$self->store(); |
132 |
$self->store(); |
| 135 |
|
133 |
|
| 136 |
logaction( 'HOLDS', 'RESUME', $self->reserve_id, Dumper($self->unblessed) ) |
134 |
logaction( 'HOLDS', 'RESUME', $self->id, Dumper($self->unblessed) ) |
| 137 |
if C4::Context->preference('HoldsLog'); |
135 |
if C4::Context->preference('HoldsLog'); |
| 138 |
|
136 |
|
| 139 |
return $self; |
137 |
return $self; |
|
Lines 150-156
sub delete {
Link Here
|
| 150 |
|
148 |
|
| 151 |
my $deleted = $self->SUPER::delete($self); |
149 |
my $deleted = $self->SUPER::delete($self); |
| 152 |
|
150 |
|
| 153 |
logaction( 'HOLDS', 'DELETE', $self->reserve_id, Dumper($self->unblessed) ) |
151 |
logaction( 'HOLDS', 'DELETE', $self->id, Dumper($self->unblessed) ) |
| 154 |
if C4::Context->preference('HoldsLog'); |
152 |
if C4::Context->preference('HoldsLog'); |
| 155 |
|
153 |
|
| 156 |
return $deleted; |
154 |
return $deleted; |
|
Lines 164-170
sub set_transfer {
Link Here
|
| 164 |
my ( $self ) = @_; |
162 |
my ( $self ) = @_; |
| 165 |
|
163 |
|
| 166 |
$self->priority(0); |
164 |
$self->priority(0); |
| 167 |
$self->found('T'); |
165 |
$self->status('in_transit'); |
| 168 |
$self->store(); |
166 |
$self->store(); |
| 169 |
|
167 |
|
| 170 |
return $self; |
168 |
return $self; |
|
Lines 181-194
sub set_waiting {
Link Here
|
| 181 |
|
179 |
|
| 182 |
my $today = dt_from_string(); |
180 |
my $today = dt_from_string(); |
| 183 |
my $values = { |
181 |
my $values = { |
| 184 |
found => 'W', |
182 |
status => 'waiting', |
| 185 |
waitingdate => $today->ymd, |
183 |
waiting_date => $today->ymd, |
| 186 |
desk_id => $desk_id, |
184 |
desk_id => $desk_id, |
| 187 |
}; |
185 |
}; |
| 188 |
|
186 |
|
| 189 |
my $requested_expiration; |
187 |
my $requested_expiration; |
| 190 |
if ($self->expirationdate) { |
188 |
if ($self->expiration_date) { |
| 191 |
$requested_expiration = dt_from_string($self->expirationdate); |
189 |
$requested_expiration = dt_from_string($self->expiration_date); |
| 192 |
} |
190 |
} |
| 193 |
|
191 |
|
| 194 |
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); |
192 |
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); |
|
Lines 201-212
sub set_waiting {
Link Here
|
| 201 |
my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype; |
199 |
my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype; |
| 202 |
my $daysmode = Koha::CirculationRules->get_effective_daysmode( |
200 |
my $daysmode = Koha::CirculationRules->get_effective_daysmode( |
| 203 |
{ |
201 |
{ |
| 204 |
categorycode => $self->borrower->categorycode, |
202 |
categorycode => $self->patron->categorycode, |
| 205 |
itemtype => $itemtype, |
203 |
itemtype => $itemtype, |
| 206 |
branchcode => $self->branchcode, |
204 |
branchcode => $self->pickup_library_id, |
| 207 |
} |
205 |
} |
| 208 |
); |
206 |
); |
| 209 |
my $calendar = Koha::Calendar->new( branchcode => $self->branchcode, days_mode => $daysmode ); |
207 |
my $calendar = Koha::Calendar->new( branchcode => $self->pickup_library_id, days_mode => $daysmode ); |
| 210 |
|
208 |
|
| 211 |
$expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); |
209 |
$expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); |
| 212 |
} |
210 |
} |
|
Lines 214-220
sub set_waiting {
Link Here
|
| 214 |
# If patron's requested expiration date is prior to the |
212 |
# If patron's requested expiration date is prior to the |
| 215 |
# calculated one, we keep the patron's one. |
213 |
# calculated one, we keep the patron's one. |
| 216 |
my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; |
214 |
my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; |
| 217 |
$values->{expirationdate} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd; |
215 |
$values->{expiration_date} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd; |
| 218 |
|
216 |
|
| 219 |
$self->set($values)->store(); |
217 |
$self->set($values)->store(); |
| 220 |
|
218 |
|
|
Lines 241-247
sub is_pickup_location_valid {
Link Here
|
| 241 |
|
239 |
|
| 242 |
my @pickup_locations; |
240 |
my @pickup_locations; |
| 243 |
|
241 |
|
| 244 |
if ( $self->itemnumber ) { # item-level |
242 |
if ( $self->item_id ) { # item-level |
| 245 |
@pickup_locations = $self->item->pickup_locations({ patron => $self->patron }); |
243 |
@pickup_locations = $self->item->pickup_locations({ patron => $self->patron }); |
| 246 |
} |
244 |
} |
| 247 |
else { # biblio-level |
245 |
else { # biblio-level |
|
Lines 282-288
sub set_pickup_location {
Link Here
|
| 282 |
) |
280 |
) |
| 283 |
{ |
281 |
{ |
| 284 |
# all good, set the new pickup location |
282 |
# all good, set the new pickup location |
| 285 |
$self->branchcode( $params->{library_id} )->store; |
283 |
$self->pickup_library_id( $params->{library_id} )->store; |
| 286 |
} |
284 |
} |
| 287 |
else { |
285 |
else { |
| 288 |
Koha::Exceptions::Hold::InvalidPickupLocation->throw; |
286 |
Koha::Exceptions::Hold::InvalidPickupLocation->throw; |
|
Lines 303-309
sub set_processing {
Link Here
|
| 303 |
my ( $self ) = @_; |
301 |
my ( $self ) = @_; |
| 304 |
|
302 |
|
| 305 |
$self->priority(0); |
303 |
$self->priority(0); |
| 306 |
$self->found('P'); |
304 |
$self->status('processing'); |
| 307 |
$self->store(); |
305 |
$self->store(); |
| 308 |
|
306 |
|
| 309 |
return $self; |
307 |
return $self; |
|
Lines 318-327
Returns true if hold is waiting, in transit or in processing
Link Here
|
| 318 |
sub is_found { |
316 |
sub is_found { |
| 319 |
my ($self) = @_; |
317 |
my ($self) = @_; |
| 320 |
|
318 |
|
| 321 |
return 0 unless $self->found(); |
319 |
if ( |
| 322 |
return 1 if $self->found() eq 'W'; |
320 |
$self->status eq 'waiting' |
| 323 |
return 1 if $self->found() eq 'T'; |
321 |
or $self->status eq 'in_transit' |
| 324 |
return 1 if $self->found() eq 'P'; |
322 |
or $self->status eq 'processing' |
|
|
323 |
) |
| 324 |
{ |
| 325 |
return 1; |
| 326 |
} |
| 327 |
|
| 328 |
return 0; |
| 325 |
} |
329 |
} |
| 326 |
|
330 |
|
| 327 |
=head3 is_waiting |
331 |
=head3 is_waiting |
|
Lines 333-340
Returns true if hold is a waiting hold
Link Here
|
| 333 |
sub is_waiting { |
337 |
sub is_waiting { |
| 334 |
my ($self) = @_; |
338 |
my ($self) = @_; |
| 335 |
|
339 |
|
| 336 |
my $found = $self->found; |
340 |
return $self->status eq 'waiting'; |
| 337 |
return $found && $found eq 'W'; |
|
|
| 338 |
} |
341 |
} |
| 339 |
|
342 |
|
| 340 |
=head3 is_in_transit |
343 |
=head3 is_in_transit |
|
Lines 346-353
Returns true if hold is a in_transit hold
Link Here
|
| 346 |
sub is_in_transit { |
349 |
sub is_in_transit { |
| 347 |
my ($self) = @_; |
350 |
my ($self) = @_; |
| 348 |
|
351 |
|
| 349 |
return 0 unless $self->found(); |
352 |
return $self->status eq 'in_transit'; |
| 350 |
return $self->found() eq 'T'; |
|
|
| 351 |
} |
353 |
} |
| 352 |
|
354 |
|
| 353 |
=head3 is_in_processing |
355 |
=head3 is_in_processing |
|
Lines 359-366
Returns true if hold is a in_processing hold
Link Here
|
| 359 |
sub is_in_processing { |
361 |
sub is_in_processing { |
| 360 |
my ($self) = @_; |
362 |
my ($self) = @_; |
| 361 |
|
363 |
|
| 362 |
return 0 unless $self->found(); |
364 |
return $self->status eq 'processing'; |
| 363 |
return $self->found() eq 'P'; |
|
|
| 364 |
} |
365 |
} |
| 365 |
|
366 |
|
| 366 |
=head3 is_cancelable_from_opac |
367 |
=head3 is_cancelable_from_opac |
|
Lines 391-397
the hold item's holding branch
Link Here
|
| 391 |
sub is_at_destination { |
392 |
sub is_at_destination { |
| 392 |
my ($self) = @_; |
393 |
my ($self) = @_; |
| 393 |
|
394 |
|
| 394 |
return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() ); |
395 |
return $self->is_waiting() && ( $self->pickup_library_id() eq $self->item()->holdingbranch() ); |
| 395 |
} |
396 |
} |
| 396 |
|
397 |
|
| 397 |
=head3 biblio |
398 |
=head3 biblio |
|
Lines 403-409
Returns the related Koha::Biblio object for this hold
Link Here
|
| 403 |
sub biblio { |
404 |
sub biblio { |
| 404 |
my ($self) = @_; |
405 |
my ($self) = @_; |
| 405 |
|
406 |
|
| 406 |
$self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() ); |
407 |
$self->{_biblio} ||= Koha::Biblios->find( $self->biblio_id ); |
| 407 |
|
408 |
|
| 408 |
return $self->{_biblio}; |
409 |
return $self->{_biblio}; |
| 409 |
} |
410 |
} |
|
Lines 430-436
Returns the related Koha::Item object for this Hold
Link Here
|
| 430 |
sub item { |
431 |
sub item { |
| 431 |
my ($self) = @_; |
432 |
my ($self) = @_; |
| 432 |
|
433 |
|
| 433 |
$self->{_item} ||= Koha::Items->find( $self->itemnumber() ); |
434 |
$self->{_item} ||= Koha::Items->find( $self->item_id ); |
| 434 |
|
435 |
|
| 435 |
return $self->{_item}; |
436 |
return $self->{_item}; |
| 436 |
} |
437 |
} |
|
Lines 444-450
Returns the related Koha::Library object for this Hold
Link Here
|
| 444 |
sub branch { |
445 |
sub branch { |
| 445 |
my ($self) = @_; |
446 |
my ($self) = @_; |
| 446 |
|
447 |
|
| 447 |
$self->{_branch} ||= Koha::Libraries->find( $self->branchcode() ); |
448 |
$self->{_branch} ||= Koha::Libraries->find( $self->pickup_library_id ); |
| 448 |
|
449 |
|
| 449 |
return $self->{_branch}; |
450 |
return $self->{_branch}; |
| 450 |
} |
451 |
} |
|
Lines 472-478
Returns the related Koha::Patron object for this Hold
Link Here
|
| 472 |
sub borrower { |
473 |
sub borrower { |
| 473 |
my ($self) = @_; |
474 |
my ($self) = @_; |
| 474 |
|
475 |
|
| 475 |
$self->{_borrower} ||= Koha::Patrons->find( $self->borrowernumber() ); |
476 |
$self->{_borrower} ||= Koha::Patrons->find( $self->patron_id ); |
| 476 |
|
477 |
|
| 477 |
return $self->{_borrower}; |
478 |
return $self->{_borrower}; |
| 478 |
} |
479 |
} |
|
Lines 486-495
my $bool = $hold->is_suspended();
Link Here
|
| 486 |
sub is_suspended { |
487 |
sub is_suspended { |
| 487 |
my ( $self ) = @_; |
488 |
my ( $self ) = @_; |
| 488 |
|
489 |
|
| 489 |
return $self->suspend(); |
490 |
return $self->suspended(); |
| 490 |
} |
491 |
} |
| 491 |
|
492 |
|
| 492 |
|
|
|
| 493 |
=head3 cancel |
493 |
=head3 cancel |
| 494 |
|
494 |
|
| 495 |
my $cancel_hold = $hold->cancel( |
495 |
my $cancel_hold = $hold->cancel( |
|
Lines 500-509
my $cancel_hold = $hold->cancel(
Link Here
|
| 500 |
); |
500 |
); |
| 501 |
|
501 |
|
| 502 |
Cancel a hold: |
502 |
Cancel a hold: |
| 503 |
- The hold will be moved to the old_reserves table with a priority=0 |
503 |
- The hold will be marked as completed, status 'cancelled' and a priority=0 |
| 504 |
- The priority of other holds will be updated |
504 |
- The priority of other holds will be updated |
| 505 |
- The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set |
505 |
- The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set |
| 506 |
- The canceled hold will have the cancellation reason added to old_reserves.cancellation_reason if one is passed in |
506 |
- The canceled hold will have the cancellation reason added to cancellation_reason if one is passed in |
| 507 |
- a CANCEL HOLDS log will be done if the pref HoldsLog is on |
507 |
- a CANCEL HOLDS log will be done if the pref HoldsLog is on |
| 508 |
|
508 |
|
| 509 |
=cut |
509 |
=cut |
|
Lines 512-521
sub cancel {
Link Here
|
| 512 |
my ( $self, $params ) = @_; |
512 |
my ( $self, $params ) = @_; |
| 513 |
$self->_result->result_source->schema->txn_do( |
513 |
$self->_result->result_source->schema->txn_do( |
| 514 |
sub { |
514 |
sub { |
| 515 |
$self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) ); |
515 |
$self->set( |
| 516 |
$self->priority(0); |
516 |
{ |
| 517 |
$self->cancellation_reason( $params->{cancellation_reason} ); |
517 |
completed_date => dt_from_string->strftime('%Y-%m-%d %H:%M:%S'), |
| 518 |
$self->store(); |
518 |
completed => 1, |
|
|
519 |
priority => 0, |
| 520 |
status => 'cancelled', |
| 521 |
cancellation_reason => $params->{cancellation_reason}, |
| 522 |
} |
| 523 |
)->store(); |
| 519 |
|
524 |
|
| 520 |
if ( $params->{cancellation_reason} ) { |
525 |
if ( $params->{cancellation_reason} ) { |
| 521 |
my $letter = C4::Letters::GetPreparedLetter( |
526 |
my $letter = C4::Letters::GetPreparedLetter( |
|
Lines 526-535
sub cancel {
Link Here
|
| 526 |
lang => $self->borrower->lang, |
531 |
lang => $self->borrower->lang, |
| 527 |
tables => { |
532 |
tables => { |
| 528 |
branches => $self->borrower->branchcode, |
533 |
branches => $self->borrower->branchcode, |
| 529 |
borrowers => $self->borrowernumber, |
534 |
borrowers => $self->patron_id, |
| 530 |
items => $self->itemnumber, |
535 |
items => $self->item_id, |
| 531 |
biblio => $self->biblionumber, |
536 |
biblio => $self->biblio_id, |
| 532 |
biblioitems => $self->biblionumber, |
537 |
biblioitems => $self->biblio_id, |
| 533 |
reserves => $self->unblessed, |
538 |
reserves => $self->unblessed, |
| 534 |
} |
539 |
} |
| 535 |
); |
540 |
); |
|
Lines 537-561
sub cancel {
Link Here
|
| 537 |
if ($letter) { |
542 |
if ($letter) { |
| 538 |
C4::Letters::EnqueueLetter( |
543 |
C4::Letters::EnqueueLetter( |
| 539 |
{ |
544 |
{ |
| 540 |
letter => $letter, |
545 |
letter => $letter, |
| 541 |
borrowernumber => $self->borrowernumber, |
546 |
borrowernumber => $self->patron_id, |
| 542 |
message_transport_type => 'email', |
547 |
message_transport_type => 'email', |
| 543 |
} |
548 |
} |
| 544 |
); |
549 |
); |
| 545 |
} |
550 |
} |
| 546 |
} |
551 |
} |
| 547 |
|
552 |
|
| 548 |
$self->_move_to_old; |
|
|
| 549 |
$self->SUPER::delete(); # Do not add a DELETE log |
| 550 |
|
| 551 |
# now fix the priority on the others.... |
553 |
# now fix the priority on the others.... |
| 552 |
C4::Reserves::_FixPriority({ biblionumber => $self->biblionumber }); |
554 |
C4::Reserves::_FixPriority({ biblionumber => $self->biblio_id }); |
| 553 |
|
555 |
|
| 554 |
# and, if desired, charge a cancel fee |
556 |
# and, if desired, charge a cancel fee |
| 555 |
my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); |
557 |
my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); |
| 556 |
if ( $charge && $params->{'charge_cancel_fee'} ) { |
558 |
if ( $charge && $params->{'charge_cancel_fee'} ) { |
| 557 |
my $account = |
559 |
my $account = |
| 558 |
Koha::Account->new( { patron_id => $self->borrowernumber } ); |
560 |
Koha::Account->new( { patron_id => $self->patron_id } ); |
| 559 |
$account->add_debit( |
561 |
$account->add_debit( |
| 560 |
{ |
562 |
{ |
| 561 |
amount => $charge, |
563 |
amount => $charge, |
|
Lines 563-574
sub cancel {
Link Here
|
| 563 |
interface => C4::Context->interface, |
565 |
interface => C4::Context->interface, |
| 564 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
566 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
| 565 |
type => 'RESERVE_EXPIRED', |
567 |
type => 'RESERVE_EXPIRED', |
| 566 |
item_id => $self->itemnumber |
568 |
item_id => $self->item_id |
| 567 |
} |
569 |
} |
| 568 |
); |
570 |
); |
| 569 |
} |
571 |
} |
| 570 |
|
572 |
|
| 571 |
C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, Dumper($self->unblessed) ) |
573 |
C4::Log::logaction( 'HOLDS', 'CANCEL', $self->id, Dumper($self->unblessed) ) |
| 572 |
if C4::Context->preference('HoldsLog'); |
574 |
if C4::Context->preference('HoldsLog'); |
| 573 |
} |
575 |
} |
| 574 |
); |
576 |
); |
|
Lines 627-646
sub _set_default_expirationdate {
Link Here
|
| 627 |
dt_from_string( $self->reservedate )->add( $timeunit => $period ) ); |
629 |
dt_from_string( $self->reservedate )->add( $timeunit => $period ) ); |
| 628 |
} |
630 |
} |
| 629 |
|
631 |
|
| 630 |
=head3 _move_to_old |
|
|
| 631 |
|
| 632 |
my $is_moved = $hold->_move_to_old; |
| 633 |
|
| 634 |
Move a hold to the old_reserve table following the same pattern as Koha::Patron->move_to_deleted |
| 635 |
|
| 636 |
=cut |
| 637 |
|
| 638 |
sub _move_to_old { |
| 639 |
my ($self) = @_; |
| 640 |
my $hold_infos = $self->unblessed; |
| 641 |
return Koha::Old::Hold->new( $hold_infos )->store; |
| 642 |
} |
| 643 |
|
| 644 |
=head3 to_api_mapping |
632 |
=head3 to_api_mapping |
| 645 |
|
633 |
|
| 646 |
This method returns the mapping for representing a Koha::Hold object |
634 |
This method returns the mapping for representing a Koha::Hold object |
|
Lines 650-673
on the API.
Link Here
|
| 650 |
|
638 |
|
| 651 |
sub to_api_mapping { |
639 |
sub to_api_mapping { |
| 652 |
return { |
640 |
return { |
| 653 |
reserve_id => 'hold_id', |
641 |
id => 'hold_id' |
| 654 |
borrowernumber => 'patron_id', |
|
|
| 655 |
reservedate => 'hold_date', |
| 656 |
biblionumber => 'biblio_id', |
| 657 |
branchcode => 'pickup_library_id', |
| 658 |
notificationdate => undef, |
| 659 |
reminderdate => undef, |
| 660 |
cancellationdate => 'cancellation_date', |
| 661 |
reservenotes => 'notes', |
| 662 |
found => 'status', |
| 663 |
itemnumber => 'item_id', |
| 664 |
waitingdate => 'waiting_date', |
| 665 |
expirationdate => 'expiration_date', |
| 666 |
lowestPriority => 'lowest_priority', |
| 667 |
suspend => 'suspended', |
| 668 |
suspend_until => 'suspended_until', |
| 669 |
itemtype => 'item_type', |
| 670 |
item_level_hold => 'item_level', |
| 671 |
}; |
642 |
}; |
| 672 |
} |
643 |
} |
| 673 |
|
644 |
|
|
Lines 678-684
sub to_api_mapping {
Link Here
|
| 678 |
=cut |
649 |
=cut |
| 679 |
|
650 |
|
| 680 |
sub _type { |
651 |
sub _type { |
| 681 |
return 'Reserve'; |
652 |
return 'Hold'; |
| 682 |
} |
653 |
} |
| 683 |
|
654 |
|
| 684 |
=head1 AUTHORS |
655 |
=head1 AUTHORS |
|
Lines 686-691
sub _type {
Link Here
|
| 686 |
Kyle M Hall <kyle@bywatersolutions.com> |
657 |
Kyle M Hall <kyle@bywatersolutions.com> |
| 687 |
Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
658 |
Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
| 688 |
Martin Renvoize <martin.renvoize@ptfs-europe.com> |
659 |
Martin Renvoize <martin.renvoize@ptfs-europe.com> |
|
|
660 |
Tomás Cohen Arazu <tomascohen@theke.io> |
| 689 |
|
661 |
|
| 690 |
=cut |
662 |
=cut |
| 691 |
|
663 |
|