Bugzilla – Attachment 181403 Details for
Bug 39722
Remove GetSuggestionFromBiblionumber from C4/Suggestions.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39722: Remove GetSuggestionFromBiblionumber from C4/Suggestions.pm
Bug-39722-Remove-GetSuggestionFromBiblionumber-fro.patch (text/plain), 4.32 KB, created by
Baptiste Wojtkowski (bwoj)
on 2025-04-24 08:53:28 UTC
(
hide
)
Description:
Bug 39722: Remove GetSuggestionFromBiblionumber from C4/Suggestions.pm
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2025-04-24 08:53:28 UTC
Size:
4.32 KB
patch
obsolete
>From dab2395808516ae0dc499dcc9b33c23f6c500e58 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Tue, 8 Apr 2025 13:53:38 +0200 >Subject: [PATCH] Bug 39722: Remove GetSuggestionFromBiblionumber from > C4/Suggestions.pm > >--- > C4/Acquisition.pm | 8 ++++---- > C4/Suggestions.pm | 26 -------------------------- > t/db_dependent/Suggestions.t | 14 ++------------ > 3 files changed, 6 insertions(+), 42 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index bd418f84..85dc9863 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -21,7 +21,7 @@ use Modern::Perl; > use Carp qw( carp croak ); > use Text::CSV_XS; > use C4::Context; >-use C4::Suggestions qw( GetSuggestionFromBiblionumber ModSuggestion ); >+use C4::Suggestions qw( ModSuggestion ); > use C4::Biblio qw( GetMarcFromKohaField GetMarcStructure IsMarcStructureInternal ); > use C4::Contract qw( GetContract ); > use C4::Log qw( logaction ); >@@ -1407,11 +1407,11 @@ sub ModReceiveOrder { > $order->{invoice_unitprice} ||= $order->{unitprice}; > $order->{invoice_currency} ||= Koha::Acquisition::Currencies->get_active->currency; > >- my $suggestionid = GetSuggestionFromBiblionumber($biblionumber); >- if ($suggestionid) { >+ my $suggestion = Koha::Suggestions->find( { biblionumber => $biblionumber } ); >+ if ($suggestion) { > ModSuggestion( > { >- suggestionid => $suggestionid, >+ suggestionid => $suggestion->suggestionid, > STATUS => 'AVAILABLE', > biblionumber => $biblionumber > } >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index dc933274..f2999f02 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -35,7 +35,6 @@ our @EXPORT = qw( > ConnectSuggestionAndBiblio > DelSuggestion > GetSuggestionByStatus >- GetSuggestionFromBiblionumber > GetSuggestionInfoFromBiblionumber > GetSuggestionInfo > ModStatus >@@ -70,31 +69,6 @@ Suggestions done by other borrowers can be seen when not "AVAILABLE" > > =head1 FUNCTIONS > >-=head2 GetSuggestionFromBiblionumber >- >-$ordernumber = &GetSuggestionFromBiblionumber($biblionumber) >- >-Get a suggestion from it's biblionumber. >- >-return : >-the id of the suggestion which is related to the biblionumber given on input args. >- >-=cut >- >-sub GetSuggestionFromBiblionumber { >- my ($biblionumber) = @_; >- my $query = q{ >- SELECT suggestionid >- FROM suggestions >- WHERE biblionumber=? LIMIT 1 >- }; >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare($query); >- $sth->execute($biblionumber); >- my ($suggestionid) = $sth->fetchrow; >- return $suggestionid; >-} >- > =head2 GetSuggestionInfoFromBiblionumber > > Get a suggestion and borrower's informations from it's biblionumber. >diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t >index 87c3f6df..50591c7a 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 => 95; >+use Test::More tests => 92; > use Test::Warn; > > use t::lib::Mocks; >@@ -38,7 +38,7 @@ use Koha::Suggestions; > BEGIN { > use_ok( > 'C4::Suggestions', >- qw( ModSuggestion GetSuggestionInfo GetSuggestionFromBiblionumber GetSuggestionInfoFromBiblionumber GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan ) >+ qw( ModSuggestion GetSuggestionInfo GetSuggestionInfoFromBiblionumber GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan ) > ); > } > >@@ -335,16 +335,6 @@ is( > 'GetSuggestionInfo returns the borrower number correctly' > ); > >-is( GetSuggestionFromBiblionumber(), undef, 'GetSuggestionFromBiblionumber without the biblio number returns undef' ); >-is( >- GetSuggestionFromBiblionumber(2), undef, >- 'GetSuggestionFromBiblionumber with an invalid biblio number returns undef' >-); >-is( >- GetSuggestionFromBiblionumber( $biblio_1->biblionumber ), $my_suggestionid, >- 'GetSuggestionFromBiblionumber functions correctly' >-); >- > is( > GetSuggestionInfoFromBiblionumber(), undef, > 'GetSuggestionInfoFromBiblionumber without the biblio number returns undef' >-- >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 39722
:
181403
|
181418