payby-default config option, with special "HIDE" option to disable billing
[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
8 $DEBUG = 0;
9
10 =head1 NAME
11
12 FS::Conf - Freeside configuration values
13
14 =head1 SYNOPSIS
15
16   use FS::Conf;
17
18   $conf = new FS::Conf "/config/directory";
19
20   $FS::Conf::default_dir = "/config/directory";
21   $conf = new FS::Conf;
22
23   $dir = $conf->dir;
24
25   $value = $conf->config('key');
26   @list  = $conf->config('key');
27   $bool  = $conf->exists('key');
28
29   $conf->touch('key');
30   $conf->set('key' => 'value');
31   $conf->delete('key');
32
33   @config_items = $conf->config_items;
34
35 =head1 DESCRIPTION
36
37 Read and write Freeside configuration values.  Keys currently map to filenames,
38 but this may change in the future.
39
40 =head1 METHODS
41
42 =over 4
43
44 =item new [ DIRECTORY ]
45
46 Create a new configuration object.  A directory arguement is required if
47 $FS::Conf::default_dir has not been set.
48
49 =cut
50
51 sub new {
52   my($proto,$dir) = @_;
53   my($class) = ref($proto) || $proto;
54   my($self) = { 'dir' => $dir || $default_dir } ;
55   bless ($self, $class);
56 }
57
58 =item dir
59
60 Returns the directory.
61
62 =cut
63
64 sub dir {
65   my($self) = @_;
66   my $dir = $self->{dir};
67   -e $dir or die "FATAL: $dir doesn't exist!";
68   -d $dir or die "FATAL: $dir isn't a directory!";
69   -r $dir or die "FATAL: Can't read $dir!";
70   -x $dir or die "FATAL: $dir not searchable (executable)!";
71   $dir =~ /^(.*)$/;
72   $1;
73 }
74
75 =item config KEY
76
77 Returns the configuration value or values (depending on context) for key.
78
79 =cut
80
81 sub config {
82   my($self,$file)=@_;
83   my($dir)=$self->dir;
84   my $fh = new IO::File "<$dir/$file" or return;
85   if ( wantarray ) {
86     map {
87       /^(.*)$/
88         or die "Illegal line (array context) in $dir/$file:\n$_\n";
89       $1;
90     } <$fh>;
91   } else {
92     <$fh> =~ /^(.*)$/
93       or die "Illegal line (scalar context) in $dir/$file:\n$_\n";
94     $1;
95   }
96 }
97
98 =item exists KEY
99
100 Returns true if the specified key exists, even if the corresponding value
101 is undefined.
102
103 =cut
104
105 sub exists {
106   my($self,$file)=@_;
107   my($dir) = $self->dir;
108   -e "$dir/$file";
109 }
110
111 =item touch KEY
112
113 Creates the specified configuration key if it does not exist.
114
115 =cut
116
117 sub touch {
118   my($self, $file) = @_;
119   my $dir = $self->dir;
120   unless ( $self->exists($file) ) {
121     warn "[FS::Conf] TOUCH $file\n" if $DEBUG;
122     system('touch', "$dir/$file");
123   }
124 }
125
126 =item set KEY VALUE
127
128 Sets the specified configuration key to the given value.
129
130 =cut
131
132 sub set {
133   my($self, $file, $value) = @_;
134   my $dir = $self->dir;
135   $value =~ /^(.*)$/s;
136   $value = $1;
137   unless ( join("\n", @{[ $self->config($file) ]}) eq $value ) {
138     warn "[FS::Conf] SET $file\n" if $DEBUG;
139 #    warn "$dir" if is_tainted($dir);
140 #    warn "$dir" if is_tainted($file);
141     chmod 0644, "$dir/$file";
142     my $fh = new IO::File ">$dir/$file" or return;
143     chmod 0644, "$dir/$file";
144     print $fh "$value\n";
145   }
146 }
147 #sub is_tainted {
148 #             return ! eval { join('',@_), kill 0; 1; };
149 #         }
150
151 =item delete KEY
152
153 Deletes the specified configuration key.
154
155 =cut
156
157 sub delete {
158   my($self, $file) = @_;
159   my $dir = $self->dir;
160   if ( $self->exists($file) ) {
161     warn "[FS::Conf] DELETE $file\n";
162     unlink "$dir/$file";
163   }
164 }
165
166 =item config_items
167
168 Returns all of the possible configuration items as FS::ConfItem objects.  See
169 L<FS::ConfItem>.
170
171 =cut
172
173 sub config_items {
174   my $self = shift; 
175   #quelle kludge
176   @config_items,
177   map { 
178         my $basename = basename($_);
179         $basename =~ /^(.*)$/;
180         $basename = $1;
181         new FS::ConfItem {
182                            'key'         => $basename,
183                            'section'     => 'billing',
184                            'description' => 'Alternate template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
185                            'type'        => 'textarea',
186                          }
187       } glob($self->dir. '/invoice_template_*')
188   ;
189 }
190
191 =back
192
193 =head1 BUGS
194
195 If this was more than just crud that will never be useful outside Freeside I'd
196 worry that config_items is freeside-specific and icky.
197
198 =head1 SEE ALSO
199
200 "Configuration" in the web interface (config/config.cgi).
201
202 httemplate/docs/config.html
203
204 =cut
205
206 @config_items = map { new FS::ConfItem $_ } (
207
208   {
209     'key'         => 'address',
210     'section'     => 'deprecated',
211     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
212     'type'        => 'text',
213   },
214
215   {
216     'key'         => 'alerter_template',
217     'section'     => 'billing',
218     'description' => 'Template file for billing method expiration alerts.  See the <a href="../docs/billing.html#invoice_template">billing documentation</a> for details.',
219     'type'        => 'textarea',
220   },
221
222   {
223     'key'         => 'apacheroot',
224     'section'     => 'deprecated',
225     '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',
226     'type'        => 'text',
227   },
228
229   {
230     'key'         => 'apacheip',
231     'section'     => 'apache',
232     'description' => 'The current IP address to assign to new virtual hosts',
233     'type'        => 'text',
234   },
235
236   {
237     'key'         => 'apachemachine',
238     'section'     => 'deprecated',
239     '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.',
240     'type'        => 'text',
241   },
242
243   {
244     'key'         => 'apachemachines',
245     'section'     => 'apache',
246     'description' => 'Your 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.',
247     'type'        => 'textarea',
248   },
249
250   {
251     'key'         => 'bindprimary',
252     'section'     => 'deprecated',
253     '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',
254     'type'        => 'text',
255   },
256
257   {
258     'key'         => 'bindsecondaries',
259     'section'     => 'deprecated',
260     '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',
261     'type'        => 'textarea',
262   },
263
264   {
265     'key'         => 'business-onlinepayment',
266     'section'     => 'billing',
267     '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.',
268     'type'        => 'textarea',
269   },
270
271   {
272     'key'         => 'business-onlinepayment-description',
273     'section'     => 'billing',
274     '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 to which the invoiced being charged applies)',
275     'type'        => 'text',
276   },
277
278   {
279     'key'         => 'bsdshellmachines',
280     'section'     => 'deprecated',
281     '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\'.',
282     'type'        => 'textarea',
283   },
284
285   {
286     'key'         => 'countrydefault',
287     'section'     => 'UI',
288     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
289     'type'        => 'text',
290   },
291
292   {
293     'key'         => 'cyrus',
294     'section'     => 'deprecated',
295     '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.',
296     'type'        => 'textarea',
297   },
298
299   {
300     'key'         => 'cp_app',
301     'section'     => 'deprecated',
302     '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).',
303     'type'        => 'textarea',
304   },
305
306   {
307     'key'         => 'deletecustomers',
308     'section'     => 'UI',
309     '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.',
310     'type'        => 'checkbox',
311   },
312
313   {
314     'key'         => 'deletepayments',
315     'section'     => 'UI',
316     'description' => 'Enable deletion of unclosed payments.  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.',
317     'type'        => [qw( checkbox text )],
318   },
319
320   {
321     'key'         => 'dirhash',
322     'section'     => 'shell',
323     '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>',
324     'type'        => 'text',
325   },
326
327   {
328     'key'         => 'disable_customer_referrals',
329     'section'     => 'UI',
330     'description' => 'Disable new customer-to-customer referrals in the web interface',
331     'type'        => 'checkbox',
332   },
333
334   {
335     'key'         => 'editreferrals',
336     'section'     => 'UI',
337     'description' => 'Enable advertising source modification for existing customers',
338     'type'       => 'checkbox',
339   },
340
341   {
342     'key'         => 'emailinvoiceonly',
343     'section'     => 'billing',
344     'description' => 'Disables postal mail invoices',
345     'type'       => 'checkbox',
346   },
347
348   {
349     'key'         => 'disablepostalinvoicedefault',
350     'section'     => 'billing',
351     '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>.',
352     'type'       => 'checkbox',
353   },
354
355   {
356     'key'         => 'emailinvoiceauto',
357     'section'     => 'billing',
358     'description' => 'Automatically adds new accounts to the email invoice list',
359     'type'       => 'checkbox',
360   },
361
362   {
363     'key'         => 'erpcdmachines',
364     'section'     => '',
365     'description' => 'Your ERPCD authenticaion machines, one per line.  This enables export of `/usr/annex/acp_passwd\' and `/usr/annex/acp_dialup\'',
366     'type'        => 'textarea',
367   },
368
369   {
370     'key'         => 'hidecancelledpackages',
371     'section'     => 'UI',
372     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
373     'type'        => 'checkbox',
374   },
375
376   {
377     'key'         => 'hidecancelledcustomers',
378     'section'     => 'UI',
379     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
380     'type'        => 'checkbox',
381   },
382
383   {
384     'key'         => 'home',
385     'section'     => 'required',
386     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
387     'type'        => 'text',
388   },
389
390   {
391     'key'         => 'icradiusmachines',
392     'section'     => 'deprecated',
393     '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>',
394     'type'        => [qw( checkbox textarea )],
395   },
396
397   {
398     'key'         => 'icradius_mysqldest',
399     'section'     => 'deprecated',
400     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> https://billing.crosswind.net/freeside/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/".',
401     'type'        => 'text',
402   },
403
404   {
405     'key'         => 'icradius_mysqlsource',
406     'section'     => 'deprecated',
407     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> https://billing.crosswind.net/freeside/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".',
408     'type'        => 'text',
409   },
410
411   {
412     'key'         => 'icradius_secrets',
413     'section'     => 'deprecated',
414     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> https://billing.crosswind.net/freeside/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.',
415     'type'        => 'textarea',
416   },
417
418   {
419     'key'         => 'invoice_from',
420     'section'     => 'required',
421     'description' => 'Return address on email invoices',
422     'type'        => 'text',
423   },
424
425   {
426     'key'         => 'invoice_template',
427     'section'     => 'required',
428     'description' => 'Required template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
429     'type'        => 'textarea',
430   },
431
432   {
433     'key'         => 'lpr',
434     'section'     => 'required',
435     'description' => 'Print command for paper invoices, for example `lpr -h\'',
436     'type'        => 'text',
437   },
438
439   {
440     'key'         => 'maildisablecatchall',
441     'section'     => 'deprecated',
442     '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.',
443     'type'        => 'checkbox',
444   },
445
446   {
447     'key'         => 'money_char',
448     'section'     => '',
449     'description' => 'Currency symbol - defaults to `$\'',
450     'type'        => 'text',
451   },
452
453   {
454     'key'         => 'mxmachines',
455     'section'     => 'deprecated',
456     'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'',
457     'type'        => 'textarea',
458   },
459
460   {
461     'key'         => 'nsmachines',
462     'section'     => 'deprecated',
463     'description' => 'NS nameservers for new domains, one per line, with trailing `.\'',
464     'type'        => 'textarea',
465   },
466
467   {
468     'key'         => 'defaultrecords',
469     'section'     => 'BIND',
470     'description' => 'DNS entries to add automatically when creating a domain',
471     'type'        => 'editlist',
472     'editlist_parts' => [ { type=>'text' },
473                           { type=>'immutable', value=>'IN' },
474                           { type=>'select',
475                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS)} },
476                           { type=> 'text' }, ],
477   },
478
479   {
480     'key'         => 'arecords',
481     'section'     => 'deprecated',
482     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
483     'type'        => 'textarea',
484   },
485
486   {
487     'key'         => 'cnamerecords',
488     'section'     => 'deprecated',
489     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
490     'type'        => 'textarea',
491   },
492
493   {
494     'key'         => 'nismachines',
495     'section'     => 'deprecated',
496     '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\'.',
497     'type'        => 'textarea',
498   },
499
500   {
501     'key'         => 'passwordmin',
502     'section'     => 'password',
503     'description' => 'Minimum password length (default 6)',
504     'type'        => 'text',
505   },
506
507   {
508     'key'         => 'passwordmax',
509     'section'     => 'password',
510     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
511     'type'        => 'text',
512   },
513
514   {
515     'key'         => 'qmailmachines',
516     'section'     => 'mail',
517     'description' => 'Your qmail machines, one per line.  This enables export of `/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.',
518     'type'        => [qw( checkbox textarea )],
519   },
520
521   {
522     'key'         => 'radiusmachines',
523     'section'     => 'deprecated',
524     '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\'.',
525     'type'        => 'textarea',
526   },
527
528   {
529     'key'         => 'referraldefault',
530     'section'     => 'UI',
531     'description' => 'Default referral, specified by refnum',
532     'type'        => 'text',
533   },
534
535 #  {
536 #    'key'         => 'registries',
537 #    'section'     => 'required',
538 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
539 #  },
540
541   {
542     'key'         => 'report_template',
543     'section'     => 'required',
544     'description' => 'Required template file for reports.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
545     'type'        => 'textarea',
546   },
547
548
549   {
550     'key'         => 'maxsearchrecordsperpage',
551     'section'     => 'UI',
552     'description' => 'If set, number of search records to return per page.',
553     'type'        => 'text',
554   },
555
556   {
557     'key'         => 'sendmailconfigpath',
558     'section'     => 'mail',
559     'description' => 'Sendmail configuration file path.  Defaults to `/etc\'.  Many newer distributions use `/etc/mail\'.',
560     'type'        => 'text',
561   },
562
563   {
564     'key'         => 'sendmailmachines',
565     'section'     => 'mail',
566     'description' => 'Your sendmail machines, one per line.  This enables export of `/etc/virtusertable\' and `/etc/sendmail.cw\'.',
567     'type'        => 'textarea',
568   },
569
570   {
571     'key'         => 'sendmailrestart',
572     'section'     => 'mail',
573     'description' => 'If defined, the command which is run on sendmail machines after files are copied.',
574     'type'        => 'text',
575   },
576
577   {
578     'key'         => 'session-start',
579     'section'     => 'session',
580     '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.',
581     'type'        => 'text',
582   },
583
584   {
585     'key'         => 'session-stop',
586     'section'     => 'session',
587     '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.',
588     'type'        => 'text',
589   },
590
591   {
592     'key'         => 'shellmachine',
593     'section'     => 'deprecated',
594     '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.',
595     'type'        => 'text',
596   },
597
598   {
599     'key'         => 'shellmachine-useradd',
600     'section'     => 'deprecated',
601     '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>.',
602     'type'        => [qw( checkbox text )],
603   },
604
605   {
606     'key'         => 'shellmachine-userdel',
607     'section'     => 'deprecated',
608     '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>.',
609     'type'        => [qw( checkbox text )],
610   },
611
612   {
613     'key'         => 'shellmachine-usermod',
614     'section'     => 'deprecated',
615     '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>.',
616     #'type'        => [qw( checkbox text )],
617     'type'        => 'text',
618   },
619
620   {
621     'key'         => 'shellmachines',
622     'section'     => 'deprecated',
623     '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.',
624      'type'        => 'textarea',
625  },
626
627   {
628     'key'         => 'shells',
629     'section'     => 'required',
630     '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.',
631     'type'        => 'textarea',
632   },
633
634   {
635     'key'         => 'showpasswords',
636     'section'     => 'UI',
637     'description' => 'Display unencrypted user passwords in the web interface',
638     'type'        => 'checkbox',
639   },
640
641   {
642     'key'         => 'signupurl',
643     'section'     => 'UI',
644     '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',
645     'type'        => 'text',
646   },
647
648   {
649     'key'         => 'smtpmachine',
650     'section'     => 'required',
651     'description' => 'SMTP relay for Freeside\'s outgoing mail',
652     'type'        => 'text',
653   },
654
655   {
656     'key'         => 'soadefaultttl',
657     'section'     => 'BIND',
658     'description' => 'SOA default TTL for new domains.',
659     'type'        => 'text',
660   },
661
662   {
663     'key'         => 'soaemail',
664     'section'     => 'BIND',
665     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
666     'type'        => 'text',
667   },
668
669   {
670     'key'         => 'soaexpire',
671     'section'     => 'BIND',
672     'description' => 'SOA expire for new domains',
673     'type'        => 'text',
674   },
675
676   {
677     'key'         => 'soamachine',
678     'section'     => 'BIND',
679     'description' => 'SOA machine for new domains, with trailing `.\'',
680     'type'        => 'text',
681   },
682
683   {
684     'key'         => 'soarefresh',
685     'section'     => 'BIND',
686     'description' => 'SOA refresh for new domains',
687     'type'        => 'text',
688   },
689
690   {
691     'key'         => 'soaretry',
692     'section'     => 'BIND',
693     'description' => 'SOA retry for new domains',
694     'type'        => 'text',
695   },
696
697   {
698     'key'         => 'statedefault',
699     'section'     => 'UI',
700     'description' => 'Default state or province (if not supplied, the default is `CA\')',
701     'type'        => 'text',
702   },
703
704   {
705     'key'         => 'radiusprepend',
706     'section'     => 'deprecated',
707     '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).',
708     'type'        => 'textarea',
709   },
710
711   {
712     'key'         => 'textradiusprepend',
713     'section'     => 'deprecated',
714     '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.',
715     'type'        => 'text',
716   },
717
718   {
719     'key'         => 'unsuspendauto',
720     'section'     => 'billing',
721     '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',
722     'type'        => 'checkbox',
723   },
724
725   {
726     'key'         => 'usernamemin',
727     'section'     => 'username',
728     'description' => 'Minimum username length (default 2)',
729     'type'        => 'text',
730   },
731
732   {
733     'key'         => 'usernamemax',
734     'section'     => 'username',
735     'description' => 'Maximum username length',
736     'type'        => 'text',
737   },
738
739   {
740     'key'         => 'username-ampersand',
741     'section'     => 'username',
742     'description' => 'Allow the ampersand character (&amp;) in usernames.  Be careful when using this option in conjunction with <a href="#shellmachine-useradd">shellmachine-useradd</a> and other configuration options which execute shell commands, as the ampersand will be interpreted by the shell if not quoted.',
743     'type'        => 'checkbox',
744   },
745
746   {
747     'key'         => 'username-letter',
748     'section'     => 'username',
749     'description' => 'Usernames must contain at least one letter',
750     'type'        => 'checkbox',
751   },
752
753   {
754     'key'         => 'username-letterfirst',
755     'section'     => 'username',
756     'description' => 'Usernames must start with a letter',
757     'type'        => 'checkbox',
758   },
759
760   {
761     'key'         => 'username-noperiod',
762     'section'     => 'username',
763     'description' => 'Disallow periods in usernames',
764     'type'        => 'checkbox',
765   },
766
767   {
768     'key'         => 'username-nounderscore',
769     'section'     => 'username',
770     'description' => 'Disallow underscores in usernames',
771     'type'        => 'checkbox',
772   },
773
774   {
775     'key'         => 'username-nodash',
776     'section'     => 'username',
777     'description' => 'Disallow dashes in usernames',
778     'type'        => 'checkbox',
779   },
780
781   {
782     'key'         => 'username-uppercase',
783     'section'     => 'username',
784     'description' => 'Allow uppercase characters in usernames',
785     'type'        => 'checkbox',
786   },
787
788   {
789     'key'         => 'username_policy',
790     'section'     => '',
791     '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\'',
792     'type'        => 'select',
793     'select_enum' => [ 'prepend domsvc', 'append domsvc', 'append domain', 'append @domain' ],
794     #'type'        => 'text',
795   },
796
797   {
798     'key'         => 'vpopmailmachines',
799     'section'     => 'deprecated',
800     'description' => '<b>DEPRECATED</b>, add a <i>cp</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',
801     'type'        => 'textarea',
802   },
803
804   {
805     'key'         => 'vpopmailrestart',
806     'section'     => 'deprecated',
807     '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.',
808     'type'        => 'textarea',
809   },
810
811   {
812     'key'         => 'safe-part_pkg',
813     'section'     => 'UI',
814     'description' => 'Validates package definition setup and recur expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
815     'type'        => 'checkbox',
816   },
817
818   {
819     'key'         => 'safe-part_bill_event',
820     'section'     => 'UI',
821     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
822     'type'        => 'checkbox',
823   },
824
825   {
826     'key'         => 'show_ss',
827     'section'     => 'UI',
828     'description' => 'Turns on display/collection of SS# in the web interface.',
829     'type'        => 'checkbox',
830   },
831
832   { 
833     'key'         => 'agent_defaultpkg',
834     'section'     => 'UI',
835     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
836     'type'        => 'checkbox',
837   },
838
839   {
840     'key'         => 'legacy_link',
841     'section'     => 'UI',
842     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
843     'type'        => 'checkbox',
844   },
845
846   {
847     'key'         => 'queue_dangerous_controls',
848     'section'     => 'UI',
849     '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.',
850     'type'        => 'checkbox',
851   },
852
853   {
854     'key'         => 'security_phrase',
855     'section'     => 'password',
856     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
857     'type'        => 'checkbox',
858   },
859
860   {
861     'key'         => 'locale',
862     'section'     => 'UI',
863     'description' => 'Message locale',
864     'type'        => 'select',
865     'select_enum' => [ qw(en_US) ],
866   },
867
868   {
869     'key'         => 'signup_server-payby',
870     'section'     => '',
871     'description' => 'Acceptable payment types for the signup server',
872     'type'        => 'selectmultiple',
873     'select_enum' => [ qw(CARD PREPAY BILL COMP) ],
874   },
875
876   {
877     'key'         => 'signup_server-email',
878     'section'     => '',
879     'description' => 'Comma-separated list of email addresses to receive notification of signups via the signup server.',
880     'type'        => 'text',
881   },
882
883
884   {
885     'key'         => 'show-msgcat-codes',
886     'section'     => 'UI',
887     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
888     'type'        => 'checkbox',
889   },
890
891   {
892     'key'         => 'signup_server-realtime',
893     'section'     => '',
894     'description' => 'Run billing for signup server signups immediately, and suspend accounts which subsequently have a balance.',
895     'type'        => 'checkbox',
896   },
897
898   {
899     'key'         => 'declinetemplate',
900     'section'     => 'billing',
901     'description' => 'Template file for credit card decline emails.',
902     'type'        => 'textarea',
903   },
904
905   {
906     'key'         => 'emaildecline',
907     'section'     => 'billing',
908     'description' => 'Enable emailing of credit card decline notices.',
909     'type'        => 'checkbox',
910   },
911
912   {
913     'key'         => 'require_cardname',
914     'section'     => 'billing',
915     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
916     'type'        => 'checkbox',
917   },
918
919   {
920     'key'         => 'enable_taxclasses',
921     'section'     => 'billing',
922     'description' => 'Enable per-package tax classes',
923     'type'        => 'checkbox',
924   },
925
926   {
927     'key'         => 'welcome_email',
928     'section'     => '',
929     '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/doc/MJD/Text-Template-1.42/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available: <code>$username</code>, <code>$password</code>, <code>$first</code>, <code>$last</code> and <code>$pkg</code>.',
930     'type'        => 'textarea',
931   },
932
933   {
934     'key'         => 'welcome_email-from',
935     'section'     => '',
936     'description' => 'From: address header for welcome email',
937     'type'        => 'text',
938   },
939
940   {
941     'key'         => 'welcome_email-subject',
942     'section'     => '',
943     'description' => 'Subject: header for welcome email',
944     'type'        => 'text',
945   },
946   
947   {
948     'key'         => 'welcome_email-mimetype',
949     'section'     => '',
950     'description' => 'MIME type for welcome email',
951     'type'        => 'select',
952     'select_enum' => [ 'text/plain', 'text/html' ],
953   },
954
955   {
956     'key'         => 'payby-default',
957     'section'     => 'UI',
958     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
959     'type'        => 'select',
960     'select_enum' => [ '', 'CARD', 'BILL', 'COMP', 'HIDE' ],
961   },
962
963
964 );
965
966 1;
967