# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
+use URI::Escape;
use C4::Auth;
use C4::Output;
use Koha::Cash::Registers;
use Koha::Patrons;
use Koha::Patron::Categories;
+use Koha::Items;
my $input=new CGI;
my $payment_id = $input->param('payment_id');
my $change_given = $input->param('change_given');
my $action = $input->param('action') || '';
+my @renew_results = $input->param('renew_result');
-my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
+my $logged_in_user = Koha::Patrons->find( $loggedinuser );
my $library_id = C4::Context->userenv->{'branch'};
my $patron = Koha::Patrons->find( $borrowernumber );
unless ( $patron ) {
);
}
+if ( $action eq 'discount' ) {
+ my $charge_id = scalar $input->param('accountlines_id');
+ my $charge = Koha::Account::Lines->find($charge_id);
+ my $amount = scalar $input->param('amount');
+ $schema->txn_do(
+ sub {
+
+ my $discount = $charge->reduce(
+ {
+ reduction_type => 'DISCOUNT',
+ branch => $library_id,
+ staff_id => $logged_in_user->id,
+ interface => 'intranet',
+ amount => $amount
+ }
+ );
+ }
+ );
+}
+
#get account details
my $total = $patron->account->balance;
$totalcredit = 1;
}
+# Populate an arrayref with everything we need to display any
+# renew errors that occurred based on what we were passed
+my $renew_results_display = [];
+foreach my $renew_result(@renew_results) {
+ my ($itemnumber, $success, $info) = split(/,/, $renew_result);
+ my $item = Koha::Items->find($itemnumber);
+ if ($success) {
+ $info = uri_unescape($info);
+ }
+ push @{$renew_results_display}, {
+ item => $item,
+ success => $success,
+ info => $info
+ };
+}
+
$template->param(
patron => $patron,
finesview => 1,
accounts => \@accountlines,
payment_id => $payment_id,
change_given => $change_given,
+ renew_results => $renew_results_display,
);
output_html_with_http_headers $input, $cookie, $template->output;