Bugzilla – Attachment 181405 Details for
Bug 39724
Remove GetSuggestionInfo from C4/Suggestions.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39724: Remove GetSuggestionInfo from C4/Suggestions.pm
Bug-39724-Remove-GetSuggestionInfo-from-C4Suggesti.patch (text/plain), 6.63 KB, created by
Baptiste Wojtkowski (bwoj)
on 2025-04-24 08:58:02 UTC
(
hide
)
Description:
Bug 39724: Remove GetSuggestionInfo from C4/Suggestions.pm
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2025-04-24 08:58:02 UTC
Size:
6.63 KB
patch
obsolete
>From 6c319fc5c7dce678b3123a9bb7b4c7e8f0509ec8 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Tue, 8 Apr 2025 14:39:47 +0200 >Subject: [PATCH] Bug 39724: Remove GetSuggestionInfo from C4/Suggestions.pm > >--- > C4/Suggestions.pm | 28 ---------------------------- > acqui/basket.pl | 5 ++--- > acqui/neworderempty.pl | 9 ++++----- > t/db_dependent/Suggestions.t | 29 ++--------------------------- > 4 files changed, 8 insertions(+), 63 deletions(-) > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 2abd8dec..4ac59001 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -35,7 +35,6 @@ our @EXPORT = qw( > ConnectSuggestionAndBiblio > DelSuggestion > GetSuggestionByStatus >- GetSuggestionInfo > ModStatus > ModSuggestion > DelSuggestionsOlderThan >@@ -68,33 +67,6 @@ Suggestions done by other borrowers can be seen when not "AVAILABLE" > > =head1 FUNCTIONS > >-=head2 GetSuggestionInfo >- >-Get a suggestion and borrower's informations from it's suggestionid >- >-return : >-all informations (suggestion and borrower) of the suggestion which is related to the suggestionid given. >- >-=cut >- >-sub GetSuggestionInfo { >- my ($suggestionid) = @_; >- 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 suggestionid=? >- LIMIT 1 >- }; >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare($query); >- $sth->execute($suggestionid); >- return $sth->fetchrow_hashref; >-} >- > =head2 GetSuggestionByStatus > > $aqorders = &GetSuggestionByStatus($status,[$branchcode]) >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 10de07ea..fb72a5ef 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -26,9 +26,8 @@ use C4::Output qw( output_html_with_http_headers output_and_exit ); > use CGI qw ( -utf8 ); > use C4::Acquisition > qw( GetBasket CanUserManageBasket GetBasketAsCSV NewBasket NewBasketgroup ModBasket ReopenBasket ModBasketUsers GetBasketgroup GetBasketgroups GetBasketUsers GetOrders GetOrder get_rounded_price ); >-use C4::Budgets qw( GetBudgetHierarchy GetBudget CanUserUseBudget ); >-use C4::Contract qw( GetContract ); >-use C4::Suggestions qw( GetSuggestionInfo ); >+use C4::Budgets qw( GetBudgetHierarchy GetBudget CanUserUseBudget ); >+use C4::Contract qw( GetContract ); > use Koha::Biblios; > use Koha::Acquisition::Baskets; > use Koha::Acquisition::Booksellers; >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 75bc59cf..1ab5bc47 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -72,7 +72,6 @@ use C4::Budgets qw( GetBudget GetBudgetHierarchy CanUserUseBudget ); > > use C4::Acquisition qw( GetOrder GetBasket FillWithDefaultValues GetOrderUsers ); > use C4::Contract qw( GetContract ); >-use C4::Suggestions qw( GetSuggestionInfo ); > use C4::Biblio qw( > AddBiblio > GetBiblioData >@@ -323,7 +322,7 @@ if ( not $ordernumber or $biblionumber ) { > $template->param( catalog_details => \@catalog_details, ); > > my $suggestion; >-$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid; >+$suggestion = Koha::Suggestions->find($suggestionid); > > my $active_currency = Koha::Acquisition::Currencies->get_active; > >@@ -461,9 +460,9 @@ $template->param( > closedate => $basket->{'closedate'}, > > # order details >- suggestionid => $suggestion->{suggestionid}, >- surnamesuggestedby => $suggestion->{surnamesuggestedby}, >- firstnamesuggestedby => $suggestion->{firstnamesuggestedby}, >+ suggestionid => $suggestion->suggestionid, >+ surnamesuggestedby => $suggestion->suggester->{surname}, >+ firstnamesuggestedby => $suggestion->suggester->{firstname}, > biblionumber => $biblionumber, > uncertainprice => $data->{'uncertainprice'}, > discount_2dp => sprintf( "%.2f", $bookseller->discount ), # for display >diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t >index 693c0b4b..3d6d5b71 100755 >--- a/t/db_dependent/Suggestions.t >+++ b/t/db_dependent/Suggestions.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use DateTime::Duration; > use Test::NoWarnings; >-use Test::More tests => 80; >+use Test::More tests => 69; > use Test::Warn; > > use t::lib::Mocks; >@@ -38,7 +38,7 @@ use Koha::Suggestions; > BEGIN { > use_ok( > 'C4::Suggestions', >- qw( ModSuggestion GetSuggestionInfo GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan ) >+ qw( ModSuggestion GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan ) > ); > } > >@@ -310,31 +310,6 @@ $messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber2 > > is( scalar(@$messages), 1, 'No new letter should have been generated if the update raised an error' ); > >-is( GetSuggestionInfo(), undef, 'GetSuggestionInfo without the suggestion id returns undef' ); >-$suggestion = GetSuggestionInfo($my_suggestionid); >-is( $suggestion->{suggestionid}, $my_suggestionid, 'GetSuggestionInfo returns the suggestion id correctly' ); >-is( $suggestion->{title}, $mod_suggestion1->{title}, 'GetSuggestionInfo returns the title correctly' ); >-is( $suggestion->{author}, $mod_suggestion1->{author}, 'GetSuggestionInfo returns the author correctly' ); >-is( >- $suggestion->{publishercode}, $mod_suggestion1->{publishercode}, >- 'GetSuggestionInfo returns the publisher code correctly' >-); >-is( >- $suggestion->{suggestedby}, $my_suggestion->{suggestedby}, >- 'GetSuggestionInfo returns the borrower number correctly' >-); >-is( >- $suggestion->{biblionumber}, $my_suggestion->{biblionumber}, >- 'GetSuggestionInfo returns the biblio number correctly' >-); >-is( $suggestion->{STATUS}, $mod_suggestion3->{STATUS}, 'GetSuggestionInfo returns the status correctly' ); >-is( $suggestion->{surnamesuggestedby}, $member->{surname}, 'GetSuggestionInfo returns the surname correctly' ); >-is( $suggestion->{firstnamesuggestedby}, $member->{firstname}, 'GetSuggestionInfo returns the firstname correctly' ); >-is( >- $suggestion->{borrnumsuggestedby}, $my_suggestion->{suggestedby}, >- 'GetSuggestionInfo returns the borrower number correctly' >-); >- > my $suggestions = GetSuggestionByStatus(); > is( @$suggestions, 0, 'GetSuggestionByStatus without the status returns an empty array' ); > $suggestions = GetSuggestionByStatus('CHECKED'); >-- >2.30.2
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 39724
: 181405