encryption fixes from huntsberg & jayce
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($default_dir @config_items @card_types $DEBUG );
4 use IO::File;
5 use File::Basename;
6 use FS::ConfItem;
7 use FS::ConfDefaults;
8
9 $DEBUG = 0;
10
11 =head1 NAME
12
13 FS::Conf - Freeside configuration values
14
15 =head1 SYNOPSIS
16
17   use FS::Conf;
18
19   $conf = new FS::Conf "/config/directory";
20
21   $FS::Conf::default_dir = "/config/directory";
22   $conf = new FS::Conf;
23
24   $dir = $conf->dir;
25
26   $value = $conf->config('key');
27   @list  = $conf->config('key');
28   $bool  = $conf->exists('key');
29
30   $conf->touch('key');
31   $conf->set('key' => 'value');
32   $conf->delete('key');
33
34   @config_items = $conf->config_items;
35
36 =head1 DESCRIPTION
37
38 Read and write Freeside configuration values.  Keys currently map to filenames,
39 but this may change in the future.
40
41 =head1 METHODS
42
43 =over 4
44
45 =item new [ DIRECTORY ]
46
47 Create a new configuration object.  A directory arguement is required if
48 $FS::Conf::default_dir has not been set.
49
50 =cut
51
52 sub new {
53   my($proto,$dir) = @_;
54   my($class) = ref($proto) || $proto;
55   my($self) = { 'dir' => $dir || $default_dir } ;
56   bless ($self, $class);
57 }
58
59 =item dir
60
61 Returns the directory.
62
63 =cut
64
65 sub dir {
66   my($self) = @_;
67   my $dir = $self->{dir};
68   -e $dir or die "FATAL: $dir doesn't exist!";
69   -d $dir or die "FATAL: $dir isn't a directory!";
70   -r $dir or die "FATAL: Can't read $dir!";
71   -x $dir or die "FATAL: $dir not searchable (executable)!";
72   $dir =~ /^(.*)$/;
73   $1;
74 }
75
76 =item config KEY
77
78 Returns the configuration value or values (depending on context) for key.
79
80 =cut
81
82 sub config {
83   my($self,$file)=@_;
84   my($dir)=$self->dir;
85   my $fh = new IO::File "<$dir/$file" or return;
86   if ( wantarray ) {
87     map {
88       /^(.*)$/
89         or die "Illegal line (array context) in $dir/$file:\n$_\n";
90       $1;
91     } <$fh>;
92   } else {
93     <$fh> =~ /^(.*)$/
94       or die "Illegal line (scalar context) in $dir/$file:\n$_\n";
95     $1;
96   }
97 }
98
99 =item config_binary KEY
100
101 Returns the exact scalar value for key.
102
103 =cut
104
105 sub config_binary {
106   my($self,$file)=@_;
107   my($dir)=$self->dir;
108   my $fh = new IO::File "<$dir/$file" or return;
109   local $/;
110   my $content = <$fh>;
111   $content;
112 }
113
114 =item exists KEY
115
116 Returns true if the specified key exists, even if the corresponding value
117 is undefined.
118
119 =cut
120
121 sub exists {
122   my($self,$file)=@_;
123   my($dir) = $self->dir;
124   -e "$dir/$file";
125 }
126
127 =item config_orbase KEY SUFFIX
128
129 Returns the configuration value or values (depending on context) for 
130 KEY_SUFFIX, if it exists, otherwise for KEY
131
132 =cut
133
134 sub config_orbase {
135   my( $self, $file, $suffix ) = @_;
136   if ( $self->exists("${file}_$suffix") ) {
137     $self->config("${file}_$suffix");
138   } else {
139     $self->config($file);
140   }
141 }
142
143 =item touch KEY
144
145 Creates the specified configuration key if it does not exist.
146
147 =cut
148
149 sub touch {
150   my($self, $file) = @_;
151   my $dir = $self->dir;
152   unless ( $self->exists($file) ) {
153     warn "[FS::Conf] TOUCH $file\n" if $DEBUG;
154     system('touch', "$dir/$file");
155   }
156 }
157
158 =item set KEY VALUE
159
160 Sets the specified configuration key to the given value.
161
162 =cut
163
164 sub set {
165   my($self, $file, $value) = @_;
166   my $dir = $self->dir;
167   $value =~ /^(.*)$/s;
168   $value = $1;
169   unless ( join("\n", @{[ $self->config($file) ]}) eq $value ) {
170     warn "[FS::Conf] SET $file\n" if $DEBUG;
171 #    warn "$dir" if is_tainted($dir);
172 #    warn "$dir" if is_tainted($file);
173     chmod 0644, "$dir/$file";
174     my $fh = new IO::File ">$dir/$file" or return;
175     chmod 0644, "$dir/$file";
176     print $fh "$value\n";
177   }
178 }
179 #sub is_tainted {
180 #             return ! eval { join('',@_), kill 0; 1; };
181 #         }
182
183 =item delete KEY
184
185 Deletes the specified configuration key.
186
187 =cut
188
189 sub delete {
190   my($self, $file) = @_;
191   my $dir = $self->dir;
192   if ( $self->exists($file) ) {
193     warn "[FS::Conf] DELETE $file\n";
194     unlink "$dir/$file";
195   }
196 }
197
198 =item config_items
199
200 Returns all of the possible configuration items as FS::ConfItem objects.  See
201 L<FS::ConfItem>.
202
203 =cut
204
205 sub config_items {
206   my $self = shift; 
207   #quelle kludge
208   @config_items,
209   ( map { 
210         my $basename = basename($_);
211         $basename =~ /^(.*)$/;
212         $basename = $1;
213         new FS::ConfItem {
214                            'key'         => $basename,
215                            'section'     => 'billing',
216                            'description' => 'Alternate template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
217                            'type'        => 'textarea',
218                          }
219       } glob($self->dir. '/invoice_template_*')
220   ),
221   ( map { 
222         my $basename = basename($_);
223         $basename =~ /^(.*)$/;
224         $basename = $1;
225         new FS::ConfItem {
226                            'key'         => $basename,
227                            'section'     => 'billing',
228                            'description' => 'Alternate HTML template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
229                            'type'        => 'textarea',
230                          }
231       } glob($self->dir. '/invoice_html_*')
232   ),
233   ( map { 
234         my $basename = basename($_);
235         $basename =~ /^(.*)$/;
236         $basename = $1;
237         ($latexname = $basename ) =~ s/latex/html/;
238         new FS::ConfItem {
239                            'key'         => $basename,
240                            'section'     => 'billing',
241                            'description' => "Alternate Notes section for HTML invoices.  Defaults to the same data in $latexname if not specified.",
242                            'type'        => 'textarea',
243                          }
244       } glob($self->dir. '/invoice_htmlnotes_*')
245   ),
246   ( map { 
247         my $basename = basename($_);
248         $basename =~ /^(.*)$/;
249         $basename = $1;
250         new FS::ConfItem {
251                            'key'         => $basename,
252                            'section'     => 'billing',
253                            'description' => 'Alternate LaTeX template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
254                            'type'        => 'textarea',
255                          }
256       } glob($self->dir. '/invoice_latex_*')
257   ),
258   ( map { 
259         my $basename = basename($_);
260         $basename =~ /^(.*)$/;
261         $basename = $1;
262         new FS::ConfItem {
263                            'key'         => $basename,
264                            'section'     => 'billing',
265                            'description' => 'Alternate Notes section for LaTeX typeset PostScript invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
266                            'type'        => 'textarea',
267                          }
268       } glob($self->dir. '/invoice_latexnotes_*')
269   );
270 }
271
272 =back
273
274 =head1 BUGS
275
276 If this was more than just crud that will never be useful outside Freeside I'd
277 worry that config_items is freeside-specific and icky.
278
279 =head1 SEE ALSO
280
281 "Configuration" in the web interface (config/config.cgi).
282
283 httemplate/docs/config.html
284
285 =cut
286
287 #Business::CreditCard
288 @card_types = (
289   "VISA card",
290   "MasterCard",
291   "Discover card",
292   "American Express card",
293   "Diner's Club/Carte Blanche",
294   "enRoute",
295   "JCB",
296   "BankCard",
297   "Switch",
298   "Solo",
299 );
300
301 @config_items = map { new FS::ConfItem $_ } (
302
303   {
304     'key'         => 'address',
305     'section'     => 'deprecated',
306     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
307     'type'        => 'text',
308   },
309
310   {
311     'key'         => 'alerter_template',
312     'section'     => 'billing',
313     'description' => 'Template file for billing method expiration alerts.  See the <a href="../docs/billing.html#invoice_template">billing documentation</a> for details.',
314     'type'        => 'textarea',
315   },
316
317   {
318     'key'         => 'apacheroot',
319     'section'     => 'deprecated',
320     'description' => '<b>DEPRECATED</b>, add a <i>www_shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  The directory containing Apache virtual hosts',
321     'type'        => 'text',
322   },
323
324   {
325     'key'         => 'apacheip',
326     'section'     => 'deprecated',
327     'description' => '<b>DEPRECATED</b>, add an <i>apache</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be the current IP address to assign to new virtual hosts',
328     'type'        => 'text',
329   },
330
331   {
332     'key'         => 'apachemachine',
333     'section'     => 'deprecated',
334     'description' => '<b>DEPRECATED</b>, add a <i>www_shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  A machine with the apacheroot directory and user home directories.  The existance of this file enables setup of virtual host directories, and, in conjunction with the `home\' configuration file, symlinks into user home directories.',
335     'type'        => 'text',
336   },
337
338   {
339     'key'         => 'apachemachines',
340     'section'     => 'deprecated',
341     'description' => '<b>DEPRECATED</b>, add an <i>apache</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be Apache machines, one per line.  This enables export of `/etc/apache/vhosts.conf\', which can be included in your Apache configuration via the <a href="http://www.apache.org/docs/mod/core.html#include">Include</a> directive.',
342     'type'        => 'textarea',
343   },
344
345   {
346     'key'         => 'bindprimary',
347     'section'     => 'deprecated',
348     'description' => '<b>DEPRECATED</b>, add a <i>bind</i> <a href="../browse/part_export.cgi">export</a> instead.  Your BIND primary nameserver.  This enables export of /var/named/named.conf and zone files into /var/named',
349     'type'        => 'text',
350   },
351
352   {
353     'key'         => 'bindsecondaries',
354     'section'     => 'deprecated',
355     'description' => '<b>DEPRECATED</b>, add a <i>bind_slave</i> <a href="../browse/part_export.cgi">export</a> instead.  Your BIND secondary nameservers, one per line.  This enables export of /var/named/named.conf',
356     'type'        => 'textarea',
357   },
358
359   {
360     'key'         => 'encryption',
361     'section'     => 'billing',
362     'description' => 'Enable encryption of credit cards.',
363     'type'        => 'checkbox',
364   },
365
366   {
367     'key'         => 'encryptionmodule',
368     'section'     => 'billing',
369     'description' => 'Use which module for encryption?',
370     'type'        => 'text',
371   },
372
373   {
374     'key'         => 'encryptionpublickey',
375     'section'     => 'billing',
376     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
377     'type'        => 'textarea',
378   },
379
380   {
381     'key'         => 'encryptionprivatekey',
382     'section'     => 'billing',
383     'description' => 'Your RSA Private Key - Including this will enable the "Bill Now" feature.  However if the system is compromised, a hacker can use this key to decode the stored credit card information.  This is generally not a good idea.',
384     'type'        => 'textarea',
385   },
386
387   {
388     'key'         => 'business-onlinepayment',
389     'section'     => 'billing',
390     'description' => '<a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support, at least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
391     'type'        => 'textarea',
392   },
393
394   {
395     'key'         => 'business-onlinepayment-ach',
396     'section'     => 'billing',
397     'description' => 'Alternate <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support for ACH transactions (defaults to regular <b>business-onlinepayment</b>).  At least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
398     'type'        => 'textarea',
399   },
400
401   {
402     'key'         => 'business-onlinepayment-description',
403     'section'     => 'billing',
404     'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>.  Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages for which these charges apply)',
405     'type'        => 'text',
406   },
407
408   {
409     'key'         => 'business-onlinepayment-email-override',
410     'section'     => 'billing',
411     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
412     'type'        => 'text',
413   },
414
415   {
416     'key'         => 'bsdshellmachines',
417     'section'     => 'deprecated',
418     'description' => '<b>DEPRECATED</b>, add a <i>bsdshell</i> <a href="../browse/part_export.cgi">export</a> instead.  Your BSD flavored shell (and mail) machines, one per line.  This enables export of `/etc/passwd\' and `/etc/master.passwd\'.',
419     'type'        => 'textarea',
420   },
421
422   {
423     'key'         => 'countrydefault',
424     'section'     => 'UI',
425     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
426     'type'        => 'text',
427   },
428
429   {
430     'key'         => 'date_format',
431     'section'     => 'UI',
432     'description' => 'Format for displaying dates',
433     'type'        => 'select',
434     'select_hash' => [
435                        '%m/%d/%Y' => 'MM/DD/YYYY',
436                        '%Y/%m/%d' => 'YYYY/MM/DD',
437                      ],
438   },
439
440   {
441     'key'         => 'cyrus',
442     'section'     => 'deprecated',
443     'description' => '<b>DEPRECATED</b>, add a <i>cyrus</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to integrate with <a href="http://asg.web.cmu.edu/cyrus/imapd/">Cyrus IMAP Server</a>, three lines: IMAP server, admin username, and admin password.  Cyrus::IMAP::Admin should be installed locally and the connection to the server secured.',
444     'type'        => 'textarea',
445   },
446
447   {
448     'key'         => 'cp_app',
449     'section'     => 'deprecated',
450     'description' => '<b>DEPRECATED</b>, add a <i>cp</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to integrate with <a href="http://www.cp.net/">Critial Path Account Provisioning Protocol</a>, four lines: "host:port", username, password, and workgroup (for new users).',
451     'type'        => 'textarea',
452   },
453
454   {
455     'key'         => 'deletecustomers',
456     'section'     => 'UI',
457     'description' => 'Enable customer deletions.  Be very careful!  Deleting a customer will remove all traces that this customer ever existed!  It should probably only be used when auditing a legacy database.  Normally, you cancel all of a customers\' packages if they cancel service.',
458     'type'        => 'checkbox',
459   },
460
461   {
462     'key'         => 'deletepayments',
463     'section'     => 'billing',
464     'description' => 'Enable deletion of unclosed payments.  Really, with voids this is pretty much not recommended in any situation anymore.  Be very careful!  Only delete payments that were data-entry errors, not adjustments.  Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted.',
465     'type'        => [qw( checkbox text )],
466   },
467
468   {
469     'key'         => 'deletecredits',
470     'section'     => 'deprecated',
471     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable deletion of unclosed credits.  Be very careful!  Only delete credits that were data-entry errors, not adjustments.  Optionally specify one or more comma-separated email addresses to be notified when a credit is deleted.',
472     'type'        => [qw( checkbox text )],
473   },
474
475   {
476     'key'         => 'unapplypayments',
477     'section'     => 'deprecated',
478     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable "unapplication" of unclosed payments.',
479     'type'        => 'checkbox',
480   },
481
482   {
483     'key'         => 'unapplycredits',
484     'section'     => 'deprecated',
485     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to nable "unapplication" of unclosed credits.',
486     'type'        => 'checkbox',
487   },
488
489   {
490     'key'         => 'dirhash',
491     'section'     => 'shell',
492     'description' => 'Optional numeric value to control directory hashing.  If positive, hashes directories for the specified number of levels from the front of the username.  If negative, hashes directories for the specified number of levels from the end of the username.  Some examples: <ul><li>1: user -> <a href="#home">/home</a>/u/user<li>2: user -> <a href="#home">/home</a>/u/s/user<li>-1: user -> <a href="#home">/home</a>/r/user<li>-2: user -> <a href="#home">home</a>/r/e/user</ul>',
493     'type'        => 'text',
494   },
495
496   {
497     'key'         => 'disable_customer_referrals',
498     'section'     => 'UI',
499     'description' => 'Disable new customer-to-customer referrals in the web interface',
500     'type'        => 'checkbox',
501   },
502
503   {
504     'key'         => 'editreferrals',
505     'section'     => 'UI',
506     'description' => 'Enable advertising source modification for existing customers',
507     'type'       => 'checkbox',
508   },
509
510   {
511     'key'         => 'emailinvoiceonly',
512     'section'     => 'billing',
513     'description' => 'Disables postal mail invoices',
514     'type'       => 'checkbox',
515   },
516
517   {
518     'key'         => 'disablepostalinvoicedefault',
519     'section'     => 'billing',
520     'description' => 'Disables postal mail invoices as the default option in the UI.  Be careful not to setup customers which are not sent invoices.  See <a href ="#emailinvoiceauto">emailinvoiceauto</a>.',
521     'type'       => 'checkbox',
522   },
523
524   {
525     'key'         => 'emailinvoiceauto',
526     'section'     => 'billing',
527     'description' => 'Automatically adds new accounts to the email invoice list',
528     'type'       => 'checkbox',
529   },
530
531   {
532     'key'         => 'exclude_ip_addr',
533     'section'     => '',
534     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
535     'type'        => 'textarea',
536   },
537   
538   {
539     'key'         => 'erpcdmachines',
540     'section'     => 'deprecated',
541     'description' => '<b>DEPRECATED</b>, ERPCD is no longer supported.  Used to be ERPCD authentication machines, one per line.  This enables export of `/usr/annex/acp_passwd\' and `/usr/annex/acp_dialup\'',
542     'type'        => 'textarea',
543   },
544
545   {
546     'key'         => 'hidecancelledpackages',
547     'section'     => 'UI',
548     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
549     'type'        => 'checkbox',
550   },
551
552   {
553     'key'         => 'hidecancelledcustomers',
554     'section'     => 'UI',
555     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
556     'type'        => 'checkbox',
557   },
558
559   {
560     'key'         => 'home',
561     'section'     => 'required',
562     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
563     'type'        => 'text',
564   },
565
566   {
567     'key'         => 'icradiusmachines',
568     'section'     => 'deprecated',
569     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to enable radcheck and radreply table population - by default in the Freeside database, or in the database specified by the <a href="http://rootwood.haze.st/aspside/config/config-view.cgi#icradius_secrets">icradius_secrets</a> config option (the radcheck and radreply tables needs to be created manually).  You do not need to use MySQL for your Freeside database to export to an ICRADIUS/FreeRADIUS MySQL database with this option.  <blockquote><b>ADDITIONAL DEPRECATED FUNCTIONALITY</b> (instead use <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Replication">MySQL replication</a> or point icradius_secrets to the external database) - your <a href="ftp://ftp.cheapnet.net/pub/icradius">ICRADIUS</a> machines or <a href="http://www.freeradius.org/">FreeRADIUS</a> (with MySQL authentication) machines, one per line.  Machines listed in this file will have the radcheck table exported to them.  Each line should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password.  For example: <CODE>"radius.isp.tld&nbsp;radius_db&nbsp;radius_user&nbsp;passw0rd"</CODE></blockquote>',
570     'type'        => [qw( checkbox textarea )],
571   },
572
573   {
574     'key'         => 'icradius_mysqldest',
575     'section'     => 'deprecated',
576     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be the destination directory for the MySQL databases, on the ICRADIUS/FreeRADIUS machines.  Defaults to "/usr/local/var/".',
577     'type'        => 'text',
578   },
579
580   {
581     'key'         => 'icradius_mysqlsource',
582     'section'     => 'deprecated',
583     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be the source directory for for the MySQL radcheck table files, on the Freeside machine.  Defaults to "/usr/local/var/freeside".',
584     'type'        => 'text',
585   },
586
587   {
588     'key'         => 'icradius_secrets',
589     'section'     => 'deprecated',
590     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to specify a database for ICRADIUS/FreeRADIUS export.  Three lines: DBI data source, username and password.',
591     'type'        => 'textarea',
592   },
593
594   {
595     'key'         => 'invoice_from',
596     'section'     => 'required',
597     'description' => 'Return address on email invoices',
598     'type'        => 'text',
599   },
600
601   {
602     'key'         => 'invoice_template',
603     'section'     => 'required',
604     'description' => 'Required template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
605     'type'        => 'textarea',
606   },
607
608   {
609     'key'         => 'invoice_html',
610     'section'     => 'billing',
611     'description' => 'Optional HTML template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
612
613     'type'        => 'textarea',
614   },
615
616   {
617     'key'         => 'invoice_htmlnotes',
618     'section'     => 'billing',
619     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
620     'type'        => 'textarea',
621   },
622
623   {
624     'key'         => 'invoice_htmlfooter',
625     'section'     => 'billing',
626     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
627     'type'        => 'textarea',
628   },
629
630   {
631     'key'         => 'invoice_htmlreturnaddress',
632     'section'     => 'billing',
633     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
634     'type'        => 'textarea',
635   },
636
637   {
638     'key'         => 'invoice_latex',
639     'section'     => 'billing',
640     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
641     'type'        => 'textarea',
642   },
643
644   {
645     'key'         => 'invoice_latexnotes',
646     'section'     => 'billing',
647     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
648     'type'        => 'textarea',
649   },
650
651   {
652     'key'         => 'invoice_latexfooter',
653     'section'     => 'billing',
654     'description' => 'Footer for LaTeX typeset PostScript invoices.',
655     'type'        => 'textarea',
656   },
657
658   {
659     'key'         => 'invoice_latexreturnaddress',
660     'section'     => 'billing',
661     'description' => 'Return address for LaTeX typeset PostScript invoices.',
662     'type'        => 'textarea',
663   },
664
665   {
666     'key'         => 'invoice_latexsmallfooter',
667     'section'     => 'billing',
668     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
669     'type'        => 'textarea',
670   },
671
672   {
673     'key'         => 'invoice_email_pdf',
674     'section'     => 'billing',
675     'description' => 'Send PDF invoice as an attachment to emailed invoices.  By default, includes the plain text invoice as the email body, unless invoice_email_pdf_note is set.',
676     'type'        => 'checkbox'
677   },
678
679   {
680     'key'         => 'invoice_email_pdf_note',
681     'section'     => 'billing',
682     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
683     'type'        => 'textarea'
684   },
685
686
687   { 
688     'key'         => 'invoice_default_terms',
689     'section'     => 'billing',
690     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
691     'type'        => 'select',
692     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 30', 'Net 45', 'Net 60' ],
693   },
694
695   {
696     'key'         => 'invoice_send_receipts',
697     'section'     => 'deprecated',
698     'description' => '<b>DEPRECATED</b>, this used to send an invoice copy on payments and credits.  See the payment_receipt_email and XXXX instead.',
699     'type'        => 'checkbox',
700   },
701
702   {
703     'key'         => 'payment_receipt_email',
704     'section'     => 'billing',
705     'description' => 'Template file for payment receipts.  Payment receipts are sent to the customer email invoice destination(s) when a payment is received.  See the <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available: <ul><li><code>$date</code> <li><code>$name</code> <li><code>$paynum</code> - Freeside payment number <li><code>$paid</code> - Amount of payment <li><code>$payby</code> - Payment type (Card, Check, Electronic check, etc.) <li><code>$payinfo</code> - Masked credit card number or check number <li><code>$balance</code> - New balance</ul>',
706     'type'        => 'textarea',
707   },
708
709   {
710     'key'         => 'lpr',
711     'section'     => 'required',
712     'description' => 'Print command for paper invoices, for example `lpr -h\'',
713     'type'        => 'text',
714   },
715
716   {
717     'key'         => 'maildisablecatchall',
718     'section'     => 'deprecated',
719     'description' => '<b>DEPRECATED</b>, now the default.  Turning this option on used to disable the requirement that each virtual domain have a catch-all mailbox.',
720     'type'        => 'checkbox',
721   },
722
723   {
724     'key'         => 'money_char',
725     'section'     => '',
726     'description' => 'Currency symbol - defaults to `$\'',
727     'type'        => 'text',
728   },
729
730   {
731     'key'         => 'mxmachines',
732     'section'     => 'deprecated',
733     'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'',
734     'type'        => 'textarea',
735   },
736
737   {
738     'key'         => 'nsmachines',
739     'section'     => 'deprecated',
740     'description' => 'NS nameservers for new domains, one per line, with trailing `.\'',
741     'type'        => 'textarea',
742   },
743
744   {
745     'key'         => 'defaultrecords',
746     'section'     => 'BIND',
747     'description' => 'DNS entries to add automatically when creating a domain',
748     'type'        => 'editlist',
749     'editlist_parts' => [ { type=>'text' },
750                           { type=>'immutable', value=>'IN' },
751                           { type=>'select',
752                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
753                           { type=> 'text' }, ],
754   },
755
756   {
757     'key'         => 'arecords',
758     'section'     => 'deprecated',
759     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
760     'type'        => 'textarea',
761   },
762
763   {
764     'key'         => 'cnamerecords',
765     'section'     => 'deprecated',
766     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
767     'type'        => 'textarea',
768   },
769
770   {
771     'key'         => 'nismachines',
772     'section'     => 'deprecated',
773     'description' => '<b>DEPRECATED</b>.  Your NIS master (not slave master) machines, one per line.  This enables export of `/etc/global/passwd\' and `/etc/global/shadow\'.',
774     'type'        => 'textarea',
775   },
776
777   {
778     'key'         => 'passwordmin',
779     'section'     => 'password',
780     'description' => 'Minimum password length (default 6)',
781     'type'        => 'text',
782   },
783
784   {
785     'key'         => 'passwordmax',
786     'section'     => 'password',
787     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
788     'type'        => 'text',
789   },
790
791   {
792     'key' => 'password-noampersand',
793     'section' => 'password',
794     'description' => 'Disallow ampersands in passwords',
795     'type' => 'checkbox',
796   },
797
798   {
799     'key' => 'password-noexclamation',
800     'section' => 'password',
801     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
802     'type' => 'checkbox',
803   },
804
805   {
806     'key'         => 'qmailmachines',
807     'section'     => 'deprecated',
808     'description' => '<b>DEPRECATED</b>, add <i>qmail</i> and <i>shellcommands</i> <a href="../browse/part_export.cgi">exports</a> instead.  This option used to export `/var/qmail/control/virtualdomains\', `/var/qmail/control/recipientmap\', and `/var/qmail/control/rcpthosts\'.  Setting this option (even if empty) also turns on user `.qmail-extension\' file maintenance in conjunction with the <b>shellmachine</b> option.',
809     'type'        => [qw( checkbox textarea )],
810   },
811
812   {
813     'key'         => 'radiusmachines',
814     'section'     => 'deprecated',
815     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to export to be: your RADIUS authentication machines, one per line.  This enables export of `/etc/raddb/users\'.',
816     'type'        => 'textarea',
817   },
818
819   {
820     'key'         => 'referraldefault',
821     'section'     => 'UI',
822     'description' => 'Default referral, specified by refnum',
823     'type'        => 'text',
824   },
825
826 #  {
827 #    'key'         => 'registries',
828 #    'section'     => 'required',
829 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
830 #  },
831
832   {
833     'key'         => 'report_template',
834     'section'     => 'deprecated',
835     'description' => 'Deprecated template file for reports.',
836     'type'        => 'textarea',
837   },
838
839
840   {
841     'key'         => 'maxsearchrecordsperpage',
842     'section'     => 'UI',
843     'description' => 'If set, number of search records to return per page.',
844     'type'        => 'text',
845   },
846
847   {
848     'key'         => 'sendmailconfigpath',
849     'section'     => 'deprecated',
850     'description' => '<b>DEPRECATED</b>, add a <i>sendmail</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be sendmail configuration file path.  Defaults to `/etc\'.  Many newer distributions use `/etc/mail\'.',
851     'type'        => 'text',
852   },
853
854   {
855     'key'         => 'sendmailmachines',
856     'section'     => 'deprecated',
857     'description' => '<b>DEPRECATED</b>, add a <i>sendmail</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be sendmail machines, one per line.  This enables export of `/etc/virtusertable\' and `/etc/sendmail.cw\'.',
858     'type'        => 'textarea',
859   },
860
861   {
862     'key'         => 'sendmailrestart',
863     'section'     => 'deprecated',
864     'description' => '<b>DEPRECATED</b>, add a <i>sendmail</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to define the command which is run on sendmail machines after files are copied.',
865     'type'        => 'text',
866   },
867
868   {
869     'key'         => 'session-start',
870     'section'     => 'session',
871     'description' => 'If defined, the command which is executed on the Freeside machine when a session begins.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
872     'type'        => 'text',
873   },
874
875   {
876     'key'         => 'session-stop',
877     'section'     => 'session',
878     'description' => 'If defined, the command which is executed on the Freeside machine when a session ends.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
879     'type'        => 'text',
880   },
881
882   {
883     'key'         => 'shellmachine',
884     'section'     => 'deprecated',
885     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain a single machine with user home directories mounted.  This enables home directory creation, renaming and archiving/deletion.  In conjunction with `qmailmachines\', it also enables `.qmail-extension\' file maintenance.',
886     'type'        => 'text',
887   },
888
889   {
890     'key'         => 'shellmachine-useradd',
891     'section'     => 'deprecated',
892     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain command(s) to run on shellmachine when an account is created.  If the <b>shellmachine</b> option is set but this option is not, <code>useradd -d $dir -m -s $shell -u $uid $username</code> is the default.  If this option is set but empty, <code>cp -pr /etc/skel $dir; chown -R $uid.$gid $dir</code> is the default instead.  Otherwise the value is evaluated as a double-quoted perl string, with the following variables available: <code>$username</code>, <code>$uid</code>, <code>$gid</code>, <code>$dir</code>, and <code>$shell</code>.',
893     'type'        => [qw( checkbox text )],
894   },
895
896   {
897     'key'         => 'shellmachine-userdel',
898     'section'     => 'deprecated',
899     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain command(s) to run on shellmachine when an account is deleted.  If the <b>shellmachine</b> option is set but this option is not, <code>userdel $username</code> is the default.  If this option is set but empty, <code>rm -rf $dir</code> is the default instead.  Otherwise the value is evaluated as a double-quoted perl string, with the following variables available: <code>$username</code> and <code>$dir</code>.',
900     'type'        => [qw( checkbox text )],
901   },
902
903   {
904     'key'         => 'shellmachine-usermod',
905     'section'     => 'deprecated',
906     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain command(s) to run on shellmachine when an account is modified.  If the <b>shellmachine</b> option is set but this option is empty, <code>[ -d $old_dir ] &amp;&amp; mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir )</code> is the default.  Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$old_dir</code>, <code>$new_dir</code>, <code>$uid</code> and <code>$gid</code>.',
907     #'type'        => [qw( checkbox text )],
908     'type'        => 'text',
909   },
910
911   {
912     'key'         => 'shellmachines',
913     'section'     => 'deprecated',
914     'description' => '<b>DEPRECATED</b>, add a <i>sysvshell</i> <a href="../browse/part_export.cgi">export</a> instead.  Your Linux and System V flavored shell (and mail) machines, one per line.  This enables export of `/etc/passwd\' and `/etc/shadow\' files.',
915      'type'        => 'textarea',
916  },
917
918   {
919     'key'         => 'shells',
920     'section'     => 'required',
921     'description' => 'Legal shells (think /etc/shells).  You probably want to `cut -d: -f7 /etc/passwd | sort | uniq\' initially so that importing doesn\'t fail with `Illegal shell\' errors, then remove any special entries afterwords.  A blank line specifies that an empty shell is permitted.',
922     'type'        => 'textarea',
923   },
924
925   {
926     'key'         => 'showpasswords',
927     'section'     => 'UI',
928     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
929     'type'        => 'checkbox',
930   },
931
932   {
933     'key'         => 'signupurl',
934     'section'     => 'UI',
935     'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="../docs/signup.html">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
936     'type'        => 'text',
937   },
938
939   {
940     'key'         => 'smtpmachine',
941     'section'     => 'required',
942     'description' => 'SMTP relay for Freeside\'s outgoing mail',
943     'type'        => 'text',
944   },
945
946   {
947     'key'         => 'soadefaultttl',
948     'section'     => 'BIND',
949     'description' => 'SOA default TTL for new domains.',
950     'type'        => 'text',
951   },
952
953   {
954     'key'         => 'soaemail',
955     'section'     => 'BIND',
956     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
957     'type'        => 'text',
958   },
959
960   {
961     'key'         => 'soaexpire',
962     'section'     => 'BIND',
963     'description' => 'SOA expire for new domains',
964     'type'        => 'text',
965   },
966
967   {
968     'key'         => 'soamachine',
969     'section'     => 'BIND',
970     'description' => 'SOA machine for new domains, with trailing `.\'',
971     'type'        => 'text',
972   },
973
974   {
975     'key'         => 'soarefresh',
976     'section'     => 'BIND',
977     'description' => 'SOA refresh for new domains',
978     'type'        => 'text',
979   },
980
981   {
982     'key'         => 'soaretry',
983     'section'     => 'BIND',
984     'description' => 'SOA retry for new domains',
985     'type'        => 'text',
986   },
987
988   {
989     'key'         => 'statedefault',
990     'section'     => 'UI',
991     'description' => 'Default state or province (if not supplied, the default is `CA\')',
992     'type'        => 'text',
993   },
994
995   {
996     'key'         => 'radiusprepend',
997     'section'     => 'deprecated',
998     'description' => '<b>DEPRECATED</b>, real-time text radius now edits an existing file in place - just (turn off freeside-queued and) edit your RADIUS users file directly.  The contents used to be be prepended to the top of the RADIUS users file (text exports only).',
999     'type'        => 'textarea',
1000   },
1001
1002   {
1003     'key'         => 'textradiusprepend',
1004     'section'     => 'deprecated',
1005     'description' => '<b>DEPRECATED</b>, use RADIUS check attributes instead.  The contents used to be prepended to the first line of a user\'s RADIUS entry in text exports.',
1006     'type'        => 'text',
1007   },
1008
1009   {
1010     'key'         => 'unsuspendauto',
1011     'section'     => 'billing',
1012     'description' => 'Enables the automatic unsuspension of suspended packages when a customer\'s balance due changes from positive to zero or negative as the result of a payment or credit',
1013     'type'        => 'checkbox',
1014   },
1015
1016   {
1017     'key'         => 'unsuspend-always_adjust_next_bill_date',
1018     'section'     => 'billing',
1019     'description' => 'Global override that causes unsuspensions to always adjust the next bill date under any circumstances.  This is now controlled on a per-package bases - probably best not to use this option unless you are a legacy installation that requires this behaviour.',
1020     'type'        => 'checkbox',
1021   },
1022
1023   {
1024     'key'         => 'usernamemin',
1025     'section'     => 'username',
1026     'description' => 'Minimum username length (default 2)',
1027     'type'        => 'text',
1028   },
1029
1030   {
1031     'key'         => 'usernamemax',
1032     'section'     => 'username',
1033     'description' => 'Maximum username length',
1034     'type'        => 'text',
1035   },
1036
1037   {
1038     'key'         => 'username-ampersand',
1039     'section'     => 'username',
1040     'description' => 'Allow the ampersand character (&amp;) in usernames.  Be careful when using this option in conjunction with <a href="../browse/part_export.cgi">exports</a> which execute shell commands, as the ampersand will be interpreted by the shell if not quoted.',
1041     'type'        => 'checkbox',
1042   },
1043
1044   {
1045     'key'         => 'username-letter',
1046     'section'     => 'username',
1047     'description' => 'Usernames must contain at least one letter',
1048     'type'        => 'checkbox',
1049   },
1050
1051   {
1052     'key'         => 'username-letterfirst',
1053     'section'     => 'username',
1054     'description' => 'Usernames must start with a letter',
1055     'type'        => 'checkbox',
1056   },
1057
1058   {
1059     'key'         => 'username-noperiod',
1060     'section'     => 'username',
1061     'description' => 'Disallow periods in usernames',
1062     'type'        => 'checkbox',
1063   },
1064
1065   {
1066     'key'         => 'username-nounderscore',
1067     'section'     => 'username',
1068     'description' => 'Disallow underscores in usernames',
1069     'type'        => 'checkbox',
1070   },
1071
1072   {
1073     'key'         => 'username-nodash',
1074     'section'     => 'username',
1075     'description' => 'Disallow dashes in usernames',
1076     'type'        => 'checkbox',
1077   },
1078
1079   {
1080     'key'         => 'username-uppercase',
1081     'section'     => 'username',
1082     'description' => 'Allow uppercase characters in usernames',
1083     'type'        => 'checkbox',
1084   },
1085
1086   { 
1087     'key'         => 'username-percent',
1088     'section'     => 'username',
1089     'description' => 'Allow the percent character (%) in usernames.',
1090     'type'        => 'checkbox',
1091   },
1092
1093   {
1094     'key'         => 'username_policy',
1095     'section'     => 'deprecated',
1096     'description' => 'This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts.  This should be one of \'prepend domsvc\' \'append domsvc\' \'append domain\' or \'append @domain\'',
1097     'type'        => 'select',
1098     'select_enum' => [ 'prepend domsvc', 'append domsvc', 'append domain', 'append @domain' ],
1099     #'type'        => 'text',
1100   },
1101
1102   {
1103     'key'         => 'vpopmailmachines',
1104     'section'     => 'deprecated',
1105     'description' => '<b>DEPRECATED</b>, add a <i>vpopmail</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain your vpopmail pop toasters, one per line.  Each line is of the form "machinename vpopdir vpopuid vpopgid".  For example: <code>poptoaster.domain.tld /home/vpopmail 508 508</code>  Note: vpopuid and vpopgid are values taken from the vpopmail machine\'s /etc/passwd',
1106     'type'        => 'textarea',
1107   },
1108
1109   {
1110     'key'         => 'vpopmailrestart',
1111     'section'     => 'deprecated',
1112     'description' => '<b>DEPRECATED</b>, add a <i>vpopmail</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to define the shell commands to run on vpopmail machines after files are copied.  An example can be found in eg/vpopmailrestart of the source distribution.',
1113     'type'        => 'textarea',
1114   },
1115
1116   {
1117     'key'         => 'safe-part_pkg',
1118     'section'     => 'deprecated',
1119     'description' => '<b>DEPRECATED</b>, obsolete.  Used to validate package definition setup and recur expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1120     'type'        => 'checkbox',
1121   },
1122
1123   {
1124     'key'         => 'safe-part_bill_event',
1125     'section'     => 'UI',
1126     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1127     'type'        => 'checkbox',
1128   },
1129
1130   {
1131     'key'         => 'show_ss',
1132     'section'     => 'UI',
1133     'description' => 'Turns on display/collection of SS# in the web interface.',
1134     'type'        => 'checkbox',
1135   },
1136
1137   { 
1138     'key'         => 'agent_defaultpkg',
1139     'section'     => 'UI',
1140     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1141     'type'        => 'checkbox',
1142   },
1143
1144   {
1145     'key'         => 'legacy_link',
1146     'section'     => 'UI',
1147     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1148     'type'        => 'checkbox',
1149   },
1150
1151   {
1152     'key'         => 'legacy_link-steal',
1153     'section'     => 'UI',
1154     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1155     'type'        => 'checkbox',
1156   },
1157
1158   {
1159     'key'         => 'queue_dangerous_controls',
1160     'section'     => 'UI',
1161     'description' => 'Enable queue modification controls on account pages and for new jobs.  Unless you are a developer working on new export code, you should probably leave this off to avoid causing provisioning problems.',
1162     'type'        => 'checkbox',
1163   },
1164
1165   {
1166     'key'         => 'security_phrase',
1167     'section'     => 'password',
1168     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1169     'type'        => 'checkbox',
1170   },
1171
1172   {
1173     'key'         => 'locale',
1174     'section'     => 'UI',
1175     'description' => 'Message locale',
1176     'type'        => 'select',
1177     'select_enum' => [ qw(en_US) ],
1178   },
1179
1180   {
1181     'key'         => 'selfservice_server-quiet',
1182     'section'     => 'deprecated',
1183     'description' => '<b>DEPRECATED</b>, the self-service server no longer sends superfluous decline and cancel emails.  Used to disable decline and cancel emails generated by transactions initiated by the selfservice server.',
1184     'type'        => 'checkbox',
1185   },
1186
1187   {
1188     'key'         => 'signup_server-quiet',
1189     'section'     => 'deprecated',
1190     'description' => '<b>DEPRECATED</b>, the signup server is now part of the self-service server and no longer sends superfluous decline and cancel emails.  Used to disable decline and cancel emails generated by transactions initiated by the signup server.  Does not disable welcome emails.',
1191     'type'        => 'checkbox',
1192   },
1193
1194   {
1195     'key'         => 'signup_server-payby',
1196     'section'     => '',
1197     'description' => 'Acceptable payment types for the signup server',
1198     'type'        => 'selectmultiple',
1199     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1200   },
1201
1202   {
1203     'key'         => 'signup_server-email',
1204     'section'     => 'deprecated',
1205     'description' => '<b>DEPRECATED</b>, this feature is no longer available.  See the ***fill me in*** report instead.  Used to contain a comma-separated list of email addresses to receive notification of signups via the signup server.',
1206     'type'        => 'text',
1207   },
1208
1209   {
1210     'key'         => 'signup_server-default_agentnum',
1211     'section'     => '',
1212     'description' => 'Default agent for the signup server',
1213     'type'        => 'select-sub',
1214     'options_sub' => sub { require FS::Record;
1215                            require FS::agent;
1216                            map { $_->agentnum => $_->agent }
1217                                FS::Record::qsearch('agent', { disabled=>'' } );
1218                          },
1219     'option_sub'  => sub { require FS::Record;
1220                            require FS::agent;
1221                            my $agent = FS::Record::qsearchs(
1222                              'agent', { 'agentnum'=>shift }
1223                            );
1224                            $agent ? $agent->agent : '';
1225                          },
1226   },
1227
1228   {
1229     'key'         => 'signup_server-default_refnum',
1230     'section'     => '',
1231     'description' => 'Default advertising source for the signup server',
1232     'type'        => 'select-sub',
1233     'options_sub' => sub { require FS::Record;
1234                            require FS::part_referral;
1235                            map { $_->refnum => $_->referral }
1236                                FS::Record::qsearch( 'part_referral', 
1237                                                     { 'disabled' => '' }
1238                                                   );
1239                          },
1240     'option_sub'  => sub { require FS::Record;
1241                            require FS::part_referral;
1242                            my $part_referral = FS::Record::qsearchs(
1243                              'part_referral', { 'refnum'=>shift } );
1244                            $part_referral ? $part_referral->referral : '';
1245                          },
1246   },
1247
1248   {
1249     'key'         => 'signup_server-default_pkgpart',
1250     'section'     => '',
1251     'description' => 'Default pakcage for the signup server',
1252     'type'        => 'select-sub',
1253     'options_sub' => sub { require FS::Record;
1254                            require FS::part_pkg;
1255                            map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1256                                FS::Record::qsearch( 'part_pkg',
1257                                                     { 'disabled' => ''}
1258                                                   );
1259                          },
1260     'option_sub'  => sub { require FS::Record;
1261                            require FS::part_pkg;
1262                            my $part_pkg = FS::Record::qsearchs(
1263                              'part_pkg', { 'pkgpart'=>shift }
1264                            );
1265                            $part_pkg
1266                              ? $part_pkg->pkg.' - '.$part_pkg->comment
1267                              : '';
1268                          },
1269   },
1270
1271   {
1272     'key'         => 'show-msgcat-codes',
1273     'section'     => 'UI',
1274     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1275     'type'        => 'checkbox',
1276   },
1277
1278   {
1279     'key'         => 'signup_server-realtime',
1280     'section'     => '',
1281     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1282     'type'        => 'checkbox',
1283   },
1284   {
1285     'key'         => 'signup_server-classnum2',
1286     'section'     => '',
1287     'description' => 'Package Class for first optional purchase',
1288     'type'        => 'select-sub',
1289     'options_sub' => sub { require FS::Record;
1290                            require FS::pkg_class;
1291                            map { $_->classnum => $_->classname }
1292                                FS::Record::qsearch('pkg_class', {} );
1293                          },
1294     'option_sub'  => sub { require FS::Record;
1295                            require FS::pkg_class;
1296                            my $pkg_class = FS::Record::qsearchs(
1297                              'pkg_class', { 'classnum'=>shift }
1298                            );
1299                            $pkg_class ? $pkg_class->classname : '';
1300                          },
1301   },
1302
1303   {
1304     'key'         => 'signup_server-classnum3',
1305     'section'     => '',
1306     'description' => 'Package Class for second optional purchase',
1307     'type'        => 'select-sub',
1308     'options_sub' => sub { require FS::Record;
1309                            require FS::pkg_class;
1310                            map { $_->classnum => $_->classname }
1311                                FS::Record::qsearch('pkg_class', {} );
1312                          },
1313     'option_sub'  => sub { require FS::Record;
1314                            require FS::pkg_class;
1315                            my $pkg_class = FS::Record::qsearchs(
1316                              'pkg_class', { 'classnum'=>shift }
1317                            );
1318                            $pkg_class ? $pkg_class->classname : '';
1319                          },
1320   },
1321
1322   {
1323     'key'         => 'backend-realtime',
1324     'section'     => '',
1325     'description' => 'Run billing for backend signups immediately.',
1326     'type'        => 'checkbox',
1327   },
1328
1329   {
1330     'key'         => 'declinetemplate',
1331     'section'     => 'billing',
1332     'description' => 'Template file for credit card decline emails.',
1333     'type'        => 'textarea',
1334   },
1335
1336   {
1337     'key'         => 'emaildecline',
1338     'section'     => 'billing',
1339     'description' => 'Enable emailing of credit card decline notices.',
1340     'type'        => 'checkbox',
1341   },
1342
1343   {
1344     'key'         => 'emaildecline-exclude',
1345     'section'     => 'billing',
1346     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1347     'type'        => 'textarea',
1348   },
1349
1350   {
1351     'key'         => 'cancelmessage',
1352     'section'     => 'billing',
1353     'description' => 'Template file for cancellation emails.',
1354     'type'        => 'textarea',
1355   },
1356
1357   {
1358     'key'         => 'cancelsubject',
1359     'section'     => 'billing',
1360     'description' => 'Subject line for cancellation emails.',
1361     'type'        => 'text',
1362   },
1363
1364   {
1365     'key'         => 'emailcancel',
1366     'section'     => 'billing',
1367     'description' => 'Enable emailing of cancellation notices.',
1368     'type'        => 'checkbox',
1369   },
1370
1371   {
1372     'key'         => 'require_cardname',
1373     'section'     => 'billing',
1374     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1375     'type'        => 'checkbox',
1376   },
1377
1378   {
1379     'key'         => 'enable_taxclasses',
1380     'section'     => 'billing',
1381     'description' => 'Enable per-package tax classes',
1382     'type'        => 'checkbox',
1383   },
1384
1385   {
1386     'key'         => 'require_taxclasses',
1387     'section'     => 'billing',
1388     'description' => 'Require a taxclass to be entered for every package',
1389     'type'        => 'checkbox',
1390   },
1391
1392   {
1393     'key'         => 'welcome_email',
1394     'section'     => '',
1395     'description' => 'Template file for welcome email.  Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created.  See the <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code></ul>',
1396     'type'        => 'textarea',
1397   },
1398
1399   {
1400     'key'         => 'welcome_email-from',
1401     'section'     => '',
1402     'description' => 'From: address header for welcome email',
1403     'type'        => 'text',
1404   },
1405
1406   {
1407     'key'         => 'welcome_email-subject',
1408     'section'     => '',
1409     'description' => 'Subject: header for welcome email',
1410     'type'        => 'text',
1411   },
1412   
1413   {
1414     'key'         => 'welcome_email-mimetype',
1415     'section'     => '',
1416     'description' => 'MIME type for welcome email',
1417     'type'        => 'select',
1418     'select_enum' => [ 'text/plain', 'text/html' ],
1419   },
1420
1421   {
1422     'key'         => 'warning_email',
1423     'section'     => '',
1424     'description' => 'Template file for warning email.  Warning emails are sent to the customer email invoice destination(s) each time a svc_acct record has its usage drop below a threshold or 0.  See the <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code> <li><code>$column</code> <li><code>$amount</code> <li><code>$threshold</code></ul>',
1425     'type'        => 'textarea',
1426   },
1427
1428   {
1429     'key'         => 'warning_email-from',
1430     'section'     => '',
1431     'description' => 'From: address header for warning email',
1432     'type'        => 'text',
1433   },
1434
1435   {
1436     'key'         => 'warning_email-cc',
1437     'section'     => '',
1438     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1439     'type'        => 'text',
1440   },
1441
1442   {
1443     'key'         => 'warning_email-subject',
1444     'section'     => '',
1445     'description' => 'Subject: header for warning email',
1446     'type'        => 'text',
1447   },
1448   
1449   {
1450     'key'         => 'warning_email-mimetype',
1451     'section'     => '',
1452     'description' => 'MIME type for warning email',
1453     'type'        => 'select',
1454     'select_enum' => [ 'text/plain', 'text/html' ],
1455   },
1456
1457   {
1458     'key'         => 'payby',
1459     'section'     => 'billing',
1460     'description' => 'Available payment types.',
1461     'type'        => 'selectmultiple',
1462     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1463   },
1464
1465   {
1466     'key'         => 'payby-default',
1467     'section'     => 'UI',
1468     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1469     'type'        => 'select',
1470     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1471   },
1472
1473   {
1474     'key'         => 'svc_acct-notes',
1475     'section'     => 'UI',
1476     'description' => 'Extra HTML to be displayed on the Account View screen.',
1477     'type'        => 'textarea',
1478   },
1479
1480   {
1481     'key'         => 'radius-password',
1482     'section'     => '',
1483     'description' => 'RADIUS attribute for plain-text passwords.',
1484     'type'        => 'select',
1485     'select_enum' => [ 'Password', 'User-Password' ],
1486   },
1487
1488   {
1489     'key'         => 'radius-ip',
1490     'section'     => '',
1491     'description' => 'RADIUS attribute for IP addresses.',
1492     'type'        => 'select',
1493     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1494   },
1495
1496   {
1497     'key'         => 'svc_acct-alldomains',
1498     'section'     => '',
1499     'description' => 'Allow accounts to select any domain in the database.  Normally accounts can only select from the domain set in the service definition and those purchased by the customer.',
1500     'type'        => 'checkbox',
1501   },
1502
1503   {
1504     'key'         => 'dump-scpdest',
1505     'section'     => '',
1506     'description' => 'destination for scp database dumps: user@host:/path',
1507     'type'        => 'text',
1508   },
1509
1510   {
1511     'key'         => 'dump-pgpid',
1512     'section'     => '',
1513     'description' => "Optional PGP public key user or key id for database dumps.  The public key should exist on the freeside user's public keyring, and the gpg binary and GnuPG perl module should be installed.",
1514     'type'        => 'text',
1515   },
1516
1517   {
1518     'key'         => 'users-allow_comp',
1519     'section'     => 'deprecated',
1520     'description' => '<b>DEPRECATED</b>, enable the <i>Complimentary customer</i> access right instead.  Was: Usernames (Freeside users, created with <a href="../docs/man/bin/freeside-adduser.html">freeside-adduser</a>) which can create complimentary customers, one per line.  If no usernames are entered, all users can create complimentary accounts.',
1521     'type'        => 'textarea',
1522   },
1523
1524   {
1525     'key'         => 'cvv-save',
1526     'section'     => 'billing',
1527     'description' => 'Save CVV2 information after the initial transaction for the selected credit card types.  Enabling this option may be in violation of your merchant agreement(s), so please check them carefully before enabling this option for any credit card types.',
1528     'type'        => 'selectmultiple',
1529     'select_enum' => \@card_types,
1530   },
1531
1532   {
1533     'key'         => 'allow_negative_charges',
1534     'section'     => 'billing',
1535     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1536     'type'        => 'checkbox',
1537   },
1538   {
1539       'key'         => 'auto_unset_catchall',
1540       'section'     => '',
1541       'description' => 'When canceling a svc_acct that is the email catchall for one or more svc_domains, automatically set their catchall fields to null.  If this option is not set, the attempt will simply fail.',
1542       'type'        => 'checkbox',
1543   },
1544
1545   {
1546     'key'         => 'system_usernames',
1547     'section'     => 'username',
1548     'description' => 'A list of system usernames that cannot be edited or removed, one per line.  Use a bare username to prohibit modification/deletion of the username in any domain, or username@domain to prohibit modification/deletetion of a specific username and domain.',
1549     'type'        => 'textarea',
1550   },
1551
1552   {
1553     'key'         => 'cust_pkg-change_svcpart',
1554     'section'     => '',
1555     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1556     'type'        => 'checkbox',
1557   },
1558
1559   {
1560     'key'         => 'disable_autoreverse',
1561     'section'     => 'BIND',
1562     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1563     'type'        => 'checkbox',
1564   },
1565
1566   {
1567     'key'         => 'svc_www-enable_subdomains',
1568     'section'     => '',
1569     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1570     'type'        => 'checkbox',
1571   },
1572
1573   {
1574     'key'         => 'svc_www-usersvc_svcpart',
1575     'section'     => '',
1576     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1577     'type'        => 'textarea',
1578   },
1579
1580   {
1581     'key'         => 'selfservice_server-primary_only',
1582     'section'     => '',
1583     'description' => 'Only allow primary accounts to access self-service functionality.',
1584     'type'        => 'checkbox',
1585   },
1586
1587   {
1588     'key'         => 'card_refund-days',
1589     'section'     => 'billing',
1590     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1591     'type'        => 'text',
1592   },
1593
1594   {
1595     'key'         => 'agent-showpasswords',
1596     'section'     => '',
1597     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1598     'type'        => 'checkbox',
1599   },
1600
1601   {
1602     'key'         => 'global_unique-username',
1603     'section'     => 'username',
1604     'description' => 'Global username uniqueness control: none (usual setting - check uniqueness per exports), username (all usernames are globally unique, regardless of domain or exports), or username@domain (all username@domain pairs are globally unique, regardless of exports).  disabled turns off duplicate checking completely and is STRONGLY NOT RECOMMENDED unless you REALLY need to turn this off.',
1605     'type'        => 'select',
1606     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1607   },
1608
1609   {
1610     'key'         => 'svc_external-skip_manual',
1611     'section'     => 'UI',
1612     'description' => 'When provisioning svc_external services, skip manual entry of id and title fields in the UI.  Usually used in conjunction with an export that populates these fields (i.e. artera_turbo).',
1613     'type'        => 'checkbox',
1614   },
1615
1616   {
1617     'key'         => 'svc_external-display_type',
1618     'section'     => 'UI',
1619     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1620     'type'        => 'select',
1621     'select_enum' => [ 'generic', 'artera_turbo', ],
1622   },
1623
1624   {
1625     'key'         => 'ticket_system',
1626     'section'     => '',
1627     'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="../docs/install-rt">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
1628     'type'        => 'select',
1629     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1630     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1631   },
1632
1633   {
1634     'key'         => 'ticket_system-default_queueid',
1635     'section'     => '',
1636     'description' => 'Default queue used when creating new customer tickets.',
1637     'type'        => 'select-sub',
1638     'options_sub' => sub {
1639                            my $conf = new FS::Conf;
1640                            if ( $conf->config('ticket_system') ) {
1641                              eval "use FS::TicketSystem;";
1642                              die $@ if $@;
1643                              FS::TicketSystem->queues();
1644                            } else {
1645                              ();
1646                            }
1647                          },
1648     'option_sub'  => sub { 
1649                            my $conf = new FS::Conf;
1650                            if ( $conf->config('ticket_system') ) {
1651                              eval "use FS::TicketSystem;";
1652                              die $@ if $@;
1653                              FS::TicketSystem->queue(shift);
1654                            } else {
1655                              '';
1656                            }
1657                          },
1658   },
1659
1660   {
1661     'key'         => 'ticket_system-custom_priority_field',
1662     'section'     => '',
1663     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1664     'type'        => 'text',
1665   },
1666
1667   {
1668     'key'         => 'ticket_system-custom_priority_field-values',
1669     'section'     => '',
1670     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1671     'type'        => 'textarea',
1672   },
1673
1674   {
1675     'key'         => 'ticket_system-custom_priority_field_queue',
1676     'section'     => '',
1677     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1678     'type'        => 'text',
1679   },
1680
1681   {
1682     'key'         => 'ticket_system-rt_external_datasrc',
1683     'section'     => '',
1684     'description' => 'With external RT integration, the DBI data source for the external RT installation, for example, <code>DBI:Pg:user=rt_user;password=rt_word;host=rt.example.com;dbname=rt</code>',
1685     'type'        => 'text',
1686
1687   },
1688
1689   {
1690     'key'         => 'ticket_system-rt_external_url',
1691     'section'     => '',
1692     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1693     'type'        => 'text',
1694   },
1695
1696   {
1697     'key'         => 'company_name',
1698     'section'     => 'required',
1699     'description' => 'Your company name',
1700     'type'        => 'text',
1701   },
1702
1703   {
1704     'key'         => 'echeck-void',
1705     'section'     => 'deprecated',
1706     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable local-only voiding of echeck payments in addition to refunds against the payment gateway',
1707     'type'        => 'checkbox',
1708   },
1709
1710   {
1711     'key'         => 'cc-void',
1712     'section'     => 'deprecated',
1713     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable local-only voiding of credit card payments in addition to refunds against the payment gateway',
1714     'type'        => 'checkbox',
1715   },
1716
1717   {
1718     'key'         => 'unvoid',
1719     'section'     => 'deprecated',
1720     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
1721     'type'        => 'checkbox',
1722   },
1723
1724   {
1725     'key'         => 'address2-search',
1726     'section'     => 'UI',
1727     'description' => 'Enable a "Unit" search box which searches the second address field',
1728     'type'        => 'checkbox',
1729   },
1730
1731   { 'key'         => 'referral_credit',
1732     'section'     => 'billing',
1733     'description' => "Enables one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency).",
1734     'type'        => 'checkbox',
1735   },
1736
1737   { 'key'         => 'selfservice_server-cache_module',
1738     'section'     => '',
1739     'description' => 'Module used to store self-service session information.  All modules handle any number of self-service servers.  Cache::SharedMemoryCache is appropriate for a single database / single Freeside server.  Cache::FileCache is useful for multiple databases on a single server, or when IPC::ShareLite is not available (i.e. FreeBSD).', #  _Database stores session information in the database and is appropriate for multiple Freeside servers, but may be slower.',
1740     'type'        => 'select',
1741     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1742   },
1743
1744   {
1745     'key'         => 'hylafax',
1746     'section'     => '',
1747     'description' => 'Options for a HylaFAX server to enable the FAX invoice destination.  They should be in the form of a space separated list of arguments to the Fax::Hylafax::Client::sendfax subroutine.  You probably shouldn\'t override things like \'docfile\'.  *Note* Only supported when using typeset invoices (see the invoice_latex configuration option).',
1748     'type'        => [qw( checkbox textarea )],
1749   },
1750
1751   {
1752     'key'         => 'svc_acct-usage_suspend',
1753     'section'     => 'billing',
1754     'description' => 'Suspends the package an account belongs to when svc_acct.seconds or a bytecount is decremented to 0 or below (accounts with an empty seconds and up|down|totalbytes value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1755     'type'        => 'checkbox',
1756   },
1757
1758   {
1759     'key'         => 'svc_acct-usage_unsuspend',
1760     'section'     => 'billing',
1761     'description' => 'Unuspends the package an account belongs to when svc_acct.seconds or a bytecount is incremented from 0 or below to a positive value (accounts with an empty seconds and up|down|totalbytes value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1762     'type'        => 'checkbox',
1763   },
1764
1765   {
1766     'key'         => 'svc_acct-usage_threshold',
1767     'section'     => 'billing',
1768     'description' => 'The threshold (expressed as percentage) of acct.seconds or acct.up|down|totalbytes at which a warning message is sent to a service holder.  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.  Defaults to 80.',
1769     'type'        => 'text',
1770   },
1771
1772   {
1773     'key'         => 'cust-fields',
1774     'section'     => 'UI',
1775     'description' => 'Which customer fields to display on reports by default',
1776     'type'        => 'select',
1777     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
1778   },
1779
1780   {
1781     'key'         => 'cust_pkg-display_times',
1782     'section'     => 'UI',
1783     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
1784     'type'        => 'checkbox',
1785   },
1786
1787   {
1788     'key'         => 'svc_acct-edit_uid',
1789     'section'     => 'shell',
1790     'description' => 'Allow UID editing.',
1791     'type'        => 'checkbox',
1792   },
1793
1794   {
1795     'key'         => 'svc_acct-edit_gid',
1796     'section'     => 'shell',
1797     'description' => 'Allow GID editing.',
1798     'type'        => 'checkbox',
1799   },
1800
1801   {
1802     'key'         => 'zone-underscore',
1803     'section'     => 'BIND',
1804     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
1805     'type'        => 'checkbox',
1806   },
1807
1808   #these should become per-user...
1809   {
1810     'key'         => 'vonage-username',
1811     'section'     => '',
1812     'description' => 'Vonage Click2Call username (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
1813     'type'        => 'text',
1814   },
1815   {
1816     'key'         => 'vonage-password',
1817     'section'     => '',
1818     'description' => 'Vonage Click2Call username (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
1819     'type'        => 'text',
1820   },
1821   {
1822     'key'         => 'vonage-fromnumber',
1823     'section'     => '',
1824     'description' => 'Vonage Click2Call number (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
1825     'type'        => 'text',
1826   },
1827
1828   {
1829     'key'         => 'echeck-nonus',
1830     'section'     => 'billing',
1831     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
1832     'type'        => 'checkbox',
1833   },
1834
1835   {
1836     'key'         => 'voip-cust_cdr_spools',
1837     'section'     => '',
1838     'description' => 'Enable the per-customer option for individual CDR spools.',
1839     'type'        => 'checkbox',
1840   },
1841
1842   {
1843     'key'         => 'svc_forward-arbitrary_dst',
1844     'section'     => '',
1845     'description' => "Allow forwards to point to arbitrary strings that don't necessarily look like email addresses.  Only used when using forwards for weird, non-email things.",
1846     'type'        => 'checkbox',
1847   },
1848
1849   {
1850     'key'         => 'tax-ship_address',
1851     'section'     => 'billing',
1852     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.  Note: Tax reports can take a long time when enabled.',
1853     'type'        => 'checkbox',
1854   },
1855
1856   {
1857     'key'         => 'batch-enable',
1858     'section'     => 'billing',
1859     'description' => 'Enable credit card batching - leave disabled for real-time installations.',
1860     'type'        => 'checkbox',
1861   },
1862
1863   {
1864     'key'         => 'batch-default_format',
1865     'section'     => 'billing',
1866     'description' => 'Default format for batches.',
1867     'type'        => 'select',
1868     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
1869                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
1870   },
1871
1872   {
1873     'key'         => 'batch-fixed_format-CARD',
1874     'section'     => 'billing',
1875     'description' => 'Fixed (unchangeable) format for credit card batches.',
1876     'type'        => 'select',
1877     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
1878                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
1879   },
1880
1881   {
1882     'key'         => 'batch-fixed_format-CHEK',
1883     'section'     => 'billing',
1884     'description' => 'Fixed (unchangeable) format for electronic check batches.',
1885     'type'        => 'select',
1886     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ]
1887   },
1888
1889   {
1890     'key'         => 'batchconfig-BoM',
1891     'section'     => 'billing',
1892     'description' => 'Configuration for Bank of Montreal batching, seven lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Long name, 6. Bank, 7. Bank account',
1893     'type'        => 'textarea',
1894   },
1895
1896   {
1897     'key'         => 'payment_history-years',
1898     'section'     => 'UI',
1899     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
1900     'type'        => 'text',
1901   },
1902
1903   {
1904     'key'         => 'cust_main-use_comments',
1905     'section'     => 'UI',
1906     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
1907     'type'        => 'checkbox',
1908   },
1909
1910   {
1911     'key'         => 'cust_main-disable_notes',
1912     'section'     => 'UI',
1913     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
1914     'type'        => 'checkbox',
1915   },
1916
1917   {
1918     'key'         => 'cust_main_note-display_times',
1919     'section'     => 'UI',
1920     'description' => 'Display full timestamps (not just dates) for customer notes.',
1921     'type'        => 'checkbox',
1922   },
1923
1924   {
1925     'key'         => 'cust_main-ticket_statuses',
1926     'section'     => 'UI',
1927     'description' => 'Show tickets with these statuses on the customer view page.',
1928     'type'        => 'selectmultiple',
1929     'select_enum' => [qw( new open stalled resolved rejected deleted )],
1930   },
1931
1932   {
1933     'key'         => 'cust_main-max_tickets',
1934     'section'     => 'UI',
1935     'description' => 'Maximum number of tickets to show on the customer view page.',
1936     'type'        => 'text',
1937   },
1938
1939   {
1940     'key'         => 'cust_main-skeleton_tables',
1941     'section'     => '',
1942     'description' => 'Tables which will have skeleton records inserted into them for each customer.  Syntax for specifying tables is unfortunately a tricky perl data structure for now.',
1943     'type'        => 'textarea',
1944   },
1945
1946   {
1947     'key'         => 'cust_main-skeleton_custnum',
1948     'section'     => '',
1949     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
1950     'type'        => 'text',
1951   },
1952
1953   {
1954     'key'         => 'cust_main-enable_birthdate',
1955     'section'     => 'UI',
1956     'descritpion' => 'Enable tracking of a birth date with each customer record',
1957     'type'        => 'checkbox',
1958   },
1959
1960   {
1961     'key'         => 'support-key',
1962     'section'     => '',
1963     'description' => 'A support key enables access to commercial services delivered over the network, such as the payroll module, access to the internal ticket system, priority support and optional backups.',
1964     'type'        => 'text',
1965   },
1966
1967   {
1968     'key'         => 'card-types',
1969     'section'     => 'billing',
1970     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
1971     'type'        => 'selectmultiple',
1972     'select_enum' => \@card_types,
1973   },
1974
1975 );
1976
1977 1;
1978