Bugzilla – Attachment 142013 Details for
Bug 14783
Allow patrons to change pickup location for non-waiting holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14783: (QA follow-up) Rename method and move tests
Bug-14783-QA-follow-up-Rename-method-and-move-test.patch (text/plain), 7.45 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-10-17 19:01:03 UTC
(
hide
)
Description:
Bug 14783: (QA follow-up) Rename method and move tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-10-17 19:01:03 UTC
Size:
7.45 KB
patch
obsolete
>From 217da9cf3dd6c10e92397274c61570ef33b50587 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 17 Oct 2022 15:43:22 -0300 >Subject: [PATCH] Bug 14783: (QA follow-up) Rename method and move tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Hold.pm | 8 +-- > .../bootstrap/en/includes/holds-table.inc | 2 +- > opac/opac-modrequest.pl | 2 +- > t/db_dependent/Hold.t | 52 +------------------ > t/db_dependent/Koha/Hold.t | 50 +++++++++++++++++- > 5 files changed, 56 insertions(+), 58 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 232012976a7..378b902638b 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -906,15 +906,15 @@ sub to_api_mapping { > }; > } > >-=head3 can_change_branch_opac >+=head3 can_update_pickup_location_opac > >-returns if a hold can change pickup location from opac >+ my $can_update_pickup_location_opac = $hold->can_update_pickup_location_opac; > >-my $can_change_branch_opac = $hold->can_change_branch_opac; >+Returns if a hold can change pickup location from opac > > =cut > >-sub can_change_branch_opac { >+sub can_update_pickup_location_opac { > my ($self) = @_; > > my @statuses = split /,/, C4::Context->preference("OPACAllowUserToChangeBranch"); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >index ef08112215f..ab345ca3b2f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >@@ -83,7 +83,7 @@ > <td class="branch"> > <span class="tdlabel">Pickup location:</span> > [% HOLD.branch.branchname | html %] >- [% IF ( HOLD.can_change_branch_opac ) %] >+ [% IF ( HOLD.can_update_pickup_location_opac ) %] > <button type="button" class="btn btn-sm btn-link" data-toggle="modal" data-target="#changePickup[% HOLD.reserve_id | html %]"> > <i class="fa fa-pencil" aria-hidden="true"></i> Change > </button> >diff --git a/opac/opac-modrequest.pl b/opac/opac-modrequest.pl >index d296591001f..1518a3b72e1 100755 >--- a/opac/opac-modrequest.pl >+++ b/opac/opac-modrequest.pl >@@ -60,7 +60,7 @@ if ( $reserve_id && $borrowernumber ) { > } > elsif ( $new_pickup_location ) { > >- if ($hold->can_change_branch_opac){ >+ if ($hold->can_update_pickup_location_opac) { > $hold->set_pickup_location({ library_id => $new_pickup_location }); > } > else { >diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t >index 1cfd5bdeca2..73007c18a08 100755 >--- a/t/db_dependent/Hold.t >+++ b/t/db_dependent/Hold.t >@@ -29,7 +29,7 @@ use Koha::Item; > use Koha::DateUtils qw( dt_from_string ); > use t::lib::TestBuilder; > >-use Test::More tests => 36; >+use Test::More tests => 35; > use Test::Exception; > use Test::Warn; > >@@ -386,53 +386,3 @@ subtest 'suspend() tests' => sub { > > $schema->storage->txn_rollback; > }; >- >-subtest 'can_change_branch_opac() tests' => sub { >- >- plan tests => 8; >- >- $schema->storage->txn_begin; >- >- my $hold = $builder->build_object( >- { class => 'Koha::Holds', >- value => { found => undef, suspend => 0, suspend_until => undef, waitingdate => undef } >- } >- ); >- >- t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', '' ); >- $hold->found(undef); >- is( $hold->can_change_branch_opac, 0, "Pending hold pickup can't be changed (No change allowed)" ); >- >- $hold->found('T'); >- is( $hold->can_change_branch_opac, 0, "In transit hold pickup can't be changed (No change allowed)" ); >- >- $hold->found('W'); >- is( $hold->can_change_branch_opac, 0, "Waiting hold pickup can't be changed (No change allowed)" ); >- >- $hold->found(undef); >- $dt = dt_from_string(); >- >- $hold->suspend_hold( $dt ); >- is( $hold->can_change_branch_opac, 0, "Suspended hold pickup can't be changed (No change allowed)" ); >- $hold->resume(); >- >- t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', 'pending,intransit,suspended' ); >- $hold->found(undef); >- is( $hold->can_change_branch_opac, 1, "Pending hold pickup can be changed (pending,intransit,suspended allowed)" ); >- >- $hold->found('T'); >- is( $hold->can_change_branch_opac, 1, "In transit hold pickup can be changed (pending,intransit,suspended allowed)" ); >- >- $hold->found('W'); >- is( $hold->can_change_branch_opac, 0, "Waiting hold pickup can't be changed (pending,intransit,suspended allowed)" ); >- >- $hold->found(undef); >- $dt = dt_from_string(); >- $hold->suspend_hold( $dt ); >- is( $hold->can_change_branch_opac, 1, "Suspended hold pickup can be changed (pending,intransit,suspended allowed)" ); >- $hold->resume(); >- >- >- $schema->storage->txn_rollback; >- >-}; >diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t >index 5aeebd073ae..fe59013719e 100755 >--- a/t/db_dependent/Koha/Hold.t >+++ b/t/db_dependent/Koha/Hold.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 9; >+use Test::More tests => 10; > > use Test::Exception; > use Test::MockModule; >@@ -29,6 +29,7 @@ use t::lib::TestBuilder; > use t::lib::Mocks; > > use Koha::ActionLogs; >+use Koha::DateUtils qw(dt_from_string); > use Koha::Holds; > use Koha::Libraries; > use Koha::Old::Holds; >@@ -863,3 +864,50 @@ subtest 'cancellation_requestable_from_opac() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'can_update_pickup_location_opac() tests' => sub { >+ >+ plan tests => 8; >+ >+ $schema->storage->txn_begin; >+ >+ my $hold = $builder->build_object( >+ { class => 'Koha::Holds', >+ value => { found => undef, suspend => 0, suspend_until => undef, waitingdate => undef } >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', '' ); >+ $hold->found(undef); >+ is( $hold->can_update_pickup_location_opac, 0, "Pending hold pickup can't be changed (No change allowed)" ); >+ >+ $hold->found('T'); >+ is( $hold->can_update_pickup_location_opac, 0, "In transit hold pickup can't be changed (No change allowed)" ); >+ >+ $hold->found('W'); >+ is( $hold->can_update_pickup_location_opac, 0, "Waiting hold pickup can't be changed (No change allowed)" ); >+ >+ $hold->found(undef); >+ my $dt = dt_from_string(); >+ >+ $hold->suspend_hold( $dt ); >+ is( $hold->can_update_pickup_location_opac, 0, "Suspended hold pickup can't be changed (No change allowed)" ); >+ $hold->resume(); >+ >+ t::lib::Mocks::mock_preference( 'OPACAllowUserToChangeBranch', 'pending,intransit,suspended' ); >+ $hold->found(undef); >+ is( $hold->can_update_pickup_location_opac, 1, "Pending hold pickup can be changed (pending,intransit,suspended allowed)" ); >+ >+ $hold->found('T'); >+ is( $hold->can_update_pickup_location_opac, 1, "In transit hold pickup can be changed (pending,intransit,suspended allowed)" ); >+ >+ $hold->found('W'); >+ is( $hold->can_update_pickup_location_opac, 0, "Waiting hold pickup can't be changed (pending,intransit,suspended allowed)" ); >+ >+ $hold->found(undef); >+ $dt = dt_from_string(); >+ $hold->suspend_hold( $dt ); >+ is( $hold->can_update_pickup_location_opac, 1, "Suspended hold pickup can be changed (pending,intransit,suspended allowed)" ); >+ >+ $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 14783
:
118189
|
118241
|
123199
|
123271
|
123708
|
123709
|
127488
|
127490
|
127492
|
130344
|
130345
|
130346
|
130347
|
141499
|
141500
|
141501
|
141502
|
141727
|
141728
|
141729
|
141730
|
142009
|
142010
|
142011
|
142012
| 142013 |
142014
|
142015
|
143025