Bug 39722: Remove GetSuggestionFromBiblionumber from C4/Suggestions.pm

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Baptiste Wojtkowski 2025-10-30 13:55:52 +00:00 committed by Lucas Gass
parent 62db27bc7c
commit fac53ff21a
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
3 changed files with 6 additions and 42 deletions

View File

@ -69,7 +69,7 @@ BEGIN {
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 );
@ -1417,11 +1417,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
}

View File

@ -27,7 +27,6 @@ BEGIN {
DelSuggestion
GetSuggestion
GetSuggestionByStatus
GetSuggestionFromBiblionumber
GetSuggestionInfoFromBiblionumber
GetSuggestionInfo
ModStatus
@ -73,31 +72,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 information from it's biblionumber.

View File

@ -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'