33974123d98b2bb15dabd3840713209bdc97e235
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($base_dir @config_items @base_items @card_types $DEBUG);
4 use Carp;
5 use IO::File;
6 use File::Basename;
7 use MIME::Base64;
8 use FS::ConfItem;
9 use FS::ConfDefaults;
10 use FS::Conf_compat17;
11 use FS::conf;
12 use FS::Record qw(qsearch qsearchs);
13 use FS::UID qw(dbh datasrc use_confcompat);
14
15 $base_dir = '%%%FREESIDE_CONF%%%';
16
17 $DEBUG = 0;
18
19 =head1 NAME
20
21 FS::Conf - Freeside configuration values
22
23 =head1 SYNOPSIS
24
25   use FS::Conf;
26
27   $conf = new FS::Conf;
28
29   $value = $conf->config('key');
30   @list  = $conf->config('key');
31   $bool  = $conf->exists('key');
32
33   $conf->touch('key');
34   $conf->set('key' => 'value');
35   $conf->delete('key');
36
37   @config_items = $conf->config_items;
38
39 =head1 DESCRIPTION
40
41 Read and write Freeside configuration values.  Keys currently map to filenames,
42 but this may change in the future.
43
44 =head1 METHODS
45
46 =over 4
47
48 =item new
49
50 Create a new configuration object.
51
52 =cut
53
54 sub new {
55   my($proto) = @_;
56   my($class) = ref($proto) || $proto;
57   my($self) = { 'base_dir' => $base_dir };
58   bless ($self, $class);
59 }
60
61 =item base_dir
62
63 Returns the base directory.  By default this is /usr/local/etc/freeside.
64
65 =cut
66
67 sub base_dir {
68   my($self) = @_;
69   my $base_dir = $self->{base_dir};
70   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
71   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
72   -r $base_dir or die "FATAL: Can't read $base_dir!";
73   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
74   $base_dir =~ /^(.*)$/;
75   $1;
76 }
77
78 =item config KEY [ AGENTNUM ]
79
80 Returns the configuration value or values (depending on context) for key.
81 The optional agent number selects an agent specific value instead of the
82 global default if one is present.
83
84 =cut
85
86 sub _usecompat {
87   my ($self, $method) = (shift, shift);
88   carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
89     if use_confcompat;
90   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
91   $compat->$method(@_);
92 }
93
94 sub _config {
95   my($self,$name,$agentnum)=@_;
96   my $hashref = { 'name' => $name };
97   $hashref->{agentnum} = $agentnum;
98   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
99   my $cv = FS::Record::qsearchs('conf', $hashref);
100   if (!$cv && defined($agentnum)) {
101     $hashref->{agentnum} = '';
102     $cv = FS::Record::qsearchs('conf', $hashref);
103   }
104   return $cv;
105 }
106
107 sub config {
108   my $self = shift;
109   return $self->_usecompat('config', @_) if use_confcompat;
110
111   my($name,$agentnum)=@_;
112   my $cv = $self->_config($name, $agentnum) or return;
113
114   if ( wantarray ) {
115     my $v = $cv->value;
116     chomp $v;
117     (split "\n", $v, -1);
118   } else {
119     (split("\n", $cv->value))[0];
120   }
121 }
122
123 =item config_binary KEY [ AGENTNUM ]
124
125 Returns the exact scalar value for key.
126
127 =cut
128
129 sub config_binary {
130   my $self = shift;
131   return $self->_usecompat('config_binary', @_) if use_confcompat;
132
133   my($name,$agentnum)=@_;
134   my $cv = $self->_config($name, $agentnum) or return;
135   decode_base64($cv->value);
136 }
137
138 =item exists KEY [ AGENTNUM ]
139
140 Returns true if the specified key exists, even if the corresponding value
141 is undefined.
142
143 =cut
144
145 sub exists {
146   my $self = shift;
147   return $self->_usecompat('exists', @_) if use_confcompat;
148
149   my($name,$agentnum)=@_;
150   defined($self->_config($name, $agentnum));
151 }
152
153 #=item config_orbase KEY SUFFIX
154 #
155 #Returns the configuration value or values (depending on context) for 
156 #KEY_SUFFIX, if it exists, otherwise for KEY
157 #
158 #=cut
159
160 # outmoded as soon as we shift to agentnum based config values
161 # well, mostly.  still useful for e.g. late notices, etc. in that we want
162 # these to fall back to standard values
163 sub config_orbase {
164   my $self = shift;
165   return $self->_usecompat('config_orbase', @_) if use_confcompat;
166
167   my( $name, $suffix ) = @_;
168   if ( $self->exists("${name}_$suffix") ) {
169     $self->config("${name}_$suffix");
170   } else {
171     $self->config($name);
172   }
173 }
174
175 =item invoice_templatenames
176
177 Returns all possible invoice template names.
178
179 =cut
180
181 sub invoice_templatenames {
182   my( $self ) = @_;
183
184   my %templatenames = ();
185   foreach my $item ( $self->config_items ) {
186     foreach my $base ( @base_items ) {
187       my( $main, $ext) = split(/\./, $base);
188       $ext = ".$ext" if $ext;
189       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
190       $templatenames{$1}++;
191       }
192     }
193   }
194   
195   sort keys %templatenames;
196
197 }
198
199 =item touch KEY [ AGENT ];
200
201 Creates the specified configuration key if it does not exist.
202
203 =cut
204
205 sub touch {
206   my $self = shift;
207   return $self->_usecompat('touch', @_) if use_confcompat;
208
209   my($name, $agentnum) = @_;
210   unless ( $self->exists($name, $agentnum) ) {
211     $self->set($name, '', $agentnum);
212   }
213 }
214
215 =item set KEY VALUE [ AGENTNUM ];
216
217 Sets the specified configuration key to the given value.
218
219 =cut
220
221 sub set {
222   my $self = shift;
223   return $self->_usecompat('set', @_) if use_confcompat;
224
225   my($name, $value, $agentnum) = @_;
226   $value =~ /^(.*)$/s;
227   $value = $1;
228
229   warn "[FS::Conf] SET $name\n" if $DEBUG;
230
231   my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
232   my $new = new FS::conf { $old ? $old->hash 
233                                 : ('name' => $name, 'agentnum' => $agentnum)
234                          };
235   $new->value($value);
236
237   my $error;
238   if ($old) {
239     $error = $new->replace($old);
240   } else {
241     $error = $new->insert;
242   }
243
244   die "error setting configuration value: $error \n"
245     if $error;
246
247 }
248
249 =item set_binary KEY VALUE [ AGENTNUM ]
250
251 Sets the specified configuration key to an exact scalar value which
252 can be retrieved with config_binary.
253
254 =cut
255
256 sub set_binary {
257   my $self  = shift;
258   return if use_confcompat;
259
260   my($name, $value, $agentnum)=@_;
261   $self->set($name, encode_base64($value), $agentnum);
262 }
263
264 =item delete KEY [ AGENTNUM ];
265
266 Deletes the specified configuration key.
267
268 =cut
269
270 sub delete {
271   my $self = shift;
272   return $self->_usecompat('delete', @_) if use_confcompat;
273
274   my($name, $agentnum) = @_;
275   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
276     warn "[FS::Conf] DELETE $name\n";
277
278     my $oldAutoCommit = $FS::UID::AutoCommit;
279     local $FS::UID::AutoCommit = 0;
280     my $dbh = dbh;
281
282     my $error = $cv->delete;
283
284     if ( $error ) {
285       $dbh->rollback if $oldAutoCommit;
286       die "error setting configuration value: $error \n"
287     }
288
289     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
290
291   }
292 }
293
294 =item import_config_item CONFITEM DIR 
295
296   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
297 the database as a conf record (see L<FS::conf>).  Imports from the file
298 in the directory DIR.
299
300 =cut
301
302 sub import_config_item { 
303   my ($self,$item,$dir) = @_;
304   my $key = $item->key;
305   if ( -e "$dir/$key" && ! use_confcompat ) {
306     warn "Inserting $key\n" if $DEBUG;
307     local $/;
308     my $value = readline(new IO::File "$dir/$key");
309     if ($item->type eq 'binary') {
310       $self->set_binary($key, $value);
311     }else{
312       $self->set($key, $value);
313     }
314   }else {
315     warn "Not inserting $key\n" if $DEBUG;
316   }
317 }
318
319 =item verify_config_item CONFITEM DIR 
320
321   Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
322 the database to the legacy file value in DIR.
323
324 =cut
325
326 sub verify_config_item { 
327   return '' if use_confcompat;
328   my ($self,$item,$dir) = @_;
329   my $key = $item->key;
330   my $type = $item->type;
331
332   my $compat = new FS::Conf_compat17 $dir;
333   my $error = '';
334   
335   $error .= "$key fails existential comparison; "
336     if $self->exists($key) xor $compat->exists($key);
337
338   unless ($type eq 'binary') {
339     {
340       no warnings;
341       $error .= "$key fails scalar comparison; "
342         unless scalar($self->config($key)) eq scalar($compat->config($key));
343     }
344
345     my (@new) = $self->config($key);
346     my (@old) = $compat->config($key);
347     unless ( scalar(@new) == scalar(@old)) { 
348       $error .= "$key fails list comparison; ";
349     }else{
350       my $r=1;
351       foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
352       $error .= "$key fails list comparison; "
353         unless $r;
354     }
355   }
356
357   if ($type eq 'binary') {
358     $error .= "$key fails binary comparison; "
359       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
360   }
361
362   if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
363     my $proto;
364     for ( @config_items ) { $proto = $_; last if $proto->key eq $key;  }
365     unless ($proto->key eq $key) { 
366       warn "removed config item $error\n" if $DEBUG;
367       $error = '';
368     }
369   }
370
371   $error;
372 }
373
374 #item _orbase_items OPTIONS
375 #
376 #Returns all of the possible extensible config items as FS::ConfItem objects.
377 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
378 #options include
379 #
380 # dir - the directory to search for configuration option files instead
381 #       of using the conf records in the database
382 #
383 #cut
384
385 #quelle kludge
386 sub _orbase_items {
387   my ($self, %opt) = @_; 
388
389   my $listmaker = sub { my $v = shift;
390                         $v =~ s/_/!_/g;
391                         if ( $v =~ /\.(png|eps)$/ ) {
392                           $v =~ s/\./!_%./;
393                         }else{
394                           $v .= '!_%';
395                         }
396                         map { $_->name }
397                           FS::Record::qsearch( 'conf',
398                                                {},
399                                                '',
400                                                "WHERE name LIKE '$v' ESCAPE '!'"
401                                              );
402                       };
403
404   if (exists($opt{dir}) && $opt{dir}) {
405     $listmaker = sub { my $v = shift;
406                        if ( $v =~ /\.(png|eps)$/ ) {
407                          $v =~ s/\./_*./;
408                        }else{
409                          $v .= '_*';
410                        }
411                        map { basename $_ } glob($opt{dir}. "/$v" );
412                      };
413   }
414
415   ( map { 
416           my $proto;
417           my $base = $_;
418           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
419           die "don't know about $base items" unless $proto->key eq $base;
420
421           map { new FS::ConfItem { 
422                                    'key' => $_,
423                                    'section' => $proto->section,
424                                    'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
425                                    'type' => $proto->type,
426                                  };
427               } &$listmaker($base);
428         } @base_items,
429   );
430 }
431
432 =item config_items
433
434 Returns all of the possible global/default configuration items as
435 FS::ConfItem objects.  See L<FS::ConfItem>.
436
437 =cut
438
439 sub config_items {
440   my $self = shift; 
441   return $self->_usecompat('config_items', @_) if use_confcompat;
442
443   ( @config_items, $self->_orbase_items(@_) );
444 }
445
446 =back
447
448 =head1 SUBROUTINES
449
450 =over 4
451
452 =item init-config DIR
453
454 Imports the non-deprecated configuration items from DIR (1.7 compatible)
455 to conf records in the database.
456
457 =cut
458
459 sub init_config {
460   my $dir = shift;
461
462   {
463     local $FS::UID::use_confcompat = 0;
464     my $conf = new FS::Conf;
465     foreach my $item ( $conf->config_items(dir => $dir) ) {
466       $conf->import_config_item($item, $dir);
467       my $error = $conf->verify_config_item($item, $dir);
468       return $error if $error;
469     }
470   
471     my $compat = new FS::Conf_compat17 $dir;
472     foreach my $item ( $compat->config_items ) {
473       my $error = $conf->verify_config_item($item, $dir);
474       return $error if $error;
475     }
476   }
477
478   $FS::UID::use_confcompat = 0;
479   '';  #success
480 }
481
482 =back
483
484 =head1 BUGS
485
486 If this was more than just crud that will never be useful outside Freeside I'd
487 worry that config_items is freeside-specific and icky.
488
489 =head1 SEE ALSO
490
491 "Configuration" in the web interface (config/config.cgi).
492
493 =cut
494
495 #Business::CreditCard
496 @card_types = (
497   "VISA card",
498   "MasterCard",
499   "Discover card",
500   "American Express card",
501   "Diner's Club/Carte Blanche",
502   "enRoute",
503   "JCB",
504   "BankCard",
505   "Switch",
506   "Solo",
507 );
508
509 @base_items = qw (
510                    invoice_template
511                    invoice_latex
512                    invoice_latexreturnaddress
513                    invoice_latexfooter
514                    invoice_latexsmallfooter
515                    invoice_latexnotes
516                    invoice_html
517                    invoice_htmlreturnaddress
518                    invoice_htmlfooter
519                    invoice_htmlnotes
520                    logo.png
521                    logo.eps
522                  );
523
524 @base_items = qw (
525                    invoice_template
526                    invoice_latex
527                    invoice_latexreturnaddress
528                    invoice_latexfooter
529                    invoice_latexsmallfooter
530                    invoice_latexnotes
531                    invoice_html
532                    invoice_htmlreturnaddress
533                    invoice_htmlfooter
534                    invoice_htmlnotes
535                    logo.png
536                    logo.eps
537                  );
538
539 @config_items = map { new FS::ConfItem $_ } (
540
541   {
542     'key'         => 'address',
543     'section'     => 'deprecated',
544     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
545     'type'        => 'text',
546   },
547
548   {
549     'key'         => 'alerter_template',
550     'section'     => 'billing',
551     'description' => 'Template file for billing method expiration alerts.  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
552     'type'        => 'textarea',
553   },
554
555   {
556     'key'         => 'apacheip',
557     'section'     => 'deprecated',
558     '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',
559     'type'        => 'text',
560   },
561
562   {
563     'key'         => 'encryption',
564     'section'     => 'billing',
565     'description' => 'Enable encryption of credit cards.',
566     'type'        => 'checkbox',
567   },
568
569   {
570     'key'         => 'encryptionmodule',
571     'section'     => 'billing',
572     'description' => 'Use which module for encryption?',
573     'type'        => 'text',
574   },
575
576   {
577     'key'         => 'encryptionpublickey',
578     'section'     => 'billing',
579     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
580     'type'        => 'textarea',
581   },
582
583   {
584     'key'         => 'encryptionprivatekey',
585     'section'     => 'billing',
586     '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.',
587     'type'        => 'textarea',
588   },
589
590   {
591     'key'         => 'business-onlinepayment',
592     'section'     => 'billing',
593     '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.',
594     'type'        => 'textarea',
595   },
596
597   {
598     'key'         => 'business-onlinepayment-ach',
599     'section'     => 'billing',
600     '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.',
601     'type'        => 'textarea',
602   },
603
604   {
605     'key'         => 'business-onlinepayment-description',
606     'section'     => 'billing',
607     '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)',
608     'type'        => 'text',
609   },
610
611   {
612     'key'         => 'business-onlinepayment-email-override',
613     'section'     => 'billing',
614     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
615     'type'        => 'text',
616   },
617
618   {
619     'key'         => 'business-onlinepayment-email_customer',
620     'section'     => 'billing',
621     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
622     'type'        => 'checkbox',
623   },
624
625   {
626     'key'         => 'countrydefault',
627     'section'     => 'UI',
628     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
629     'type'        => 'text',
630   },
631
632   {
633     'key'         => 'date_format',
634     'section'     => 'UI',
635     'description' => 'Format for displaying dates',
636     'type'        => 'select',
637     'select_hash' => [
638                        '%m/%d/%Y' => 'MM/DD/YYYY',
639                        '%Y/%m/%d' => 'YYYY/MM/DD',
640                      ],
641   },
642
643   {
644     'key'         => 'deletecustomers',
645     'section'     => 'UI',
646     '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.',
647     'type'        => 'checkbox',
648   },
649
650   {
651     'key'         => 'deletepayments',
652     'section'     => 'billing',
653     '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.',
654     'type'        => [qw( checkbox text )],
655   },
656
657   {
658     'key'         => 'deletecredits',
659     'section'     => 'deprecated',
660     '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.',
661     'type'        => [qw( checkbox text )],
662   },
663
664   {
665     'key'         => 'deleterefunds',
666     'section'     => 'billing',
667     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
668     'type'        => 'checkbox',
669   },
670
671   {
672     'key'         => 'dirhash',
673     'section'     => 'shell',
674     '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>',
675     'type'        => 'text',
676   },
677
678   {
679     'key'         => 'disable_customer_referrals',
680     'section'     => 'UI',
681     'description' => 'Disable new customer-to-customer referrals in the web interface',
682     'type'        => 'checkbox',
683   },
684
685   {
686     'key'         => 'editreferrals',
687     'section'     => 'UI',
688     'description' => 'Enable advertising source modification for existing customers',
689     'type'       => 'checkbox',
690   },
691
692   {
693     'key'         => 'emailinvoiceonly',
694     'section'     => 'billing',
695     'description' => 'Disables postal mail invoices',
696     'type'       => 'checkbox',
697   },
698
699   {
700     'key'         => 'disablepostalinvoicedefault',
701     'section'     => 'billing',
702     '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>.',
703     'type'       => 'checkbox',
704   },
705
706   {
707     'key'         => 'emailinvoiceauto',
708     'section'     => 'billing',
709     'description' => 'Automatically adds new accounts to the email invoice list',
710     'type'       => 'checkbox',
711   },
712
713   {
714     'key'         => 'emailinvoiceautoalways',
715     'section'     => 'billing',
716     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
717     'type'       => 'checkbox',
718   },
719
720   {
721     'key'         => 'exclude_ip_addr',
722     'section'     => '',
723     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
724     'type'        => 'textarea',
725   },
726   
727   {
728     'key'         => 'hidecancelledpackages',
729     'section'     => 'UI',
730     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
731     'type'        => 'checkbox',
732   },
733
734   {
735     'key'         => 'hidecancelledcustomers',
736     'section'     => 'UI',
737     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
738     'type'        => 'checkbox',
739   },
740
741   {
742     'key'         => 'home',
743     'section'     => 'shell',
744     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
745     'type'        => 'text',
746   },
747
748   {
749     'key'         => 'invoice_from',
750     'section'     => 'required',
751     'description' => 'Return address on email invoices',
752     'type'        => 'text',
753   },
754
755   {
756     'key'         => 'invoice_template',
757     'section'     => 'billing',
758     'description' => 'Text template file for invoices.  Used if no invoice_html template is defined, and also seen by users using non-HTML capable mail clients.  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
759     'type'        => 'textarea',
760   },
761
762   {
763     'key'         => 'invoice_html',
764     'section'     => 'billing',
765     'description' => 'Optional HTML template for invoices.  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
766
767     'type'        => 'textarea',
768   },
769
770   {
771     'key'         => 'invoice_htmlnotes',
772     'section'     => 'billing',
773     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
774     'type'        => 'textarea',
775   },
776
777   {
778     'key'         => 'invoice_htmlfooter',
779     'section'     => 'billing',
780     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
781     'type'        => 'textarea',
782   },
783
784   {
785     'key'         => 'invoice_htmlreturnaddress',
786     'section'     => 'billing',
787     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
788     'type'        => 'textarea',
789   },
790
791   {
792     'key'         => 'invoice_latex',
793     'section'     => 'billing',
794     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
795     'type'        => 'textarea',
796   },
797
798   {
799     'key'         => 'invoice_latexnotes',
800     'section'     => 'billing',
801     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
802     'type'        => 'textarea',
803   },
804
805   {
806     'key'         => 'invoice_latexfooter',
807     'section'     => 'billing',
808     'description' => 'Footer for LaTeX typeset PostScript invoices.',
809     'type'        => 'textarea',
810   },
811
812   {
813     'key'         => 'invoice_latexreturnaddress',
814     'section'     => 'billing',
815     'description' => 'Return address for LaTeX typeset PostScript invoices.',
816     'type'        => 'textarea',
817   },
818
819   {
820     'key'         => 'invoice_latexsmallfooter',
821     'section'     => 'billing',
822     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
823     'type'        => 'textarea',
824   },
825
826   {
827     'key'         => 'invoice_email_pdf',
828     'section'     => 'billing',
829     '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.',
830     'type'        => 'checkbox'
831   },
832
833   {
834     'key'         => 'invoice_email_pdf_note',
835     'section'     => 'billing',
836     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
837     'type'        => 'textarea'
838   },
839
840
841   { 
842     'key'         => 'invoice_default_terms',
843     'section'     => 'billing',
844     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
845     'type'        => 'select',
846     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 30', 'Net 45', 'Net 60' ],
847   },
848
849   { 
850     'key'         => 'invoice_sections',
851     'section'     => 'billing',
852     'description' => 'Split invoice into sections and label according to package type when enabled.',
853     'type'        => 'checkbox',
854   },
855
856   {
857     'key'         => 'payment_receipt_email',
858     'section'     => 'billing',
859     '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>',
860     'type'        => [qw( checkbox textarea )],
861   },
862
863   {
864     'key'         => 'lpr',
865     'section'     => 'required',
866     'description' => 'Print command for paper invoices, for example `lpr -h\'',
867     'type'        => 'text',
868   },
869
870   {
871     'key'         => 'lpr-postscript_prefix',
872     'section'     => 'billing',
873     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
874     'type'        => 'text',
875   },
876
877   {
878     'key'         => 'lpr-postscript_suffix',
879     'section'     => 'billing',
880     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
881     'type'        => 'text',
882   },
883
884   {
885     'key'         => 'money_char',
886     'section'     => '',
887     'description' => 'Currency symbol - defaults to `$\'',
888     'type'        => 'text',
889   },
890
891   {
892     'key'         => 'defaultrecords',
893     'section'     => 'BIND',
894     'description' => 'DNS entries to add automatically when creating a domain',
895     'type'        => 'editlist',
896     'editlist_parts' => [ { type=>'text' },
897                           { type=>'immutable', value=>'IN' },
898                           { type=>'select',
899                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
900                           { type=> 'text' }, ],
901   },
902
903   {
904     'key'         => 'passwordmin',
905     'section'     => 'password',
906     'description' => 'Minimum password length (default 6)',
907     'type'        => 'text',
908   },
909
910   {
911     'key'         => 'passwordmax',
912     'section'     => 'password',
913     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
914     'type'        => 'text',
915   },
916
917   {
918     'key' => 'password-noampersand',
919     'section' => 'password',
920     'description' => 'Disallow ampersands in passwords',
921     'type' => 'checkbox',
922   },
923
924   {
925     'key' => 'password-noexclamation',
926     'section' => 'password',
927     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
928     'type' => 'checkbox',
929   },
930
931   {
932     'key'         => 'referraldefault',
933     'section'     => 'UI',
934     'description' => 'Default referral, specified by refnum',
935     'type'        => 'text',
936   },
937
938 #  {
939 #    'key'         => 'registries',
940 #    'section'     => 'required',
941 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
942 #  },
943
944   {
945     'key'         => 'maxsearchrecordsperpage',
946     'section'     => 'UI',
947     'description' => 'If set, number of search records to return per page.',
948     'type'        => 'text',
949   },
950
951   {
952     'key'         => 'session-start',
953     'section'     => 'session',
954     '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.',
955     'type'        => 'text',
956   },
957
958   {
959     'key'         => 'session-stop',
960     'section'     => 'session',
961     '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.',
962     'type'        => 'text',
963   },
964
965   {
966     'key'         => 'shells',
967     'section'     => 'shell',
968     '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.',
969     'type'        => 'textarea',
970   },
971
972   {
973     'key'         => 'showpasswords',
974     'section'     => 'UI',
975     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
976     'type'        => 'checkbox',
977   },
978
979   {
980     'key'         => 'signupurl',
981     'section'     => 'UI',
982     'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Self-Service_Installation">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
983     'type'        => 'text',
984   },
985
986   {
987     'key'         => 'smtpmachine',
988     'section'     => 'required',
989     'description' => 'SMTP relay for Freeside\'s outgoing mail',
990     'type'        => 'text',
991   },
992
993   {
994     'key'         => 'soadefaultttl',
995     'section'     => 'BIND',
996     'description' => 'SOA default TTL for new domains.',
997     'type'        => 'text',
998   },
999
1000   {
1001     'key'         => 'soaemail',
1002     'section'     => 'BIND',
1003     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1004     'type'        => 'text',
1005   },
1006
1007   {
1008     'key'         => 'soaexpire',
1009     'section'     => 'BIND',
1010     'description' => 'SOA expire for new domains',
1011     'type'        => 'text',
1012   },
1013
1014   {
1015     'key'         => 'soamachine',
1016     'section'     => 'BIND',
1017     'description' => 'SOA machine for new domains, with trailing `.\'',
1018     'type'        => 'text',
1019   },
1020
1021   {
1022     'key'         => 'soarefresh',
1023     'section'     => 'BIND',
1024     'description' => 'SOA refresh for new domains',
1025     'type'        => 'text',
1026   },
1027
1028   {
1029     'key'         => 'soaretry',
1030     'section'     => 'BIND',
1031     'description' => 'SOA retry for new domains',
1032     'type'        => 'text',
1033   },
1034
1035   {
1036     'key'         => 'statedefault',
1037     'section'     => 'UI',
1038     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1039     'type'        => 'text',
1040   },
1041
1042   {
1043     'key'         => 'unsuspendauto',
1044     'section'     => 'billing',
1045     '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',
1046     'type'        => 'checkbox',
1047   },
1048
1049   {
1050     'key'         => 'unsuspend-always_adjust_next_bill_date',
1051     'section'     => 'billing',
1052     '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.',
1053     'type'        => 'checkbox',
1054   },
1055
1056   {
1057     'key'         => 'usernamemin',
1058     'section'     => 'username',
1059     'description' => 'Minimum username length (default 2)',
1060     'type'        => 'text',
1061   },
1062
1063   {
1064     'key'         => 'usernamemax',
1065     'section'     => 'username',
1066     'description' => 'Maximum username length',
1067     'type'        => 'text',
1068   },
1069
1070   {
1071     'key'         => 'username-ampersand',
1072     'section'     => 'username',
1073     '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.',
1074     'type'        => 'checkbox',
1075   },
1076
1077   {
1078     'key'         => 'username-letter',
1079     'section'     => 'username',
1080     'description' => 'Usernames must contain at least one letter',
1081     'type'        => 'checkbox',
1082   },
1083
1084   {
1085     'key'         => 'username-letterfirst',
1086     'section'     => 'username',
1087     'description' => 'Usernames must start with a letter',
1088     'type'        => 'checkbox',
1089   },
1090
1091   {
1092     'key'         => 'username-noperiod',
1093     'section'     => 'username',
1094     'description' => 'Disallow periods in usernames',
1095     'type'        => 'checkbox',
1096   },
1097
1098   {
1099     'key'         => 'username-nounderscore',
1100     'section'     => 'username',
1101     'description' => 'Disallow underscores in usernames',
1102     'type'        => 'checkbox',
1103   },
1104
1105   {
1106     'key'         => 'username-nodash',
1107     'section'     => 'username',
1108     'description' => 'Disallow dashes in usernames',
1109     'type'        => 'checkbox',
1110   },
1111
1112   {
1113     'key'         => 'username-uppercase',
1114     'section'     => 'username',
1115     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1116     'type'        => 'checkbox',
1117   },
1118
1119   { 
1120     'key'         => 'username-percent',
1121     'section'     => 'username',
1122     'description' => 'Allow the percent character (%) in usernames.',
1123     'type'        => 'checkbox',
1124   },
1125
1126   {
1127     'key'         => 'safe-part_bill_event',
1128     'section'     => 'UI',
1129     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1130     'type'        => 'checkbox',
1131   },
1132
1133   {
1134     'key'         => 'show_ss',
1135     'section'     => 'UI',
1136     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
1137     'type'        => 'checkbox',
1138   },
1139
1140   {
1141     'key'         => 'show_stateid',
1142     'section'     => 'UI',
1143     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
1144     'type'        => 'checkbox',
1145   },
1146
1147   {
1148     'key'         => 'show_bankstate',
1149     'section'     => 'UI',
1150     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
1151     'type'        => 'checkbox',
1152   },
1153
1154   { 
1155     'key'         => 'agent_defaultpkg',
1156     'section'     => 'UI',
1157     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1158     'type'        => 'checkbox',
1159   },
1160
1161   {
1162     'key'         => 'legacy_link',
1163     'section'     => 'UI',
1164     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1165     'type'        => 'checkbox',
1166   },
1167
1168   {
1169     'key'         => 'legacy_link-steal',
1170     'section'     => 'UI',
1171     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1172     'type'        => 'checkbox',
1173   },
1174
1175   {
1176     'key'         => 'queue_dangerous_controls',
1177     'section'     => 'UI',
1178     '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.',
1179     'type'        => 'checkbox',
1180   },
1181
1182   {
1183     'key'         => 'security_phrase',
1184     'section'     => 'password',
1185     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1186     'type'        => 'checkbox',
1187   },
1188
1189   {
1190     'key'         => 'locale',
1191     'section'     => 'UI',
1192     'description' => 'Message locale',
1193     'type'        => 'select',
1194     'select_enum' => [ qw(en_US) ],
1195   },
1196
1197   {
1198     'key'         => 'signup_server-payby',
1199     'section'     => '',
1200     'description' => 'Acceptable payment types for the signup server',
1201     'type'        => 'selectmultiple',
1202     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1203   },
1204
1205   {
1206     'key'         => 'signup_server-default_agentnum',
1207     'section'     => '',
1208     'description' => 'Default agent for the signup server',
1209     'type'        => 'select-sub',
1210     'options_sub' => sub { require FS::Record;
1211                            require FS::agent;
1212                            map { $_->agentnum => $_->agent }
1213                                FS::Record::qsearch('agent', { disabled=>'' } );
1214                          },
1215     'option_sub'  => sub { require FS::Record;
1216                            require FS::agent;
1217                            my $agent = FS::Record::qsearchs(
1218                              'agent', { 'agentnum'=>shift }
1219                            );
1220                            $agent ? $agent->agent : '';
1221                          },
1222   },
1223
1224   {
1225     'key'         => 'signup_server-default_refnum',
1226     'section'     => '',
1227     'description' => 'Default advertising source for the signup server',
1228     'type'        => 'select-sub',
1229     'options_sub' => sub { require FS::Record;
1230                            require FS::part_referral;
1231                            map { $_->refnum => $_->referral }
1232                                FS::Record::qsearch( 'part_referral', 
1233                                                     { 'disabled' => '' }
1234                                                   );
1235                          },
1236     'option_sub'  => sub { require FS::Record;
1237                            require FS::part_referral;
1238                            my $part_referral = FS::Record::qsearchs(
1239                              'part_referral', { 'refnum'=>shift } );
1240                            $part_referral ? $part_referral->referral : '';
1241                          },
1242   },
1243
1244   {
1245     'key'         => 'signup_server-default_pkgpart',
1246     'section'     => '',
1247     'description' => 'Default pakcage for the signup server',
1248     'type'        => 'select-sub',
1249     'options_sub' => sub { require FS::Record;
1250                            require FS::part_pkg;
1251                            map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1252                                FS::Record::qsearch( 'part_pkg',
1253                                                     { 'disabled' => ''}
1254                                                   );
1255                          },
1256     'option_sub'  => sub { require FS::Record;
1257                            require FS::part_pkg;
1258                            my $part_pkg = FS::Record::qsearchs(
1259                              'part_pkg', { 'pkgpart'=>shift }
1260                            );
1261                            $part_pkg
1262                              ? $part_pkg->pkg.' - '.$part_pkg->comment
1263                              : '';
1264                          },
1265   },
1266
1267   {
1268     'key'         => 'show-msgcat-codes',
1269     'section'     => 'UI',
1270     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1271     'type'        => 'checkbox',
1272   },
1273
1274   {
1275     'key'         => 'signup_server-realtime',
1276     'section'     => '',
1277     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1278     'type'        => 'checkbox',
1279   },
1280   {
1281     'key'         => 'signup_server-classnum2',
1282     'section'     => '',
1283     'description' => 'Package Class for first optional purchase',
1284     'type'        => 'select-sub',
1285     'options_sub' => sub { require FS::Record;
1286                            require FS::pkg_class;
1287                            map { $_->classnum => $_->classname }
1288                                FS::Record::qsearch('pkg_class', {} );
1289                          },
1290     'option_sub'  => sub { require FS::Record;
1291                            require FS::pkg_class;
1292                            my $pkg_class = FS::Record::qsearchs(
1293                              'pkg_class', { 'classnum'=>shift }
1294                            );
1295                            $pkg_class ? $pkg_class->classname : '';
1296                          },
1297   },
1298
1299   {
1300     'key'         => 'signup_server-classnum3',
1301     'section'     => '',
1302     'description' => 'Package Class for second optional purchase',
1303     'type'        => 'select-sub',
1304     'options_sub' => sub { require FS::Record;
1305                            require FS::pkg_class;
1306                            map { $_->classnum => $_->classname }
1307                                FS::Record::qsearch('pkg_class', {} );
1308                          },
1309     'option_sub'  => sub { require FS::Record;
1310                            require FS::pkg_class;
1311                            my $pkg_class = FS::Record::qsearchs(
1312                              'pkg_class', { 'classnum'=>shift }
1313                            );
1314                            $pkg_class ? $pkg_class->classname : '';
1315                          },
1316   },
1317
1318   {
1319     'key'         => 'backend-realtime',
1320     'section'     => '',
1321     'description' => 'Run billing for backend signups immediately.',
1322     'type'        => 'checkbox',
1323   },
1324
1325   {
1326     'key'         => 'declinetemplate',
1327     'section'     => 'billing',
1328     'description' => 'Template file for credit card decline emails.',
1329     'type'        => 'textarea',
1330   },
1331
1332   {
1333     'key'         => 'emaildecline',
1334     'section'     => 'billing',
1335     'description' => 'Enable emailing of credit card decline notices.',
1336     'type'        => 'checkbox',
1337   },
1338
1339   {
1340     'key'         => 'emaildecline-exclude',
1341     'section'     => 'billing',
1342     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1343     'type'        => 'textarea',
1344   },
1345
1346   {
1347     'key'         => 'cancelmessage',
1348     'section'     => 'billing',
1349     'description' => 'Template file for cancellation emails.',
1350     'type'        => 'textarea',
1351   },
1352
1353   {
1354     'key'         => 'cancelsubject',
1355     'section'     => 'billing',
1356     'description' => 'Subject line for cancellation emails.',
1357     'type'        => 'text',
1358   },
1359
1360   {
1361     'key'         => 'emailcancel',
1362     'section'     => 'billing',
1363     'description' => 'Enable emailing of cancellation notices.  Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
1364     'type'        => 'checkbox',
1365   },
1366
1367   {
1368     'key'         => 'require_cardname',
1369     'section'     => 'billing',
1370     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1371     'type'        => 'checkbox',
1372   },
1373
1374   {
1375     'key'         => 'enable_taxclasses',
1376     'section'     => 'billing',
1377     'description' => 'Enable per-package tax classes',
1378     'type'        => 'checkbox',
1379   },
1380
1381   {
1382     'key'         => 'require_taxclasses',
1383     'section'     => 'billing',
1384     'description' => 'Require a taxclass to be entered for every package',
1385     'type'        => 'checkbox',
1386   },
1387
1388   {
1389     'key'         => 'welcome_email',
1390     'section'     => '',
1391     '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>',
1392     'type'        => 'textarea',
1393     'per_agent'   => 1,
1394   },
1395
1396   {
1397     'key'         => 'welcome_email-from',
1398     'section'     => '',
1399     'description' => 'From: address header for welcome email',
1400     'type'        => 'text',
1401     'per_agent'   => 1,
1402   },
1403
1404   {
1405     'key'         => 'welcome_email-subject',
1406     'section'     => '',
1407     'description' => 'Subject: header for welcome email',
1408     'type'        => 'text',
1409     'per_agent'   => 1,
1410   },
1411   
1412   {
1413     'key'         => 'welcome_email-mimetype',
1414     'section'     => '',
1415     'description' => 'MIME type for welcome email',
1416     'type'        => 'select',
1417     'select_enum' => [ 'text/plain', 'text/html' ],
1418     'per_agent'   => 1,
1419   },
1420
1421   {
1422     'key'         => 'welcome_letter',
1423     'section'     => '',
1424     'description' => 'Optional LaTex template file for a printed welcome letter.  A welcome letter is printed the first time a cust_pkg record is created.  See the <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation and the billing documentation for details on the template substitution language.  A variable exists for each fieldname in the customer record (<code>$first, $last, etc</code>).  The following additional variables are available<ul><li><code>$payby</code> - a friendler represenation of the field<li><code>$payinfo</code> - the masked payment information<li><code>$expdate</code> - the time at which the payment method expires (a UNIX timestamp)<li><code>$returnaddress</code> - the invoice return address for this customer\'s agent</ul>',
1425     'type'        => 'textarea',
1426   },
1427
1428   {
1429     'key'         => 'warning_email',
1430     'section'     => '',
1431     '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>',
1432     'type'        => 'textarea',
1433   },
1434
1435   {
1436     'key'         => 'warning_email-from',
1437     'section'     => '',
1438     'description' => 'From: address header for warning email',
1439     'type'        => 'text',
1440   },
1441
1442   {
1443     'key'         => 'warning_email-cc',
1444     'section'     => '',
1445     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1446     'type'        => 'text',
1447   },
1448
1449   {
1450     'key'         => 'warning_email-subject',
1451     'section'     => '',
1452     'description' => 'Subject: header for warning email',
1453     'type'        => 'text',
1454   },
1455   
1456   {
1457     'key'         => 'warning_email-mimetype',
1458     'section'     => '',
1459     'description' => 'MIME type for warning email',
1460     'type'        => 'select',
1461     'select_enum' => [ 'text/plain', 'text/html' ],
1462   },
1463
1464   {
1465     'key'         => 'payby',
1466     'section'     => 'billing',
1467     'description' => 'Available payment types.',
1468     'type'        => 'selectmultiple',
1469     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1470   },
1471
1472   {
1473     'key'         => 'payby-default',
1474     'section'     => 'UI',
1475     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1476     'type'        => 'select',
1477     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1478   },
1479
1480   {
1481     'key'         => 'paymentforcedtobatch',
1482     'section'     => 'UI',
1483     'description' => 'Causes per customer payment entry to be forced to a batch processor rather than performed realtime.',
1484     'type'        => 'checkbox',
1485   },
1486
1487   {
1488     'key'         => 'svc_acct-notes',
1489     'section'     => 'UI',
1490     'description' => 'Extra HTML to be displayed on the Account View screen.',
1491     'type'        => 'textarea',
1492   },
1493
1494   {
1495     'key'         => 'radius-password',
1496     'section'     => '',
1497     'description' => 'RADIUS attribute for plain-text passwords.',
1498     'type'        => 'select',
1499     'select_enum' => [ 'Password', 'User-Password' ],
1500   },
1501
1502   {
1503     'key'         => 'radius-ip',
1504     'section'     => '',
1505     'description' => 'RADIUS attribute for IP addresses.',
1506     'type'        => 'select',
1507     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1508   },
1509
1510   {
1511     'key'         => 'svc_acct-alldomains',
1512     'section'     => '',
1513     '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.',
1514     'type'        => 'checkbox',
1515   },
1516
1517   {
1518     'key'         => 'dump-scpdest',
1519     'section'     => '',
1520     'description' => 'destination for scp database dumps: user@host:/path',
1521     'type'        => 'text',
1522   },
1523
1524   {
1525     'key'         => 'dump-pgpid',
1526     'section'     => '',
1527     '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.",
1528     'type'        => 'text',
1529   },
1530
1531   {
1532     'key'         => 'cvv-save',
1533     'section'     => 'billing',
1534     '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.',
1535     'type'        => 'selectmultiple',
1536     'select_enum' => \@card_types,
1537   },
1538
1539   {
1540     'key'         => 'allow_negative_charges',
1541     'section'     => 'billing',
1542     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1543     'type'        => 'checkbox',
1544   },
1545   {
1546       'key'         => 'auto_unset_catchall',
1547       'section'     => '',
1548       '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.',
1549       'type'        => 'checkbox',
1550   },
1551
1552   {
1553     'key'         => 'system_usernames',
1554     'section'     => 'username',
1555     '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.',
1556     'type'        => 'textarea',
1557   },
1558
1559   {
1560     'key'         => 'cust_pkg-change_svcpart',
1561     'section'     => '',
1562     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1563     'type'        => 'checkbox',
1564   },
1565
1566   {
1567     'key'         => 'disable_autoreverse',
1568     'section'     => 'BIND',
1569     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1570     'type'        => 'checkbox',
1571   },
1572
1573   {
1574     'key'         => 'svc_www-enable_subdomains',
1575     'section'     => '',
1576     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1577     'type'        => 'checkbox',
1578   },
1579
1580   {
1581     'key'         => 'svc_www-usersvc_svcpart',
1582     'section'     => '',
1583     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1584     'type'        => 'textarea',
1585   },
1586
1587   {
1588     'key'         => 'selfservice_server-primary_only',
1589     'section'     => '',
1590     'description' => 'Only allow primary accounts to access self-service functionality.',
1591     'type'        => 'checkbox',
1592   },
1593
1594   {
1595     'key'         => 'card_refund-days',
1596     'section'     => 'billing',
1597     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1598     'type'        => 'text',
1599   },
1600
1601   {
1602     'key'         => 'agent-showpasswords',
1603     'section'     => '',
1604     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1605     'type'        => 'checkbox',
1606   },
1607
1608   {
1609     'key'         => 'global_unique-username',
1610     'section'     => 'username',
1611     '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.',
1612     'type'        => 'select',
1613     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1614   },
1615
1616   {
1617     'key'         => 'svc_external-skip_manual',
1618     'section'     => 'UI',
1619     '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).',
1620     'type'        => 'checkbox',
1621   },
1622
1623   {
1624     'key'         => 'svc_external-display_type',
1625     'section'     => 'UI',
1626     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1627     'type'        => 'select',
1628     'select_enum' => [ 'generic', 'artera_turbo', ],
1629   },
1630
1631   {
1632     'key'         => 'ticket_system',
1633     'section'     => '',
1634     'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
1635     'type'        => 'select',
1636     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1637     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1638   },
1639
1640   {
1641     'key'         => 'ticket_system-default_queueid',
1642     'section'     => '',
1643     'description' => 'Default queue used when creating new customer tickets.',
1644     'type'        => 'select-sub',
1645     'options_sub' => sub {
1646                            my $conf = new FS::Conf;
1647                            if ( $conf->config('ticket_system') ) {
1648                              eval "use FS::TicketSystem;";
1649                              die $@ if $@;
1650                              FS::TicketSystem->queues();
1651                            } else {
1652                              ();
1653                            }
1654                          },
1655     'option_sub'  => sub { 
1656                            my $conf = new FS::Conf;
1657                            if ( $conf->config('ticket_system') ) {
1658                              eval "use FS::TicketSystem;";
1659                              die $@ if $@;
1660                              FS::TicketSystem->queue(shift);
1661                            } else {
1662                              '';
1663                            }
1664                          },
1665   },
1666
1667   {
1668     'key'         => 'ticket_system-priority_reverse',
1669     'section'     => '',
1670     'description' => 'Enable this to consider lower numbered priorities more important.  A bad habit we picked up somewhere.  You probably want to avoid it and use the default.',
1671     'type'        => 'checkbox',
1672   },
1673
1674   {
1675     'key'         => 'ticket_system-custom_priority_field',
1676     'section'     => '',
1677     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1678     'type'        => 'text',
1679   },
1680
1681   {
1682     'key'         => 'ticket_system-custom_priority_field-values',
1683     'section'     => '',
1684     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1685     'type'        => 'textarea',
1686   },
1687
1688   {
1689     'key'         => 'ticket_system-custom_priority_field_queue',
1690     'section'     => '',
1691     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1692     'type'        => 'text',
1693   },
1694
1695   {
1696     'key'         => 'ticket_system-rt_external_datasrc',
1697     'section'     => '',
1698     '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>',
1699     'type'        => 'text',
1700
1701   },
1702
1703   {
1704     'key'         => 'ticket_system-rt_external_url',
1705     'section'     => '',
1706     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1707     'type'        => 'text',
1708   },
1709
1710   {
1711     'key'         => 'company_name',
1712     'section'     => 'required',
1713     'description' => 'Your company name',
1714     'type'        => 'text',
1715   },
1716
1717   {
1718     'key'         => 'company_address',
1719     'section'     => 'required',
1720     'description' => 'Your company address',
1721     'type'        => 'textarea',
1722   },
1723
1724   {
1725     'key'         => 'address2-search',
1726     'section'     => 'UI',
1727     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
1728     'type'        => 'checkbox',
1729   },
1730
1731   {
1732     'key'         => 'cust_main-require_address2',
1733     'section'     => 'UI',
1734     'description' => 'Second address field is required (on service address only, if billing and service addresses differ).  Also enables "Unit" labeling of address2 on customer view and edit pages.  Useful for multi-tenant applications.  See also: address2-search',
1735     'type'        => 'checkbox',
1736   },
1737
1738   { 'key'         => 'referral_credit',
1739     'section'     => 'billing',
1740     'description' => "Enables one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency).",
1741     'type'        => 'checkbox',
1742   },
1743
1744   { 'key'         => 'selfservice_server-cache_module',
1745     'section'     => '',
1746     '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.',
1747     'type'        => 'select',
1748     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1749   },
1750
1751   {
1752     'key'         => 'hylafax',
1753     'section'     => '',
1754     '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).',
1755     'type'        => [qw( checkbox textarea )],
1756   },
1757
1758   {
1759     'key'         => 'svc_acct-usage_suspend',
1760     'section'     => 'billing',
1761     '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.',
1762     'type'        => 'checkbox',
1763   },
1764
1765   {
1766     'key'         => 'svc_acct-usage_unsuspend',
1767     'section'     => 'billing',
1768     '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.',
1769     'type'        => 'checkbox',
1770   },
1771
1772   {
1773     'key'         => 'svc_acct-usage_threshold',
1774     'section'     => 'billing',
1775     '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.',
1776     'type'        => 'text',
1777   },
1778
1779   {
1780     'key'         => 'cust-fields',
1781     'section'     => 'UI',
1782     'description' => 'Which customer fields to display on reports by default',
1783     'type'        => 'select',
1784     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
1785   },
1786
1787   {
1788     'key'         => 'cust_pkg-display_times',
1789     'section'     => 'UI',
1790     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
1791     'type'        => 'checkbox',
1792   },
1793
1794   {
1795     'key'         => 'svc_acct-edit_uid',
1796     'section'     => 'shell',
1797     'description' => 'Allow UID editing.',
1798     'type'        => 'checkbox',
1799   },
1800
1801   {
1802     'key'         => 'svc_acct-edit_gid',
1803     'section'     => 'shell',
1804     'description' => 'Allow GID editing.',
1805     'type'        => 'checkbox',
1806   },
1807
1808   {
1809     'key'         => 'zone-underscore',
1810     'section'     => 'BIND',
1811     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
1812     'type'        => 'checkbox',
1813   },
1814
1815   {
1816     'key'         => 'echeck-nonus',
1817     'section'     => 'billing',
1818     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
1819     'type'        => 'checkbox',
1820   },
1821
1822   {
1823     'key'         => 'voip-cust_cdr_spools',
1824     'section'     => '',
1825     'description' => 'Enable the per-customer option for individual CDR spools.',
1826     'type'        => 'checkbox',
1827   },
1828
1829   {
1830     'key'         => 'svc_forward-arbitrary_dst',
1831     'section'     => '',
1832     '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.",
1833     'type'        => 'checkbox',
1834   },
1835
1836   {
1837     'key'         => 'tax-ship_address',
1838     'section'     => 'billing',
1839     '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.',
1840     'type'        => 'checkbox',
1841   },
1842
1843   {
1844     'key'         => 'batch-enable',
1845     'section'     => 'billing',
1846     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
1847     'type'        => 'checkbox',
1848   },
1849
1850   {
1851     'key'         => 'batch-default_format',
1852     'section'     => 'billing',
1853     'description' => 'Default format for batches.',
1854     'type'        => 'select',
1855     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
1856                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
1857                        'ach-spiritone',
1858                     ]
1859   },
1860
1861   {
1862     'key'         => 'batch-fixed_format-CARD',
1863     'section'     => 'billing',
1864     'description' => 'Fixed (unchangeable) format for credit card batches.',
1865     'type'        => 'select',
1866     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
1867                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
1868   },
1869
1870   {
1871     'key'         => 'batch-fixed_format-CHEK',
1872     'section'     => 'billing',
1873     'description' => 'Fixed (unchangeable) format for electronic check batches.',
1874     'type'        => 'select',
1875     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
1876                        'ach-spiritone',
1877                      ]
1878   },
1879
1880   {
1881     'key'         => 'batch-increment_expiration',
1882     'section'     => 'billing',
1883     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
1884     'type'        => 'checkbox'
1885   },
1886
1887   {
1888     'key'         => 'batchconfig-BoM',
1889     'section'     => 'billing',
1890     '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',
1891     'type'        => 'textarea',
1892   },
1893
1894   {
1895     'key'         => 'batchconfig-PAP',
1896     'section'     => 'billing',
1897     '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',
1898     'type'        => 'textarea',
1899   },
1900
1901   {
1902     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
1903     'section'     => 'billing',
1904     'description' => 'Gateway ID for Chase Canada E-xact batching',
1905     'type'        => 'text',
1906   },
1907
1908   {
1909     'key'         => 'payment_history-years',
1910     'section'     => 'UI',
1911     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
1912     'type'        => 'text',
1913   },
1914
1915   {
1916     'key'         => 'cust_main-use_comments',
1917     'section'     => 'UI',
1918     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
1919     'type'        => 'checkbox',
1920   },
1921
1922   {
1923     'key'         => 'cust_main-disable_notes',
1924     'section'     => 'UI',
1925     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
1926     'type'        => 'checkbox',
1927   },
1928
1929   {
1930     'key'         => 'cust_main_note-display_times',
1931     'section'     => 'UI',
1932     'description' => 'Display full timestamps (not just dates) for customer notes.',
1933     'type'        => 'checkbox',
1934   },
1935
1936   {
1937     'key'         => 'cust_main-ticket_statuses',
1938     'section'     => 'UI',
1939     'description' => 'Show tickets with these statuses on the customer view page.',
1940     'type'        => 'selectmultiple',
1941     'select_enum' => [qw( new open stalled resolved rejected deleted )],
1942   },
1943
1944   {
1945     'key'         => 'cust_main-max_tickets',
1946     'section'     => 'UI',
1947     'description' => 'Maximum number of tickets to show on the customer view page.',
1948     'type'        => 'text',
1949   },
1950
1951   {
1952     'key'         => 'cust_main-skeleton_tables',
1953     'section'     => '',
1954     '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.',
1955     'type'        => 'textarea',
1956   },
1957
1958   {
1959     'key'         => 'cust_main-skeleton_custnum',
1960     'section'     => '',
1961     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
1962     'type'        => 'text',
1963   },
1964
1965   {
1966     'key'         => 'cust_main-enable_birthdate',
1967     'section'     => 'UI',
1968     'descritpion' => 'Enable tracking of a birth date with each customer record',
1969     'type'        => 'checkbox',
1970   },
1971
1972   {
1973     'key'         => 'support-key',
1974     'section'     => '',
1975     '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.',
1976     'type'        => 'text',
1977   },
1978
1979   {
1980     'key'         => 'card-types',
1981     'section'     => 'billing',
1982     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
1983     'type'        => 'selectmultiple',
1984     'select_enum' => \@card_types,
1985   },
1986
1987   {
1988     'key'         => 'disable-fuzzy',
1989     'section'     => 'UI',
1990     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
1991     'type'        => 'checkbox',
1992   },
1993
1994   { 'key'         => 'pkg_referral',
1995     'section'     => '',
1996     'description' => 'Enable package-specific advertising sources.',
1997     'type'        => 'checkbox',
1998   },
1999
2000   { 'key'         => 'pkg_referral-multiple',
2001     'section'     => '',
2002     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
2003     'type'        => 'checkbox',
2004   },
2005
2006   {
2007     'key'         => 'dashboard-toplist',
2008     'section'     => 'UI',
2009     'description' => 'List of items to display on the top of the front page',
2010     'type'        => 'textarea',
2011   },
2012
2013   {
2014     'key'         => 'impending_recur_template',
2015     'section'     => 'billing',
2016     '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>',
2017 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
2018     'type'        => 'textarea',
2019   },
2020
2021   {
2022     'key'         => 'logo.png',
2023     'section'     => 'billing',  #? 
2024     'description' => 'An image to include in some types of invoices',
2025     'type'        => 'binary',
2026   },
2027
2028   {
2029     'key'         => 'logo.eps',
2030     'section'     => 'billing',  #? 
2031     'description' => 'An image to include in some types of invoices',
2032     'type'        => 'binary',
2033   },
2034
2035   {
2036     'key'         => 'selfservice-ignore_quantity',
2037     'section'     => '',
2038     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
2039     'type'        => 'checkbox',
2040   },
2041
2042   {
2043     'key'         => 'selfservice-session_timeout',
2044     'section'     => '',
2045     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
2046     'type'        => 'select',
2047     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
2048   },
2049
2050   {
2051     'key'         => 'disable_setup_suspended_pkgs',
2052     'section'     => 'billing',
2053     'description' => 'Disables charging of setup fees for suspended packages.',
2054     'type'       => 'checkbox',
2055   },
2056
2057   {
2058     'key' => 'password-generated-allcaps',
2059     'section' => 'password',
2060     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
2061     'type' => 'checkbox',
2062   },
2063
2064   {
2065     'key'         => 'datavolume-forcemegabytes',
2066     'section'     => 'UI',
2067     'description' => 'All data volumes are expressed in megabytes',
2068     'type'        => 'checkbox',
2069   },
2070
2071   {
2072     'key'         => 'datavolume-significantdigits',
2073     'section'     => 'UI',
2074     'description' => 'number of significant digits to use to represent data volumes',
2075     'type'        => 'text',
2076   },
2077
2078   {
2079     'key'         => 'disable_void_after',
2080     'section'     => 'billing',
2081     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
2082     'type'        => 'text',
2083   },
2084
2085   {
2086     'key'         => 'disable_line_item_date_ranges',
2087     'section'     => 'billing',
2088     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
2089     'type'        => 'checkbox',
2090   },
2091
2092   {
2093     'key'         => 'support_packages',
2094     'section'     => '',
2095     'description' => 'A list of packages eligible for RT ticket time transfer, one pkgpart per line.', #this should really be a select multiple, or specified in the packages themselves...
2096     'type'        => 'textarea',
2097   },
2098
2099   {
2100     'key'         => 'cust_main-require_phone',
2101     'section'     => '',
2102     'description' => 'Require daytime or night for all customer records.',
2103     'type'        => 'checkbox',
2104   },
2105
2106   {
2107     'key'         => 'cust_main-require_invoicing_list_email',
2108     'section'     => '',
2109     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
2110     'type'        => 'checkbox',
2111   },
2112
2113   {
2114     'key'         => 'svc_acct-display_paid_time_remaining',
2115     'section'     => '',
2116     'description' => 'Show paid time remaining in addition to time remaining.',
2117     'type'        => 'checkbox',
2118   },
2119
2120   {
2121     'key'         => 'cancel_credit_type',
2122     'section'     => 'billing',
2123     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
2124     'type'        => 'select-sub',
2125     'options_sub' => sub { require FS::Record;
2126                            require FS::reason_type;
2127                            map { $_->typenum => $_->type }
2128                                FS::Record::qsearch('reason_type', { class=>'R' } );
2129                          },
2130     'option_sub'  => sub { require FS::Record;
2131                            require FS::reason_type;
2132                            my $reason_type = FS::Record::qsearchs(
2133                              'reason_type', { 'typenum' => shift }
2134                            );
2135                            $reason_type ? $reason_type->type : '';
2136                          },
2137   },
2138
2139   {
2140     'key'         => 'referral_credit_type',
2141     'section'     => 'billing',
2142     'description' => 'The group to use for new, automatically generated credit reasons resulting from referrals.',
2143     'type'        => 'select-sub',
2144     'options_sub' => sub { require FS::Record;
2145                            require FS::reason_type;
2146                            map { $_->typenum => $_->type }
2147                                FS::Record::qsearch('reason_type', { class=>'R' } );
2148                          },
2149     'option_sub'  => sub { require FS::Record;
2150                            require FS::reason_type;
2151                            my $reason_type = FS::Record::qsearchs(
2152                              'reason_type', { 'typenum' => shift }
2153                            );
2154                            $reason_type ? $reason_type->type : '';
2155                          },
2156   },
2157
2158   {
2159     'key'         => 'signup_credit_type',
2160     'section'     => 'billing',
2161     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
2162     'type'        => 'select-sub',
2163     'options_sub' => sub { require FS::Record;
2164                            require FS::reason_type;
2165                            map { $_->typenum => $_->type }
2166                                FS::Record::qsearch('reason_type', { class=>'R' } );
2167                          },
2168     'option_sub'  => sub { require FS::Record;
2169                            require FS::reason_type;
2170                            my $reason_type = FS::Record::qsearchs(
2171                              'reason_type', { 'typenum' => shift }
2172                            );
2173                            $reason_type ? $reason_type->type : '';
2174                          },
2175   },
2176
2177   {
2178     'key'         => 'cust_main-agent_custid-format',
2179     'section'     => '',
2180     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
2181     'type'        => 'select',
2182     'select_hash' => [
2183                        ''      => 'Numeric only',
2184                        'ww?d+' => 'Numeric with one or two letter prefix',
2185                      ],
2186   },
2187
2188   {
2189     'key'         => 'card_masking_method',
2190     'section'     => 'UI',
2191     'description' => 'Digits to display when masking credit cards.  Note that the first six digits are necessary to canonically identify the credit card type (Visa/MC, Amex, Discover, Maestro, etc.) in all cases.  The first four digits can identify the most common credit card types in most cases (Visa/MC, Amex, and Discover).  The first two digits can distinguish between Visa/MC and Amex.',
2192     'type'        => 'select',
2193     'select_hash' => [
2194                        ''            => '123456xxxxxx1234',
2195                        'first6last2' => '123456xxxxxxxx12',
2196                        'first4last4' => '1234xxxxxxxx1234',
2197                        'first4last2' => '1234xxxxxxxxxx12',
2198                        'first2last4' => '12xxxxxxxxxx1234',
2199                        'first2last2' => '12xxxxxxxxxxxx12',
2200                        'first0last4' => 'xxxxxxxxxxxx1234',
2201                        'first0last2' => 'xxxxxxxxxxxxxx12',
2202                      ],
2203   },
2204
2205 );
2206
2207 1;