From 28a80807d48aaabcea96e80cfe300d9278322cda Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 May 2023 15:19:38 +0200 Subject: [PATCH] Bug 35717: Remove GetSuggestionInfoFromBiblionumber Signed-off-by: Nick Clemens --- C4/Suggestions.pm | 28 ---------------------------- acqui/orderreceive.pl | 6 ------ t/db_dependent/Suggestions.t | 19 ++----------------- 3 files changed, 2 insertions(+), 51 deletions(-) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index ed3a19bcfda..4cc1256d283 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -37,7 +37,6 @@ our @EXPORT = qw( GetSuggestion GetSuggestionByStatus GetSuggestionFromBiblionumber - GetSuggestionInfoFromBiblionumber GetSuggestionInfo ModStatus ModSuggestion @@ -120,33 +119,6 @@ sub GetSuggestionFromBiblionumber { return $suggestionid; } -=head2 GetSuggestionInfoFromBiblionumber - -Get a suggestion and borrower's informations from it's biblionumber. - -return : -all informations (suggestion and borrower) of the suggestion which is related to the biblionumber given. - -=cut - -sub GetSuggestionInfoFromBiblionumber { - my ($biblionumber) = @_; - my $query = q{ - SELECT suggestions.*, - U1.surname AS surnamesuggestedby, - U1.firstname AS firstnamesuggestedby, - U1.borrowernumber AS borrnumsuggestedby - FROM suggestions - LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber - WHERE biblionumber=? - LIMIT 1 - }; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare($query); - $sth->execute($biblionumber); - return $sth->fetchrow_hashref; -} - =head2 GetSuggestionInfo Get a suggestion and borrower's informations from it's suggestionid diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index d84a2430d6d..c51595833be 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -133,12 +133,6 @@ if ($order) { $template->param( orders => $orders, ); } - my $suggestion = GetSuggestionInfoFromBiblionumber( $order->biblionumber ); - - if ($suggestion) { - $template->param( suggestion => $suggestion ); - } - $template->param( order => $order, creator => $creator, diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t index 97a0d80ab9c..13a89b4ee06 100755 --- a/t/db_dependent/Suggestions.t +++ b/t/db_dependent/Suggestions.t @@ -18,7 +18,7 @@ use Modern::Perl; use DateTime::Duration; -use Test::More tests => 92; +use Test::More tests => 80; use Test::Warn; use t::lib::Mocks; @@ -35,7 +35,7 @@ use Koha::Patrons; use Koha::Suggestions; BEGIN { - use_ok('C4::Suggestions', qw( GetSuggestion ModSuggestion GetSuggestionInfo GetSuggestionFromBiblionumber GetSuggestionInfoFromBiblionumber GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan )); + use_ok('C4::Suggestions', qw( GetSuggestion ModSuggestion GetSuggestionInfo GetSuggestionFromBiblionumber GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan )); } my $schema = Koha::Database->new->schema; @@ -299,21 +299,6 @@ is( GetSuggestionFromBiblionumber(2), undef, 'GetSuggestionFromBiblionumber with is( GetSuggestionFromBiblionumber($biblio_1->biblionumber), $my_suggestionid, 'GetSuggestionFromBiblionumber functions correctly' ); -is( GetSuggestionInfoFromBiblionumber(), undef, 'GetSuggestionInfoFromBiblionumber without the biblio number returns undef' ); -is( GetSuggestionInfoFromBiblionumber(2), undef, 'GetSuggestionInfoFromBiblionumber with an invalid biblio number returns undef' ); -$suggestion = GetSuggestionInfoFromBiblionumber($biblio_1->biblionumber); -is( $suggestion->{suggestionid}, $my_suggestionid, 'GetSuggestionInfoFromBiblionumber returns the suggestion id correctly' ); -is( $suggestion->{title}, $mod_suggestion1->{title}, 'GetSuggestionInfoFromBiblionumber returns the title correctly' ); -is( $suggestion->{author}, $mod_suggestion1->{author}, 'GetSuggestionInfoFromBiblionumber returns the author correctly' ); -is( $suggestion->{publishercode}, $mod_suggestion1->{publishercode}, 'GetSuggestionInfoFromBiblionumber returns the publisher code correctly' ); -is( $suggestion->{suggestedby}, $my_suggestion->{suggestedby}, 'GetSuggestionInfoFromBiblionumber returns the borrower number correctly' ); -is( $suggestion->{biblionumber}, $my_suggestion->{biblionumber}, 'GetSuggestionInfoFromBiblionumber returns the biblio number correctly' ); -is( $suggestion->{STATUS}, $mod_suggestion3->{STATUS}, 'GetSuggestionInfoFromBiblionumber returns the status correctly' ); -is( $suggestion->{surnamesuggestedby}, $member->{surname}, 'GetSuggestionInfoFromBiblionumber returns the surname correctly' ); -is( $suggestion->{firstnamesuggestedby}, $member->{firstname}, 'GetSuggestionInfoFromBiblionumber returns the firstname correctly' ); -is( $suggestion->{borrnumsuggestedby}, $my_suggestion->{suggestedby}, 'GetSuggestionInfoFromBiblionumeber returns the borrower number correctly' ); - - my $suggestions = GetSuggestionByStatus(); is( @$suggestions, 0, 'GetSuggestionByStatus without the status returns an empty array' ); $suggestions = GetSuggestionByStatus('CHECKED'); -- 2.47.0