Bugzilla – Attachment 129396 Details for
Bug 29869
Add Koha::Hold->fill
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29869: Add Koha::Hold->fill
Bug-29869-Add-KohaHold-fill.patch (text/plain), 2.53 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-01-13 12:53:16 UTC
(
hide
)
Description:
Bug 29869: Add Koha::Hold->fill
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-01-13 12:53:16 UTC
Size:
2.53 KB
patch
obsolete
>From 64e0f515de66e33f695767b2f125d23c3cc5f817 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 13 Jan 2022 09:03:20 -0300 >Subject: [PATCH] Bug 29869: Add Koha::Hold->fill > >This patch introduces a new method for marking a hold as filled. The >code is the result of tracking the following methods in C4::Reserves: >- ModReserveFill >- GetReserveFee >- ChargeReserveFee > >To test: >1. Apply this patches >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Hold.t >=> SUCCESS: Tests pass! >3. Sign off :-D >--- > Koha/Hold.pm | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 51bba2c297..cc06327d45 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -580,6 +580,57 @@ sub cancel { > return $self; > } > >+=head3 fill >+ >+ $hold->fill; >+ >+This method marks the hold as filled. It effectively moves it to old_reserves. >+ >+=cut >+ >+sub fill { >+ my ( $self ) = @_; >+ $self->_result->result_source->schema->txn_do( >+ sub { >+ my $patron = $self->patron; >+ >+ $self->set( >+ { >+ found => 'F', >+ priority => 0, >+ } >+ ); >+ >+ $self->_move_to_old; >+ $self->SUPER::delete(); # Do not add a DELETE log >+ >+ # now fix the priority on the others.... >+ C4::Reserves::_FixPriority({ biblionumber => $self->biblionumber }); >+ >+ if ( C4::Context->preference('HoldFeeMode') eq 'any_time_is_collected' ) { >+ my $fee = $patron->category->reservefee // 0; >+ if ( $fee > 0 ) { >+ $patron->account->add_debit( >+ { >+ amount => $fee, >+ description => $self->biblio->title, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, >+ library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, >+ interface => C4::Context->interface, >+ type => 'RESERVE', >+ item_id => $self->itemnumber >+ } >+ ); >+ } >+ } >+ >+ C4::Log::logaction( 'HOLDS', 'FILL', $self->id, $self ) >+ if C4::Context->preference('HoldsLog'); >+ } >+ ); >+ return $self; >+} >+ > =head3 store > > Override base store method to set default >-- >2.32.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29869
:
129395
|
129396
|
129397
|
129398
|
129400
|
129405
|
129406
|
129407
|
129408
|
129409
|
129417
|
129418
|
129419
|
129420
|
129421
|
129502
|
129503
|
129504
|
129505
|
129506
|
129507