From 4a1b5c005e6f2467cf1b78314e2ea4517b28ffb8 Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Mon, 12 May 2014 18:36:13 +0300 Subject: [PATCH] MT#5879 Few small fixes of some some already fixed errors. Some small fixes which should make behavior much more clear. I already did some of them them today, but seems like lost somwhow. --- lib/NGCP/Panel/Controller/Invoice.pm | 4 ++-- share/templates/helpers/datatables.tt | 2 +- share/templates/invoice/list.tt | 17 +++++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/NGCP/Panel/Controller/Invoice.pm b/lib/NGCP/Panel/Controller/Invoice.pm index 5abc2670a7..78bc54111a 100644 --- a/lib/NGCP/Panel/Controller/Invoice.pm +++ b/lib/NGCP/Panel/Controller/Invoice.pm @@ -205,7 +205,7 @@ sub invoice_data :Chained('invoice') :PathPart('data') :Args(1) { my $backend = NGCP::Panel::Model::DB::InvoiceTemplate->new( schema => $c->model('DB') ); my $invoice = $backend->getInvoice(invoice_id => $invoice_id); $c->response->content_type('application/pdf'); - $c->response->body( $invoice->first->get_column('data') ); + $c->response->body( $invoice->get_column('data') ); return; } @@ -395,7 +395,7 @@ sub generate_invoice :Private{ } $svg = $c->view('SVG')->getTemplateProcessed($c,\$svg, $stash ); NGCP::Panel::Utils::InvoiceTemplate::convertSvg2Pdf($c,\$svg,$in,$out); - #$backend->storeInvoiceData('invoice'=>$invoice,'data'=>\$out->{tt_string_pdf}); + $backend->storeInvoiceData('invoice'=>$invoice,'data'=>\$out->{tt_string_pdf}); } sub parse_invoice_period :Private{ my ($self, $c, $in) = @_; diff --git a/share/templates/helpers/datatables.tt b/share/templates/helpers/datatables.tt index 9d6b2aca42..c65be342d8 100644 --- a/share/templates/helpers/datatables.tt +++ b/share/templates/helpers/datatables.tt @@ -62,7 +62,7 @@ $(document).ready(function() { 'iShowPages': 5, "sAjaxSource": "[% helper.ajax_uri %]", "fnServerParams": function ( aoData ) { - var params = localStorage.getItem("datatables.paramsJSON"); + var params = localStorage.getItem("ngcp_dt.[%helper.id_from_name%]_table.paramsJSON"); if(params){ var paramsParsed = JSON.parse(params); for(var key in paramsParsed){ diff --git a/share/templates/invoice/list.tt b/share/templates/invoice/list.tt index 58991316c2..f20cc0c4fc 100644 --- a/share/templates/invoice/list.tt +++ b/share/templates/invoice/list.tt @@ -9,6 +9,7 @@ [%PROCESS 'helpers/modal.tt' -%] [%mf_helper = { ajax_load => 1, + ajax_callback => 'refreshInvoicesTable();' }%] [%modal_script( m = mf_helper )%] @@ -33,6 +34,12 @@ [%PROCESS 'helpers/ajax_messages.tt' -%] @@ -116,6 +121,7 @@ function applyClientFilter(table,tr,contact_id){ clearHelper(); helper.name_single = c.loc('Invoices'); helper.name = c.loc('Invoices'); + helper.identifier = 'invoice_list_data_ajax'; helper.dt_columns = [ { name => 'contract_balances.contract.contact.reseller_id'}, { name => 'contract_balances.contract.contact.reseller.name'}, @@ -129,10 +135,9 @@ function applyClientFilter(table,tr,contact_id){ { name => 'contract_balances.free_time_balance', title => c.loc('Free Time balance')}, ]; helper.dt_buttons = [ - { name = c.loc('Delete'), uri = "javascript:fetch_into(\\'messages\\', \\'" _ c.uri_for_action('/invoice/invoice_delete', [ provider.id ] ) _ "\\',\\'invoice_id='+full.contract_balances_invoice_id+'\\',function(){\$(\\'#" _ helper.id_from_name _ "_table\\').DataTable().fnDraw();});void(0);", class = 'btn-small btn-secondary', icon = 'icon-trash' }, + { name = c.loc('Delete'), uri = "javascript:fetch_into(\\'messages\\', \\'" _ c.uri_for_action('/invoice/invoice_delete', [ provider.id ] ) _ "\\',\\'invoice_id='+full.contract_balances_invoice_id+'\\',function(){\$(\\'#" _ helper.identifier _ "_table\\').DataTable().fnDraw();});void(0);", class = 'btn-small btn-secondary', icon = 'icon-trash' }, { name = c.loc('View invoice PDF'), uri = "javascript:window.open(\\'/invoice/data/' + full.contract_balances_invoice_id + '\\',\\'_blank\\');void(0);", class = 'btn-small btn-primary', icon = 'icon-edit' }, ]; - helper.identifier = 'invoice_list_data_ajax'; helper.ajax_uri = c.uri_for_action( '/invoice/ajax_datatables_data', [ provider.id, 'invoice_list_data' ] ) ; initHelperAuto(); PROCESS 'helpers/datatables.tt';