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 '$username' => 'Login name',
100 '$password' => 'Password',
103 '$paynum' => 'Payment#',
105 '$payby' => 'Payment method',
106 '$date' => 'Payment date',
107 '$payinfo' => 'Card/account# (masked)',
108 '$error' => 'Decline reason',
111 my @c = @{ $substitutions{'contact'} };
112 for (my $i=0; $i<scalar(@c); $i += 2) {
113 $c[$i] =~ s/\$(.*)/\$ship_$1/;
115 $substitutions{'shipping'} = \@c;
117 tie my %sections, 'Tie::IxHash', (
118 'contact' => 'Name and contact info (billing)',
119 'shipping' => 'Name and contact info (shipping)',
120 'cust_main' => 'Customer status and payment info',
121 'cust_pkg' => 'Package fields',
122 'cust_bill' => 'Invoice fields',
123 'cust_pay' => 'Payment fields',
124 'svc_acct' => 'Login service fields',
127 my $widget = new HTML::Widgets::SelectLayers(
128 'options' => \%sections,
129 'form_name' => 'dummy',
130 'html_between'=>'</FORM><FONT SIZE=-1>',
131 'selected_layer'=>(keys(%sections))[0],
132 'layer_callback' => sub {
134 my $html = include('/elements/table-grid.html');
135 my @hints = @{ $substitutions{$section} };
137 my $key = shift @hints;
138 $html .= qq!\n<TR><TD><A href="javascript:insertHtml('{$key}')">$key</A></TD>!;
139 $html .= "\n<TD>".shift(@hints).'</TD></TR>';
141 $html .= "\n</TABLE>";
147 <SCRIPT TYPE="text/javascript">
148 function insertHtml(what) {
149 var oEditor = FCKeditorAPI.GetInstance("body");
150 oEditor.InsertHtml(what);
153 <TD valign="top"><FORM name="dummy">
156 '<BR>Click links to insert.
157 <BR>Enclose substitutions and other Perl expressions in braces:
158 <BR>{ $name } = ExampleCo (Smith, John)
159 <BR>{ time2str("%D", time) } = '.time2str("%D", time).'