Bugzilla – Attachment 172875 Details for
Bug 35717
Link suggestions to orders by adding ordernumber to suggestions table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35717: Remove GetSuggestionFromBiblionumber
Bug-35717-Remove-GetSuggestionFromBiblionumber.patch (text/plain), 4.11 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-10-17 13:48:52 UTC
(
hide
)
Description:
Bug 35717: Remove GetSuggestionFromBiblionumber
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-10-17 13:48:52 UTC
Size:
4.11 KB
patch
obsolete
>From 72eb47efc7ac37cbcd9620dc1c029b44f72185c2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Oct 2024 18:28:51 -0300 >Subject: [PATCH] Bug 35717: Remove GetSuggestionFromBiblionumber > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Acquisition.pm | 6 ++++-- > C4/Suggestions.pm | 26 -------------------------- > t/db_dependent/Suggestions.t | 9 ++------- > 3 files changed, 6 insertions(+), 35 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index e3ba40494fa..755e3f17eee 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1385,10 +1385,12 @@ sub ModReceiveOrder { > $order->{invoice_unitprice} ||= $order->{unitprice}; > $order->{invoice_currency} ||= Koha::Acquisition::Currencies->get_active->currency; > >- if ( $order->{suggestionid} ) { >+ my $order_object = Koha::Acquistions::Orders->find( $order->{ordernumber} ); >+ my $suggestions = $order_object->suggestions; >+ while ( my $suggestion = $suggestions->next ) { > ModSuggestion( > { >- suggestionid => $order->{suggestionid}, >+ suggestionid => $suggestion->id, > STATUS => 'AVAILABLE', > biblionumber => $biblionumber > } >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 4cc1256d283..5bb2f963a19 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -36,7 +36,6 @@ our @EXPORT = qw( > DelSuggestion > GetSuggestion > GetSuggestionByStatus >- GetSuggestionFromBiblionumber > GetSuggestionInfo > ModStatus > ModSuggestion >@@ -94,31 +93,6 @@ sub GetSuggestion { > return ( $sth->fetchrow_hashref ); > } > >-=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 GetSuggestionInfo > > Get a suggestion and borrower's informations from it's suggestionid >diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t >index 13a89b4ee06..8706f6aa5b0 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 => 80; >+use Test::More tests => 77; > 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 GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan )); >+ use_ok('C4::Suggestions', qw( GetSuggestion ModSuggestion GetSuggestionInfo GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan )); > } > > my $schema = Koha::Database->new->schema; >@@ -294,11 +294,6 @@ is( $suggestion->{firstnamesuggestedby}, $member->{firstname}, 'GetSuggestionInf > is( $suggestion->{borrnumsuggestedby}, $my_suggestion->{suggestedby}, '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' ); >- >- > my $suggestions = GetSuggestionByStatus(); > is( @$suggestions, 0, 'GetSuggestionByStatus without the status returns an empty array' ); > $suggestions = GetSuggestionByStatus('CHECKED'); >-- >2.47.0
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 35717
:
160576
|
160577
|
160578
|
160579
|
160580
|
160581
|
160582
|
160583
|
164834
|
164835
|
164836
|
164837
|
164838
|
164839
|
164840
|
172871
|
172872
|
172873
|
172874
| 172875 |
172876
|
172877
|
172878
|
172899
|
172900
|
172901