ticket 1568 config options for new echeck fields and addition to selfservice interface
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($base_dir @config_items @card_types $DEBUG );
4 use MIME::Base64;
5 use FS::ConfItem;
6 use FS::ConfDefaults;
7 use FS::conf;
8 use FS::Record qw(qsearch qsearchs);
9 use FS::UID qw(dbh);
10
11 $base_dir = '%%%FREESIDE_CONF%%%';
12
13
14 $DEBUG = 0;
15
16 =head1 NAME
17
18 FS::Conf - Freeside configuration values
19
20 =head1 SYNOPSIS
21
22   use FS::Conf;
23
24   $conf = new FS::Conf;
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
46
47 Create a new configuration object.
48
49 =cut
50
51 sub new {
52   my($proto) = @_;
53   my($class) = ref($proto) || $proto;
54   my($self) = { 'base_dir' => $base_dir };
55   bless ($self, $class);
56 }
57
58 =item base_dir
59
60 Returns the base directory.  By default this is /usr/local/etc/freeside.
61
62 =cut
63
64 sub base_dir {
65   my($self) = @_;
66   my $base_dir = $self->{base_dir};
67   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
68   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
69   -r $base_dir or die "FATAL: Can't read $base_dir!";
70   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
71   $base_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,$name,$agent)=@_;
83   my $hashref = { 'name' => $name };
84   if (defined($agent) && $agent) {
85     $hashref->{agent} = $agent;
86   }
87   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
88   my $cv = FS::Record::qsearchs('conf', $hashref);
89   if (!$cv && exists($hashref->{agent})) {
90     delete($hashref->{agent});
91     $cv = FS::Record::qsearchs('conf', $hashref);
92   }
93   return $cv;
94 }
95
96 sub config {
97   my($self,$name,$agent)=@_;
98   my $cv = $self->_config($name, $agent) or return;
99
100   if ( wantarray ) {
101     split "\n", $cv->value;
102   } else {
103     (split("\n", $cv->value))[0];
104   }
105 }
106
107 =item config_binary KEY
108
109 Returns the exact scalar value for key.
110
111 =cut
112
113 sub config_binary {
114   my($self,$name,$agent)=@_;
115   my $cv = $self->_config($name, $agent) or return;
116   decode_base64($cv->value);
117 }
118
119 =item exists KEY
120
121 Returns true if the specified key exists, even if the corresponding value
122 is undefined.
123
124 =cut
125
126 sub exists {
127   my($self,$name,$agent)=@_;
128   defined($self->_config($name, $agent));
129 }
130
131 =item config_orbase KEY SUFFIX
132
133 Returns the configuration value or values (depending on context) for 
134 KEY_SUFFIX, if it exists, otherwise for KEY
135
136 =cut
137
138 sub config_orbase {
139   my( $self, $name, $suffix ) = @_;
140   if ( $self->exists("${name}_$suffix") ) {
141     $self->config("${name}_$suffix");
142   } else {
143     $self->config($name);
144   }
145 }
146
147 =item touch KEY
148
149 Creates the specified configuration key if it does not exist.
150
151 =cut
152
153 sub touch {
154   my($self, $name, $agent) = @_;
155   $self->set($name, '', $agent);
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, $name, $value, $agent) = @_;
166   $value =~ /^(.*)$/s;
167   $value = $1;
168
169   warn "[FS::Conf] SET $file\n" if $DEBUG;
170
171   my $old = FS::Record::qsearchs('conf', {name => $name, agent => $agent});
172   my $new = new FS::conf { $old ? $old->hash 
173                                 : ('name' => $name, 'agent' => $agent)
174                          };
175   $new->value($value);
176
177   my $error;
178   if ($old) {
179     $error = $new->replace($old);
180   } else {
181     $error = $new->insert;
182   }
183
184   die "error setting configuration value: $error \n"
185     if $error;
186
187 }
188
189 =item set_binary KEY VALUE
190
191 Sets the specified configuration key to an exact scalar value which
192 can be retrieved with config_binary.
193
194 =cut
195
196 sub set_binary {
197   my($self,$name, $value, $agent)=@_;
198   $self->set($name, encode_base64($value), $agent);
199 }
200
201 =item delete KEY
202
203 Deletes the specified configuration key.
204
205 =cut
206
207 sub delete {
208   my($self, $name, $agent) = @_;
209   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agent => $agent}) ) {
210     warn "[FS::Conf] DELETE $file\n";
211
212     my $oldAutoCommit = $FS::UID::AutoCommit;
213     local $FS::UID::AutoCommit = 0;
214     my $dbh = dbh;
215
216     my $error = $cv->delete;
217
218     if ( $error ) {
219       $dbh->rollback if $oldAutoCommit;
220       die "error setting configuration value: $error \n"
221     }
222
223     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
224
225   }
226 }
227
228 =item config_items
229
230 Returns all of the possible configuration items as FS::ConfItem objects.  See
231 L<FS::ConfItem>.
232
233 =cut
234
235 sub config_items {
236   my $self = shift; 
237   #quelle kludge
238   @config_items,
239   ( map { 
240         new FS::ConfItem {
241                            'key'         => $_->name,
242                            'section'     => 'billing',
243                            'description' => 'Alternate template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
244                            'type'        => 'textarea',
245                          }
246       } FS::Record::qsearch('conf', {}, '', "WHERE name LIKE 'invoice!_template!_%' ESCAPE '!'")
247   ),
248   ( map { 
249         new FS::ConfItem {
250                            'key'         => '$_->name',
251                            'section'     => 'billing',  #? 
252                            'description' => 'An image to include in some types of invoices',
253                            'type'        => 'binary',
254                          }
255       } FS::Record::qsearch('conf', {}, '', "WHERE name LIKE 'logo!_%.png' ESCAPE '!'")
256   ),
257   ( map { 
258         new FS::ConfItem {
259                            'key'         => $_->name,
260                            'section'     => 'billing',
261                            'description' => 'Alternate HTML template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
262                            'type'        => 'textarea',
263                          }
264       } FS::Record::qsearch('conf', {}, '', "WHERE name LIKE 'invoice!_html!_%' ESCAPE '!'")
265   ),
266   ( map { 
267         ($latexname = $_->name ) =~ s/latex/html/;
268         new FS::ConfItem {
269                            'key'         => $_->name,
270                            'section'     => 'billing',
271                            'description' => "Alternate Notes section for HTML invoices.  Defaults to the same data in $latexname if not specified.",
272                            'type'        => 'textarea',
273                          }
274       } FS::Record::qsearch('conf', {}, '', "WHERE name LIKE 'invoice!_htmlnotes!_%' ESCAPE '!'")
275   ),
276   ( map { 
277         new FS::ConfItem {
278                            'key'         => $_->name,
279                            'section'     => 'billing',
280                            'description' => 'Alternate LaTeX template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
281                            'type'        => 'textarea',
282                          }
283       } FS::Record::qsearch('conf', {}, '', "WHERE name LIKE 'invoice!_latex!_%' ESCAPE '!'")
284   ),
285   ( map { 
286         new FS::ConfItem {
287                            'key'         => '$_->name',
288                            'section'     => 'billing',  #? 
289                            'description' => 'An image to include in some types of invoices',
290                            'type'        => 'binary',
291                          }
292       } FS::Record::qsearch('conf', {}, '', "WHERE name LIKE 'logo!_%.eps' ESCAPE '!'")
293   ),
294   ( map { 
295         new FS::ConfItem {
296                            'key'         => $_->name,
297                            'section'     => 'billing',
298                            'description' => 'Alternate Notes section for LaTeX typeset PostScript invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
299                            'type'        => 'textarea',
300                          }
301       } FS::Record::qsearch('conf', {}, '', "WHERE name LIKE 'invoice!_latexnotes!_%' ESCAPE '!'")
302   );
303 }
304
305 =back
306
307 =head1 BUGS
308
309 If this was more than just crud that will never be useful outside Freeside I'd
310 worry that config_items is freeside-specific and icky.
311
312 =head1 SEE ALSO
313
314 "Configuration" in the web interface (config/config.cgi).
315
316 httemplate/docs/config.html
317
318 =cut
319
320 #Business::CreditCard
321 @card_types = (
322   "VISA card",
323   "MasterCard",
324   "Discover card",
325   "American Express card",
326   "Diner's Club/Carte Blanche",
327   "enRoute",
328   "JCB",
329   "BankCard",
330   "Switch",
331   "Solo",
332 );
333
334 @config_items = map { new FS::ConfItem $_ } (
335
336   {
337     'key'         => 'address',
338     'section'     => 'deprecated',
339     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
340     'type'        => 'text',
341   },
342
343   {
344     'key'         => 'alerter_template',
345     'section'     => 'billing',
346     'description' => 'Template file for billing method expiration alerts.  See the <a href="../docs/billing.html#invoice_template">billing documentation</a> for details.',
347     'type'        => 'textarea',
348   },
349
350   {
351     'key'         => 'apacheip',
352     'section'     => 'deprecated',
353     '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',
354     'type'        => 'text',
355   },
356
357   {
358     'key'         => 'encryption',
359     'section'     => 'billing',
360     'description' => 'Enable encryption of credit cards.',
361     'type'        => 'checkbox',
362   },
363
364   {
365     'key'         => 'encryptionmodule',
366     'section'     => 'billing',
367     'description' => 'Use which module for encryption?',
368     'type'        => 'text',
369   },
370
371   {
372     'key'         => 'encryptionpublickey',
373     'section'     => 'billing',
374     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
375     'type'        => 'textarea',
376   },
377
378   {
379     'key'         => 'encryptionprivatekey',
380     'section'     => 'billing',
381     '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.',
382     'type'        => 'textarea',
383   },
384
385   {
386     'key'         => 'business-onlinepayment',
387     'section'     => 'billing',
388     '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.',
389     'type'        => 'textarea',
390   },
391
392   {
393     'key'         => 'business-onlinepayment-ach',
394     'section'     => 'billing',
395     '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.',
396     'type'        => 'textarea',
397   },
398
399   {
400     'key'         => 'business-onlinepayment-description',
401     'section'     => 'billing',
402     '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)',
403     'type'        => 'text',
404   },
405
406   {
407     'key'         => 'business-onlinepayment-email-override',
408     'section'     => 'billing',
409     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
410     'type'        => 'text',
411   },
412
413   {
414     'key'         => 'countrydefault',
415     'section'     => 'UI',
416     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
417     'type'        => 'text',
418   },
419
420   {
421     'key'         => 'date_format',
422     'section'     => 'UI',
423     'description' => 'Format for displaying dates',
424     'type'        => 'select',
425     'select_hash' => [
426                        '%m/%d/%Y' => 'MM/DD/YYYY',
427                        '%Y/%m/%d' => 'YYYY/MM/DD',
428                      ],
429   },
430
431   {
432     'key'         => 'deletecustomers',
433     'section'     => 'UI',
434     '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.',
435     'type'        => 'checkbox',
436   },
437
438   {
439     'key'         => 'deletepayments',
440     'section'     => 'billing',
441     '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.',
442     'type'        => [qw( checkbox text )],
443   },
444
445   {
446     'key'         => 'deletecredits',
447     'section'     => 'deprecated',
448     '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.',
449     'type'        => [qw( checkbox text )],
450   },
451
452   {
453     'key'         => 'deleterefunds',
454     'section'     => 'billing',
455     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
456     'type'        => 'checkbox',
457   },
458
459   {
460     'key'         => 'dirhash',
461     'section'     => 'shell',
462     '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>',
463     'type'        => 'text',
464   },
465
466   {
467     'key'         => 'disable_customer_referrals',
468     'section'     => 'UI',
469     'description' => 'Disable new customer-to-customer referrals in the web interface',
470     'type'        => 'checkbox',
471   },
472
473   {
474     'key'         => 'editreferrals',
475     'section'     => 'UI',
476     'description' => 'Enable advertising source modification for existing customers',
477     'type'       => 'checkbox',
478   },
479
480   {
481     'key'         => 'emailinvoiceonly',
482     'section'     => 'billing',
483     'description' => 'Disables postal mail invoices',
484     'type'       => 'checkbox',
485   },
486
487   {
488     'key'         => 'disablepostalinvoicedefault',
489     'section'     => 'billing',
490     '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>.',
491     'type'       => 'checkbox',
492   },
493
494   {
495     'key'         => 'emailinvoiceauto',
496     'section'     => 'billing',
497     'description' => 'Automatically adds new accounts to the email invoice list',
498     'type'       => 'checkbox',
499   },
500
501   {
502     'key'         => 'emailinvoiceautoalways',
503     'section'     => 'billing',
504     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
505     'type'       => 'checkbox',
506   },
507
508   {
509     'key'         => 'exclude_ip_addr',
510     'section'     => '',
511     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
512     'type'        => 'textarea',
513   },
514   
515   {
516     'key'         => 'hidecancelledpackages',
517     'section'     => 'UI',
518     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
519     'type'        => 'checkbox',
520   },
521
522   {
523     'key'         => 'hidecancelledcustomers',
524     'section'     => 'UI',
525     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
526     'type'        => 'checkbox',
527   },
528
529   {
530     'key'         => 'home',
531     'section'     => 'required',
532     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
533     'type'        => 'text',
534   },
535
536   {
537     'key'         => 'invoice_from',
538     'section'     => 'required',
539     'description' => 'Return address on email invoices',
540     'type'        => 'text',
541   },
542
543   {
544     'key'         => 'invoice_template',
545     'section'     => 'required',
546     'description' => 'Required template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
547     'type'        => 'textarea',
548   },
549
550   {
551     'key'         => 'invoice_html',
552     'section'     => 'billing',
553     'description' => 'Optional HTML template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
554
555     'type'        => 'textarea',
556   },
557
558   {
559     'key'         => 'invoice_htmlnotes',
560     'section'     => 'billing',
561     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
562     'type'        => 'textarea',
563   },
564
565   {
566     'key'         => 'invoice_htmlfooter',
567     'section'     => 'billing',
568     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
569     'type'        => 'textarea',
570   },
571
572   {
573     'key'         => 'invoice_htmlreturnaddress',
574     'section'     => 'billing',
575     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
576     'type'        => 'textarea',
577   },
578
579   {
580     'key'         => 'invoice_latex',
581     'section'     => 'billing',
582     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
583     'type'        => 'textarea',
584   },
585
586   {
587     'key'         => 'invoice_latexnotes',
588     'section'     => 'billing',
589     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
590     'type'        => 'textarea',
591   },
592
593   {
594     'key'         => 'invoice_latexfooter',
595     'section'     => 'billing',
596     'description' => 'Footer for LaTeX typeset PostScript invoices.',
597     'type'        => 'textarea',
598   },
599
600   {
601     'key'         => 'invoice_latexreturnaddress',
602     'section'     => 'billing',
603     'description' => 'Return address for LaTeX typeset PostScript invoices.',
604     'type'        => 'textarea',
605   },
606
607   {
608     'key'         => 'invoice_latexsmallfooter',
609     'section'     => 'billing',
610     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
611     'type'        => 'textarea',
612   },
613
614   {
615     'key'         => 'invoice_email_pdf',
616     'section'     => 'billing',
617     '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.',
618     'type'        => 'checkbox'
619   },
620
621   {
622     'key'         => 'invoice_email_pdf_note',
623     'section'     => 'billing',
624     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
625     'type'        => 'textarea'
626   },
627
628
629   { 
630     'key'         => 'invoice_default_terms',
631     'section'     => 'billing',
632     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
633     'type'        => 'select',
634     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 30', 'Net 45', 'Net 60' ],
635   },
636
637   {
638     'key'         => 'payment_receipt_email',
639     'section'     => 'billing',
640     '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>',
641     'type'        => [qw( checkbox textarea )],
642   },
643
644   {
645     'key'         => 'lpr',
646     'section'     => 'required',
647     'description' => 'Print command for paper invoices, for example `lpr -h\'',
648     'type'        => 'text',
649   },
650
651   {
652     'key'         => 'lpr-postscript_prefix',
653     'section'     => 'billing',
654     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
655     'type'        => 'text',
656   },
657
658   {
659     'key'         => 'lpr-postscript_suffix',
660     'section'     => 'billing',
661     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
662     'type'        => 'text',
663   },
664
665   {
666     'key'         => 'money_char',
667     'section'     => '',
668     'description' => 'Currency symbol - defaults to `$\'',
669     'type'        => 'text',
670   },
671
672   {
673     'key'         => 'defaultrecords',
674     'section'     => 'BIND',
675     'description' => 'DNS entries to add automatically when creating a domain',
676     'type'        => 'editlist',
677     'editlist_parts' => [ { type=>'text' },
678                           { type=>'immutable', value=>'IN' },
679                           { type=>'select',
680                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
681                           { type=> 'text' }, ],
682   },
683
684   {
685     'key'         => 'passwordmin',
686     'section'     => 'password',
687     'description' => 'Minimum password length (default 6)',
688     'type'        => 'text',
689   },
690
691   {
692     'key'         => 'passwordmax',
693     'section'     => 'password',
694     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
695     'type'        => 'text',
696   },
697
698   {
699     'key' => 'password-noampersand',
700     'section' => 'password',
701     'description' => 'Disallow ampersands in passwords',
702     'type' => 'checkbox',
703   },
704
705   {
706     'key' => 'password-noexclamation',
707     'section' => 'password',
708     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
709     'type' => 'checkbox',
710   },
711
712   {
713     'key'         => 'referraldefault',
714     'section'     => 'UI',
715     'description' => 'Default referral, specified by refnum',
716     'type'        => 'text',
717   },
718
719 #  {
720 #    'key'         => 'registries',
721 #    'section'     => 'required',
722 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
723 #  },
724
725   {
726     'key'         => 'maxsearchrecordsperpage',
727     'section'     => 'UI',
728     'description' => 'If set, number of search records to return per page.',
729     'type'        => 'text',
730   },
731
732   {
733     'key'         => 'session-start',
734     'section'     => 'session',
735     '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.',
736     'type'        => 'text',
737   },
738
739   {
740     'key'         => 'session-stop',
741     'section'     => 'session',
742     '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.',
743     'type'        => 'text',
744   },
745
746   {
747     'key'         => 'shells',
748     'section'     => 'required',
749     '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.',
750     'type'        => 'textarea',
751   },
752
753   {
754     'key'         => 'showpasswords',
755     'section'     => 'UI',
756     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
757     'type'        => 'checkbox',
758   },
759
760   {
761     'key'         => 'signupurl',
762     'section'     => 'UI',
763     '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',
764     'type'        => 'text',
765   },
766
767   {
768     'key'         => 'smtpmachine',
769     'section'     => 'required',
770     'description' => 'SMTP relay for Freeside\'s outgoing mail',
771     'type'        => 'text',
772   },
773
774   {
775     'key'         => 'soadefaultttl',
776     'section'     => 'BIND',
777     'description' => 'SOA default TTL for new domains.',
778     'type'        => 'text',
779   },
780
781   {
782     'key'         => 'soaemail',
783     'section'     => 'BIND',
784     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
785     'type'        => 'text',
786   },
787
788   {
789     'key'         => 'soaexpire',
790     'section'     => 'BIND',
791     'description' => 'SOA expire for new domains',
792     'type'        => 'text',
793   },
794
795   {
796     'key'         => 'soamachine',
797     'section'     => 'BIND',
798     'description' => 'SOA machine for new domains, with trailing `.\'',
799     'type'        => 'text',
800   },
801
802   {
803     'key'         => 'soarefresh',
804     'section'     => 'BIND',
805     'description' => 'SOA refresh for new domains',
806     'type'        => 'text',
807   },
808
809   {
810     'key'         => 'soaretry',
811     'section'     => 'BIND',
812     'description' => 'SOA retry for new domains',
813     'type'        => 'text',
814   },
815
816   {
817     'key'         => 'statedefault',
818     'section'     => 'UI',
819     'description' => 'Default state or province (if not supplied, the default is `CA\')',
820     'type'        => 'text',
821   },
822
823   {
824     'key'         => 'unsuspendauto',
825     'section'     => 'billing',
826     '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',
827     'type'        => 'checkbox',
828   },
829
830   {
831     'key'         => 'unsuspend-always_adjust_next_bill_date',
832     'section'     => 'billing',
833     'description' => 'Global override that causes unsuspensions to always adjust the next bill date under any circumstances.  This is now controlled on a per-package bases - probably best not to use this option unless you are a legacy installation that requires this behaviour.',
834     'type'        => 'checkbox',
835   },
836
837   {
838     'key'         => 'usernamemin',
839     'section'     => 'username',
840     'description' => 'Minimum username length (default 2)',
841     'type'        => 'text',
842   },
843
844   {
845     'key'         => 'usernamemax',
846     'section'     => 'username',
847     'description' => 'Maximum username length',
848     'type'        => 'text',
849   },
850
851   {
852     'key'         => 'username-ampersand',
853     'section'     => 'username',
854     '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.',
855     'type'        => 'checkbox',
856   },
857
858   {
859     'key'         => 'username-letter',
860     'section'     => 'username',
861     'description' => 'Usernames must contain at least one letter',
862     'type'        => 'checkbox',
863   },
864
865   {
866     'key'         => 'username-letterfirst',
867     'section'     => 'username',
868     'description' => 'Usernames must start with a letter',
869     'type'        => 'checkbox',
870   },
871
872   {
873     'key'         => 'username-noperiod',
874     'section'     => 'username',
875     'description' => 'Disallow periods in usernames',
876     'type'        => 'checkbox',
877   },
878
879   {
880     'key'         => 'username-nounderscore',
881     'section'     => 'username',
882     'description' => 'Disallow underscores in usernames',
883     'type'        => 'checkbox',
884   },
885
886   {
887     'key'         => 'username-nodash',
888     'section'     => 'username',
889     'description' => 'Disallow dashes in usernames',
890     'type'        => 'checkbox',
891   },
892
893   {
894     'key'         => 'username-uppercase',
895     'section'     => 'username',
896     'description' => 'Allow uppercase characters in usernames',
897     'type'        => 'checkbox',
898   },
899
900   { 
901     'key'         => 'username-percent',
902     'section'     => 'username',
903     'description' => 'Allow the percent character (%) in usernames.',
904     'type'        => 'checkbox',
905   },
906
907   {
908     'key'         => 'safe-part_bill_event',
909     'section'     => 'UI',
910     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
911     'type'        => 'checkbox',
912   },
913
914   {
915     'key'         => 'show_ss',
916     'section'     => 'UI',
917     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
918     'type'        => 'checkbox',
919   },
920
921   {
922     'key'         => 'show_stateid',
923     'section'     => 'UI',
924     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
925     'type'        => 'checkbox',
926   },
927
928   {
929     'key'         => 'show_bankstate',
930     'section'     => 'UI',
931     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
932     'type'        => 'checkbox',
933   },
934
935   { 
936     'key'         => 'agent_defaultpkg',
937     'section'     => 'UI',
938     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
939     'type'        => 'checkbox',
940   },
941
942   {
943     'key'         => 'legacy_link',
944     'section'     => 'UI',
945     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
946     'type'        => 'checkbox',
947   },
948
949   {
950     'key'         => 'legacy_link-steal',
951     'section'     => 'UI',
952     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
953     'type'        => 'checkbox',
954   },
955
956   {
957     'key'         => 'queue_dangerous_controls',
958     'section'     => 'UI',
959     '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.',
960     'type'        => 'checkbox',
961   },
962
963   {
964     'key'         => 'security_phrase',
965     'section'     => 'password',
966     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
967     'type'        => 'checkbox',
968   },
969
970   {
971     'key'         => 'locale',
972     'section'     => 'UI',
973     'description' => 'Message locale',
974     'type'        => 'select',
975     'select_enum' => [ qw(en_US) ],
976   },
977
978   {
979     'key'         => 'signup_server-payby',
980     'section'     => '',
981     'description' => 'Acceptable payment types for the signup server',
982     'type'        => 'selectmultiple',
983     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
984   },
985
986   {
987     'key'         => 'signup_server-default_agentnum',
988     'section'     => '',
989     'description' => 'Default agent for the signup server',
990     'type'        => 'select-sub',
991     'options_sub' => sub { require FS::Record;
992                            require FS::agent;
993                            map { $_->agentnum => $_->agent }
994                                FS::Record::qsearch('agent', { disabled=>'' } );
995                          },
996     'option_sub'  => sub { require FS::Record;
997                            require FS::agent;
998                            my $agent = FS::Record::qsearchs(
999                              'agent', { 'agentnum'=>shift }
1000                            );
1001                            $agent ? $agent->agent : '';
1002                          },
1003   },
1004
1005   {
1006     'key'         => 'signup_server-default_refnum',
1007     'section'     => '',
1008     'description' => 'Default advertising source for the signup server',
1009     'type'        => 'select-sub',
1010     'options_sub' => sub { require FS::Record;
1011                            require FS::part_referral;
1012                            map { $_->refnum => $_->referral }
1013                                FS::Record::qsearch( 'part_referral', 
1014                                                     { 'disabled' => '' }
1015                                                   );
1016                          },
1017     'option_sub'  => sub { require FS::Record;
1018                            require FS::part_referral;
1019                            my $part_referral = FS::Record::qsearchs(
1020                              'part_referral', { 'refnum'=>shift } );
1021                            $part_referral ? $part_referral->referral : '';
1022                          },
1023   },
1024
1025   {
1026     'key'         => 'signup_server-default_pkgpart',
1027     'section'     => '',
1028     'description' => 'Default pakcage for the signup server',
1029     'type'        => 'select-sub',
1030     'options_sub' => sub { require FS::Record;
1031                            require FS::part_pkg;
1032                            map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1033                                FS::Record::qsearch( 'part_pkg',
1034                                                     { 'disabled' => ''}
1035                                                   );
1036                          },
1037     'option_sub'  => sub { require FS::Record;
1038                            require FS::part_pkg;
1039                            my $part_pkg = FS::Record::qsearchs(
1040                              'part_pkg', { 'pkgpart'=>shift }
1041                            );
1042                            $part_pkg
1043                              ? $part_pkg->pkg.' - '.$part_pkg->comment
1044                              : '';
1045                          },
1046   },
1047
1048   {
1049     'key'         => 'show-msgcat-codes',
1050     'section'     => 'UI',
1051     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1052     'type'        => 'checkbox',
1053   },
1054
1055   {
1056     'key'         => 'signup_server-realtime',
1057     'section'     => '',
1058     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1059     'type'        => 'checkbox',
1060   },
1061   {
1062     'key'         => 'signup_server-classnum2',
1063     'section'     => '',
1064     'description' => 'Package Class for first optional purchase',
1065     'type'        => 'select-sub',
1066     'options_sub' => sub { require FS::Record;
1067                            require FS::pkg_class;
1068                            map { $_->classnum => $_->classname }
1069                                FS::Record::qsearch('pkg_class', {} );
1070                          },
1071     'option_sub'  => sub { require FS::Record;
1072                            require FS::pkg_class;
1073                            my $pkg_class = FS::Record::qsearchs(
1074                              'pkg_class', { 'classnum'=>shift }
1075                            );
1076                            $pkg_class ? $pkg_class->classname : '';
1077                          },
1078   },
1079
1080   {
1081     'key'         => 'signup_server-classnum3',
1082     'section'     => '',
1083     'description' => 'Package Class for second optional purchase',
1084     'type'        => 'select-sub',
1085     'options_sub' => sub { require FS::Record;
1086                            require FS::pkg_class;
1087                            map { $_->classnum => $_->classname }
1088                                FS::Record::qsearch('pkg_class', {} );
1089                          },
1090     'option_sub'  => sub { require FS::Record;
1091                            require FS::pkg_class;
1092                            my $pkg_class = FS::Record::qsearchs(
1093                              'pkg_class', { 'classnum'=>shift }
1094                            );
1095                            $pkg_class ? $pkg_class->classname : '';
1096                          },
1097   },
1098
1099   {
1100     'key'         => 'backend-realtime',
1101     'section'     => '',
1102     'description' => 'Run billing for backend signups immediately.',
1103     'type'        => 'checkbox',
1104   },
1105
1106   {
1107     'key'         => 'declinetemplate',
1108     'section'     => 'billing',
1109     'description' => 'Template file for credit card decline emails.',
1110     'type'        => 'textarea',
1111   },
1112
1113   {
1114     'key'         => 'emaildecline',
1115     'section'     => 'billing',
1116     'description' => 'Enable emailing of credit card decline notices.',
1117     'type'        => 'checkbox',
1118   },
1119
1120   {
1121     'key'         => 'emaildecline-exclude',
1122     'section'     => 'billing',
1123     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1124     'type'        => 'textarea',
1125   },
1126
1127   {
1128     'key'         => 'cancelmessage',
1129     'section'     => 'billing',
1130     'description' => 'Template file for cancellation emails.',
1131     'type'        => 'textarea',
1132   },
1133
1134   {
1135     'key'         => 'cancelsubject',
1136     'section'     => 'billing',
1137     'description' => 'Subject line for cancellation emails.',
1138     'type'        => 'text',
1139   },
1140
1141   {
1142     'key'         => 'emailcancel',
1143     'section'     => 'billing',
1144     'description' => 'Enable emailing of cancellation notices.',
1145     'type'        => 'checkbox',
1146   },
1147
1148   {
1149     'key'         => 'require_cardname',
1150     'section'     => 'billing',
1151     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1152     'type'        => 'checkbox',
1153   },
1154
1155   {
1156     'key'         => 'enable_taxclasses',
1157     'section'     => 'billing',
1158     'description' => 'Enable per-package tax classes',
1159     'type'        => 'checkbox',
1160   },
1161
1162   {
1163     'key'         => 'require_taxclasses',
1164     'section'     => 'billing',
1165     'description' => 'Require a taxclass to be entered for every package',
1166     'type'        => 'checkbox',
1167   },
1168
1169   {
1170     'key'         => 'welcome_email',
1171     'section'     => '',
1172     '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>',
1173     'type'        => 'textarea',
1174   },
1175
1176   {
1177     'key'         => 'welcome_email-from',
1178     'section'     => '',
1179     'description' => 'From: address header for welcome email',
1180     'type'        => 'text',
1181   },
1182
1183   {
1184     'key'         => 'welcome_email-subject',
1185     'section'     => '',
1186     'description' => 'Subject: header for welcome email',
1187     'type'        => 'text',
1188   },
1189   
1190   {
1191     'key'         => 'welcome_email-mimetype',
1192     'section'     => '',
1193     'description' => 'MIME type for welcome email',
1194     'type'        => 'select',
1195     'select_enum' => [ 'text/plain', 'text/html' ],
1196   },
1197
1198   {
1199     'key'         => 'warning_email',
1200     'section'     => '',
1201     'description' => 'Template file for warning email.  Warning emails are sent to the customer email invoice destination(s) each time a svc_acct record has its usage drop below a threshold or 0.  See the <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code> <li><code>$column</code> <li><code>$amount</code> <li><code>$threshold</code></ul>',
1202     'type'        => 'textarea',
1203   },
1204
1205   {
1206     'key'         => 'warning_email-from',
1207     'section'     => '',
1208     'description' => 'From: address header for warning email',
1209     'type'        => 'text',
1210   },
1211
1212   {
1213     'key'         => 'warning_email-cc',
1214     'section'     => '',
1215     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1216     'type'        => 'text',
1217   },
1218
1219   {
1220     'key'         => 'warning_email-subject',
1221     'section'     => '',
1222     'description' => 'Subject: header for warning email',
1223     'type'        => 'text',
1224   },
1225   
1226   {
1227     'key'         => 'warning_email-mimetype',
1228     'section'     => '',
1229     'description' => 'MIME type for warning email',
1230     'type'        => 'select',
1231     'select_enum' => [ 'text/plain', 'text/html' ],
1232   },
1233
1234   {
1235     'key'         => 'payby',
1236     'section'     => 'billing',
1237     'description' => 'Available payment types.',
1238     'type'        => 'selectmultiple',
1239     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1240   },
1241
1242   {
1243     'key'         => 'payby-default',
1244     'section'     => 'UI',
1245     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1246     'type'        => 'select',
1247     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1248   },
1249
1250   {
1251     'key'         => 'paymentforcedtobatch',
1252     'section'     => 'UI',
1253     'description' => 'Causes per customer payment entry to be forced to a batch processor rather than performed realtime.',
1254     'type'        => 'checkbox',
1255   },
1256
1257   {
1258     'key'         => 'svc_acct-notes',
1259     'section'     => 'UI',
1260     'description' => 'Extra HTML to be displayed on the Account View screen.',
1261     'type'        => 'textarea',
1262   },
1263
1264   {
1265     'key'         => 'radius-password',
1266     'section'     => '',
1267     'description' => 'RADIUS attribute for plain-text passwords.',
1268     'type'        => 'select',
1269     'select_enum' => [ 'Password', 'User-Password' ],
1270   },
1271
1272   {
1273     'key'         => 'radius-ip',
1274     'section'     => '',
1275     'description' => 'RADIUS attribute for IP addresses.',
1276     'type'        => 'select',
1277     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1278   },
1279
1280   {
1281     'key'         => 'svc_acct-alldomains',
1282     'section'     => '',
1283     '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.',
1284     'type'        => 'checkbox',
1285   },
1286
1287   {
1288     'key'         => 'dump-scpdest',
1289     'section'     => '',
1290     'description' => 'destination for scp database dumps: user@host:/path',
1291     'type'        => 'text',
1292   },
1293
1294   {
1295     'key'         => 'dump-pgpid',
1296     'section'     => '',
1297     '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.",
1298     'type'        => 'text',
1299   },
1300
1301   {
1302     'key'         => 'cvv-save',
1303     'section'     => 'billing',
1304     '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.',
1305     'type'        => 'selectmultiple',
1306     'select_enum' => \@card_types,
1307   },
1308
1309   {
1310     'key'         => 'allow_negative_charges',
1311     'section'     => 'billing',
1312     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1313     'type'        => 'checkbox',
1314   },
1315   {
1316       'key'         => 'auto_unset_catchall',
1317       'section'     => '',
1318       '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.',
1319       'type'        => 'checkbox',
1320   },
1321
1322   {
1323     'key'         => 'system_usernames',
1324     'section'     => 'username',
1325     '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.',
1326     'type'        => 'textarea',
1327   },
1328
1329   {
1330     'key'         => 'cust_pkg-change_svcpart',
1331     'section'     => '',
1332     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1333     'type'        => 'checkbox',
1334   },
1335
1336   {
1337     'key'         => 'disable_autoreverse',
1338     'section'     => 'BIND',
1339     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1340     'type'        => 'checkbox',
1341   },
1342
1343   {
1344     'key'         => 'svc_www-enable_subdomains',
1345     'section'     => '',
1346     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1347     'type'        => 'checkbox',
1348   },
1349
1350   {
1351     'key'         => 'svc_www-usersvc_svcpart',
1352     'section'     => '',
1353     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1354     'type'        => 'textarea',
1355   },
1356
1357   {
1358     'key'         => 'selfservice_server-primary_only',
1359     'section'     => '',
1360     'description' => 'Only allow primary accounts to access self-service functionality.',
1361     'type'        => 'checkbox',
1362   },
1363
1364   {
1365     'key'         => 'card_refund-days',
1366     'section'     => 'billing',
1367     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1368     'type'        => 'text',
1369   },
1370
1371   {
1372     'key'         => 'agent-showpasswords',
1373     'section'     => '',
1374     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1375     'type'        => 'checkbox',
1376   },
1377
1378   {
1379     'key'         => 'global_unique-username',
1380     'section'     => 'username',
1381     '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.',
1382     'type'        => 'select',
1383     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1384   },
1385
1386   {
1387     'key'         => 'svc_external-skip_manual',
1388     'section'     => 'UI',
1389     '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).',
1390     'type'        => 'checkbox',
1391   },
1392
1393   {
1394     'key'         => 'svc_external-display_type',
1395     'section'     => 'UI',
1396     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1397     'type'        => 'select',
1398     'select_enum' => [ 'generic', 'artera_turbo', ],
1399   },
1400
1401   {
1402     'key'         => 'ticket_system',
1403     'section'     => '',
1404     '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).',
1405     'type'        => 'select',
1406     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1407     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1408   },
1409
1410   {
1411     'key'         => 'ticket_system-default_queueid',
1412     'section'     => '',
1413     'description' => 'Default queue used when creating new customer tickets.',
1414     'type'        => 'select-sub',
1415     'options_sub' => sub {
1416                            my $conf = new FS::Conf;
1417                            if ( $conf->config('ticket_system') ) {
1418                              eval "use FS::TicketSystem;";
1419                              die $@ if $@;
1420                              FS::TicketSystem->queues();
1421                            } else {
1422                              ();
1423                            }
1424                          },
1425     'option_sub'  => sub { 
1426                            my $conf = new FS::Conf;
1427                            if ( $conf->config('ticket_system') ) {
1428                              eval "use FS::TicketSystem;";
1429                              die $@ if $@;
1430                              FS::TicketSystem->queue(shift);
1431                            } else {
1432                              '';
1433                            }
1434                          },
1435   },
1436
1437   {
1438     'key'         => 'ticket_system-custom_priority_field',
1439     'section'     => '',
1440     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1441     'type'        => 'text',
1442   },
1443
1444   {
1445     'key'         => 'ticket_system-custom_priority_field-values',
1446     'section'     => '',
1447     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1448     'type'        => 'textarea',
1449   },
1450
1451   {
1452     'key'         => 'ticket_system-custom_priority_field_queue',
1453     'section'     => '',
1454     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1455     'type'        => 'text',
1456   },
1457
1458   {
1459     'key'         => 'ticket_system-rt_external_datasrc',
1460     'section'     => '',
1461     '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>',
1462     'type'        => 'text',
1463
1464   },
1465
1466   {
1467     'key'         => 'ticket_system-rt_external_url',
1468     'section'     => '',
1469     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1470     'type'        => 'text',
1471   },
1472
1473   {
1474     'key'         => 'company_name',
1475     'section'     => 'required',
1476     'description' => 'Your company name',
1477     'type'        => 'text',
1478   },
1479
1480   {
1481     'key'         => 'address2-search',
1482     'section'     => 'UI',
1483     'description' => 'Enable a "Unit" search box which searches the second address field',
1484     'type'        => 'checkbox',
1485   },
1486
1487   { 'key'         => 'referral_credit',
1488     'section'     => 'billing',
1489     'description' => "Enables one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency).",
1490     'type'        => 'checkbox',
1491   },
1492
1493   { 'key'         => 'selfservice_server-cache_module',
1494     'section'     => '',
1495     '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.',
1496     'type'        => 'select',
1497     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1498   },
1499
1500   {
1501     'key'         => 'hylafax',
1502     'section'     => '',
1503     '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).',
1504     'type'        => [qw( checkbox textarea )],
1505   },
1506
1507   {
1508     'key'         => 'svc_acct-usage_suspend',
1509     'section'     => 'billing',
1510     'description' => 'Suspends the package an account belongs to when svc_acct.seconds or a bytecount is decremented to 0 or below (accounts with an empty seconds and up|down|totalbytes value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1511     'type'        => 'checkbox',
1512   },
1513
1514   {
1515     'key'         => 'svc_acct-usage_unsuspend',
1516     'section'     => 'billing',
1517     'description' => 'Unuspends the package an account belongs to when svc_acct.seconds or a bytecount is incremented from 0 or below to a positive value (accounts with an empty seconds and up|down|totalbytes value are ignored).  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1518     'type'        => 'checkbox',
1519   },
1520
1521   {
1522     'key'         => 'svc_acct-usage_threshold',
1523     'section'     => 'billing',
1524     'description' => 'The threshold (expressed as percentage) of acct.seconds or acct.up|down|totalbytes at which a warning message is sent to a service holder.  Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.  Defaults to 80.',
1525     'type'        => 'text',
1526   },
1527
1528   {
1529     'key'         => 'cust-fields',
1530     'section'     => 'UI',
1531     'description' => 'Which customer fields to display on reports by default',
1532     'type'        => 'select',
1533     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
1534   },
1535
1536   {
1537     'key'         => 'cust_pkg-display_times',
1538     'section'     => 'UI',
1539     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
1540     'type'        => 'checkbox',
1541   },
1542
1543   {
1544     'key'         => 'svc_acct-edit_uid',
1545     'section'     => 'shell',
1546     'description' => 'Allow UID editing.',
1547     'type'        => 'checkbox',
1548   },
1549
1550   {
1551     'key'         => 'svc_acct-edit_gid',
1552     'section'     => 'shell',
1553     'description' => 'Allow GID editing.',
1554     'type'        => 'checkbox',
1555   },
1556
1557   {
1558     'key'         => 'zone-underscore',
1559     'section'     => 'BIND',
1560     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
1561     'type'        => 'checkbox',
1562   },
1563
1564   {
1565     'key'         => 'echeck-nonus',
1566     'section'     => 'billing',
1567     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
1568     'type'        => 'checkbox',
1569   },
1570
1571   {
1572     'key'         => 'voip-cust_cdr_spools',
1573     'section'     => '',
1574     'description' => 'Enable the per-customer option for individual CDR spools.',
1575     'type'        => 'checkbox',
1576   },
1577
1578   {
1579     'key'         => 'svc_forward-arbitrary_dst',
1580     'section'     => '',
1581     '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.",
1582     'type'        => 'checkbox',
1583   },
1584
1585   {
1586     'key'         => 'tax-ship_address',
1587     'section'     => 'billing',
1588     '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.',
1589     'type'        => 'checkbox',
1590   },
1591
1592   {
1593     'key'         => 'batch-enable',
1594     'section'     => 'billing',
1595     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
1596     'type'        => 'checkbox',
1597   },
1598
1599   {
1600     'key'         => 'batch-default_format',
1601     'section'     => 'billing',
1602     'description' => 'Default format for batches.',
1603     'type'        => 'select',
1604     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
1605                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
1606                        'ach-spiritone',
1607                     ]
1608   },
1609
1610   {
1611     'key'         => 'batch-fixed_format-CARD',
1612     'section'     => 'billing',
1613     'description' => 'Fixed (unchangeable) format for credit card batches.',
1614     'type'        => 'select',
1615     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
1616                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
1617   },
1618
1619   {
1620     'key'         => 'batch-fixed_format-CHEK',
1621     'section'     => 'billing',
1622     'description' => 'Fixed (unchangeable) format for electronic check batches.',
1623     'type'        => 'select',
1624     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
1625                        'ach-spiritone',
1626                      ]
1627   },
1628
1629   {
1630     'key'         => 'batch-increment_expiration',
1631     'section'     => 'billing',
1632     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
1633     'type'        => 'checkbox'
1634   },
1635
1636   {
1637     'key'         => 'batchconfig-BoM',
1638     'section'     => 'billing',
1639     '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',
1640     'type'        => 'textarea',
1641   },
1642
1643   {
1644     'key'         => 'batchconfig-PAP',
1645     'section'     => 'billing',
1646     'description' => 'Configuration for PAP batching, seven lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Long name, 6. Bank, 7. Bank account',
1647     'type'        => 'textarea',
1648   },
1649
1650   {
1651     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
1652     'section'     => 'billing',
1653     'description' => 'Gateway ID for Chase Canada E-xact batching',
1654     'type'        => 'text',
1655   },
1656
1657   {
1658     'key'         => 'payment_history-years',
1659     'section'     => 'UI',
1660     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
1661     'type'        => 'text',
1662   },
1663
1664   {
1665     'key'         => 'cust_main-use_comments',
1666     'section'     => 'UI',
1667     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
1668     'type'        => 'checkbox',
1669   },
1670
1671   {
1672     'key'         => 'cust_main-disable_notes',
1673     'section'     => 'UI',
1674     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
1675     'type'        => 'checkbox',
1676   },
1677
1678   {
1679     'key'         => 'cust_main_note-display_times',
1680     'section'     => 'UI',
1681     'description' => 'Display full timestamps (not just dates) for customer notes.',
1682     'type'        => 'checkbox',
1683   },
1684
1685   {
1686     'key'         => 'cust_main-ticket_statuses',
1687     'section'     => 'UI',
1688     'description' => 'Show tickets with these statuses on the customer view page.',
1689     'type'        => 'selectmultiple',
1690     'select_enum' => [qw( new open stalled resolved rejected deleted )],
1691   },
1692
1693   {
1694     'key'         => 'cust_main-max_tickets',
1695     'section'     => 'UI',
1696     'description' => 'Maximum number of tickets to show on the customer view page.',
1697     'type'        => 'text',
1698   },
1699
1700   {
1701     'key'         => 'cust_main-skeleton_tables',
1702     'section'     => '',
1703     '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.',
1704     'type'        => 'textarea',
1705   },
1706
1707   {
1708     'key'         => 'cust_main-skeleton_custnum',
1709     'section'     => '',
1710     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
1711     'type'        => 'text',
1712   },
1713
1714   {
1715     'key'         => 'cust_main-enable_birthdate',
1716     'section'     => 'UI',
1717     'descritpion' => 'Enable tracking of a birth date with each customer record',
1718     'type'        => 'checkbox',
1719   },
1720
1721   {
1722     'key'         => 'support-key',
1723     'section'     => '',
1724     'description' => 'A support key enables access to commercial services delivered over the network, such as the payroll module, access to the internal ticket system, priority support and optional backups.',
1725     'type'        => 'text',
1726   },
1727
1728   {
1729     'key'         => 'card-types',
1730     'section'     => 'billing',
1731     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
1732     'type'        => 'selectmultiple',
1733     'select_enum' => \@card_types,
1734   },
1735
1736   {
1737     'key'         => 'dashboard-toplist',
1738     'section'     => 'UI',
1739     'description' => 'List of items to display on the top of the front page',
1740     'type'        => 'textarea',
1741   },
1742
1743   {
1744     'key'         => 'impending_recur_template',
1745     'section'     => 'billing',
1746     'description' => 'Template file for alerts about looming first time recurrant billing.  See the <a href="http://search.cpan.org/~mjd/Text-Template.pm">Text::Template</a> documentation for details on the template substitition language.  Also see packages with a <a href="../browse/part_pkg.cgi">flat price plan</a>  The following variables are available<ul><li><code>$packages</code> allowing <code>$packages->[0]</code> thru <code>$packages->[n]</code> <li><code>$package</code> the first package, same as <code>$packages->[0]</code> <li><code>$recurdates</code> allowing <code>$recurdates->[0]</code> thru <code>$recurdates->[n]</code> <li><code>$recurdate</code> the first recurdate, same as <code>$recurdate->[0]</code> <li><code>$first</code> <li><code>$last</code></ul>',
1747 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
1748     'type'        => 'textarea',
1749   },
1750
1751   {
1752     'key'         => 'logo.png',
1753     'section'     => 'billing',  #? 
1754     'description' => 'An image to include in some types of invoices',
1755     'type'        => 'binary',
1756   },
1757
1758   {
1759     'key'         => 'logo.eps',
1760     'section'     => 'billing',  #? 
1761     'description' => 'An image to include in some types of invoices',
1762     'type'        => 'binary',
1763   },
1764
1765   {
1766     'key'         => 'selfservice-ignore_quantity',
1767     'section'     => '',
1768     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
1769     'type'        => 'checkbox',
1770   },
1771
1772   {
1773     'key'         => 'disable_setup_suspended_pkgs',
1774     'section'     => 'billing',
1775     'description' => 'Disables charging of setup fees for suspended packages.',
1776     'type'       => 'checkbox',
1777   },
1778
1779   {
1780     'key' => 'password-generated-allcaps',
1781     'section' => 'password',
1782     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
1783     'type' => 'checkbox',
1784   },
1785
1786   {
1787     'key'         => 'datavolume-forcemegabytes',
1788     'section'     => 'UI',
1789     'description' => 'All data volumes are expressed in megabytes',
1790     'type'        => 'checkbox',
1791   },
1792
1793   {
1794     'key'         => 'datavolume-significantdigits',
1795     'section'     => 'UI',
1796     'description' => 'number of significant digits to use to represent data volumes',
1797     'type'        => 'text',
1798   },
1799
1800 );
1801
1802 1;
1803