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