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',
59 'contact' => [ # duplicate this for shipping
60 '$name' => 'Company and contact name',
61 '$name_short' => 'Company or contact name',
62 '$company' => 'Company name',
63 '$contact' => 'Contact name (last, first)',
64 '$contact_firstlast'=> 'Contact name (first last)',
65 '$first' => 'First name',
66 '$last' => 'Last name',
67 '$address1' => 'Address line 1',
68 '$address2' => 'Address line 2',
70 '$county' => 'County',
73 '$country' => 'Country',
74 '$daytime' => 'Day phone',
75 '$night' => 'Night phone',
79 '$invnum' => 'Invoice#',
82 '$pkgnum' => 'Package#',
83 '$pkg_label' => 'Package label (short)',
84 '$pkg_label_long' => 'Package label (long)',
85 '$status' => 'Status',
86 '$statuscolor' => 'Status color code',
87 '$start_ymd' => 'Start date',
88 '$setup_ymd' => 'Setup date',
89 '$last_bill_ymd' => 'Last bill date',
90 '$next_bill_ymd' => 'Next bill date',
91 '$susp_ymd' => 'Suspended on date',
92 '$cancel_ymd' => 'Canceled on date',
93 '$adjourn_ymd' => 'Adjournment date',
94 '$expire_ymd' => 'Expiration date',
95 '$labels_short' => 'Service labels',
96 '$location_label' => 'Service location',
99 '$svcnum' => 'Service#',
100 '$username' => 'Login name',
101 '$password' => 'Password',
102 '$domain' => 'Domain name',
105 '$paynum' => 'Payment#',
107 '$payby' => 'Payment method',
108 '$date' => 'Payment date',
109 '$payinfo' => 'Card/account# (masked)',
110 '$error' => 'Decline reason',
113 my @c = @{ $substitutions{'contact'} };
114 for (my $i=0; $i<scalar(@c); $i += 2) {
115 $c[$i] =~ s/\$(.*)/\$ship_$1/;
117 $substitutions{'shipping'} = \@c;
119 tie my %sections, 'Tie::IxHash', (
120 'contact' => 'Name and contact info (billing)',
121 'shipping' => 'Name and contact info (shipping)',
122 'cust_main' => 'Customer status and payment info',
123 'cust_pkg' => 'Package fields',
124 'cust_bill' => 'Invoice fields',
125 'cust_pay' => 'Payment fields',
126 'svc_acct' => 'Login service fields',
129 my $widget = new HTML::Widgets::SelectLayers(
130 'options' => \%sections,
131 'form_name' => 'dummy',
132 'html_between'=>'</FORM><FONT SIZE=-1>',
133 'selected_layer'=>(keys(%sections))[0],
134 'layer_callback' => sub {
136 my $html = include('/elements/table-grid.html');
137 my @hints = @{ $substitutions{$section} };
139 my $key = shift @hints;
140 $html .= qq!\n<TR><TD><A href="javascript:insertHtml('{$key}')">$key</A></TD>!;
141 $html .= "\n<TD>".shift(@hints).'</TD></TR>';
143 $html .= "\n</TABLE>";
149 <SCRIPT TYPE="text/javascript">
150 function insertHtml(what) {
151 var oEditor = FCKeditorAPI.GetInstance("body");
152 oEditor.InsertHtml(what);
155 <TD valign="top"><FORM name="dummy">
158 '<BR>Click links to insert.
159 <BR>Enclose substitutions and other Perl expressions in braces:
160 <BR>{ $name } = ExampleCo (Smith, John)
161 <BR>{ time2str("%D", time) } = '.time2str("%D", time).'