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', 'Configuration'],
10 'fields' => [ 'msgname',
11 { field=>'from_addr', size=>60, },
12 { field=>'bcc_addr', size=>60, },
13 { field=>'subject', size=>80, },
14 { field=>'body', type=>'htmlarea', width=>763 },
16 'labels' => { 'msgnum' => 'Template',
17 'msgname' => 'Template name',
18 'from_addr' => 'From: ',
19 'bcc_addr' => 'Bcc: ',
20 'subject' => 'Subject: ',
21 'body' => 'Message template',
23 'html_foot' => "</TD>$sidebar</TR></TABLE>",
29 unless $FS::CurrentUser::CurrentUser->access_right('Edit templates')
30 || $FS::CurrentUser::CurrentUser->access_right('Edit global templates')
31 || $FS::CurrentUser::CurrentUser->access_right('Configuration');
37 '$display_custnum'=> 'Customer#',
38 '$agentnum' => 'Agent#',
39 '$agent_name' => 'Agent name',
40 '$payby' => 'Payment method',
41 '$paymask' => 'Card/account# (masked)',
42 '$payname' => 'Name on card/bank name',
43 '$paytype' => 'Account type',
44 '$payip' => 'IP address used to submit payment info',
45 '$num_ncancelled_pkgs' => '# of active packages',
46 '$num_cancelled_pkgs' => '# of cancelled packages',
47 '$num_pkgs' => '# of packages',
48 '$classname' => 'Customer class',
49 '$categoryname' => 'Customer category',
50 '$balance' => 'Current balance',
51 '$credit_limit' => 'Credit limit',
52 '$invoicing_list_emailonly' => 'Billing email address',
53 '$cust_status' => 'Status',
54 '$ucfirst_cust_status' => 'Status, capitalized',
55 '$cust_statuscolor' => 'Status color code',
56 '$company_name' => 'Our company name',
57 '$company_address'=> 'Our company address',
58 '$company_phonenum' => 'Our phone number',
60 'contact' => [ # duplicate this for shipping
61 '$name' => 'Company and contact name',
62 '$name_short' => 'Company or contact name',
63 '$company' => 'Company name',
64 '$contact' => 'Contact name (last, first)',
65 '$contact_firstlast'=> 'Contact name (first last)',
66 '$first' => 'First name',
67 '$last' => 'Last name',
68 '$address1' => 'Address line 1',
69 '$address2' => 'Address line 2',
71 '$county' => 'County',
74 '$country' => 'Country',
75 '$daytime' => 'Day phone',
76 '$night' => 'Night phone',
80 '$invnum' => 'Invoice#',
83 '$pkgnum' => 'Package#',
84 '$pkg' => 'Package description',
85 '$pkg_label' => 'Description + comment',
86 '$status' => 'Status',
87 '$statuscolor' => 'Status color code',
88 '$start_ymd' => 'Start date',
89 '$setup_ymd' => 'Setup date',
90 '$last_bill_ymd' => 'Last bill date',
91 '$next_bill_ymd' => 'Next bill date',
92 '$susp_ymd' => 'Suspended on date',
93 '$cancel_ymd' => 'Canceled on date',
94 '$adjourn_ymd' => 'Adjournment date',
95 '$expire_ymd' => 'Expiration date',
96 '$labels_short' => 'Service labels',
97 '$location_label' => 'Service location',
100 '$svcnum' => 'Service#',
101 '$username' => 'Login name',
102 '$password' => 'Password',
103 '$domain' => 'Domain name',
106 '$svcnum' => 'Service#',
107 '$domain' => 'Domain name',
108 '$registrar' => 'Registrar name',
109 '$catchall' => 'Catchall email',
112 '$svcnum' => 'Service#',
113 '$phonenum' => 'Phone number',
114 '$countrycode' => 'Country code',
115 '$domain' => 'Domain name'
118 '$svcnum' => 'Service#',
119 '$ip_addr' => 'IP address',
120 '$mac_addr' => 'MAC address',
121 '$speed_up' => 'Upstream speed',
122 '$speed_down' => 'Downstream speed',
125 '$paynum' => 'Payment#',
127 '$payby' => 'Payment method',
128 '$date' => 'Payment date',
129 '$payinfo' => 'Card/account# (masked)',
130 '$error' => 'Decline reason',
133 my @c = @{ $substitutions{'contact'} };
134 for (my $i=0; $i<scalar(@c); $i += 2) {
135 $c[$i] =~ s/\$(.*)/\$ship_$1/;
137 $substitutions{'shipping'} = \@c;
139 tie my %sections, 'Tie::IxHash', (
140 'contact' => 'Name and contact info (billing)',
141 'shipping' => 'Name and contact info (shipping)',
142 'cust_main' => 'Customer status and payment info',
143 'cust_pkg' => 'Package fields',
144 'cust_bill' => 'Invoice fields',
145 'cust_pay' => 'Payment fields',
146 'svc_acct' => 'Login service fields',
147 'svc_domain'=> 'Domain service fields',
148 'svc_phone' => 'Phone service fields',
149 'svc_broadband' => 'Broadband service fields',
152 my $widget = new HTML::Widgets::SelectLayers(
153 'options' => \%sections,
154 'form_name' => 'dummy',
155 'html_between'=>'</FORM><FONT SIZE=-1>',
156 'selected_layer'=>(keys(%sections))[0],
157 'layer_callback' => sub {
159 my $html = include('/elements/table-grid.html');
160 my @hints = @{ $substitutions{$section} };
162 my $key = shift @hints;
163 $html .= qq!\n<TR><TD><A href="javascript:insertHtml('{$key}')">$key</A></TD>!;
164 $html .= "\n<TD>".shift(@hints).'</TD></TR>';
166 $html .= "\n</TABLE>";
172 <SCRIPT TYPE="text/javascript">
173 function insertHtml(what) {
174 var oEditor = FCKeditorAPI.GetInstance("body");
175 oEditor.InsertHtml(what);
178 <TD valign="top"><FORM name="dummy">
181 '<BR>Click links to insert.
182 <BR>Enclose substitutions and other Perl expressions in braces:
183 <BR>{ $name } = ExampleCo (Smith, John)
184 <BR>{ time2str("%D", time) } = '.time2str("%D", time).'