MT#5879 Changes related to invoice email template.

All schemas are taken as it was before.
mr3.3.1
Irina Peshinskaya 11 years ago
parent 6d6484a645
commit 9f5bf1ad35

@ -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;

@ -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) {

@ -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) {

Loading…
Cancel
Save