Bugzilla – Attachment 129637 Details for
Bug 21652
reserves.waitingdate is set to current date by printing new hold slip
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21652: Simplify code
Bug-21652-Simplify-code.patch (text/plain), 2.02 KB, created by
Jonathan Druart
on 2022-01-20 10:25:05 UTC
(
hide
)
Description:
Bug 21652: Simplify code
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-20 10:25:05 UTC
Size:
2.02 KB
patch
obsolete
>From b1b9e0ddfd98d144c778a4f5e23e0dc3e9bd7aa4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 20 Jan 2022 11:20:49 +0100 >Subject: [PATCH] Bug 21652: Simplify code > >And add a test. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Hold.pm | 9 +-------- > t/db_dependent/Hold.t | 12 ++++++------ > 2 files changed, 7 insertions(+), 14 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 34ce8961544..39edcc743ac 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -178,18 +178,11 @@ sub set_waiting { > > $self->priority(0); > >- my $waiting_date; > my $today = dt_from_string(); > >- if ( $self->waitingdate ) { >- $waiting_date = $self->waitingdate; >- } else { >- $waiting_date = $today->ymd; >- } >- > my $values = { > found => 'W', >- waitingdate => $waiting_date, >+ ( !$self->waitingdate ? ( waitingdate => $today->ymd ) : () ), > desk_id => $desk_id, > }; > >diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t >index d258e70c13a..73007c18a08 100755 >--- a/t/db_dependent/Hold.t >+++ b/t/db_dependent/Hold.t >@@ -227,21 +227,21 @@ subtest "store() tests" => sub { > > subtest "set_waiting() tests" => sub { > >- plan tests => 1; >+ plan tests => 2; > > $schema->storage->txn_begin(); > >- # Disable logging >- t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); >- > my $hold = $builder->build_object({ class => 'Koha::Holds' }); > > $hold->waitingdate('2021-01-01'); >- > $hold->set_waiting(); >+ is($hold->waitingdate, '2021-01-01', "Setting waiting when already waiting should not update waitingdate"); > >- is($hold->waitingdate,'2021-01-01',"Setting waiting when already waiting should not update waitingdate"); >+ $hold->waitingdate(undef)->store; >+ $hold->set_waiting(); >+ isnt($hold->waitingdate, undef, "Setting waiting when not waiting already should update waitingdate"); > >+ $schema->storage->txn_rollback(); > }; > > subtest "delete() tests" => sub { >-- >2.25.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 21652
:
129099
|
129100
|
129484
|
129485
|
129635
|
129636
| 129637