diff --git a/lib/NGCP/Panel/Controller/API/EmailTemplatesItem.pm b/lib/NGCP/Panel/Controller/API/EmailTemplatesItem.pm index 687db02ae1..c7c8e17826 100644 --- a/lib/NGCP/Panel/Controller/API/EmailTemplatesItem.pm +++ b/lib/NGCP/Panel/Controller/API/EmailTemplatesItem.pm @@ -172,28 +172,13 @@ sub DELETE :Allow { { my $item = $self->item_by_id($c, $id); last unless $self->resource_exists($c, emailtemplate => $item); - #foreach(qw/subscriber_email_template_id passreset_email_template_id invoice_email_template_id/){ - # $c->model('DB')->resultset('contracts')->search({ - # $_ => $item->id, - # })->update({ - # $_ => undef, - # }); - #} - $c->model('DB')->resultset('contracts')->search({ - subscriber_email_template_id => $item->id, - })->update({ - subscriber_email_template_id => undef, - }); - $c->model('DB')->resultset('contracts')->search({ - passreset_email_template_id => $item->id, - })->update({ - passreset_email_template_id => undef, - }); - $c->model('DB')->resultset('contracts')->search({ - invoice_email_template_id => $item->id, - })->update({ - invoice_email_template_id => undef, - }); + foreach(qw/subscriber_email_template_id passreset_email_template_id invoice_email_template_id/){ + $c->model('DB')->resultset('contracts')->search({ + $_ => $item->id, + })->update({ + $_ => undef, + }); + } $item->delete; diff --git a/lib/NGCP/Panel/Controller/Contract.pm b/lib/NGCP/Panel/Controller/Contract.pm index 0780dec4eb..5e7509cb16 100644 --- a/lib/NGCP/Panel/Controller/Contract.pm +++ b/lib/NGCP/Panel/Controller/Contract.pm @@ -401,7 +401,8 @@ sub reseller_create :Chained('reseller_list') :PathPart('create') :Args(0) { c => $c, form => $form, fields => {'contact.create' => $c->uri_for('/contact/create/noreseller'), - 'billing_profile.create' => $c->uri_for('/billing/create/noreseller')}, + 'billing_profile.create' => $c->uri_for('/billing/create/noreseller') + }, back_uri => $c->req->uri, ); if($posted && $form->validated) { diff --git a/lib/NGCP/Panel/Controller/EmailTemplate.pm b/lib/NGCP/Panel/Controller/EmailTemplate.pm index 22975b8531..67f9433614 100644 --- a/lib/NGCP/Panel/Controller/EmailTemplate.pm +++ b/lib/NGCP/Panel/Controller/EmailTemplate.pm @@ -156,28 +156,13 @@ sub tmpl_delete :Chained('tmpl_base') :PathPart('delete') { my ($self, $c) = @_; try { - #foreach(qw/subscriber_email_template_id passreset_email_template_id invoice_email_template_id/){ - # $c->model('DB')->resultset('contracts')->search({ - # $_ => $c->stash->{tmpl}->id, - # })->update({ - # $_ => undef, - # }); - #} - $c->model('DB')->resultset('contracts')->search({ - subscriber_email_template_id => $c->stash->{tmpl}->id, - })->update({ - subscriber_email_template_id => undef, - }); - $c->model('DB')->resultset('contracts')->search({ - passreset_email_template_id => $c->stash->{tmpl}->id, - })->update({ - passreset_email_template_id => undef, - }); - $c->model('DB')->resultset('contracts')->search({ - invoice_email_template_id => $c->stash->{tmpl}->id, - })->update({ - invoice_email_template_id => undef, - }); + foreach(qw/subscriber_email_template_id passreset_email_template_id invoice_email_template_id/){ + $c->model('DB')->resultset('contracts')->search({ + $_ => $c->stash->{tmpl}->id, + })->update({ + $_ => undef, + }); + } $c->stash->{tmpl}->delete; $c->flash(messages => [{type => 'success', text => $c->loc('Email template successfully deleted') }]); } catch ($e) {