MT#5879 Remove artefacts from datatables vars and make possible deactivate all invoice templates.

ipeshinskaya/InvoiceTemplate5
Irina Peshinskaya 11 years ago committed by Victor Seva
parent f6fe84df61
commit 89e6533d5b

@ -841,18 +841,18 @@ sub invoice_details_ajax :Chained('base') :PathPart('invoice/details/ajax') :Arg
#use irka;
#use Data::Dumper;
#irka::loglong(Dumper($dt_columns));
$c->forward( 'invoice_data' );
$c->forward( 'invoice_details_ajax' );
my $dt_columns = from_json($dt_columns_json);
NGCP::Panel::Utils::Datatables::process($c, $c->stash->{invoice_details_raw}, $dt_columns );
$c->detach( $c->view("JSON") );
}
sub invoice_template_activate :Chained('base') :PathPart('invoice_template/activate') :Args(1) {
sub invoice_template_activate :Chained('base') :PathPart('invoice_template/activate') :Args(2) {
my ($self, $c) = @_;
$c->log->debug('invoice_template_activate');
my($validator,$backend,$in,$out);
(undef,undef,@$in{qw/tt_id/}) = @_;
(undef,undef,@$in{qw/tt_id is_active/}) = @_;
#check that this id really belongs to specified contract? or just add contract condition to delete query?
#checking is more universal
#this is just copy-paste from method above
@ -894,8 +894,11 @@ sub invoice_template_activate :Chained('base') :PathPart('invoice_template/activ
#really model logic should recieve validated input, but raw input also should be saved somewhere
$in = $in_validated;
#think about it more
$backend->activateCustomerInvoiceTemplate(%$in);
if( ! $in->{is_active} ){
$backend->activateCustomerInvoiceTemplate(%$in);
}else{
$backend->deactivateCustomerInvoiceTemplate(%$in);
}
$c->forward( 'invoice_template_list' );
}
sub invoice_template_delete :Chained('base') :PathPart('invoice_template/delete') :Args(1) {

@ -21,7 +21,7 @@
[%# Dumper.dump_html(invoice_template_list.as_query)%]
[%# Dumper.dump_html(template)%]
<tr class="sw_action_row">
<td><input type="radio" name="is_active" value="[%template.get_column('is_active')%]" [%IF template.get_column('is_active') %] checked [%END%] onclick="javascript:fetch_into('collapse_invoice_template_list', '[%- c.uri_for_action("/customer/invoice_template_activate", [contract.id, template.get_column('id')]) -%]','',function(){ mainWrapperInit(); });void(0);"></td>
<td><input type="radio" name="is_active" value="[%template.get_column('is_active')%]" [%IF template.get_column('is_active') %] checked [%END%] onclick="javascript:fetch_into('collapse_invoice_template_list', '[%- c.uri_for_action("/customer/invoice_template_activate", [contract.id, template.get_column('id'),template.get_column('is_active')]) -%]','',function(){ mainWrapperInit(); });void(0);"></td>
<td>[% template.get_column('type') %]</td>
<td>[% template.get_column('name') %]</td>

@ -1,4 +1,4 @@
[% USE JSON.Escape( pretty => 0 ) %];
[% USE JSON.Escape( pretty => 0 ) %]
[%-
#USE Dumper;

Loading…
Cancel
Save