|
Lines 16-29
use Koha::Charges::Sales;
Link Here
|
| 16 |
use Koha::Database; |
16 |
use Koha::Database; |
| 17 |
use Koha::Libraries; |
17 |
use Koha::Libraries; |
| 18 |
|
18 |
|
| 19 |
my $q = CGI->new(); |
19 |
my $input = CGI->new(); |
| 20 |
my $sessionID = $q->cookie('CGISESSID'); |
20 |
my $sessionID = $input->cookie('CGISESSID'); |
| 21 |
my $session = get_session($sessionID); |
21 |
my $session = get_session($sessionID); |
| 22 |
|
22 |
|
| 23 |
my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user( |
23 |
my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user( |
| 24 |
{ |
24 |
{ |
| 25 |
template_name => 'pos/pay.tt', |
25 |
template_name => 'pos/pay.tt', |
| 26 |
query => $q, |
26 |
query => $input, |
| 27 |
type => 'intranet', |
27 |
type => 'intranet', |
| 28 |
authnotrequired => 0, |
28 |
authnotrequired => 0, |
| 29 |
} |
29 |
} |
|
Lines 31-37
my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user(
Link Here
|
| 31 |
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in"; |
31 |
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in"; |
| 32 |
|
32 |
|
| 33 |
my $library_id = C4::Context->userenv->{'branch'}; |
33 |
my $library_id = C4::Context->userenv->{'branch'}; |
| 34 |
my $registerid = $q->param('registerid'); |
34 |
my $registerid = $input->param('registerid'); |
| 35 |
my $registers = Koha::Cash::Registers->search( |
35 |
my $registers = Koha::Cash::Registers->search( |
| 36 |
{ branch => $library_id, archived => 0 }, |
36 |
{ branch => $library_id, archived => 0 }, |
| 37 |
{ order_by => { '-asc' => 'name' } } |
37 |
{ order_by => { '-asc' => 'name' } } |
|
Lines 60-69
my $invoice_types =
Link Here
|
| 60 |
{}, $library_id ); |
60 |
{}, $library_id ); |
| 61 |
$template->param( invoice_types => $invoice_types ); |
61 |
$template->param( invoice_types => $invoice_types ); |
| 62 |
|
62 |
|
| 63 |
my $total_paid = $q->param('paid'); |
63 |
my $total_paid = $input->param('paid'); |
| 64 |
if ( $total_paid and $total_paid ne '0.00' ) { |
64 |
if ( $total_paid and $total_paid ne '0.00' ) { |
| 65 |
my $cash_register = Koha::Cash::Registers->find( { id => $registerid } ); |
65 |
my $cash_register = Koha::Cash::Registers->find( { id => $registerid } ); |
| 66 |
my $payment_type = $q->param('payment_type'); |
66 |
my $payment_type = $input->param('payment_type'); |
| 67 |
my $sale = Koha::Charges::Sales->new( |
67 |
my $sale = Koha::Charges::Sales->new( |
| 68 |
{ |
68 |
{ |
| 69 |
cash_register => $cash_register, |
69 |
cash_register => $cash_register, |
|
Lines 71-77
if ( $total_paid and $total_paid ne '0.00' ) {
Link Here
|
| 71 |
} |
71 |
} |
| 72 |
); |
72 |
); |
| 73 |
|
73 |
|
| 74 |
my @sales = $q->multi_param('sales'); |
74 |
my @sales = $input->multi_param('sales'); |
| 75 |
for my $item (@sales) { |
75 |
for my $item (@sales) { |
| 76 |
$item = from_json $item; |
76 |
$item = from_json $item; |
| 77 |
$sale->add_item($item); |
77 |
$sale->add_item($item); |
|
Lines 81-91
if ( $total_paid and $total_paid ne '0.00' ) {
Link Here
|
| 81 |
|
81 |
|
| 82 |
$template->param( |
82 |
$template->param( |
| 83 |
payment_id => $payment->accountlines_id, |
83 |
payment_id => $payment->accountlines_id, |
| 84 |
collected => scalar $q->param('collected'), |
84 |
collected => scalar $input->param('collected'), |
| 85 |
change => scalar $q->param('change') |
85 |
change => scalar $input->param('change') |
| 86 |
); |
86 |
); |
| 87 |
} |
87 |
} |
| 88 |
|
88 |
|
| 89 |
output_html_with_http_headers( $q, $cookie, $template->output ); |
89 |
output_html_with_http_headers( $input, $cookie, $template->output ); |
| 90 |
|
90 |
|
| 91 |
1; |
91 |
1; |
| 92 |
- |
|
|