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