From 978d763e0cd32bf491b0e9eb085b95140aea443a Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 9 Nov 2020 10:19:11 +1300 Subject: [PATCH] Bug 19532: (follow-up) Fixing tests and QA tools And making reverted ajax message clearer Signed-off-by: David Nind --- Koha/Recalls.pm | 2 +- koha-tmpl/intranet-tmpl/prog/js/recalls.js | 2 +- opac/opac-recall.pl | 2 +- opac/opac-recalls.pl | 2 +- recalls/recall_pickup_slip.pl | 2 +- recalls/recalls_old_queue.pl | 2 +- recalls/recalls_overdue.pl | 2 +- recalls/recalls_queue.pl | 2 +- recalls/recalls_to_pull.pl | 2 +- recalls/recalls_waiting.pl | 2 +- svc/recall | 2 +- t/db_dependent/Koha/Recalls.t | 4 ++-- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Koha/Recalls.pm b/Koha/Recalls.pm index 0e18c116d8..11c267abb6 100644 --- a/Koha/Recalls.pm +++ b/Koha/Recalls.pm @@ -183,7 +183,7 @@ sub move_recall { if ( $message eq 'no action provided' and $item and $item->biblionumber and $borrowernumber ) { # move_recall was not called to revert or cancel, but was called to fulfill - my $recall = Koha::Recalls->find({ borrowernumber => $borrowernumber, biblionumber => $item->biblionumber, itemnumber => [ $item->itemnumber, undef ], old => undef }); + my $recall = Koha::Recalls->search({ borrowernumber => $borrowernumber, biblionumber => $item->biblionumber, itemnumber => [ $item->itemnumber, undef ], old => undef }, { order_by => { -asc => 'recalldate' } })->next; if ( $recall ) { $recall->set_finished; $message = 'fulfilled'; diff --git a/koha-tmpl/intranet-tmpl/prog/js/recalls.js b/koha-tmpl/intranet-tmpl/prog/js/recalls.js index c45a6c8f19..e4a791d795 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/recalls.js +++ b/koha-tmpl/intranet-tmpl/prog/js/recalls.js @@ -77,7 +77,7 @@ $(document).ready(function() { if(data.success == 0) { message = __("The recall waiting status may have already been reverted. Please refresh the page."); } else { - message = __("Status updated"); + message = __("Waiting status reverted"); } $self.parent().parent().parent().parent().html(message); }); diff --git a/opac/opac-recall.pl b/opac/opac-recall.pl index 9bb5ea6e85..43913e4c67 100755 --- a/opac/opac-recall.pl +++ b/opac/opac-recall.pl @@ -23,7 +23,7 @@ use C4::Auth; use C4::Output; use C4::Context; -my $query = new CGI; +my $query = CGI->new; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "opac-recall.tt", diff --git a/opac/opac-recalls.pl b/opac/opac-recalls.pl index 090b1c8f11..82b6e97afe 100755 --- a/opac/opac-recalls.pl +++ b/opac/opac-recalls.pl @@ -23,7 +23,7 @@ use C4::Auth; # get_template_and_user use C4::Output; use Koha::Recalls; -my $input = new CGI; +my $input = CGI->new; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "opac-recalls.tt", diff --git a/recalls/recall_pickup_slip.pl b/recalls/recall_pickup_slip.pl index b123ba0652..eb250fde17 100755 --- a/recalls/recall_pickup_slip.pl +++ b/recalls/recall_pickup_slip.pl @@ -23,7 +23,7 @@ use C4::Context; use C4::Output; use C4::Auth; -my $input = new CGI; +my $input = CGI->new; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { diff --git a/recalls/recalls_old_queue.pl b/recalls/recalls_old_queue.pl index a608b87c48..dbd043fda0 100755 --- a/recalls/recalls_old_queue.pl +++ b/recalls/recalls_old_queue.pl @@ -22,7 +22,7 @@ use C4::Auth; use C4::Output; use Koha::BiblioFrameworks; -my $query = new CGI; +my $query = CGI->new; my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( { template_name => "recalls/recalls_old_queue.tt", diff --git a/recalls/recalls_overdue.pl b/recalls/recalls_overdue.pl index 44883c4529..3d6a0527f8 100755 --- a/recalls/recalls_overdue.pl +++ b/recalls/recalls_overdue.pl @@ -23,7 +23,7 @@ use C4::Output; use Koha::BiblioFrameworks; use Koha::DateUtils; -my $query = new CGI; +my $query = CGI->new; my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( { template_name => "recalls/recalls_overdue.tt", diff --git a/recalls/recalls_queue.pl b/recalls/recalls_queue.pl index bd66283c82..81a982798d 100755 --- a/recalls/recalls_queue.pl +++ b/recalls/recalls_queue.pl @@ -22,7 +22,7 @@ use C4::Auth; use C4::Output; use Koha::BiblioFrameworks; -my $query = new CGI; +my $query = CGI->new; my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( { template_name => "recalls/recalls_queue.tt", diff --git a/recalls/recalls_to_pull.pl b/recalls/recalls_to_pull.pl index 66d9408c7b..163aeac15d 100755 --- a/recalls/recalls_to_pull.pl +++ b/recalls/recalls_to_pull.pl @@ -22,7 +22,7 @@ use C4::Auth; use C4::Output; use Koha::BiblioFrameworks; -my $query = new CGI; +my $query = CGI->new; my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( { template_name => "recalls/recalls_to_pull.tt", diff --git a/recalls/recalls_waiting.pl b/recalls/recalls_waiting.pl index 6fdf1eeba9..d6fbe65f20 100755 --- a/recalls/recalls_waiting.pl +++ b/recalls/recalls_waiting.pl @@ -25,7 +25,7 @@ use Koha::BiblioFrameworks; use Koha::DateUtils; use Koha::Patrons; -my $query = new CGI; +my $query = CGI->new; my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( { template_name => "recalls/recalls_waiting.tt", diff --git a/svc/recall b/svc/recall index 35c24585ff..3c7970019a 100755 --- a/svc/recall +++ b/svc/recall @@ -27,7 +27,7 @@ use C4::Output qw(output_with_http_headers); use C4::Circulation qw(AddReturn); use Koha::Recalls; -my $input = new CGI; +my $input = CGI->new; my $json = encode_json({ success => 0 }); my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { recall => 'manage_recalls' } ); diff --git a/t/db_dependent/Koha/Recalls.t b/t/db_dependent/Koha/Recalls.t index 07f8d9f1ad..32dc9e96ba 100755 --- a/t/db_dependent/Koha/Recalls.t +++ b/t/db_dependent/Koha/Recalls.t @@ -43,7 +43,7 @@ my $item1 = $builder->build_sample_item(); my $biblio1 = $item1->biblio; my $branch1 = $item1->holdingbranch; my $itemtype1 = $item1->effective_itemtype; -my $item2 = $builder->build_sample_item(); +my $item2 = $builder->build_sample_item({ biblionumber => $biblio1->biblionumber }); my $biblio2 = $item1->biblio; my $branch2 = $item1->holdingbranch; my $itemtype2 = $item1->effective_itemtype; @@ -168,7 +168,7 @@ ok( $recall->cancelled, "Recall cancelled with move_recall" ); expirationdate => undef, interface => 'COMMANDLINE', }); -$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id, itemnumber => $item2->itemnumber, borrowernumber => $patron1->borrowernumber }); +$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id, item => $item2, borrowernumber => $patron1->borrowernumber }); $recall = Koha::Recalls->find( $recall->recall_id ); ok( $recall->finished, "Recall fulfilled with move_recall" ); -- 2.29.2