1 <% include( 'elements/edit.html',
2 'html_init' => '<TABLE id="outerTable"><TR><TD>',
3 'name_singular' => 'template',
4 'table' => 'msg_template',
5 'viewall_dir' => 'browse',
8 'agent_null_right' => 'Edit global templates',
10 'fields' => [ 'msgname',
13 { field=>'body', type=>'htmlarea', width=>763 },
15 'labels' => { 'msgnum' => 'Template',
16 'msgname' => 'Template name',
17 'from_addr' => 'Return address',
18 'subject' => 'Message subject',
19 'body' => 'Message template',
21 'html_foot' => "</TD>$sidebar</TR></TABLE>",
27 unless $FS::CurrentUser::CurrentUser->access_right('Edit templates')
28 || $FS::CurrentUser::CurrentUser->access_right('Edit global templates')
29 || $FS::CurrentUser::CurrentUser->access_right('Configuration');
35 '$display_custnum'=> 'Customer#',
36 '$agentnum' => 'Agent#',
37 '$agent_name' => 'Agent name',
38 '$payby' => 'Payment method',
39 '$paymask' => 'Card/account# (masked)',
40 '$payname' => 'Name on card/bank name',
41 '$paytype' => 'Account type',
42 '$payip' => 'IP address used to submit payment info',
43 '$num_ncancelled_pkgs' => '# of active packages',
44 '$num_cancelled_pkgs' => '# of cancelled packages',
45 '$num_pkgs' => '# of packages',
46 '$classname' => 'Customer class',
47 '$categoryname' => 'Customer category',
48 '$balance' => 'Current balance',
49 '$invoicing_list_emailonly' => 'Billing email address',
50 '$cust_status' => 'Status',
51 '$ucfirst_cust_status' => 'Status, capitalized',
52 '$cust_statuscolor' => 'Status color code',
53 '$company_name' => 'Our company name',
54 '$company_address'=> 'Our company address',
56 'contact' => [ # duplicate this for shipping
57 '$name' => 'Company and contact name',
58 '$name_short' => 'Company or contact name',
59 '$company' => 'Company name',
60 '$contact' => 'Contact name (last, first)',
61 '$contact_firstlast'=> 'Contact name (first last)',
62 '$first' => 'First name',
63 '$last' => 'Last name',
64 '$address1' => 'Address line 1',
65 '$address2' => 'Address line 2',
67 '$county' => 'County',
70 '$country' => 'Country',
71 '$daytime' => 'Day phone',
72 '$night' => 'Night phone',
76 '$invnum' => 'Invoice#',
79 '$pkgnum' => 'Package#',
80 '$pkg_label' => 'Package label (short)',
81 '$pkg_label_long' => 'Package label (long)',
82 '$status' => 'Status',
83 '$statuscolor' => 'Status color code',
84 '$start_ymd' => 'Start date',
85 '$setup_ymd' => 'Setup date',
86 '$last_bill_ymd' => 'Last bill date',
87 '$next_bill_ymd' => 'Next bill date',
88 '$susp_ymd' => 'Suspended on date',
89 '$cancel_ymd' => 'Canceled on date',
90 '$adjourn_ymd' => 'Adjournment date',
91 '$expire_ymd' => 'Expiration date',
92 '$labels_short' => 'Service labels',
93 '$location_label' => 'Service location',
96 '$username' => 'Login name',
97 '$password' => 'Password',
100 '$paynum' => 'Payment#',
102 '$payby' => 'Payment method',
103 '$date' => 'Payment date',
104 '$payinfo' => 'Card/account# (masked)',
105 '$error' => 'Decline reason',
108 my @c = @{ $substitutions{'contact'} };
109 for (my $i=0; $i<scalar(@c); $i += 2) {
110 $c[$i] =~ s/\$(.*)/\$ship_$1/;
112 $substitutions{'shipping'} = \@c;
114 tie my %sections, 'Tie::IxHash', (
115 'contact' => 'Name and contact info (billing)',
116 'shipping' => 'Name and contact info (shipping)',
117 'cust_main' => 'Customer status and payment info',
118 'cust_pkg' => 'Package fields',
119 'cust_bill' => 'Invoice fields',
120 'cust_pay' => 'Payment fields',
121 'svc_acct' => 'Login service fields',
124 my $widget = new HTML::Widgets::SelectLayers(
125 'options' => \%sections,
126 'form_name' => 'dummy',
127 'html_between'=>'</FORM><FONT SIZE=-1>',
128 'selected_layer'=>(keys(%sections))[0],
129 'layer_callback' => sub {
131 my $html = include('/elements/table-grid.html');
132 my @hints = @{ $substitutions{$section} };
134 my $key = shift @hints;
135 $html .= qq!\n<TR><TD><A href="javascript:insertHtml('{$key}')">$key</A></TD>!;
136 $html .= "\n<TD>".shift(@hints).'</TD></TR>';
138 $html .= "\n</TABLE>";
144 <SCRIPT TYPE="text/javascript">
145 function insertHtml(what) {
146 var oEditor = FCKeditorAPI.GetInstance("body");
147 oEditor.InsertHtml(what);
150 <TD valign="top"><FORM name="dummy">
153 '<BR>Click links to insert.
154 <BR>Enclose substitutions and other Perl expressions in braces:
155 <BR>{ $name } = ExampleCo (Smith, John)
156 <BR>{ time2str("%D", time) } = '.time2str("%D", time).'