use C4::Output;
use C4::Suggestions;
use C4::Koha; #GetItemTypes
-use C4::Branch;
use C4::Budgets;
use C4::Search;
use C4::Members;
use C4::Debug;
use Koha::DateUtils qw( dt_from_string );
+use Koha::Acquisition::Currencies;
+use Koha::Libraries;
use URI::Escape;
}
return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i);
}
- return (GetBranchName($criteriumvalue)) if ($displayby =~/branchcode/);
+ return Koha::Libraries->find($criteriumvalue)->branchname
+ if $displayby =~ /branchcode/;
return GetAuthorisedValueByCode('SUGGEST_FORMAT', $criteriumvalue) || "Unknown" if ($displayby =~/itemtype/);
if ($displayby =~/suggestedby/||$displayby =~/managedby/||$displayby =~/acceptedby/){
my $borr=C4::Members::GetMember(borrowernumber=>$criteriumvalue);
my $redirect = $input->param('redirect');
my $suggestedbyme = (defined $input->param('suggestedbyme')? $input->param('suggestedbyme'):1);
my $op = $input->param('op')||'else';
-my @editsuggestions = $input->param('edit_field');
+my @editsuggestions = $input->multi_param('edit_field');
my $suggestedby = $input->param('suggestedby');
my $returnsuggestedby = $input->param('returnsuggestedby');
my $returnsuggested = $input->param('returnsuggested');
}
elsif ($op eq "change" ) {
# set accepted/rejected/managed informations if applicable
- # ie= if the librarian has choosen some action on the suggestions
+ # ie= if the librarian has chosen some action on the suggestions
if ($suggestion_only->{"STATUS"} eq "ACCEPTED"){
$suggestion_only->{accepteddate} = dt_from_string;
$suggestion_only->{"acceptedby"}=C4::Context->userenv->{number};
}
elsif ( $op eq 'show' ) {
$suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'});
- $$suggestion_ref{branchname} = GetBranchName $$suggestion_ref{branchcode};
my $budget = GetBudget $$suggestion_ref{budgetid};
$$suggestion_ref{budgetname} = $$budget{budget_name};
Init($suggestion_ref);
$criteria_has_empty = 1;
}
}
- # agregate null and empty values under empty value
+ # aggregate null and empty values under empty value
push @criteria_dv, '' if $criteria_has_empty;
my @allsuggestions;
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=".$returnsuggested."#suggestions");
}
-####################
-## Initializing selection lists
-
-#branch display management
-my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : '';
-my $onlymine =
- C4::Context->preference('IndependentBranches')
- && C4::Context->userenv
- && !C4::Context->IsSuperLibrarian()
- && C4::Context->userenv->{branch};
-my $branches = GetBranches($onlymine);
-my @branchloop;
-
-foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) {
- my %row = (
- value => $thisbranch,
- branchname => $branches->{$thisbranch}->{'branchname'},
- selected => ($branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter ) || ( $$suggestion_ref{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'} )
- );
- push @branchloop, \%row;
-}
-$branchfilter=C4::Context->userenv->{'branch'} if ($onlymine && !$branchfilter);
+my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : C4::Context->userenv->{'branch'};
-$template->param( branchloop => \@branchloop,
- branchfilter => $branchfilter);
+$template->param(
+ branchfilter => $branchfilter,
+);
$template->param( returnsuggestedby => $returnsuggestedby );
-my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG",$$suggestion_ref{'patronreason'});
+my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG");
$template->param(patron_reason_loop=>$patron_reason_loop);
#Budgets management
$template->param( budgetsloop => \@budgets_loop);
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1) if ($$suggestion_ref{'STATUS'});
-# get currencies and rates
-my @rates = GetCurrencies();
-my $count = scalar @rates;
-my $active_currency = GetCurrency();
-my $selected_currency;
-if ($$suggestion_ref{'currency'}) {
- $selected_currency = $$suggestion_ref{'currency'};
-}
-else {
- $selected_currency = $active_currency->{currency};
-}
-
-my @loop_currency = ();
-for ( my $i = 0 ; $i < $count ; $i++ ) {
- my %line;
- $line{currcode} = $rates[$i]->{'currency'};
- $line{rate} = $rates[$i]->{'rate'};
- $line{selected} = 1 if ($line{'currcode'} eq $selected_currency);
- push @loop_currency, \%line;
-}
+my @currencies = Koha::Acquisition::Currencies->search;
$template->param(
- loop_currency => \@loop_currency,
+ currencies => \@currencies,
+ suggestion => $suggestion_ref,
price => sprintf("%.2f", $$suggestion_ref{'price'}||0),
total => sprintf("%.2f", $$suggestion_ref{'total'}||0),
);