import torrus 1.0.9
[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
13   <% include('/elements/htmlarea.html',
14                'field'      => 'value',
15                'curr_value' => $value,
16                'height'     => 800,
17             )
18   %>
19
20 % } else {
21
22   <TEXTAREA NAME="value" ROWS=30 COLS=80 WRAP="off"><%$value |h %></TEXTAREA>
23
24 % }
25
26 <BR><BR>
27 <INPUT TYPE="submit" VALUE="Change template">
28
29 </FORM>
30
31 <% include("/elements/footer.html") %>
32
33 <%once>
34
35 my %type2desc = (
36   'html'  => 'HTML',
37   'latex' => 'Print/PDF (typeset)',
38   'text'  => 'Plaintext',
39 );
40
41 my %type2base = (
42   'html'  => 'invoice_html',
43   'latex' => 'invoice_latex',
44   'text'  => 'invoice_template',
45 );
46
47 </%once>
48 <%init>
49
50 die "access denied"
51   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
52
53 my $type = $cgi->param('type');
54 my $name = $cgi->param('name');
55 my $suffix = $cgi->param('suffix');
56
57 #XXX type handling, just testing this out for now
58
59 my $conf = new FS::Conf;
60
61 my $value = length($name)
62               ? join("\n", $conf->config_orbase($type2base{$type}.$suffix, $name) )
63               : join("\n", $conf->config($type2base{$type}.$suffix) );
64
65 my $confname = length($name)
66                  ? $type2base{$type}.$suffix. '_'. $name
67                  : $type2base{$type}.$suffix;
68
69 </%init>