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=>'subject', size=>80, },
12 { field=>'from_addr', size=>60, },
13 { field=>'bcc_addr', size=>60, },
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 '$invoicing_list_emailonly' => 'Billing email address',
52 '$cust_status' => 'Status',
53 '$ucfirst_cust_status' => 'Status, capitalized',
54 '$cust_statuscolor' => 'Status color code',
55 '$company_name' => 'Our company name',
56 '$company_address'=> 'Our company address',
58 'contact' => [ # duplicate this for shipping
59 '$name' => 'Company and contact name',
60 '$name_short' => 'Company or contact name',
61 '$company' => 'Company name',
62 '$contact' => 'Contact name (last, first)',
63 '$contact_firstlast'=> 'Contact name (first last)',
64 '$first' => 'First name',
65 '$last' => 'Last name',
66 '$address1' => 'Address line 1',
67 '$address2' => 'Address line 2',
69 '$county' => 'County',
72 '$country' => 'Country',
73 '$daytime' => 'Day phone',
74 '$night' => 'Night phone',
78 '$invnum' => 'Invoice#',
81 '$pkgnum' => 'Package#',
82 '$pkg_label' => 'Package label (short)',
83 '$pkg_label_long' => 'Package label (long)',
84 '$status' => 'Status',
85 '$statuscolor' => 'Status color code',
86 '$start_ymd' => 'Start date',
87 '$setup_ymd' => 'Setup date',
88 '$last_bill_ymd' => 'Last bill date',
89 '$next_bill_ymd' => 'Next bill date',
90 '$susp_ymd' => 'Suspended on date',
91 '$cancel_ymd' => 'Canceled on date',
92 '$adjourn_ymd' => 'Adjournment date',
93 '$expire_ymd' => 'Expiration date',
94 '$labels_short' => 'Service labels',
95 '$location_label' => 'Service location',
98 '$username' => 'Login name',
99 '$password' => 'Password',
102 '$paynum' => 'Payment#',
104 '$payby' => 'Payment method',
105 '$date' => 'Payment date',
106 '$payinfo' => 'Card/account# (masked)',
107 '$error' => 'Decline reason',
110 my @c = @{ $substitutions{'contact'} };
111 for (my $i=0; $i<scalar(@c); $i += 2) {
112 $c[$i] =~ s/\$(.*)/\$ship_$1/;
114 $substitutions{'shipping'} = \@c;
116 tie my %sections, 'Tie::IxHash', (
117 'contact' => 'Name and contact info (billing)',
118 'shipping' => 'Name and contact info (shipping)',
119 'cust_main' => 'Customer status and payment info',
120 'cust_pkg' => 'Package fields',
121 'cust_bill' => 'Invoice fields',
122 'cust_pay' => 'Payment fields',
123 'svc_acct' => 'Login service fields',
126 my $widget = new HTML::Widgets::SelectLayers(
127 'options' => \%sections,
128 'form_name' => 'dummy',
129 'html_between'=>'</FORM><FONT SIZE=-1>',
130 'selected_layer'=>(keys(%sections))[0],
131 'layer_callback' => sub {
133 my $html = include('/elements/table-grid.html');
134 my @hints = @{ $substitutions{$section} };
136 my $key = shift @hints;
137 $html .= qq!\n<TR><TD><A href="javascript:insertHtml('{$key}')">$key</A></TD>!;
138 $html .= "\n<TD>".shift(@hints).'</TD></TR>';
140 $html .= "\n</TABLE>";
146 <SCRIPT TYPE="text/javascript">
147 function insertHtml(what) {
148 var oEditor = FCKeditorAPI.GetInstance("body");
149 oEditor.InsertHtml(what);
152 <TD valign="top"><FORM name="dummy">
155 '<BR>Click links to insert.
156 <BR>Enclose substitutions and other Perl expressions in braces:
157 <BR>{ $name } = ExampleCo (Smith, John)
158 <BR>{ time2str("%D", time) } = '.time2str("%D", time).'