Bugzilla – Attachment 164824 Details for
Bug 34032
Holds expirationdate left blank if waiting status is reverted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34032: Use reserves.patron_expiration_date if set
Bug-34032-Use-reservespatronexpirationdate-if-set.patch (text/plain), 3.63 KB, created by
Kyle M Hall (khall)
on 2024-04-12 11:14:54 UTC
(
hide
)
Description:
Bug 34032: Use reserves.patron_expiration_date if set
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-04-12 11:14:54 UTC
Size:
3.63 KB
patch
obsolete
>From 0cf016fc62e5f5499bbb53033b28e64055a802b5 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Mon, 6 Nov 2023 14:31:03 +0200 >Subject: [PATCH] Bug 34032: Use reserves.patron_expiration_date if set > >If reserves.patron_expiration_date is set use it as holds >expiration date when waiting status is reverted. > >To test: >1. Apply this patch. >2. Add hold for patron A and set expiration date manually. >3. Check in item on hold for patron A and confirm hold was >set as waiting. >4. Revert holds waiting status. >=> Hold should still have expiration date you set manually >in step 2. >5. Check that you have DefaultHoldExpirationdate and other >DefaultHold sysprefs set. >6. Add hold for patron B, but this time do not set expiration >date. >7. Check in item on hold for patron B, revert waiting status. >=> Hold should now have expiration date set based on >DefaultHold sysprefs. > >Also prove t/db_dependent/Hold.t. > >Sponsored-by: Koha-Suomi Oy >Signed-off-by: Esther <esther@bywatersolutions.com> >--- > Koha/Hold.pm | 13 +++++++------ > t/db_dependent/Hold.t | 27 ++++++++++++++++++++++++++- > 2 files changed, 33 insertions(+), 7 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 382f40a6ddc..82a1340691f 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -955,13 +955,14 @@ sub store { > if ( exists $updated_columns{reservedate} || $hold_reverted ) { > if ( > ( C4::Context->preference('DefaultHoldExpirationdate') >- && ! exists $updated_columns{expirationdate} ) >- || ( C4::Context->preference('DefaultHoldExpirationdate') >- && exists $updated_columns{expirationdate} >- && $hold_reverted ) >- ) >+ && ( ! exists $updated_columns{expirationdate} || $hold_reverted ) ) >+ ) > { >- $self->_set_default_expirationdate; >+ if($self->patron_expiration_date){ >+ $self->expirationdate($self->patron_expiration_date); >+ } else { >+ $self->_set_default_expirationdate; >+ } > } > } > } >diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t >index ce8488c8447..fa607a5c2e0 100755 >--- a/t/db_dependent/Hold.t >+++ b/t/db_dependent/Hold.t >@@ -146,7 +146,7 @@ $schema->storage->txn_rollback(); > > subtest "store() tests" => sub { > >- plan tests => 6; >+ plan tests => 7; > > $schema->storage->txn_begin(); > >@@ -241,6 +241,31 @@ subtest "store() tests" => sub { > is( $hold->expirationdate, > $expected_date, 'Expiration date set after reverting holds waiting status.' ); > >+ my $patron_expiration_date = dt_from_string('2023-11-06')->ymd; >+ $hold = Koha::Hold->new( >+ { >+ biblionumber => $biblio->biblionumber, >+ itemnumber => $item->id, >+ reservedate => '2023-10-15', >+ expirationdate => $patron_expiration_date, >+ waitingdate => '2023-10-15', >+ borrowernumber => $borrower->borrowernumber, >+ branchcode => $library->branchcode, >+ suspend => 0, >+ patron_expiration_date => $patron_expiration_date, >+ } >+ )->store; >+ $hold->discard_changes; >+ >+ $hold->set_waiting; >+ C4::Reserves::RevertWaitingStatus( >+ { itemnumber => $item->itemnumber } >+ ); >+ $hold->discard_changes; >+ >+ is( $hold->expirationdate, >+ $patron_expiration_date, 'Expiration date set same as patron_expiration_date after reverting holds waiting status.' ); >+ > $schema->storage->txn_rollback(); > }; > >-- >2.30.2
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 34032
:
152516
|
152535
|
158516
|
159908
|
164823
| 164824 |
164825