RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / browse / invoice_template.html
1 <% include("/elements/header.html", 'Invoice templates') %>
2
3 <% include('/elements/table-grid.html') %>
4 % my $bgcolor1 = '#eeeeee';
5 %   my $bgcolor2 = '#ffffff';
6 %   my $bgcolor = '';
7
8 <TR>
9   <TH CLASS="grid" BGCOLOR="#cccccc">Template</TH>
10   <TH CLASS="grid" BGCOLOR="#cccccc">HTML</TH>
11   <TH CLASS="grid" BGCOLOR="#cccccc">Print/PDF (typeset)</TH>
12   <TH CLASS="grid" BGCOLOR="#cccccc">Plaintext</TH>
13 </TR>
14
15 % foreach my $templatename ( '', @templatenames ) {
16 %   my $tname = length($templatename) ? "_$templatename" : '';
17 %
18 %   if ( $bgcolor eq $bgcolor1 ) {
19 %     $bgcolor = $bgcolor2;
20 %   } else {
21 %     $bgcolor = $bgcolor1;
22 %   }
23 %
24 %   my $display = length($templatename) ? $templatename : '<i>(Default)</i>';
25
26     <TR>
27
28       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
29         <% $display %>
30       </TD>
31
32       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
33
34 %       my( $logo_label, $logo_link_label)= length( $templatename )
35 %                                             ? labels("logo_$templatename.png")
36 %                                             : ( '', 'edit' );
37         <% $logo_label %> Logo
38         (<A HREF="<% $p %>edit/invoice_logo.html?type=png;name=<% $templatename %>"><% $logo_link_label %></A>)
39         <BR>
40
41 %       foreach my $suffix (qw( returnaddress notes footer), '' ) {
42 %         my $file = "invoice_html$suffix$tname";
43 %         my($label, $link_label) = length($templatename)
44 %                                     ? labels($file)
45 %                                     : ( '', 'edit' );
46
47           <% $label %> <% $suffix2name{$suffix} %>
48           (<A HREF="<% $p %>edit/invoice_template.html?type=html;suffix=<% $suffix %>;name=<% $templatename %>"><% $link_label %></A>)
49           <BR>
50
51 %       }
52
53       </TD>
54
55       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
56
57 %       my( $logo_label, $logo_link_label)= length( $templatename )
58 %                                             ? labels("logo_$templatename.eps")
59 %                                             : ( '', 'edit' );
60         <% $logo_label %> Logo
61         (<A HREF="<% $p %>edit/invoice_logo.html?type=eps;name=<% $templatename %>"><% $logo_link_label %></A>)
62         <BR>
63
64 %       foreach my $suffix (qw( returnaddress notes footer smallfooter), '' ) {
65 %         my $file = "invoice_latex$suffix$tname";
66 %         my($label, $link_label) = length($templatename)
67 %                                     ? labels($file)
68 %                                     : ( '', 'edit' );
69
70           <% $label %> <% $suffix2name{$suffix} %>
71           (<A HREF="<% $p %>edit/invoice_template.html?type=latex;suffix=<% $suffix %>;name=<% $templatename %>"><% $link_label %></A>)
72           <BR>
73
74 %       }
75
76       </TD>
77
78       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
79
80 %       my( $txt_label, $txtlink_label)=
81 %         length( $templatename )
82 %           ? labels("invoice_template_$templatename.png")
83 %           : ( 'Main template', 'edit' );
84         <% $txt_label %> 
85         (<A HREF="<% $p %>edit/invoice_template.html?type=text;name=<% $templatename %>"><% $txtlink_label %></A>)
86
87       </TD>
88
89     </TR>
90
91 % }
92
93 <% include("/elements/footer.html") %>
94
95 <%once>
96
97 my %suffix2name = (
98   'returnaddress' => 'Return address',
99   'notes'         => 'Notes',
100   'footer'        => 'Footer',
101   'smallfooter'   => 'Small footer',
102   ''              => 'Main template',
103 );
104
105 my $conf = new FS::Conf;
106
107 sub labels {
108   my $filename = shift;
109   if ( $conf->exists($filename) ) {
110     ( 'Custom', 'edit' );
111   } else {
112     ( 'Standard', 'customize' );
113   }
114 }
115
116 </%once>
117 <%init>
118
119 die "access denied"
120   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
121
122 my @templatenames = $conf->invoice_templatenames;
123
124 </%init>