From c8805b3b5bc7454cdad048897177fb48785fe98c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 5 May 2022 11:14:44 +0100 Subject: [PATCH] Bug 30291: (QA follow-up) Fix for revert to recall_id Signed-off-by: Fridolin Somers --- C4/Letters.pm | 2 +- Koha/Recall.pm | 2 +- t/db_dependent/Koha/Recalls.t | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index ddb43568fc..7c63b23d8e 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -751,7 +751,7 @@ sub _parseletter_sth { ($table eq 'serial') ? "SELECT * FROM $table WHERE serialid = ?" : ($table eq 'problem_reports') ? "SELECT * FROM $table WHERE reportid = ?" : ($table eq 'additional_contents' || $table eq 'opac_news') ? "SELECT * FROM additional_contents WHERE idnew = ?" : - ($table eq 'recalls') ? "SELECT * FROM $table WHERE id = ?" : + ($table eq 'recalls') ? "SELECT * FROM $table WHERE recall_id = ?" : undef ; unless ($query) { warn "ERROR: No _parseletter_sth query for table '$table'"; diff --git a/Koha/Recall.pm b/Koha/Recall.pm index ebe2037c93..a97e741b64 100644 --- a/Koha/Recall.pm +++ b/Koha/Recall.pm @@ -354,7 +354,7 @@ sub set_waiting { biblio => $self->biblio_id, borrowers => $self->patron_id, items => $itemnumber, - recalls => $self->id, + recalls => $self->recall_id, }, ); diff --git a/t/db_dependent/Koha/Recalls.t b/t/db_dependent/Koha/Recalls.t index 3e5810ffaa..63d4c0dd05 100755 --- a/t/db_dependent/Koha/Recalls.t +++ b/t/db_dependent/Koha/Recalls.t @@ -146,19 +146,19 @@ is( $messages_count, 3, "RETURN_RECALLED_ITEM notice successfully sent to checko my $message = Koha::Recalls->move_recall; is( $message, 'no recall_id provided', "Can't move a recall without specifying which recall" ); -$message = Koha::Recalls->move_recall({ recall_id => $recall->id }); +$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id }); is( $message, 'no action provided', "No clear action to perform on recall" ); -$message = Koha::Recalls->move_recall({ recall_id => $recall->id, action => 'whatever' }); +$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id, action => 'whatever' }); is( $message, 'no action provided', "Legal action not provided to perform on recall" ); $recall->set_waiting({ item => $item1 }); ok( $recall->waiting, "Recall is waiting" ); -Koha::Recalls->move_recall({ recall_id => $recall->id, action => 'revert' }); -$recall = Koha::Recalls->find( $recall->id ); +Koha::Recalls->move_recall({ recall_id => $recall->recall_id, action => 'revert' }); +$recall = Koha::Recalls->find( $recall->recall_id ); ok( $recall->requested, "Recall reverted to requested with move_recall" ); -Koha::Recalls->move_recall({ recall_id => $recall->id, action => 'cancel' }); -$recall = Koha::Recalls->find( $recall->id ); +Koha::Recalls->move_recall({ recall_id => $recall->recall_id, action => 'cancel' }); +$recall = Koha::Recalls->find( $recall->recall_id ); ok( $recall->cancelled, "Recall cancelled with move_recall" ); ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ @@ -169,8 +169,8 @@ ok( $recall->cancelled, "Recall cancelled with move_recall" ); expirationdate => undef, interface => 'COMMANDLINE', }); -$message = Koha::Recalls->move_recall({ recall_id => $recall->id, item => $item2, borrowernumber => $patron1->borrowernumber }); -$recall = Koha::Recalls->find( $recall->id ); +$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id, item => $item2, borrowernumber => $patron1->borrowernumber }); +$recall = Koha::Recalls->find( $recall->recall_id ); ok( $recall->fulfilled, "Recall fulfilled with move_recall" ); $schema->storage->txn_rollback(); @@ -191,7 +191,7 @@ subtest 'filter_by_current() and filter_by_finished() tests' => sub { my $recalls = Koha::Recalls->search( { - id => [ + recall_id => [ $in_transit->id, $overdue->id, $requested->id, @@ -201,7 +201,7 @@ subtest 'filter_by_current() and filter_by_finished() tests' => sub { $fulfilled->id, ] }, - { order_by => [ 'id' ] } + { order_by => [ 'recall_id' ] } ); is( $recalls->count, 7, 'Resultset count is correct' ); -- 2.39.5