MT#8401 Invoce data preprocessing.

gjungwirth/email_test
Irka 11 years ago
parent 068e71acfa
commit c43ccd7c5d

@ -1,5 +1,4 @@
package NGCP::Panel::Controller::Invoice; package NGCP::Panel::Controller::Invoice;
use Geography::Countries qw/country/;
use Sipwise::Base; use Sipwise::Base;
use namespace::sweep; use namespace::sweep;
BEGIN { extends 'Catalyst::Controller'; } BEGIN { extends 'Catalyst::Controller'; }
@ -293,6 +292,7 @@ sub create :Chained('inv_list') :PathPart('create') :Args() :Does(ACL) :ACLDetac
}}); }});
my $svg = $tmpl->data; my $svg = $tmpl->data;
utf8::decode($svg);
my $t = NGCP::Panel::Utils::InvoiceTemplate::get_tt(); my $t = NGCP::Panel::Utils::InvoiceTemplate::get_tt();
my $out = ''; my $out = '';
my $pdf = ''; my $pdf = '';
@ -304,8 +304,8 @@ sub create :Chained('inv_list') :PathPart('create') :Args() :Does(ACL) :ACLDetac
$vars->{customer} = { $customer->get_inflated_columns }; $vars->{customer} = { $customer->get_inflated_columns };
$vars->{custcontact} = { $customer->contact->get_inflated_columns }; $vars->{custcontact} = { $customer->contact->get_inflated_columns };
$vars->{custcontact}->{country} = country($vars->{custcontact}->{country} || ''); NGCP::Panel::Utils::Invoice::prepare_contact_data($vars->{custcontact});
$vars->{rescontact}->{country} = country($vars->{rescontact}->{country} || ''); NGCP::Panel::Utils::Invoice::prepare_contact_data($vars->{rescontact});
$vars->{billprof} = { $billing_profile->get_inflated_columns }; $vars->{billprof} = { $billing_profile->get_inflated_columns };
$vars->{invoice} = { $vars->{invoice} = {

@ -1,6 +1,8 @@
package NGCP::Panel::Utils::Invoice; package NGCP::Panel::Utils::Invoice;
use Sipwise::Base; use Sipwise::Base;
use Geography::Countries qw/country/;
use HTML::Entities;
sub get_invoice_amounts{ sub get_invoice_amounts{
my(%params) = @_; my(%params) = @_;
@ -25,5 +27,14 @@ sub get_invoice_serial{
my($invoice) = @$params{qw/invoice/}; my($invoice) = @$params{qw/invoice/};
return sprintf("INV%04d%02d%07d", $invoice->{period_start}->year, $invoice->{period_start}->month, $invoice->{id}); return sprintf("INV%04d%02d%07d", $invoice->{period_start}->year, $invoice->{period_start}->month, $invoice->{id});
} }
sub prepare_contact_data{
my($contact) = @_;
$contact->{country} = country($contact->{country} || '');
foreach(keys %$contact){
$contact->{$_} = encode_entities($contact->{$_}, '<>&"');
}
#passed by reference
#return $contact;
}
1; 1;
# vim: set tabstop=4 expandtab: # vim: set tabstop=4 expandtab:

Loading…
Cancel
Save