Optimize "Customer has a referring customer" condition, RT#74452
[freeside.git] / httemplate / edit / invoice_template.html
1 <% include("/elements/header.html", "Edit $type2desc{$type} invoice template",
2              menubar(
3                'View all invoice templates' => $p.'browse/invoice_template.html'
4              )
5           )
6 %>
7
8 <FORM ACTION="process/invoice_template.html" METHOD="POST">
9 <INPUT TYPE="hidden" NAME="confname" VALUE="<% $confname %>">
10
11 % #if ( $type eq 'html' ) {
12 % if ( 0 ) { #this seems to broken, using a text editor for everything for now
13
14   <% include('/elements/htmlarea.html',
15                'field'      => 'value',
16                'curr_value' => $value,
17                'height'     => 800,
18             )
19   %>
20
21 % } else {
22
23   <TEXTAREA NAME="value" ROWS=30 COLS=80 WRAP="off"><%$value |h %></TEXTAREA>
24
25 % }
26
27 <BR><BR>
28 <INPUT TYPE="submit" VALUE="Change template">
29
30 </FORM>
31
32 <% include("/elements/footer.html") %>
33
34 <%once>
35
36 my %type2desc = (
37   'html'  => 'HTML',
38   'latex' => 'Print/PDF (typeset)',
39   'text'  => 'Plaintext',
40 );
41
42 my %type2base = (
43   'html'  => 'invoice_html',
44   'latex' => 'invoice_latex',
45   'text'  => 'invoice_template',
46 );
47
48 </%once>
49 <%init>
50
51 die "access denied"
52   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
53
54 my $type = $cgi->param('type');
55 my $name = $cgi->param('name');
56 my $suffix = $cgi->param('suffix');
57
58 #XXX type handling, just testing this out for now
59
60 my $conf = new FS::Conf;
61
62 my $value = length($name)
63               ? join("\n", $conf->config_orbase($type2base{$type}.$suffix, $name) )
64               : join("\n", $conf->config($type2base{$type}.$suffix) );
65
66 my $confname = length($name)
67                  ? $type2base{$type}.$suffix. '_'. $name
68                  : $type2base{$type}.$suffix;
69
70 </%init>