Bugzilla – Attachment 158516 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
0001-Bug-34032-Use-reserves.patron_expiration_date-if-set.patch (text/plain), 3.58 KB, created by
Emmi Takkinen
on 2023-11-06 12:35:02 UTC
(
hide
)
Description:
Bug 34032: Use reserves.patron_expiration_date if set
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2023-11-06 12:35:02 UTC
Size:
3.58 KB
patch
obsolete
>From 84f6a9cf1dd1410876030d43e19d1822eb78e367 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 >--- > 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 748babfe9d..8b3aafa342 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -940,13 +940,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 ce8488c844..fa607a5c2e 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.34.1 >
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