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