first try at skeleton feature for mg
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($default_dir @config_items $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 @config_items = map { new FS::ConfItem $_ } (
288
289   {
290     'key'         => 'address',
291     'section'     => 'deprecated',
292     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
293     'type'        => 'text',
294   },
295
296   {
297     'key'         => 'alerter_template',
298     'section'     => 'billing',
299     'description' => 'Template file for billing method expiration alerts.  See the <a href="../docs/billing.html#invoice_template">billing documentation</a> for details.',
300     'type'        => 'textarea',
301   },
302
303   {
304     'key'         => 'apacheroot',
305     'section'     => 'deprecated',
306     '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',
307     'type'        => 'text',
308   },
309
310   {
311     'key'         => 'apacheip',
312     'section'     => 'deprecated',
313     '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',
314     'type'        => 'text',
315   },
316
317   {
318     'key'         => 'apachemachine',
319     'section'     => 'deprecated',
320     '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.',
321     'type'        => 'text',
322   },
323
324   {
325     'key'         => 'apachemachines',
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 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.',
328     'type'        => 'textarea',
329   },
330
331   {
332     'key'         => 'bindprimary',
333     'section'     => 'deprecated',
334     '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',
335     'type'        => 'text',
336   },
337
338   {
339     'key'         => 'bindsecondaries',
340     'section'     => 'deprecated',
341     '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',
342     'type'        => 'textarea',
343   },
344
345   {
346     'key'         => 'encryption',
347     'section'     => 'billing',
348     'description' => 'Enable encryption of credit cards.',
349     'type'        => 'checkbox',
350   },
351
352   {
353     'key'         => 'encryptionmodule',
354     'section'     => 'billing',
355     'description' => 'Use which module for encryption?',
356     'type'        => 'text',
357   },
358
359   {
360     'key'         => 'encryptionpublickey',
361     'section'     => 'billing',
362     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
363     'type'        => 'textarea',
364   },
365
366   {
367     'key'         => 'encryptionprivatekey',
368     'section'     => 'billing',
369     '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.',
370     'type'        => 'textarea',
371   },
372
373   {
374     'key'         => 'business-onlinepayment',
375     'section'     => 'billing',
376     '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.',
377     'type'        => 'textarea',
378   },
379
380   {
381     'key'         => 'business-onlinepayment-ach',
382     'section'     => 'billing',
383     '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.',
384     'type'        => 'textarea',
385   },
386
387   {
388     'key'         => 'business-onlinepayment-description',
389     'section'     => 'billing',
390     '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)',
391     'type'        => 'text',
392   },
393
394   {
395     'key'         => 'business-onlinepayment-email-override',
396     'section'     => 'billing',
397     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
398     'type'        => 'text',
399   },
400
401   {
402     'key'         => 'bsdshellmachines',
403     'section'     => 'deprecated',
404     '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\'.',
405     'type'        => 'textarea',
406   },
407
408   {
409     'key'         => 'countrydefault',
410     'section'     => 'UI',
411     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
412     'type'        => 'text',
413   },
414
415   {
416     'key'         => 'cyrus',
417     'section'     => 'deprecated',
418     '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.',
419     'type'        => 'textarea',
420   },
421
422   {
423     'key'         => 'cp_app',
424     'section'     => 'deprecated',
425     '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).',
426     'type'        => 'textarea',
427   },
428
429   {
430     'key'         => 'deletecustomers',
431     'section'     => 'UI',
432     '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.',
433     'type'        => 'checkbox',
434   },
435
436   {
437     'key'         => 'deletepayments',
438     'section'     => 'billing',
439     '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.',
440     'type'        => [qw( checkbox text )],
441   },
442
443   {
444     'key'         => 'deletecredits',
445     'section'     => 'deprecated',
446     '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.',
447     'type'        => [qw( checkbox text )],
448   },
449
450   {
451     'key'         => 'unapplypayments',
452     'section'     => 'deprecated',
453     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable "unapplication" of unclosed payments.',
454     'type'        => 'checkbox',
455   },
456
457   {
458     'key'         => 'unapplycredits',
459     'section'     => 'deprecated',
460     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to nable "unapplication" of unclosed credits.',
461     'type'        => 'checkbox',
462   },
463
464   {
465     'key'         => 'dirhash',
466     'section'     => 'shell',
467     '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>',
468     'type'        => 'text',
469   },
470
471   {
472     'key'         => 'disable_customer_referrals',
473     'section'     => 'UI',
474     'description' => 'Disable new customer-to-customer referrals in the web interface',
475     'type'        => 'checkbox',
476   },
477
478   {
479     'key'         => 'editreferrals',
480     'section'     => 'UI',
481     'description' => 'Enable advertising source modification for existing customers',
482     'type'       => 'checkbox',
483   },
484
485   {
486     'key'         => 'emailinvoiceonly',
487     'section'     => 'billing',
488     'description' => 'Disables postal mail invoices',
489     'type'       => 'checkbox',
490   },
491
492   {
493     'key'         => 'disablepostalinvoicedefault',
494     'section'     => 'billing',
495     '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>.',
496     'type'       => 'checkbox',
497   },
498
499   {
500     'key'         => 'emailinvoiceauto',
501     'section'     => 'billing',
502     'description' => 'Automatically adds new accounts to the email invoice list',
503     'type'       => 'checkbox',
504   },
505
506   {
507     'key'         => 'exclude_ip_addr',
508     'section'     => '',
509     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
510     'type'        => 'textarea',
511   },
512   
513   {
514     'key'         => 'erpcdmachines',
515     'section'     => 'deprecated',
516     '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\'',
517     'type'        => 'textarea',
518   },
519
520   {
521     'key'         => 'hidecancelledpackages',
522     'section'     => 'UI',
523     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
524     'type'        => 'checkbox',
525   },
526
527   {
528     'key'         => 'hidecancelledcustomers',
529     'section'     => 'UI',
530     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
531     'type'        => 'checkbox',
532   },
533
534   {
535     'key'         => 'home',
536     'section'     => 'required',
537     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
538     'type'        => 'text',
539   },
540
541   {
542     'key'         => 'icradiusmachines',
543     'section'     => 'deprecated',
544     '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>',
545     'type'        => [qw( checkbox textarea )],
546   },
547
548   {
549     'key'         => 'icradius_mysqldest',
550     'section'     => 'deprecated',
551     '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/".',
552     'type'        => 'text',
553   },
554
555   {
556     'key'         => 'icradius_mysqlsource',
557     'section'     => 'deprecated',
558     '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".',
559     'type'        => 'text',
560   },
561
562   {
563     'key'         => 'icradius_secrets',
564     'section'     => 'deprecated',
565     '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.',
566     'type'        => 'textarea',
567   },
568
569   {
570     'key'         => 'invoice_from',
571     'section'     => 'required',
572     'description' => 'Return address on email invoices',
573     'type'        => 'text',
574   },
575
576   {
577     'key'         => 'invoice_template',
578     'section'     => 'required',
579     'description' => 'Required template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
580     'type'        => 'textarea',
581   },
582
583   {
584     'key'         => 'invoice_html',
585     'section'     => 'billing',
586     'description' => 'Optional HTML template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
587
588     'type'        => 'textarea',
589   },
590
591   {
592     'key'         => 'invoice_htmlnotes',
593     'section'     => 'billing',
594     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
595     'type'        => 'textarea',
596   },
597
598   {
599     'key'         => 'invoice_htmlfooter',
600     'section'     => 'billing',
601     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
602     'type'        => 'textarea',
603   },
604
605   {
606     'key'         => 'invoice_htmlreturnaddress',
607     'section'     => 'billing',
608     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
609     'type'        => 'textarea',
610   },
611
612   {
613     'key'         => 'invoice_latex',
614     'section'     => 'billing',
615     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
616     'type'        => 'textarea',
617   },
618
619   {
620     'key'         => 'invoice_latexnotes',
621     'section'     => 'billing',
622     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
623     'type'        => 'textarea',
624   },
625
626   {
627     'key'         => 'invoice_latexfooter',
628     'section'     => 'billing',
629     'description' => 'Footer for LaTeX typeset PostScript invoices.',
630     'type'        => 'textarea',
631   },
632
633   {
634     'key'         => 'invoice_latexreturnaddress',
635     'section'     => 'billing',
636     'description' => 'Return address for LaTeX typeset PostScript invoices.',
637     'type'        => 'textarea',
638   },
639
640   {
641     'key'         => 'invoice_latexsmallfooter',
642     'section'     => 'billing',
643     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
644     'type'        => 'textarea',
645   },
646
647   {
648     'key'         => 'invoice_email_pdf',
649     'section'     => 'billing',
650     '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.',
651     'type'        => 'checkbox'
652   },
653
654   {
655     'key'         => 'invoice_email_pdf_note',
656     'section'     => 'billing',
657     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
658     'type'        => 'textarea'
659   },
660
661
662   { 
663     'key'         => 'invoice_default_terms',
664     'section'     => 'billing',
665     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
666     'type'        => 'select',
667     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 30', 'Net 45', 'Net 60' ],
668   },
669
670   {
671     'key'         => 'invoice_send_receipts',
672     'section'     => 'deprecated',
673     'description' => '<b>DEPRECATED</b>, this used to send an invoice copy on payments and credits.  See the payment_receipt_email and XXXX instead.',
674     'type'        => 'checkbox',
675   },
676
677   {
678     'key'         => 'payment_receipt_email',
679     'section'     => 'billing',
680     '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>',
681     'type'        => 'textarea',
682   },
683
684   {
685     'key'         => 'lpr',
686     'section'     => 'required',
687     'description' => 'Print command for paper invoices, for example `lpr -h\'',
688     'type'        => 'text',
689   },
690
691   {
692     'key'         => 'maildisablecatchall',
693     'section'     => 'deprecated',
694     '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.',
695     'type'        => 'checkbox',
696   },
697
698   {
699     'key'         => 'money_char',
700     'section'     => '',
701     'description' => 'Currency symbol - defaults to `$\'',
702     'type'        => 'text',
703   },
704
705   {
706     'key'         => 'mxmachines',
707     'section'     => 'deprecated',
708     'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'',
709     'type'        => 'textarea',
710   },
711
712   {
713     'key'         => 'nsmachines',
714     'section'     => 'deprecated',
715     'description' => 'NS nameservers for new domains, one per line, with trailing `.\'',
716     'type'        => 'textarea',
717   },
718
719   {
720     'key'         => 'defaultrecords',
721     'section'     => 'BIND',
722     'description' => 'DNS entries to add automatically when creating a domain',
723     'type'        => 'editlist',
724     'editlist_parts' => [ { type=>'text' },
725                           { type=>'immutable', value=>'IN' },
726                           { type=>'select',
727                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
728                           { type=> 'text' }, ],
729   },
730
731   {
732     'key'         => 'arecords',
733     'section'     => 'deprecated',
734     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
735     'type'        => 'textarea',
736   },
737
738   {
739     'key'         => 'cnamerecords',
740     'section'     => 'deprecated',
741     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
742     'type'        => 'textarea',
743   },
744
745   {
746     'key'         => 'nismachines',
747     'section'     => 'deprecated',
748     '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\'.',
749     'type'        => 'textarea',
750   },
751
752   {
753     'key'         => 'passwordmin',
754     'section'     => 'password',
755     'description' => 'Minimum password length (default 6)',
756     'type'        => 'text',
757   },
758
759   {
760     'key'         => 'passwordmax',
761     'section'     => 'password',
762     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
763     'type'        => 'text',
764   },
765
766   {
767     'key' => 'password-noampersand',
768     'section' => 'password',
769     'description' => 'Disallow ampersands in passwords',
770     'type' => 'checkbox',
771   },
772
773   {
774     'key' => 'password-noexclamation',
775     'section' => 'password',
776     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
777     'type' => 'checkbox',
778   },
779
780   {
781     'key'         => 'qmailmachines',
782     'section'     => 'deprecated',
783     '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.',
784     'type'        => [qw( checkbox textarea )],
785   },
786
787   {
788     'key'         => 'radiusmachines',
789     'section'     => 'deprecated',
790     '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\'.',
791     'type'        => 'textarea',
792   },
793
794   {
795     'key'         => 'referraldefault',
796     'section'     => 'UI',
797     'description' => 'Default referral, specified by refnum',
798     'type'        => 'text',
799   },
800
801 #  {
802 #    'key'         => 'registries',
803 #    'section'     => 'required',
804 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
805 #  },
806
807   {
808     'key'         => 'report_template',
809     'section'     => 'deprecated',
810     'description' => 'Deprecated template file for reports.',
811     'type'        => 'textarea',
812   },
813
814
815   {
816     'key'         => 'maxsearchrecordsperpage',
817     'section'     => 'UI',
818     'description' => 'If set, number of search records to return per page.',
819     'type'        => 'text',
820   },
821
822   {
823     'key'         => 'sendmailconfigpath',
824     'section'     => 'deprecated',
825     '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\'.',
826     'type'        => 'text',
827   },
828
829   {
830     'key'         => 'sendmailmachines',
831     'section'     => 'deprecated',
832     '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\'.',
833     'type'        => 'textarea',
834   },
835
836   {
837     'key'         => 'sendmailrestart',
838     'section'     => 'deprecated',
839     '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.',
840     'type'        => 'text',
841   },
842
843   {
844     'key'         => 'session-start',
845     'section'     => 'session',
846     '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.',
847     'type'        => 'text',
848   },
849
850   {
851     'key'         => 'session-stop',
852     'section'     => 'session',
853     '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.',
854     'type'        => 'text',
855   },
856
857   {
858     'key'         => 'shellmachine',
859     'section'     => 'deprecated',
860     '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.',
861     'type'        => 'text',
862   },
863
864   {
865     'key'         => 'shellmachine-useradd',
866     'section'     => 'deprecated',
867     '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>.',
868     'type'        => [qw( checkbox text )],
869   },
870
871   {
872     'key'         => 'shellmachine-userdel',
873     'section'     => 'deprecated',
874     '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>.',
875     'type'        => [qw( checkbox text )],
876   },
877
878   {
879     'key'         => 'shellmachine-usermod',
880     'section'     => 'deprecated',
881     '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>.',
882     #'type'        => [qw( checkbox text )],
883     'type'        => 'text',
884   },
885
886   {
887     'key'         => 'shellmachines',
888     'section'     => 'deprecated',
889     '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.',
890      'type'        => 'textarea',
891  },
892
893   {
894     'key'         => 'shells',
895     'section'     => 'required',
896     '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.',
897     'type'        => 'textarea',
898   },
899
900   {
901     'key'         => 'showpasswords',
902     'section'     => 'UI',
903     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
904     'type'        => 'checkbox',
905   },
906
907   {
908     'key'         => 'signupurl',
909     'section'     => 'UI',
910     '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',
911     'type'        => 'text',
912   },
913
914   {
915     'key'         => 'smtpmachine',
916     'section'     => 'required',
917     'description' => 'SMTP relay for Freeside\'s outgoing mail',
918     'type'        => 'text',
919   },
920
921   {
922     'key'         => 'soadefaultttl',
923     'section'     => 'BIND',
924     'description' => 'SOA default TTL for new domains.',
925     'type'        => 'text',
926   },
927
928   {
929     'key'         => 'soaemail',
930     'section'     => 'BIND',
931     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
932     'type'        => 'text',
933   },
934
935   {
936     'key'         => 'soaexpire',
937     'section'     => 'BIND',
938     'description' => 'SOA expire for new domains',
939     'type'        => 'text',
940   },
941
942   {
943     'key'         => 'soamachine',
944     'section'     => 'BIND',
945     'description' => 'SOA machine for new domains, with trailing `.\'',
946     'type'        => 'text',
947   },
948
949   {
950     'key'         => 'soarefresh',
951     'section'     => 'BIND',
952     'description' => 'SOA refresh for new domains',
953     'type'        => 'text',
954   },
955
956   {
957     'key'         => 'soaretry',
958     'section'     => 'BIND',
959     'description' => 'SOA retry for new domains',
960     'type'        => 'text',
961   },
962
963   {
964     'key'         => 'statedefault',
965     'section'     => 'UI',
966     'description' => 'Default state or province (if not supplied, the default is `CA\')',
967     'type'        => 'text',
968   },
969
970   {
971     'key'         => 'radiusprepend',
972     'section'     => 'deprecated',
973     '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).',
974     'type'        => 'textarea',
975   },
976
977   {
978     'key'         => 'textradiusprepend',
979     'section'     => 'deprecated',
980     '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.',
981     'type'        => 'text',
982   },
983
984   {
985     'key'         => 'unsuspendauto',
986     'section'     => 'billing',
987     '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',
988     'type'        => 'checkbox',
989   },
990
991   {
992     'key'         => 'usernamemin',
993     'section'     => 'username',
994     'description' => 'Minimum username length (default 2)',
995     'type'        => 'text',
996   },
997
998   {
999     'key'         => 'usernamemax',
1000     'section'     => 'username',
1001     'description' => 'Maximum username length',
1002     'type'        => 'text',
1003   },
1004
1005   {
1006     'key'         => 'username-ampersand',
1007     'section'     => 'username',
1008     '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.',
1009     'type'        => 'checkbox',
1010   },
1011
1012   {
1013     'key'         => 'username-letter',
1014     'section'     => 'username',
1015     'description' => 'Usernames must contain at least one letter',
1016     'type'        => 'checkbox',
1017   },
1018
1019   {
1020     'key'         => 'username-letterfirst',
1021     'section'     => 'username',
1022     'description' => 'Usernames must start with a letter',
1023     'type'        => 'checkbox',
1024   },
1025
1026   {
1027     'key'         => 'username-noperiod',
1028     'section'     => 'username',
1029     'description' => 'Disallow periods in usernames',
1030     'type'        => 'checkbox',
1031   },
1032
1033   {
1034     'key'         => 'username-nounderscore',
1035     'section'     => 'username',
1036     'description' => 'Disallow underscores in usernames',
1037     'type'        => 'checkbox',
1038   },
1039
1040   {
1041     'key'         => 'username-nodash',
1042     'section'     => 'username',
1043     'description' => 'Disallow dashes in usernames',
1044     'type'        => 'checkbox',
1045   },
1046
1047   {
1048     'key'         => 'username-uppercase',
1049     'section'     => 'username',
1050     'description' => 'Allow uppercase characters in usernames',
1051     'type'        => 'checkbox',
1052   },
1053
1054   { 
1055     'key'         => 'username-percent',
1056     'section'     => 'username',
1057     'description' => 'Allow the percent character (%) in usernames.',
1058     'type'        => 'checkbox',
1059   },
1060
1061   {
1062     'key'         => 'username_policy',
1063     'section'     => 'deprecated',
1064     '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\'',
1065     'type'        => 'select',
1066     'select_enum' => [ 'prepend domsvc', 'append domsvc', 'append domain', 'append @domain' ],
1067     #'type'        => 'text',
1068   },
1069
1070   {
1071     'key'         => 'vpopmailmachines',
1072     'section'     => 'deprecated',
1073     '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',
1074     'type'        => 'textarea',
1075   },
1076
1077   {
1078     'key'         => 'vpopmailrestart',
1079     'section'     => 'deprecated',
1080     '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.',
1081     'type'        => 'textarea',
1082   },
1083
1084   {
1085     'key'         => 'safe-part_pkg',
1086     'section'     => 'deprecated',
1087     'description' => '<b>DEPRECATED</b>, obsolete.  Used to validate package definition setup and recur expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1088     'type'        => 'checkbox',
1089   },
1090
1091   {
1092     'key'         => 'safe-part_bill_event',
1093     'section'     => 'UI',
1094     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1095     'type'        => 'checkbox',
1096   },
1097
1098   {
1099     'key'         => 'show_ss',
1100     'section'     => 'UI',
1101     'description' => 'Turns on display/collection of SS# in the web interface.',
1102     'type'        => 'checkbox',
1103   },
1104
1105   { 
1106     'key'         => 'agent_defaultpkg',
1107     'section'     => 'UI',
1108     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1109     'type'        => 'checkbox',
1110   },
1111
1112   {
1113     'key'         => 'legacy_link',
1114     'section'     => 'UI',
1115     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1116     'type'        => 'checkbox',
1117   },
1118
1119   {
1120     'key'         => 'legacy_link-steal',
1121     'section'     => 'UI',
1122     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1123     'type'        => 'checkbox',
1124   },
1125
1126   {
1127     'key'         => 'queue_dangerous_controls',
1128     'section'     => 'UI',
1129     '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.',
1130     'type'        => 'checkbox',
1131   },
1132
1133   {
1134     'key'         => 'security_phrase',
1135     'section'     => 'password',
1136     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1137     'type'        => 'checkbox',
1138   },
1139
1140   {
1141     'key'         => 'locale',
1142     'section'     => 'UI',
1143     'description' => 'Message locale',
1144     'type'        => 'select',
1145     'select_enum' => [ qw(en_US) ],
1146   },
1147
1148   {
1149     'key'         => 'selfservice_server-quiet',
1150     'section'     => 'deprecated',
1151     '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.',
1152     'type'        => 'checkbox',
1153   },
1154
1155   {
1156     'key'         => 'signup_server-quiet',
1157     'section'     => 'deprecated',
1158     '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.',
1159     'type'        => 'checkbox',
1160   },
1161
1162   {
1163     'key'         => 'signup_server-payby',
1164     'section'     => '',
1165     'description' => 'Acceptable payment types for the signup server',
1166     'type'        => 'selectmultiple',
1167     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1168   },
1169
1170   {
1171     'key'         => 'signup_server-email',
1172     'section'     => 'deprecated',
1173     '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.',
1174     'type'        => 'text',
1175   },
1176
1177   {
1178     'key'         => 'signup_server-default_agentnum',
1179     'section'     => '',
1180     'description' => 'Default agentnum for the signup server',
1181     'type'        => 'text',
1182   },
1183
1184   {
1185     'key'         => 'signup_server-default_refnum',
1186     'section'     => '',
1187     'description' => 'Default advertising source number for the signup server',
1188     'type'        => 'text',
1189   },
1190
1191   {
1192     'key'         => 'show-msgcat-codes',
1193     'section'     => 'UI',
1194     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1195     'type'        => 'checkbox',
1196   },
1197
1198   {
1199     'key'         => 'signup_server-realtime',
1200     'section'     => '',
1201     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1202     'type'        => 'checkbox',
1203   },
1204
1205   {
1206     'key'         => 'backend-realtime',
1207     'section'     => '',
1208     'description' => 'Run billing for backend signups immediately.',
1209     'type'        => 'checkbox',
1210   },
1211
1212   {
1213     'key'         => 'declinetemplate',
1214     'section'     => 'billing',
1215     'description' => 'Template file for credit card decline emails.',
1216     'type'        => 'textarea',
1217   },
1218
1219   {
1220     'key'         => 'emaildecline',
1221     'section'     => 'billing',
1222     'description' => 'Enable emailing of credit card decline notices.',
1223     'type'        => 'checkbox',
1224   },
1225
1226   {
1227     'key'         => 'emaildecline-exclude',
1228     'section'     => 'billing',
1229     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1230     'type'        => 'textarea',
1231   },
1232
1233   {
1234     'key'         => 'cancelmessage',
1235     'section'     => 'billing',
1236     'description' => 'Template file for cancellation emails.',
1237     'type'        => 'textarea',
1238   },
1239
1240   {
1241     'key'         => 'cancelsubject',
1242     'section'     => 'billing',
1243     'description' => 'Subject line for cancellation emails.',
1244     'type'        => 'text',
1245   },
1246
1247   {
1248     'key'         => 'emailcancel',
1249     'section'     => 'billing',
1250     'description' => 'Enable emailing of cancellation notices.',
1251     'type'        => 'checkbox',
1252   },
1253
1254   {
1255     'key'         => 'require_cardname',
1256     'section'     => 'billing',
1257     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1258     'type'        => 'checkbox',
1259   },
1260
1261   {
1262     'key'         => 'enable_taxclasses',
1263     'section'     => 'billing',
1264     'description' => 'Enable per-package tax classes',
1265     'type'        => 'checkbox',
1266   },
1267
1268   {
1269     'key'         => 'require_taxclasses',
1270     'section'     => 'billing',
1271     'description' => 'Require a taxclass to be entered for every package',
1272     'type'        => 'checkbox',
1273   },
1274
1275   {
1276     'key'         => 'welcome_email',
1277     'section'     => '',
1278     '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>',
1279     'type'        => 'textarea',
1280   },
1281
1282   {
1283     'key'         => 'welcome_email-from',
1284     'section'     => '',
1285     'description' => 'From: address header for welcome email',
1286     'type'        => 'text',
1287   },
1288
1289   {
1290     'key'         => 'welcome_email-subject',
1291     'section'     => '',
1292     'description' => 'Subject: header for welcome email',
1293     'type'        => 'text',
1294   },
1295   
1296   {
1297     'key'         => 'welcome_email-mimetype',
1298     'section'     => '',
1299     'description' => 'MIME type for welcome email',
1300     'type'        => 'select',
1301     'select_enum' => [ 'text/plain', 'text/html' ],
1302   },
1303
1304   {
1305     'key'         => 'payby',
1306     'section'     => 'billing',
1307     'description' => 'Available payment types.',
1308     'type'        => 'selectmultiple',
1309     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1310   },
1311
1312   {
1313     'key'         => 'payby-default',
1314     'section'     => 'UI',
1315     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1316     'type'        => 'select',
1317     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1318   },
1319
1320   {
1321     'key'         => 'svc_acct-notes',
1322     'section'     => 'UI',
1323     'description' => 'Extra HTML to be displayed on the Account View screen.',
1324     'type'        => 'textarea',
1325   },
1326
1327   {
1328     'key'         => 'radius-password',
1329     'section'     => '',
1330     'description' => 'RADIUS attribute for plain-text passwords.',
1331     'type'        => 'select',
1332     'select_enum' => [ 'Password', 'User-Password' ],
1333   },
1334
1335   {
1336     'key'         => 'radius-ip',
1337     'section'     => '',
1338     'description' => 'RADIUS attribute for IP addresses.',
1339     'type'        => 'select',
1340     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1341   },
1342
1343   {
1344     'key'         => 'svc_acct-alldomains',
1345     'section'     => '',
1346     '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.',
1347     'type'        => 'checkbox',
1348   },
1349
1350   {
1351     'key'         => 'dump-scpdest',
1352     'section'     => '',
1353     'description' => 'destination for scp database dumps: user@host:/path',
1354     'type'        => 'text',
1355   },
1356
1357   {
1358     'key'         => 'dump-pgpid',
1359     'section'     => '',
1360     '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.",
1361     'type'        => 'text',
1362   },
1363
1364   {
1365     'key'         => 'users-allow_comp',
1366     'section'     => 'deprecated',
1367     '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.',
1368     'type'        => 'textarea',
1369   },
1370
1371   {
1372     'key'         => 'cvv-save',
1373     'section'     => 'billing',
1374     '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.',
1375     'type'        => 'selectmultiple',
1376     'select_enum' => [ "VISA card",
1377                        "MasterCard",
1378                        "Discover card",
1379                        "American Express card",
1380                        "Diner's Club/Carte Blanche",
1381                        "enRoute",
1382                        "JCB",
1383                        "BankCard",
1384                      ],
1385   },
1386
1387   {
1388     'key'         => 'allow_negative_charges',
1389     'section'     => 'billing',
1390     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1391     'type'        => 'checkbox',
1392   },
1393   {
1394       'key'         => 'auto_unset_catchall',
1395       'section'     => '',
1396       '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.',
1397       'type'        => 'checkbox',
1398   },
1399
1400   {
1401     'key'         => 'system_usernames',
1402     'section'     => 'username',
1403     '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.',
1404     'type'        => 'textarea',
1405   },
1406
1407   {
1408     'key'         => 'cust_pkg-change_svcpart',
1409     'section'     => '',
1410     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1411     'type'        => 'checkbox',
1412   },
1413
1414   {
1415     'key'         => 'disable_autoreverse',
1416     'section'     => 'BIND',
1417     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1418     'type'        => 'checkbox',
1419   },
1420
1421   {
1422     'key'         => 'svc_www-enable_subdomains',
1423     'section'     => '',
1424     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1425     'type'        => 'checkbox',
1426   },
1427
1428   {
1429     'key'         => 'svc_www-usersvc_svcpart',
1430     'section'     => '',
1431     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1432     'type'        => 'textarea',
1433   },
1434
1435   {
1436     'key'         => 'selfservice_server-primary_only',
1437     'section'     => '',
1438     'description' => 'Only allow primary accounts to access self-service functionality.',
1439     'type'        => 'checkbox',
1440   },
1441
1442   {
1443     'key'         => 'card_refund-days',
1444     'section'     => 'billing',
1445     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1446     'type'        => 'text',
1447   },
1448
1449   {
1450     'key'         => 'agent-showpasswords',
1451     'section'     => '',
1452     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1453     'type'        => 'checkbox',
1454   },
1455
1456   {
1457     'key'         => 'global_unique-username',
1458     'section'     => 'username',
1459     '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.',
1460     'type'        => 'select',
1461     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1462   },
1463
1464   {
1465     'key'         => 'svc_external-skip_manual',
1466     'section'     => 'UI',
1467     '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).',
1468     'type'        => 'checkbox',
1469   },
1470
1471   {
1472     'key'         => 'svc_external-display_type',
1473     'section'     => 'UI',
1474     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1475     'type'        => 'select',
1476     'select_enum' => [ 'generic', 'artera_turbo', ],
1477   },
1478
1479   {
1480     'key'         => 'ticket_system',
1481     'section'     => '',
1482     '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).',
1483     'type'        => 'select',
1484     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1485     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1486   },
1487
1488   {
1489     'key'         => 'ticket_system-default_queueid',
1490     'section'     => '',
1491     'description' => 'Default queue used when creating new customer tickets.',
1492     'type'        => 'select-sub',
1493     'options_sub' => sub {
1494                            my $conf = new FS::Conf;
1495                            if ( $conf->config('ticket_system') ) {
1496                              eval "use FS::TicketSystem;";
1497                              die $@ if $@;
1498                              FS::TicketSystem->queues();
1499                            } else {
1500                              ();
1501                            }
1502                          },
1503     'option_sub'  => sub { 
1504                            my $conf = new FS::Conf;
1505                            if ( $conf->config('ticket_system') ) {
1506                              eval "use FS::TicketSystem;";
1507                              die $@ if $@;
1508                              FS::TicketSystem->queue(shift);
1509                            } else {
1510                              '';
1511                            }
1512                          },
1513   },
1514
1515   {
1516     'key'         => 'ticket_system-custom_priority_field',
1517     'section'     => '',
1518     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1519     'type'        => 'text',
1520   },
1521
1522   {
1523     'key'         => 'ticket_system-custom_priority_field-values',
1524     'section'     => '',
1525     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1526     'type'        => 'textarea',
1527   },
1528
1529   {
1530     'key'         => 'ticket_system-custom_priority_field_queue',
1531     'section'     => '',
1532     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1533     'type'        => 'text',
1534   },
1535
1536   {
1537     'key'         => 'ticket_system-rt_external_datasrc',
1538     'section'     => '',
1539     '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>',
1540     'type'        => 'text',
1541
1542   },
1543
1544   {
1545     'key'         => 'ticket_system-rt_external_url',
1546     'section'     => '',
1547     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1548     'type'        => 'text',
1549   },
1550
1551   {
1552     'key'         => 'company_name',
1553     'section'     => 'required',
1554     'description' => 'Your company name',
1555     'type'        => 'text',
1556   },
1557
1558   {
1559     'key'         => 'echeck-void',
1560     'section'     => 'deprecated',
1561     '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',
1562     'type'        => 'checkbox',
1563   },
1564
1565   {
1566     'key'         => 'cc-void',
1567     'section'     => 'deprecated',
1568     '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',
1569     'type'        => 'checkbox',
1570   },
1571
1572   {
1573     'key'         => 'unvoid',
1574     'section'     => 'deprecated',
1575     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
1576     'type'        => 'checkbox',
1577   },
1578
1579   {
1580     'key'         => 'address2-search',
1581     'section'     => 'UI',
1582     'description' => 'Enable a "Unit" search box which searches the second address field',
1583     'type'        => 'checkbox',
1584   },
1585
1586   { 'key'         => 'referral_credit',
1587     'section'     => 'billing',
1588     'description' => "Enables one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency).",
1589     'type'        => 'checkbox',
1590   },
1591
1592   { 'key'         => 'selfservice_server-cache_module',
1593     'section'     => '',
1594     '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.',
1595     'type'        => 'select',
1596     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1597   },
1598
1599   {
1600     'key'         => 'hylafax',
1601     'section'     => '',
1602     '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).',
1603     'type'        => [qw( checkbox textarea )],
1604   },
1605
1606   {
1607     'key'         => 'svc_acct-usage_suspend',
1608     'section'     => 'billing',
1609     'description' => 'Suspends the package an account belongs to when svc_acct.seconds is decremented to 0 or below (accounts with an empty seconds value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1610     'type'        => 'checkbox',
1611   },
1612
1613   {
1614     'key'         => 'svc_acct-usage_unsuspend',
1615     'section'     => 'billing',
1616     'description' => 'Unuspends the package an account belongs to when svc_acct.seconds is incremented from 0 or below to a positive value (accounts with an empty seconds value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1617     'type'        => 'checkbox',
1618   },
1619
1620   {
1621     'key'         => 'cust-fields',
1622     'section'     => 'UI',
1623     'description' => 'Which customer fields to display on reports by default',
1624     'type'        => 'select',
1625     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
1626   },
1627
1628   {
1629     'key'         => 'cust_pkg-display_times',
1630     'section'     => 'UI',
1631     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
1632     'type'        => 'checkbox',
1633   },
1634
1635   {
1636     'key'         => 'svc_acct-edit_uid',
1637     'section'     => 'shell',
1638     'description' => 'Allow UID editing.',
1639     'type'        => 'checkbox',
1640   },
1641
1642   {
1643     'key'         => 'svc_acct-edit_gid',
1644     'section'     => 'shell',
1645     'description' => 'Allow GID editing.',
1646     'type'        => 'checkbox',
1647   },
1648
1649   {
1650     'key'         => 'zone-underscore',
1651     'section'     => 'BIND',
1652     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
1653     'type'        => 'checkbox',
1654   },
1655
1656   #these should become per-user...
1657   {
1658     'key'         => 'vonage-username',
1659     'section'     => '',
1660     'description' => 'Vonage Click2Call username (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
1661     'type'        => 'text',
1662   },
1663   {
1664     'key'         => 'vonage-password',
1665     'section'     => '',
1666     'description' => 'Vonage Click2Call username (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
1667     'type'        => 'text',
1668   },
1669   {
1670     'key'         => 'vonage-fromnumber',
1671     'section'     => '',
1672     'description' => 'Vonage Click2Call number (see <a href="https://secure.click2callu.com/">https://secure.click2callu.com/</a>)',
1673     'type'        => 'text',
1674   },
1675
1676   {
1677     'key'         => 'echeck-nonus',
1678     'section'     => 'billing',
1679     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
1680     'type'        => 'checkbox',
1681   },
1682
1683   {
1684     'key'         => 'voip-cust_cdr_spools',
1685     'section'     => '',
1686     'description' => 'Enable the per-customer option for individual CDR spools.',
1687     'type'        => 'checkbox',
1688   },
1689
1690   {
1691     'key'         => 'svc_forward-arbitrary_dst',
1692     'section'     => '',
1693     '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.",
1694     'type'        => 'checkbox',
1695   },
1696
1697   {
1698     'key'         => 'tax-ship_address',
1699     'section'     => 'billing',
1700     '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.',
1701     'type'        => 'checkbox',
1702   },
1703
1704   {
1705     'key'         => 'batch-default_format',
1706     'section'     => 'billing',
1707     'description' => 'Default format for batches.',
1708     'type'        => 'select',
1709     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM' ]
1710   },
1711
1712   {
1713     'key'         => 'batchconfig-BoM',
1714     'section'     => 'billing',
1715     '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',
1716     'type'        => 'textarea',
1717   },
1718
1719   {
1720     'key'         => 'payment_history-years',
1721     'section'     => 'UI',
1722     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
1723     'type'        => 'text',
1724   },
1725
1726   {
1727     'key'         => 'cust_main-ticket_statuses',
1728     'section'     => 'UI',
1729     'description' => 'Show tickets with these statuses on the customer view page.',
1730     'type'        => 'selectmultiple',
1731     'select_enum' => [qw( new open stalled resolved rejected deleted )],
1732   },
1733
1734   {
1735     'key'         => 'cust_main-max_tickets',
1736     'section'     => 'UI',
1737     'description' => 'Maximum number of tickets to show on the customer view page.',
1738     'type'        => 'text',
1739   },
1740
1741   {
1742     'key'         => 'cust_main-skeleton_tables',
1743     'section'     => '',
1744     '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.',
1745     'type'        => 'textarea',
1746   },
1747
1748   {
1749     'key'         => 'cust_main-skeleton_custnum',
1750     'section'     => '',
1751     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
1752     'type'        => 'text',
1753   },
1754
1755 );
1756
1757 1;
1758