Bug 39724: Remove GetSuggestionInfo from C4/Suggestions.pm
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
713b525d1f
commit
e4f14b3b1d
|
|
@ -27,7 +27,6 @@ BEGIN {
|
|||
DelSuggestion
|
||||
GetSuggestion
|
||||
GetSuggestionByStatus
|
||||
GetSuggestionInfo
|
||||
ModStatus
|
||||
ModSuggestion
|
||||
DelSuggestionsOlderThan
|
||||
|
|
@ -71,33 +70,6 @@ Suggestions done by other borrowers can be seen when not "AVAILABLE"
|
|||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
=head2 GetSuggestionInfo
|
||||
|
||||
Get a suggestion and borrower's information from it's suggestionid
|
||||
|
||||
return :
|
||||
all information (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])
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ 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 Koha::Biblios;
|
||||
use Koha::Acquisition::Baskets;
|
||||
use Koha::Acquisition::Booksellers;
|
||||
|
|
|
|||
|
|
@ -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 => $suggestionid } ) if $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->surname,
|
||||
firstnamesuggestedby => $suggestion->firstname,
|
||||
biblionumber => $biblionumber,
|
||||
uncertainprice => $data->{'uncertainprice'},
|
||||
discount_2dp => sprintf( "%.2f", $bookseller->discount ), # for display
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ use C4::Output qw( output_html_with_http_headers );
|
|||
use C4::Budgets qw( GetBudget GetBudgetPeriods GetBudgetPeriod GetBudgetHierarchy CanUserUseBudget );
|
||||
use C4::Members;
|
||||
use C4::Biblio qw( GetMarcStructure );
|
||||
use C4::Suggestions qw( GetSuggestionInfo );
|
||||
|
||||
use Koha::Acquisition::Booksellers;
|
||||
use Koha::Acquisition::Currencies;
|
||||
|
|
@ -133,12 +132,6 @@ if ($order) {
|
|||
$template->param( orders => $orders, );
|
||||
}
|
||||
|
||||
my $suggestion = GetSuggestionInfoFromBiblionumber( $order->biblionumber );
|
||||
|
||||
if ($suggestion) {
|
||||
$template->param( suggestion => $suggestion );
|
||||
}
|
||||
|
||||
$template->param(
|
||||
order => $order,
|
||||
creator => $creator,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ use C4::Acquisition qw( CancelReceipt GetInvoice GetInvoiceDetails get_rounded_p
|
|||
use C4::Budgets qw( GetBudget GetBudgetByOrderNumber GetBudgetName );
|
||||
use CGI qw ( -utf8 );
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
use C4::Suggestions qw( GetSuggestionInfo );
|
||||
|
||||
use Koha::Acquisition::Baskets;
|
||||
use Koha::Acquisition::Bookseller;
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue