Bugzilla – Attachment 193485 Details for
Bug 39725
Remove GetSuggestionByStatus from C4/Suggestions.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39725: Remove GetSuggestionByStatus from C4/Suggestions.pm
Bug-39725-Remove-GetSuggestionByStatus-from-C4Sugg.patch (text/plain), 6.53 KB, created by
Baptiste Wojtkowski (bwoj)
on 2026-02-19 15:00:16 UTC
(
hide
)
Description:
Bug 39725: Remove GetSuggestionByStatus from C4/Suggestions.pm
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2026-02-19 15:00:16 UTC
Size:
6.53 KB
patch
obsolete
>From c25c4983e82e807cff796e15372ed888b87c25c1 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Thu, 19 Feb 2026 14:52:20 +0000 >Subject: [PATCH] Bug 39725: Remove GetSuggestionByStatus from > C4/Suggestions.pm > >--- > C4/Suggestions.pm | 49 ------------------------------------ > t/db_dependent/Suggestions.t | 49 ++---------------------------------- > 2 files changed, 2 insertions(+), 96 deletions(-) > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 1ce0a5364d4..e83713952a1 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -26,7 +26,6 @@ BEGIN { > ConnectSuggestionAndBiblio > DelSuggestion > GetSuggestion >- GetSuggestionByStatus > ModStatus > ModSuggestion > DelSuggestionsOlderThan >@@ -81,54 +80,6 @@ all the suggestion with C<$status> > > =cut > >-sub GetSuggestionByStatus { >- my $status = shift; >- my $branchcode = shift; >- my $dbh = C4::Context->dbh; >- my @sql_params = ($status); >- my $query = q{ >- SELECT suggestions.*, >- U1.surname AS surnamesuggestedby, >- U1.firstname AS firstnamesuggestedby, >- U1.branchcode AS branchcodesuggestedby, >- B1.branchname AS branchnamesuggestedby, >- U1.borrowernumber AS borrnumsuggestedby, >- U1.categorycode AS categorycodesuggestedby, >- C1.description AS categorydescriptionsuggestedby, >- U2.surname AS surnamemanagedby, >- U2.firstname AS firstnamemanagedby, >- U2.borrowernumber AS borrnummanagedby >- FROM suggestions >- LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber >- LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber >- LEFT JOIN categories AS C1 ON C1.categorycode=U1.categorycode >- LEFT JOIN branches AS B1 on B1.branchcode=U1.branchcode >- WHERE status = ? >- ORDER BY suggestionid >- }; >- >- # filter on branch >- if ( C4::Context->preference("IndependentBranches") || $branchcode ) { >- my $userenv = C4::Context->userenv; >- if ($userenv) { >- unless ( C4::Context->IsSuperLibrarian() ) { >- push @sql_params, $userenv->{branch}; >- $query .= q{ AND (U1.branchcode = ? OR U1.branchcode ='') }; >- } >- } >- if ($branchcode) { >- push @sql_params, $branchcode; >- $query .= q{ AND (U1.branchcode = ? OR U1.branchcode ='') }; >- } >- } >- >- my $sth = $dbh->prepare($query); >- $sth->execute(@sql_params); >- my $results; >- $results = $sth->fetchall_arrayref( {} ); >- return $results; >-} >- > =head2 ModSuggestion > > &ModSuggestion($suggestion) >diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t >index 6cf914b3318..14016928b8b 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 => 69; >+use Test::More tests => 53; > use Test::Warn; > > use t::lib::Mocks; >@@ -38,7 +38,7 @@ use Koha::Suggestions; > BEGIN { > use_ok( > 'C4::Suggestions', >- qw( ModSuggestion GetSuggestionByStatus ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan ) >+ qw( ModSuggestion ConnectSuggestionAndBiblio DelSuggestion MarcRecordFromNewSuggestion GetUnprocessedSuggestions DelSuggestionsOlderThan ) > ); > } > >@@ -310,47 +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' ); > >-my $suggestions = GetSuggestionByStatus(); >-is( @$suggestions, 0, 'GetSuggestionByStatus without the status returns an empty array' ); >-$suggestions = GetSuggestionByStatus('CHECKED'); >-is( @$suggestions, 2, 'GetSuggestionByStatus returns the correct number of suggestions' ); >-is( $suggestions->[0]->{suggestionid}, $my_suggestionid, 'GetSuggestionByStatus returns the suggestion id correctly' ); >-is( $suggestions->[0]->{title}, $mod_suggestion1->{title}, 'GetSuggestionByStatus returns the title correctly' ); >-is( $suggestions->[0]->{author}, $mod_suggestion1->{author}, 'GetSuggestionByStatus returns the author correctly' ); >-is( >- $suggestions->[0]->{publishercode}, $mod_suggestion1->{publishercode}, >- 'GetSuggestionByStatus returns the publisher code correctly' >-); >-is( >- $suggestions->[0]->{suggestedby}, $my_suggestion->{suggestedby}, >- 'GetSuggestionByStatus returns the borrower number correctly' >-); >-is( >- $suggestions->[0]->{biblionumber}, $my_suggestion->{biblionumber}, >- 'GetSuggestionByStatus returns the biblio number correctly' >-); >-is( $suggestions->[0]->{STATUS}, $mod_suggestion3->{STATUS}, 'GetSuggestionByStatus returns the status correctly' ); >-is( >- $suggestions->[0]->{surnamesuggestedby}, $member->{surname}, >- 'GetSuggestionByStatus returns the surname correctly' >-); >-is( >- $suggestions->[0]->{firstnamesuggestedby}, $member->{firstname}, >- 'GetSuggestionByStatus returns the firstname correctly' >-); >-is( >- $suggestions->[0]->{branchcodesuggestedby}, $member->{branchcode}, >- 'GetSuggestionByStatus returns the branch code correctly' >-); >-is( >- $suggestions->[0]->{borrnumsuggestedby}, $my_suggestion->{suggestedby}, >- 'GetSuggestionByStatus returns the borrower number correctly' >-); >-is( >- $suggestions->[0]->{categorycodesuggestedby}, $member->{categorycode}, >- 'GetSuggestionByStatus returns the category code correctly' >-); >- > is( ConnectSuggestionAndBiblio(), '0E0', 'ConnectSuggestionAndBiblio without arguments returns 0E0' ); > my $biblio_2 = $builder->build_object( { class => 'Koha::Biblios' } ); > my $connect_suggestion_and_biblio = ConnectSuggestionAndBiblio( $my_suggestionid, $biblio_2->biblionumber ); >@@ -378,10 +337,6 @@ is( > $suggestion = DelSuggestion( $borrowernumber, $my_suggestionid ); > is( $suggestion, 1, 'DelSuggestion deletes one suggestion' ); > >-$suggestions = GetSuggestionByStatus('CHECKED'); >-is( @$suggestions, 2, 'DelSuggestion deletes one suggestion' ); >-is( $suggestions->[1]->{title}, $del_suggestion->{title}, 'DelSuggestion deletes the correct suggestion' ); >- > # Test budgetid fk > $my_suggestion->{budgetid} = ''; # If budgetid == '', NULL should be set in DB > my $my_suggestionid_test_budget_object = Koha::Suggestion->new($my_suggestion)->store; >-- >2.43.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 39725
:
181406
|
193482
|
193485
|
193492