Call end-user-contracts customers to avoid confusion

especially when the user navigates here from the Customer controller
Mantis: 0003605
agranig/1_0_subfix
Gerhard Jungwirth 12 years ago committed by Andrew Pogrebennyk
parent 3ca68fae13
commit a0a39c243c

@ -70,6 +70,8 @@ sub contract_list :Chained('/') :PathPart('contract') :CaptureArgs(0) {
}
$c->stash(contract_select_rs => $rs);
$c->stash(page_title => "Contract",
page_title_plural => "Contracts");
$c->stash(ajax_uri => $c->uri_for_action("/contract/ajax"));
$c->stash(template => 'contract/list.tt');
}
@ -159,6 +161,12 @@ sub base :Chained('contract_list') :PathPart('') :CaptureArgs(1) {
$c->flash(messages => [{type => 'error', text => 'Contract does not exist'}]);
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/contract'));
}
my $billing_mapping = $res->billing_mappings->find($res->get_column('bmid'));
if (! defined ($billing_mapping->product) ) {
$c->stash(page_title => "Customer",
page_title_plural => "Customers");
}
$c->stash(contract => {$res->get_inflated_columns});
$c->stash(contract_result => $res);
@ -221,7 +229,8 @@ sub edit :Chained('base') :PathPart('edit') :Args(0) {
delete $c->session->{created_objects}->{contact};
delete $c->session->{created_objects}->{billing_profile};
});
$c->flash(messages => [{type => 'success', text => 'Contract successfully changed!'}]);
my $page_title = $c->stash->{page_title};
$c->flash(messages => [{type => 'success', text => "$page_title successfully changed!"}]);
} catch($e) {
$c->log->error("failed to update contract: $e");
$c->flash(messages => [{type => 'error', text => 'Failed to update contract'}]);
@ -252,7 +261,8 @@ sub terminate :Chained('base') :PathPart('terminate') :Args(0) {
contract => $contract,
);
}
$c->flash(messages => [{type => 'success', text => 'Contract successfully terminated'}]);
my $page_title = $c->stash->{page_title};
$c->flash(messages => [{type => 'success', text => "$page_title successfully terminated"}]);
} catch ($e) {
$c->log->error("failed to terminate contract: $e");
$c->flash(messages => [{type => 'error', text => 'Failed to terminate contract'}]);
@ -359,7 +369,9 @@ sub customer_list :Chained('contract_list') :PathPart('customer') :CaptureArgs(0
}, {
'join' => {'billing_mappings' => 'product'},
});
$c->stash(page_title => "Customer",
page_title_plural => "Customers");
$c->stash(ajax_uri => $c->uri_for_action("/contract/customer_ajax"));
}
@ -417,11 +429,14 @@ sub customer_create :Chained('customer_list') :PathPart('create') :Args(0) {
$c->session->{created_objects}->{contract} = { id => $contract->id };
delete $c->session->{created_objects}->{contact};
delete $c->session->{created_objects}->{billing_profile};
$c->flash(messages => [{type => 'success', text => 'Contract successfully created'}]);
$c->flash(messages => [{type => 'success', text => 'Customer successfully created'}]);
});
} catch($e) {
$c->log->error("Failed to create contract: $e");
$c->flash(messages => [{type => 'error', text => 'Failed to create contract'}]);
NGCP::Panel::Utils::Message->error(
c => $c,
error => $e,
desc => "Failed to create customer contract.",
);
}
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/contract'));
}

@ -1,6 +1,6 @@
[% META title = 'Contracts' -%]
[% site_config.title = page_title_plural -%]
[%
helper.name = 'Contract';
helper.name = page_title;
helper.data = contracts;
helper.messages = messages;
helper.dt_columns = contract_dt_columns;

Loading…
Cancel
Save