remove a ton of deprecated config options
[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'         => 'money_char',
653     'section'     => '',
654     'description' => 'Currency symbol - defaults to `$\'',
655     'type'        => 'text',
656   },
657
658   {
659     'key'         => 'defaultrecords',
660     'section'     => 'BIND',
661     'description' => 'DNS entries to add automatically when creating a domain',
662     'type'        => 'editlist',
663     'editlist_parts' => [ { type=>'text' },
664                           { type=>'immutable', value=>'IN' },
665                           { type=>'select',
666                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
667                           { type=> 'text' }, ],
668   },
669
670   {
671     'key'         => 'passwordmin',
672     'section'     => 'password',
673     'description' => 'Minimum password length (default 6)',
674     'type'        => 'text',
675   },
676
677   {
678     'key'         => 'passwordmax',
679     'section'     => 'password',
680     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
681     'type'        => 'text',
682   },
683
684   {
685     'key' => 'password-noampersand',
686     'section' => 'password',
687     'description' => 'Disallow ampersands in passwords',
688     'type' => 'checkbox',
689   },
690
691   {
692     'key' => 'password-noexclamation',
693     'section' => 'password',
694     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
695     'type' => 'checkbox',
696   },
697
698   {
699     'key'         => 'referraldefault',
700     'section'     => 'UI',
701     'description' => 'Default referral, specified by refnum',
702     'type'        => 'text',
703   },
704
705 #  {
706 #    'key'         => 'registries',
707 #    'section'     => 'required',
708 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
709 #  },
710
711   {
712     'key'         => 'maxsearchrecordsperpage',
713     'section'     => 'UI',
714     'description' => 'If set, number of search records to return per page.',
715     'type'        => 'text',
716   },
717
718   {
719     'key'         => 'session-start',
720     'section'     => 'session',
721     '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.',
722     'type'        => 'text',
723   },
724
725   {
726     'key'         => 'session-stop',
727     'section'     => 'session',
728     '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.',
729     'type'        => 'text',
730   },
731
732   {
733     'key'         => 'shells',
734     'section'     => 'required',
735     '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.',
736     'type'        => 'textarea',
737   },
738
739   {
740     'key'         => 'showpasswords',
741     'section'     => 'UI',
742     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
743     'type'        => 'checkbox',
744   },
745
746   {
747     'key'         => 'signupurl',
748     'section'     => 'UI',
749     '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',
750     'type'        => 'text',
751   },
752
753   {
754     'key'         => 'smtpmachine',
755     'section'     => 'required',
756     'description' => 'SMTP relay for Freeside\'s outgoing mail',
757     'type'        => 'text',
758   },
759
760   {
761     'key'         => 'soadefaultttl',
762     'section'     => 'BIND',
763     'description' => 'SOA default TTL for new domains.',
764     'type'        => 'text',
765   },
766
767   {
768     'key'         => 'soaemail',
769     'section'     => 'BIND',
770     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
771     'type'        => 'text',
772   },
773
774   {
775     'key'         => 'soaexpire',
776     'section'     => 'BIND',
777     'description' => 'SOA expire for new domains',
778     'type'        => 'text',
779   },
780
781   {
782     'key'         => 'soamachine',
783     'section'     => 'BIND',
784     'description' => 'SOA machine for new domains, with trailing `.\'',
785     'type'        => 'text',
786   },
787
788   {
789     'key'         => 'soarefresh',
790     'section'     => 'BIND',
791     'description' => 'SOA refresh for new domains',
792     'type'        => 'text',
793   },
794
795   {
796     'key'         => 'soaretry',
797     'section'     => 'BIND',
798     'description' => 'SOA retry for new domains',
799     'type'        => 'text',
800   },
801
802   {
803     'key'         => 'statedefault',
804     'section'     => 'UI',
805     'description' => 'Default state or province (if not supplied, the default is `CA\')',
806     'type'        => 'text',
807   },
808
809   {
810     'key'         => 'unsuspendauto',
811     'section'     => 'billing',
812     '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',
813     'type'        => 'checkbox',
814   },
815
816   {
817     'key'         => 'unsuspend-always_adjust_next_bill_date',
818     'section'     => 'billing',
819     '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.',
820     'type'        => 'checkbox',
821   },
822
823   {
824     'key'         => 'usernamemin',
825     'section'     => 'username',
826     'description' => 'Minimum username length (default 2)',
827     'type'        => 'text',
828   },
829
830   {
831     'key'         => 'usernamemax',
832     'section'     => 'username',
833     'description' => 'Maximum username length',
834     'type'        => 'text',
835   },
836
837   {
838     'key'         => 'username-ampersand',
839     'section'     => 'username',
840     '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.',
841     'type'        => 'checkbox',
842   },
843
844   {
845     'key'         => 'username-letter',
846     'section'     => 'username',
847     'description' => 'Usernames must contain at least one letter',
848     'type'        => 'checkbox',
849   },
850
851   {
852     'key'         => 'username-letterfirst',
853     'section'     => 'username',
854     'description' => 'Usernames must start with a letter',
855     'type'        => 'checkbox',
856   },
857
858   {
859     'key'         => 'username-noperiod',
860     'section'     => 'username',
861     'description' => 'Disallow periods in usernames',
862     'type'        => 'checkbox',
863   },
864
865   {
866     'key'         => 'username-nounderscore',
867     'section'     => 'username',
868     'description' => 'Disallow underscores in usernames',
869     'type'        => 'checkbox',
870   },
871
872   {
873     'key'         => 'username-nodash',
874     'section'     => 'username',
875     'description' => 'Disallow dashes in usernames',
876     'type'        => 'checkbox',
877   },
878
879   {
880     'key'         => 'username-uppercase',
881     'section'     => 'username',
882     'description' => 'Allow uppercase characters in usernames',
883     'type'        => 'checkbox',
884   },
885
886   { 
887     'key'         => 'username-percent',
888     'section'     => 'username',
889     'description' => 'Allow the percent character (%) in usernames.',
890     'type'        => 'checkbox',
891   },
892
893   {
894     'key'         => 'safe-part_bill_event',
895     'section'     => 'UI',
896     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
897     'type'        => 'checkbox',
898   },
899
900   {
901     'key'         => 'show_ss',
902     'section'     => 'UI',
903     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
904     'type'        => 'checkbox',
905   },
906
907   {
908     'key'         => 'show_stateid',
909     'section'     => 'UI',
910     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
911     'type'        => 'checkbox',
912   },
913
914   { 
915     'key'         => 'agent_defaultpkg',
916     'section'     => 'UI',
917     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
918     'type'        => 'checkbox',
919   },
920
921   {
922     'key'         => 'legacy_link',
923     'section'     => 'UI',
924     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
925     'type'        => 'checkbox',
926   },
927
928   {
929     'key'         => 'legacy_link-steal',
930     'section'     => 'UI',
931     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
932     'type'        => 'checkbox',
933   },
934
935   {
936     'key'         => 'queue_dangerous_controls',
937     'section'     => 'UI',
938     '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.',
939     'type'        => 'checkbox',
940   },
941
942   {
943     'key'         => 'security_phrase',
944     'section'     => 'password',
945     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
946     'type'        => 'checkbox',
947   },
948
949   {
950     'key'         => 'locale',
951     'section'     => 'UI',
952     'description' => 'Message locale',
953     'type'        => 'select',
954     'select_enum' => [ qw(en_US) ],
955   },
956
957   {
958     'key'         => 'signup_server-payby',
959     'section'     => '',
960     'description' => 'Acceptable payment types for the signup server',
961     'type'        => 'selectmultiple',
962     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
963   },
964
965   {
966     'key'         => 'signup_server-default_agentnum',
967     'section'     => '',
968     'description' => 'Default agent for the signup server',
969     'type'        => 'select-sub',
970     'options_sub' => sub { require FS::Record;
971                            require FS::agent;
972                            map { $_->agentnum => $_->agent }
973                                FS::Record::qsearch('agent', { disabled=>'' } );
974                          },
975     'option_sub'  => sub { require FS::Record;
976                            require FS::agent;
977                            my $agent = FS::Record::qsearchs(
978                              'agent', { 'agentnum'=>shift }
979                            );
980                            $agent ? $agent->agent : '';
981                          },
982   },
983
984   {
985     'key'         => 'signup_server-default_refnum',
986     'section'     => '',
987     'description' => 'Default advertising source for the signup server',
988     'type'        => 'select-sub',
989     'options_sub' => sub { require FS::Record;
990                            require FS::part_referral;
991                            map { $_->refnum => $_->referral }
992                                FS::Record::qsearch( 'part_referral', 
993                                                     { 'disabled' => '' }
994                                                   );
995                          },
996     'option_sub'  => sub { require FS::Record;
997                            require FS::part_referral;
998                            my $part_referral = FS::Record::qsearchs(
999                              'part_referral', { 'refnum'=>shift } );
1000                            $part_referral ? $part_referral->referral : '';
1001                          },
1002   },
1003
1004   {
1005     'key'         => 'signup_server-default_pkgpart',
1006     'section'     => '',
1007     'description' => 'Default pakcage for the signup server',
1008     'type'        => 'select-sub',
1009     'options_sub' => sub { require FS::Record;
1010                            require FS::part_pkg;
1011                            map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1012                                FS::Record::qsearch( 'part_pkg',
1013                                                     { 'disabled' => ''}
1014                                                   );
1015                          },
1016     'option_sub'  => sub { require FS::Record;
1017                            require FS::part_pkg;
1018                            my $part_pkg = FS::Record::qsearchs(
1019                              'part_pkg', { 'pkgpart'=>shift }
1020                            );
1021                            $part_pkg
1022                              ? $part_pkg->pkg.' - '.$part_pkg->comment
1023                              : '';
1024                          },
1025   },
1026
1027   {
1028     'key'         => 'show-msgcat-codes',
1029     'section'     => 'UI',
1030     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1031     'type'        => 'checkbox',
1032   },
1033
1034   {
1035     'key'         => 'signup_server-realtime',
1036     'section'     => '',
1037     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1038     'type'        => 'checkbox',
1039   },
1040   {
1041     'key'         => 'signup_server-classnum2',
1042     'section'     => '',
1043     'description' => 'Package Class for first optional purchase',
1044     'type'        => 'select-sub',
1045     'options_sub' => sub { require FS::Record;
1046                            require FS::pkg_class;
1047                            map { $_->classnum => $_->classname }
1048                                FS::Record::qsearch('pkg_class', {} );
1049                          },
1050     'option_sub'  => sub { require FS::Record;
1051                            require FS::pkg_class;
1052                            my $pkg_class = FS::Record::qsearchs(
1053                              'pkg_class', { 'classnum'=>shift }
1054                            );
1055                            $pkg_class ? $pkg_class->classname : '';
1056                          },
1057   },
1058
1059   {
1060     'key'         => 'signup_server-classnum3',
1061     'section'     => '',
1062     'description' => 'Package Class for second optional purchase',
1063     'type'        => 'select-sub',
1064     'options_sub' => sub { require FS::Record;
1065                            require FS::pkg_class;
1066                            map { $_->classnum => $_->classname }
1067                                FS::Record::qsearch('pkg_class', {} );
1068                          },
1069     'option_sub'  => sub { require FS::Record;
1070                            require FS::pkg_class;
1071                            my $pkg_class = FS::Record::qsearchs(
1072                              'pkg_class', { 'classnum'=>shift }
1073                            );
1074                            $pkg_class ? $pkg_class->classname : '';
1075                          },
1076   },
1077
1078   {
1079     'key'         => 'backend-realtime',
1080     'section'     => '',
1081     'description' => 'Run billing for backend signups immediately.',
1082     'type'        => 'checkbox',
1083   },
1084
1085   {
1086     'key'         => 'declinetemplate',
1087     'section'     => 'billing',
1088     'description' => 'Template file for credit card decline emails.',
1089     'type'        => 'textarea',
1090   },
1091
1092   {
1093     'key'         => 'emaildecline',
1094     'section'     => 'billing',
1095     'description' => 'Enable emailing of credit card decline notices.',
1096     'type'        => 'checkbox',
1097   },
1098
1099   {
1100     'key'         => 'emaildecline-exclude',
1101     'section'     => 'billing',
1102     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1103     'type'        => 'textarea',
1104   },
1105
1106   {
1107     'key'         => 'cancelmessage',
1108     'section'     => 'billing',
1109     'description' => 'Template file for cancellation emails.',
1110     'type'        => 'textarea',
1111   },
1112
1113   {
1114     'key'         => 'cancelsubject',
1115     'section'     => 'billing',
1116     'description' => 'Subject line for cancellation emails.',
1117     'type'        => 'text',
1118   },
1119
1120   {
1121     'key'         => 'emailcancel',
1122     'section'     => 'billing',
1123     'description' => 'Enable emailing of cancellation notices.',
1124     'type'        => 'checkbox',
1125   },
1126
1127   {
1128     'key'         => 'require_cardname',
1129     'section'     => 'billing',
1130     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1131     'type'        => 'checkbox',
1132   },
1133
1134   {
1135     'key'         => 'enable_taxclasses',
1136     'section'     => 'billing',
1137     'description' => 'Enable per-package tax classes',
1138     'type'        => 'checkbox',
1139   },
1140
1141   {
1142     'key'         => 'require_taxclasses',
1143     'section'     => 'billing',
1144     'description' => 'Require a taxclass to be entered for every package',
1145     'type'        => 'checkbox',
1146   },
1147
1148   {
1149     'key'         => 'welcome_email',
1150     'section'     => '',
1151     '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>',
1152     'type'        => 'textarea',
1153   },
1154
1155   {
1156     'key'         => 'welcome_email-from',
1157     'section'     => '',
1158     'description' => 'From: address header for welcome email',
1159     'type'        => 'text',
1160   },
1161
1162   {
1163     'key'         => 'welcome_email-subject',
1164     'section'     => '',
1165     'description' => 'Subject: header for welcome email',
1166     'type'        => 'text',
1167   },
1168   
1169   {
1170     'key'         => 'welcome_email-mimetype',
1171     'section'     => '',
1172     'description' => 'MIME type for welcome email',
1173     'type'        => 'select',
1174     'select_enum' => [ 'text/plain', 'text/html' ],
1175   },
1176
1177   {
1178     'key'         => 'warning_email',
1179     'section'     => '',
1180     '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>',
1181     'type'        => 'textarea',
1182   },
1183
1184   {
1185     'key'         => 'warning_email-from',
1186     'section'     => '',
1187     'description' => 'From: address header for warning email',
1188     'type'        => 'text',
1189   },
1190
1191   {
1192     'key'         => 'warning_email-cc',
1193     'section'     => '',
1194     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1195     'type'        => 'text',
1196   },
1197
1198   {
1199     'key'         => 'warning_email-subject',
1200     'section'     => '',
1201     'description' => 'Subject: header for warning email',
1202     'type'        => 'text',
1203   },
1204   
1205   {
1206     'key'         => 'warning_email-mimetype',
1207     'section'     => '',
1208     'description' => 'MIME type for warning email',
1209     'type'        => 'select',
1210     'select_enum' => [ 'text/plain', 'text/html' ],
1211   },
1212
1213   {
1214     'key'         => 'payby',
1215     'section'     => 'billing',
1216     'description' => 'Available payment types.',
1217     'type'        => 'selectmultiple',
1218     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1219   },
1220
1221   {
1222     'key'         => 'payby-default',
1223     'section'     => 'UI',
1224     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1225     'type'        => 'select',
1226     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1227   },
1228
1229   {
1230     'key'         => 'svc_acct-notes',
1231     'section'     => 'UI',
1232     'description' => 'Extra HTML to be displayed on the Account View screen.',
1233     'type'        => 'textarea',
1234   },
1235
1236   {
1237     'key'         => 'radius-password',
1238     'section'     => '',
1239     'description' => 'RADIUS attribute for plain-text passwords.',
1240     'type'        => 'select',
1241     'select_enum' => [ 'Password', 'User-Password' ],
1242   },
1243
1244   {
1245     'key'         => 'radius-ip',
1246     'section'     => '',
1247     'description' => 'RADIUS attribute for IP addresses.',
1248     'type'        => 'select',
1249     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1250   },
1251
1252   {
1253     'key'         => 'svc_acct-alldomains',
1254     'section'     => '',
1255     '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.',
1256     'type'        => 'checkbox',
1257   },
1258
1259   {
1260     'key'         => 'dump-scpdest',
1261     'section'     => '',
1262     'description' => 'destination for scp database dumps: user@host:/path',
1263     'type'        => 'text',
1264   },
1265
1266   {
1267     'key'         => 'dump-pgpid',
1268     'section'     => '',
1269     '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.",
1270     'type'        => 'text',
1271   },
1272
1273   {
1274     'key'         => 'cvv-save',
1275     'section'     => 'billing',
1276     '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.',
1277     'type'        => 'selectmultiple',
1278     'select_enum' => \@card_types,
1279   },
1280
1281   {
1282     'key'         => 'allow_negative_charges',
1283     'section'     => 'billing',
1284     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1285     'type'        => 'checkbox',
1286   },
1287   {
1288       'key'         => 'auto_unset_catchall',
1289       'section'     => '',
1290       '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.',
1291       'type'        => 'checkbox',
1292   },
1293
1294   {
1295     'key'         => 'system_usernames',
1296     'section'     => 'username',
1297     '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.',
1298     'type'        => 'textarea',
1299   },
1300
1301   {
1302     'key'         => 'cust_pkg-change_svcpart',
1303     'section'     => '',
1304     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1305     'type'        => 'checkbox',
1306   },
1307
1308   {
1309     'key'         => 'disable_autoreverse',
1310     'section'     => 'BIND',
1311     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1312     'type'        => 'checkbox',
1313   },
1314
1315   {
1316     'key'         => 'svc_www-enable_subdomains',
1317     'section'     => '',
1318     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1319     'type'        => 'checkbox',
1320   },
1321
1322   {
1323     'key'         => 'svc_www-usersvc_svcpart',
1324     'section'     => '',
1325     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1326     'type'        => 'textarea',
1327   },
1328
1329   {
1330     'key'         => 'selfservice_server-primary_only',
1331     'section'     => '',
1332     'description' => 'Only allow primary accounts to access self-service functionality.',
1333     'type'        => 'checkbox',
1334   },
1335
1336   {
1337     'key'         => 'card_refund-days',
1338     'section'     => 'billing',
1339     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1340     'type'        => 'text',
1341   },
1342
1343   {
1344     'key'         => 'agent-showpasswords',
1345     'section'     => '',
1346     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1347     'type'        => 'checkbox',
1348   },
1349
1350   {
1351     'key'         => 'global_unique-username',
1352     'section'     => 'username',
1353     '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.',
1354     'type'        => 'select',
1355     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1356   },
1357
1358   {
1359     'key'         => 'svc_external-skip_manual',
1360     'section'     => 'UI',
1361     '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).',
1362     'type'        => 'checkbox',
1363   },
1364
1365   {
1366     'key'         => 'svc_external-display_type',
1367     'section'     => 'UI',
1368     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1369     'type'        => 'select',
1370     'select_enum' => [ 'generic', 'artera_turbo', ],
1371   },
1372
1373   {
1374     'key'         => 'ticket_system',
1375     'section'     => '',
1376     '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).',
1377     'type'        => 'select',
1378     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1379     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1380   },
1381
1382   {
1383     'key'         => 'ticket_system-default_queueid',
1384     'section'     => '',
1385     'description' => 'Default queue used when creating new customer tickets.',
1386     'type'        => 'select-sub',
1387     'options_sub' => sub {
1388                            my $conf = new FS::Conf;
1389                            if ( $conf->config('ticket_system') ) {
1390                              eval "use FS::TicketSystem;";
1391                              die $@ if $@;
1392                              FS::TicketSystem->queues();
1393                            } else {
1394                              ();
1395                            }
1396                          },
1397     'option_sub'  => sub { 
1398                            my $conf = new FS::Conf;
1399                            if ( $conf->config('ticket_system') ) {
1400                              eval "use FS::TicketSystem;";
1401                              die $@ if $@;
1402                              FS::TicketSystem->queue(shift);
1403                            } else {
1404                              '';
1405                            }
1406                          },
1407   },
1408
1409   {
1410     'key'         => 'ticket_system-custom_priority_field',
1411     'section'     => '',
1412     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1413     'type'        => 'text',
1414   },
1415
1416   {
1417     'key'         => 'ticket_system-custom_priority_field-values',
1418     'section'     => '',
1419     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1420     'type'        => 'textarea',
1421   },
1422
1423   {
1424     'key'         => 'ticket_system-custom_priority_field_queue',
1425     'section'     => '',
1426     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1427     'type'        => 'text',
1428   },
1429
1430   {
1431     'key'         => 'ticket_system-rt_external_datasrc',
1432     'section'     => '',
1433     '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>',
1434     'type'        => 'text',
1435
1436   },
1437
1438   {
1439     'key'         => 'ticket_system-rt_external_url',
1440     'section'     => '',
1441     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1442     'type'        => 'text',
1443   },
1444
1445   {
1446     'key'         => 'company_name',
1447     'section'     => 'required',
1448     'description' => 'Your company name',
1449     'type'        => 'text',
1450   },
1451
1452   {
1453     'key'         => 'address2-search',
1454     'section'     => 'UI',
1455     'description' => 'Enable a "Unit" search box which searches the second address field',
1456     'type'        => 'checkbox',
1457   },
1458
1459   { 'key'         => 'referral_credit',
1460     'section'     => 'billing',
1461     'description' => "Enables one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency).",
1462     'type'        => 'checkbox',
1463   },
1464
1465   { 'key'         => 'selfservice_server-cache_module',
1466     'section'     => '',
1467     '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.',
1468     'type'        => 'select',
1469     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1470   },
1471
1472   {
1473     'key'         => 'hylafax',
1474     'section'     => '',
1475     '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).',
1476     'type'        => [qw( checkbox textarea )],
1477   },
1478
1479   {
1480     'key'         => 'svc_acct-usage_suspend',
1481     'section'     => 'billing',
1482     '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.',
1483     'type'        => 'checkbox',
1484   },
1485
1486   {
1487     'key'         => 'svc_acct-usage_unsuspend',
1488     'section'     => 'billing',
1489     '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.',
1490     'type'        => 'checkbox',
1491   },
1492
1493   {
1494     'key'         => 'svc_acct-usage_threshold',
1495     'section'     => 'billing',
1496     '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.',
1497     'type'        => 'text',
1498   },
1499
1500   {
1501     'key'         => 'cust-fields',
1502     'section'     => 'UI',
1503     'description' => 'Which customer fields to display on reports by default',
1504     'type'        => 'select',
1505     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
1506   },
1507
1508   {
1509     'key'         => 'cust_pkg-display_times',
1510     'section'     => 'UI',
1511     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
1512     'type'        => 'checkbox',
1513   },
1514
1515   {
1516     'key'         => 'svc_acct-edit_uid',
1517     'section'     => 'shell',
1518     'description' => 'Allow UID editing.',
1519     'type'        => 'checkbox',
1520   },
1521
1522   {
1523     'key'         => 'svc_acct-edit_gid',
1524     'section'     => 'shell',
1525     'description' => 'Allow GID editing.',
1526     'type'        => 'checkbox',
1527   },
1528
1529   {
1530     'key'         => 'zone-underscore',
1531     'section'     => 'BIND',
1532     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
1533     'type'        => 'checkbox',
1534   },
1535
1536   {
1537     'key'         => 'echeck-nonus',
1538     'section'     => 'billing',
1539     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
1540     'type'        => 'checkbox',
1541   },
1542
1543   {
1544     'key'         => 'voip-cust_cdr_spools',
1545     'section'     => '',
1546     'description' => 'Enable the per-customer option for individual CDR spools.',
1547     'type'        => 'checkbox',
1548   },
1549
1550   {
1551     'key'         => 'svc_forward-arbitrary_dst',
1552     'section'     => '',
1553     '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.",
1554     'type'        => 'checkbox',
1555   },
1556
1557   {
1558     'key'         => 'tax-ship_address',
1559     'section'     => 'billing',
1560     '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.',
1561     'type'        => 'checkbox',
1562   },
1563
1564   {
1565     'key'         => 'batch-enable',
1566     'section'     => 'billing',
1567     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
1568     'type'        => 'checkbox',
1569   },
1570
1571   {
1572     'key'         => 'batch-default_format',
1573     'section'     => 'billing',
1574     'description' => 'Default format for batches.',
1575     'type'        => 'select',
1576     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
1577                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
1578                        'ach-spiritone',
1579                     ]
1580   },
1581
1582   {
1583     'key'         => 'batch-fixed_format-CARD',
1584     'section'     => 'billing',
1585     'description' => 'Fixed (unchangeable) format for credit card batches.',
1586     'type'        => 'select',
1587     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
1588                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
1589   },
1590
1591   {
1592     'key'         => 'batch-fixed_format-CHEK',
1593     'section'     => 'billing',
1594     'description' => 'Fixed (unchangeable) format for electronic check batches.',
1595     'type'        => 'select',
1596     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
1597                        'ach-spiritone',
1598                      ]
1599   },
1600
1601   {
1602     'key'         => 'batch-increment_expiration',
1603     'section'     => 'billing',
1604     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
1605     'type'        => 'checkbox'
1606   },
1607
1608   {
1609     'key'         => 'batchconfig-BoM',
1610     'section'     => 'billing',
1611     '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',
1612     'type'        => 'textarea',
1613   },
1614
1615   {
1616     'key'         => 'batchconfig-PAP',
1617     'section'     => 'billing',
1618     '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',
1619     'type'        => 'textarea',
1620   },
1621
1622   {
1623     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
1624     'section'     => 'billing',
1625     'description' => 'Gateway ID for Chase Canada E-xact batching',
1626     'type'        => 'text',
1627   },
1628
1629   {
1630     'key'         => 'payment_history-years',
1631     'section'     => 'UI',
1632     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
1633     'type'        => 'text',
1634   },
1635
1636   {
1637     'key'         => 'cust_main-use_comments',
1638     'section'     => 'UI',
1639     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
1640     'type'        => 'checkbox',
1641   },
1642
1643   {
1644     'key'         => 'cust_main-disable_notes',
1645     'section'     => 'UI',
1646     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
1647     'type'        => 'checkbox',
1648   },
1649
1650   {
1651     'key'         => 'cust_main_note-display_times',
1652     'section'     => 'UI',
1653     'description' => 'Display full timestamps (not just dates) for customer notes.',
1654     'type'        => 'checkbox',
1655   },
1656
1657   {
1658     'key'         => 'cust_main-ticket_statuses',
1659     'section'     => 'UI',
1660     'description' => 'Show tickets with these statuses on the customer view page.',
1661     'type'        => 'selectmultiple',
1662     'select_enum' => [qw( new open stalled resolved rejected deleted )],
1663   },
1664
1665   {
1666     'key'         => 'cust_main-max_tickets',
1667     'section'     => 'UI',
1668     'description' => 'Maximum number of tickets to show on the customer view page.',
1669     'type'        => 'text',
1670   },
1671
1672   {
1673     'key'         => 'cust_main-skeleton_tables',
1674     'section'     => '',
1675     '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.',
1676     'type'        => 'textarea',
1677   },
1678
1679   {
1680     'key'         => 'cust_main-skeleton_custnum',
1681     'section'     => '',
1682     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
1683     'type'        => 'text',
1684   },
1685
1686   {
1687     'key'         => 'cust_main-enable_birthdate',
1688     'section'     => 'UI',
1689     'descritpion' => 'Enable tracking of a birth date with each customer record',
1690     'type'        => 'checkbox',
1691   },
1692
1693   {
1694     'key'         => 'support-key',
1695     'section'     => '',
1696     '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.',
1697     'type'        => 'text',
1698   },
1699
1700   {
1701     'key'         => 'card-types',
1702     'section'     => 'billing',
1703     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
1704     'type'        => 'selectmultiple',
1705     'select_enum' => \@card_types,
1706   },
1707
1708   {
1709     'key'         => 'dashboard-toplist',
1710     'section'     => 'UI',
1711     'description' => 'List of items to display on the top of the front page',
1712     'type'        => 'textarea',
1713   },
1714
1715   {
1716     'key'         => 'impending_recur_template',
1717     'section'     => 'billing',
1718     '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>',
1719 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
1720     'type'        => 'textarea',
1721   },
1722
1723   {
1724     'key'         => 'logo.png',
1725     'section'     => 'billing',  #? 
1726     'description' => 'An image to include in some types of invoices',
1727     'type'        => 'binary',
1728   },
1729
1730   {
1731     'key'         => 'logo.eps',
1732     'section'     => 'billing',  #? 
1733     'description' => 'An image to include in some types of invoices',
1734     'type'        => 'binary',
1735   },
1736
1737   {
1738     'key'         => 'selfservice-ignore_quantity',
1739     'section'     => '',
1740     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
1741     'type'        => 'checkbox',
1742   },
1743
1744   {
1745     'key'         => 'disable_setup_suspended_pkgs',
1746     'section'     => 'billing',
1747     'description' => 'Disables charging of setup fees for suspended packages.',
1748     'type'       => 'checkbox',
1749   },
1750
1751   {
1752     'key' => 'password-generated-allcaps',
1753     'section' => 'password',
1754     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
1755     'type' => 'checkbox',
1756   },
1757
1758 );
1759
1760 1;
1761