diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-07-26 15:41:26 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-07-26 15:41:26 -0700 |
commit | 9aee669886202be7035e6c6049fc71bc99dd3013 (patch) | |
tree | 2fd5bf6de74f3d99270587ffb1833e4188a6373d /rt/share/html/Admin/Global/Template.html | |
parent | ac20214d38d9af00430423f147b5a0e50751b050 (diff) | |
parent | 1add633372bdca3cc7163c2ce48363fed3984437 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'rt/share/html/Admin/Global/Template.html')
-rwxr-xr-x | rt/share/html/Admin/Global/Template.html | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/rt/share/html/Admin/Global/Template.html b/rt/share/html/Admin/Global/Template.html index fad2d86e4..c2a802d3c 100755 --- a/rt/share/html/Admin/Global/Template.html +++ b/rt/share/html/Admin/Global/Template.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -59,10 +59,10 @@ %# hang onto the queue id <input type="hidden" class="hidden" name="Queue" value="<%$Queue%>" /> <& /Admin/Elements/ModifyTemplate, - Name => $TemplateObj->Name, - Description => $TemplateObj->Description, - Content => $TemplateObj->Content, - Type => $TemplateObj->Type + Name => $TemplateObj->Name // $ARGS{Name}, + Description => $TemplateObj->Description // $ARGS{Description}, + Content => $TemplateObj->Content // $ARGS{Content}, + Type => $TemplateObj->Type // $ARGS{Type}, &> <& /Elements/Submit, Label => $SubmitLabel, Reset => 1 &> </form> @@ -73,35 +73,37 @@ my $TemplateObj = RT::Template->new($session{'CurrentUser'}); my ($title, @results, $SubmitLabel); -if ($Create) { - $title = loc("Create a template"); - $SubmitLabel = loc('Create'); -} - -else { - if (defined ($Template) && $Template eq 'new') { - my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name, Type => $Type); - Abort(loc("Could not create template: [_1]", $msg)) unless ($val); - push @results, $msg; +if (!$Create) { + if (defined ($Template) && $Template eq 'new') { + my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name, Type => $Type); + push @results, $msg; + } else { + $TemplateObj->Load($Template) || Abort(loc('No Template')); } - else { - $TemplateObj->Load($Template) || Abort(loc('No Template')); - } - $title = loc('Modify template [_1]', loc($TemplateObj->Name())); - $SubmitLabel = loc('Save Changes'); - } + if ($TemplateObj->Id()) { - my @attribs = qw( Name Description Queue Type Content ); - my @aresults = UpdateRecordObject( AttributesRef => \@attribs, - Object => $TemplateObj, - ARGSRef => \%ARGS); - push @results, @aresults; + my @attribs = qw( Name Description Queue Type Content ); + my @aresults = UpdateRecordObject( AttributesRef => \@attribs, + Object => $TemplateObj, + ARGSRef => \%ARGS); + push @results, @aresults; - my ($ok, $msg) = $TemplateObj->CompileCheck; - push @results, $msg if !$ok; + my ($ok, $msg) = $TemplateObj->CompileCheck; + push @results, $msg if !$ok; +} else { + $Create = 1; } +if ($Create) { + $title = loc("Create a template"); + $SubmitLabel = loc('Create'); +} else { + $title = loc('Modify template [_1]', loc($TemplateObj->Name())); + $SubmitLabel = loc('Save Changes'); +} + + </%INIT> <%ARGS> $Queue => '' |