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

@ -1,6 +1,8 @@
package NGCP::Panel::Utils::Invoice;
use Sipwise::Base;
use Geography::Countries qw/country/;
use HTML::Entities;
sub get_invoice_amounts{
my(%params) = @_;
@ -25,5 +27,14 @@ sub get_invoice_serial{
my($invoice) = @$params{qw/invoice/};
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;
# vim: set tabstop=4 expandtab:

Loading…
Cancel
Save