bulk provisioning via ftp and SOAP #5202
[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::payby;
12 use FS::conf;
13 use FS::Record qw(qsearch qsearchs);
14 use FS::UID qw(dbh datasrc use_confcompat);
15
16 $base_dir = '%%%FREESIDE_CONF%%%';
17
18 $DEBUG = 0;
19
20 =head1 NAME
21
22 FS::Conf - Freeside configuration values
23
24 =head1 SYNOPSIS
25
26   use FS::Conf;
27
28   $conf = new FS::Conf;
29
30   $value = $conf->config('key');
31   @list  = $conf->config('key');
32   $bool  = $conf->exists('key');
33
34   $conf->touch('key');
35   $conf->set('key' => 'value');
36   $conf->delete('key');
37
38   @config_items = $conf->config_items;
39
40 =head1 DESCRIPTION
41
42 Read and write Freeside configuration values.  Keys currently map to filenames,
43 but this may change in the future.
44
45 =head1 METHODS
46
47 =over 4
48
49 =item new
50
51 Create a new configuration object.
52
53 =cut
54
55 sub new {
56   my($proto) = @_;
57   my($class) = ref($proto) || $proto;
58   my($self) = { 'base_dir' => $base_dir };
59   bless ($self, $class);
60 }
61
62 =item base_dir
63
64 Returns the base directory.  By default this is /usr/local/etc/freeside.
65
66 =cut
67
68 sub base_dir {
69   my($self) = @_;
70   my $base_dir = $self->{base_dir};
71   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
72   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
73   -r $base_dir or die "FATAL: Can't read $base_dir!";
74   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
75   $base_dir =~ /^(.*)$/;
76   $1;
77 }
78
79 =item config KEY [ AGENTNUM ]
80
81 Returns the configuration value or values (depending on context) for key.
82 The optional agent number selects an agent specific value instead of the
83 global default if one is present.
84
85 =cut
86
87 sub _usecompat {
88   my ($self, $method) = (shift, shift);
89   carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
90     if use_confcompat;
91   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
92   $compat->$method(@_);
93 }
94
95 # needs a non _ name, called externally by config-view now (and elsewhere?)
96 sub _config {
97   my($self,$name,$agentnum)=@_;
98   my $hashref = { 'name' => $name };
99   $hashref->{agentnum} = $agentnum;
100   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
101   my $cv = FS::Record::qsearchs('conf', $hashref);
102   if (!$cv && defined($agentnum) && $agentnum) {
103     $hashref->{agentnum} = '';
104     $cv = FS::Record::qsearchs('conf', $hashref);
105   }
106   return $cv;
107 }
108
109 sub config {
110   my $self = shift;
111   return $self->_usecompat('config', @_) if use_confcompat;
112
113   my($name, $agentnum)=@_;
114
115   carp "FS::Conf->config($name, $agentnum) called"
116     if $DEBUG > 1;
117
118   my $cv = $self->_config($name, $agentnum) or return;
119
120   if ( wantarray ) {
121     my $v = $cv->value;
122     chomp $v;
123     (split "\n", $v, -1);
124   } else {
125     (split("\n", $cv->value))[0];
126   }
127 }
128
129 =item config_binary KEY [ AGENTNUM ]
130
131 Returns the exact scalar value for key.
132
133 =cut
134
135 sub config_binary {
136   my $self = shift;
137   return $self->_usecompat('config_binary', @_) if use_confcompat;
138
139   my($name,$agentnum)=@_;
140   my $cv = $self->_config($name, $agentnum) or return;
141   decode_base64($cv->value);
142 }
143
144 =item exists KEY [ AGENTNUM ]
145
146 Returns true if the specified key exists, even if the corresponding value
147 is undefined.
148
149 =cut
150
151 sub exists {
152   my $self = shift;
153   return $self->_usecompat('exists', @_) if use_confcompat;
154
155   my($name, $agentnum)=@_;
156
157   carp "FS::Conf->exists($name, $agentnum) called"
158     if $DEBUG > 1;
159
160   defined($self->_config($name, $agentnum));
161 }
162
163 =item config_orbase KEY SUFFIX
164
165 Returns the configuration value or values (depending on context) for 
166 KEY_SUFFIX, if it exists, otherwise for KEY
167
168 =cut
169
170 # outmoded as soon as we shift to agentnum based config values
171 # well, mostly.  still useful for e.g. late notices, etc. in that we want
172 # these to fall back to standard values
173 sub config_orbase {
174   my $self = shift;
175   return $self->_usecompat('config_orbase', @_) if use_confcompat;
176
177   my( $name, $suffix ) = @_;
178   if ( $self->exists("${name}_$suffix") ) {
179     $self->config("${name}_$suffix");
180   } else {
181     $self->config($name);
182   }
183 }
184
185 =item key_orbase KEY SUFFIX
186
187 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
188 KEY.  Useful for determining which exact configuration option is returned by
189 config_orbase.
190
191 =cut
192
193 sub key_orbase {
194   my $self = shift;
195   #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
196
197   my( $name, $suffix ) = @_;
198   if ( $self->exists("${name}_$suffix") ) {
199     "${name}_$suffix";
200   } else {
201     $name;
202   }
203 }
204
205 =item invoice_templatenames
206
207 Returns all possible invoice template names.
208
209 =cut
210
211 sub invoice_templatenames {
212   my( $self ) = @_;
213
214   my %templatenames = ();
215   foreach my $item ( $self->config_items ) {
216     foreach my $base ( @base_items ) {
217       my( $main, $ext) = split(/\./, $base);
218       $ext = ".$ext" if $ext;
219       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
220       $templatenames{$1}++;
221       }
222     }
223   }
224   
225   sort keys %templatenames;
226
227 }
228
229 =item touch KEY [ AGENT ];
230
231 Creates the specified configuration key if it does not exist.
232
233 =cut
234
235 sub touch {
236   my $self = shift;
237   return $self->_usecompat('touch', @_) if use_confcompat;
238
239   my($name, $agentnum) = @_;
240   unless ( $self->exists($name, $agentnum) ) {
241     $self->set($name, '', $agentnum);
242   }
243 }
244
245 =item set KEY VALUE [ AGENTNUM ];
246
247 Sets the specified configuration key to the given value.
248
249 =cut
250
251 sub set {
252   my $self = shift;
253   return $self->_usecompat('set', @_) if use_confcompat;
254
255   my($name, $value, $agentnum) = @_;
256   $value =~ /^(.*)$/s;
257   $value = $1;
258
259   warn "[FS::Conf] SET $name\n" if $DEBUG;
260
261   my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
262   my $new = new FS::conf { $old ? $old->hash 
263                                 : ('name' => $name, 'agentnum' => $agentnum)
264                          };
265   $new->value($value);
266
267   my $error;
268   if ($old) {
269     $error = $new->replace($old);
270   } else {
271     $error = $new->insert;
272   }
273
274   die "error setting configuration value: $error \n"
275     if $error;
276
277 }
278
279 =item set_binary KEY VALUE [ AGENTNUM ]
280
281 Sets the specified configuration key to an exact scalar value which
282 can be retrieved with config_binary.
283
284 =cut
285
286 sub set_binary {
287   my $self  = shift;
288   return if use_confcompat;
289
290   my($name, $value, $agentnum)=@_;
291   $self->set($name, encode_base64($value), $agentnum);
292 }
293
294 =item delete KEY [ AGENTNUM ];
295
296 Deletes the specified configuration key.
297
298 =cut
299
300 sub delete {
301   my $self = shift;
302   return $self->_usecompat('delete', @_) if use_confcompat;
303
304   my($name, $agentnum) = @_;
305   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
306     warn "[FS::Conf] DELETE $name\n";
307
308     my $oldAutoCommit = $FS::UID::AutoCommit;
309     local $FS::UID::AutoCommit = 0;
310     my $dbh = dbh;
311
312     my $error = $cv->delete;
313
314     if ( $error ) {
315       $dbh->rollback if $oldAutoCommit;
316       die "error setting configuration value: $error \n"
317     }
318
319     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
320
321   }
322 }
323
324 =item import_config_item CONFITEM DIR 
325
326   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
327 the database as a conf record (see L<FS::conf>).  Imports from the file
328 in the directory DIR.
329
330 =cut
331
332 sub import_config_item { 
333   my ($self,$item,$dir) = @_;
334   my $key = $item->key;
335   if ( -e "$dir/$key" && ! use_confcompat ) {
336     warn "Inserting $key\n" if $DEBUG;
337     local $/;
338     my $value = readline(new IO::File "$dir/$key");
339     if ($item->type =~ /^(binary|image)$/ ) {
340       $self->set_binary($key, $value);
341     }else{
342       $self->set($key, $value);
343     }
344   }else {
345     warn "Not inserting $key\n" if $DEBUG;
346   }
347 }
348
349 =item verify_config_item CONFITEM DIR 
350
351   Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
352 the database to the legacy file value in DIR.
353
354 =cut
355
356 sub verify_config_item { 
357   return '' if use_confcompat;
358   my ($self,$item,$dir) = @_;
359   my $key = $item->key;
360   my $type = $item->type;
361
362   my $compat = new FS::Conf_compat17 $dir;
363   my $error = '';
364   
365   $error .= "$key fails existential comparison; "
366     if $self->exists($key) xor $compat->exists($key);
367
368   if ( $type !~ /^(binary|image)$/ ) {
369
370     {
371       no warnings;
372       $error .= "$key fails scalar comparison; "
373         unless scalar($self->config($key)) eq scalar($compat->config($key));
374     }
375
376     my (@new) = $self->config($key);
377     my (@old) = $compat->config($key);
378     unless ( scalar(@new) == scalar(@old)) { 
379       $error .= "$key fails list comparison; ";
380     }else{
381       my $r=1;
382       foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
383       $error .= "$key fails list comparison; "
384         unless $r;
385     }
386
387   } else {
388
389     $error .= "$key fails binary comparison; "
390       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
391
392   }
393
394 #remove deprecated config on our own terms, not freeside-upgrade's
395 #  if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
396 #    my $proto;
397 #    for ( @config_items ) { $proto = $_; last if $proto->key eq $key;  }
398 #    unless ($proto->key eq $key) { 
399 #      warn "removed config item $error\n" if $DEBUG;
400 #      $error = '';
401 #    }
402 #  }
403
404   $error;
405 }
406
407 #item _orbase_items OPTIONS
408 #
409 #Returns all of the possible extensible config items as FS::ConfItem objects.
410 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
411 #options include
412 #
413 # dir - the directory to search for configuration option files instead
414 #       of using the conf records in the database
415 #
416 #cut
417
418 #quelle kludge
419 sub _orbase_items {
420   my ($self, %opt) = @_; 
421
422   my $listmaker = sub { my $v = shift;
423                         $v =~ s/_/!_/g;
424                         if ( $v =~ /\.(png|eps)$/ ) {
425                           $v =~ s/\./!_%./;
426                         }else{
427                           $v .= '!_%';
428                         }
429                         map { $_->name }
430                           FS::Record::qsearch( 'conf',
431                                                {},
432                                                '',
433                                                "WHERE name LIKE '$v' ESCAPE '!'"
434                                              );
435                       };
436
437   if (exists($opt{dir}) && $opt{dir}) {
438     $listmaker = sub { my $v = shift;
439                        if ( $v =~ /\.(png|eps)$/ ) {
440                          $v =~ s/\./_*./;
441                        }else{
442                          $v .= '_*';
443                        }
444                        map { basename $_ } glob($opt{dir}. "/$v" );
445                      };
446   }
447
448   ( map { 
449           my $proto;
450           my $base = $_;
451           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
452           die "don't know about $base items" unless $proto->key eq $base;
453
454           map { new FS::ConfItem { 
455                   'key'         => $_,
456                   'base_key'    => $proto->key,
457                   'section'     => $proto->section,
458                   'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
459                   'type'        => $proto->type,
460                 };
461               } &$listmaker($base);
462         } @base_items,
463   );
464 }
465
466 =item config_items
467
468 Returns all of the possible global/default configuration items as
469 FS::ConfItem objects.  See L<FS::ConfItem>.
470
471 =cut
472
473 sub config_items {
474   my $self = shift; 
475   return $self->_usecompat('config_items', @_) if use_confcompat;
476
477   ( @config_items, $self->_orbase_items(@_) );
478 }
479
480 =back
481
482 =head1 SUBROUTINES
483
484 =over 4
485
486 =item init-config DIR
487
488 Imports the configuration items from DIR (1.7 compatible)
489 to conf records in the database.
490
491 =cut
492
493 sub init_config {
494   my $dir = shift;
495
496   {
497     local $FS::UID::use_confcompat = 0;
498     my $conf = new FS::Conf;
499     foreach my $item ( $conf->config_items(dir => $dir) ) {
500       $conf->import_config_item($item, $dir);
501       my $error = $conf->verify_config_item($item, $dir);
502       return $error if $error;
503     }
504   
505     my $compat = new FS::Conf_compat17 $dir;
506     foreach my $item ( $compat->config_items ) {
507       my $error = $conf->verify_config_item($item, $dir);
508       return $error if $error;
509     }
510   }
511
512   $FS::UID::use_confcompat = 0;
513   '';  #success
514 }
515
516 =back
517
518 =head1 BUGS
519
520 If this was more than just crud that will never be useful outside Freeside I'd
521 worry that config_items is freeside-specific and icky.
522
523 =head1 SEE ALSO
524
525 "Configuration" in the web interface (config/config.cgi).
526
527 =cut
528
529 #Business::CreditCard
530 @card_types = (
531   "VISA card",
532   "MasterCard",
533   "Discover card",
534   "American Express card",
535   "Diner's Club/Carte Blanche",
536   "enRoute",
537   "JCB",
538   "BankCard",
539   "Switch",
540   "Solo",
541 );
542
543 @base_items = qw (
544                    invoice_template
545                    invoice_latex
546                    invoice_latexreturnaddress
547                    invoice_latexfooter
548                    invoice_latexsmallfooter
549                    invoice_latexnotes
550                    invoice_latexcoupon
551                    invoice_html
552                    invoice_htmlreturnaddress
553                    invoice_htmlfooter
554                    invoice_htmlnotes
555                    logo.png
556                    logo.eps
557                  );
558
559 @config_items = map { new FS::ConfItem $_ } (
560
561   {
562     'key'         => 'address',
563     'section'     => 'deprecated',
564     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
565     'type'        => 'text',
566   },
567
568   {
569     'key'         => 'alerter_template',
570     'section'     => 'billing',
571     'description' => 'Template file for billing method expiration alerts.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
572     'type'        => 'textarea',
573     'per-agent'   => 1,
574   },
575
576   {
577     'key'         => 'apacheip',
578     #not actually deprecated yet
579     #'section'     => 'deprecated',
580     #'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',
581     'section'     => '',
582     'description' => 'IP address to assign to new virtual hosts',
583     'type'        => 'text',
584   },
585
586   {
587     'key'         => 'encryption',
588     'section'     => 'billing',
589     'description' => 'Enable encryption of credit cards.',
590     'type'        => 'checkbox',
591   },
592
593   {
594     'key'         => 'encryptionmodule',
595     'section'     => 'billing',
596     'description' => 'Use which module for encryption?',
597     'type'        => 'text',
598   },
599
600   {
601     'key'         => 'encryptionpublickey',
602     'section'     => 'billing',
603     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
604     'type'        => 'textarea',
605   },
606
607   {
608     'key'         => 'encryptionprivatekey',
609     'section'     => 'billing',
610     '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.',
611     'type'        => 'textarea',
612   },
613
614   {
615     'key'         => 'business-onlinepayment',
616     'section'     => 'billing',
617     '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.',
618     'type'        => 'textarea',
619   },
620
621   {
622     'key'         => 'business-onlinepayment-ach',
623     'section'     => 'billing',
624     '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.',
625     'type'        => 'textarea',
626   },
627
628   {
629     'key'         => 'business-onlinepayment-namespace',
630     'section'     => 'billing',
631     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
632     'type'        => 'select',
633     'select_hash' => [
634                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
635                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
636                      ],
637   },
638
639   {
640     'key'         => 'business-onlinepayment-description',
641     'section'     => 'billing',
642     '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)',
643     'type'        => 'text',
644   },
645
646   {
647     'key'         => 'business-onlinepayment-email-override',
648     'section'     => 'billing',
649     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
650     'type'        => 'text',
651   },
652
653   {
654     'key'         => 'business-onlinepayment-email_customer',
655     'section'     => 'billing',
656     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
657     'type'        => 'checkbox',
658   },
659
660   {
661     'key'         => 'countrydefault',
662     'section'     => 'UI',
663     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
664     'type'        => 'text',
665   },
666
667   {
668     'key'         => 'date_format',
669     'section'     => 'UI',
670     'description' => 'Format for displaying dates',
671     'type'        => 'select',
672     'select_hash' => [
673                        '%m/%d/%Y' => 'MM/DD/YYYY',
674                        '%Y/%m/%d' => 'YYYY/MM/DD',
675                      ],
676   },
677
678   {
679     'key'         => 'deletecustomers',
680     'section'     => 'UI',
681     '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.',
682     'type'        => 'checkbox',
683   },
684
685   {
686     'key'         => 'deletepayments',
687     'section'     => 'billing',
688     '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.',
689     'type'        => [qw( checkbox text )],
690   },
691
692   {
693     'key'         => 'deletecredits',
694     #not actually deprecated yet
695     #'section'     => 'deprecated',
696     #'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.',
697     'section'     => '',
698     'description' => 'One or more comma-separated email addresses to be notified when a credit is deleted.',
699     'type'        => [qw( checkbox text )],
700   },
701
702   {
703     'key'         => 'deleterefunds',
704     'section'     => 'billing',
705     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
706     'type'        => 'checkbox',
707   },
708
709   {
710     'key'         => 'dirhash',
711     'section'     => 'shell',
712     '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>',
713     'type'        => 'text',
714   },
715
716   {
717     'key'         => 'disable_customer_referrals',
718     'section'     => 'UI',
719     'description' => 'Disable new customer-to-customer referrals in the web interface',
720     'type'        => 'checkbox',
721   },
722
723   {
724     'key'         => 'editreferrals',
725     'section'     => 'UI',
726     'description' => 'Enable advertising source modification for existing customers',
727     'type'       => 'checkbox',
728   },
729
730   {
731     'key'         => 'emailinvoiceonly',
732     'section'     => 'billing',
733     'description' => 'Disables postal mail invoices',
734     'type'       => 'checkbox',
735   },
736
737   {
738     'key'         => 'disablepostalinvoicedefault',
739     'section'     => 'billing',
740     '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>.',
741     'type'       => 'checkbox',
742   },
743
744   {
745     'key'         => 'emailinvoiceauto',
746     'section'     => 'billing',
747     'description' => 'Automatically adds new accounts to the email invoice list',
748     'type'       => 'checkbox',
749   },
750
751   {
752     'key'         => 'emailinvoiceautoalways',
753     'section'     => 'billing',
754     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
755     'type'       => 'checkbox',
756   },
757
758   {
759     'key'         => 'exclude_ip_addr',
760     'section'     => '',
761     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
762     'type'        => 'textarea',
763   },
764   
765   {
766     'key'         => 'auto_router',
767     'section'     => '',
768     'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
769     'type'        => 'checkbox',
770   },
771   
772   {
773     'key'         => 'hidecancelledpackages',
774     'section'     => 'UI',
775     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
776     'type'        => 'checkbox',
777   },
778
779   {
780     'key'         => 'hidecancelledcustomers',
781     'section'     => 'UI',
782     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
783     'type'        => 'checkbox',
784   },
785
786   {
787     'key'         => 'home',
788     'section'     => 'shell',
789     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
790     'type'        => 'text',
791   },
792
793   {
794     'key'         => 'invoice_from',
795     'section'     => 'required',
796     'description' => 'Return address on email invoices',
797     'type'        => 'text',
798     'per_agent'   => 1,
799   },
800
801   {
802     'key'         => 'invoice_subject',
803     'section'     => 'billing',
804     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
805     'type'        => 'text',
806     'per_agent'   => 1,
807   },
808
809   {
810     'key'         => 'invoice_template',
811     'section'     => 'billing',
812     '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.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
813     'type'        => 'textarea',
814   },
815
816   {
817     'key'         => 'invoice_html',
818     'section'     => 'billing',
819     'description' => 'Optional HTML template for invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
820
821     'type'        => 'textarea',
822   },
823
824   {
825     'key'         => 'invoice_htmlnotes',
826     'section'     => 'billing',
827     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
828     'type'        => 'textarea',
829     'per_agent'   => 1,
830   },
831
832   {
833     'key'         => 'invoice_htmlfooter',
834     'section'     => 'billing',
835     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
836     'type'        => 'textarea',
837     'per_agent'   => 1,
838   },
839
840   {
841     'key'         => 'invoice_htmlreturnaddress',
842     'section'     => 'billing',
843     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
844     'type'        => 'textarea',
845   },
846
847   {
848     'key'         => 'invoice_latex',
849     'section'     => 'billing',
850     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
851     'type'        => 'textarea',
852   },
853
854   {
855     'key'         => 'invoice_latexnotes',
856     'section'     => 'billing',
857     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
858     'type'        => 'textarea',
859     'per_agent'   => 1,
860   },
861
862   {
863     'key'         => 'invoice_latexfooter',
864     'section'     => 'billing',
865     'description' => 'Footer for LaTeX typeset PostScript invoices.',
866     'type'        => 'textarea',
867     'per_agent'   => 1,
868   },
869
870   {
871     'key'         => 'invoice_latexcoupon',
872     'section'     => 'billing',
873     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
874     'type'        => 'textarea',
875     'per_agent'   => 1,
876   },
877
878   {
879     'key'         => 'invoice_latexreturnaddress',
880     'section'     => 'billing',
881     'description' => 'Return address for LaTeX typeset PostScript invoices.',
882     'type'        => 'textarea',
883   },
884
885   {
886     'key'         => 'invoice_latexsmallfooter',
887     'section'     => 'billing',
888     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
889     'type'        => 'textarea',
890     'per_agent'   => 1,
891   },
892
893   {
894     'key'         => 'invoice_email_pdf',
895     'section'     => 'billing',
896     '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.',
897     'type'        => 'checkbox'
898   },
899
900   {
901     'key'         => 'invoice_email_pdf_note',
902     'section'     => 'billing',
903     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
904     'type'        => 'textarea'
905   },
906
907
908   { 
909     'key'         => 'invoice_default_terms',
910     'section'     => 'billing',
911     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
912     'type'        => 'select',
913     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 20', 'Net 30', 'Net 45', 'Net 60' ],
914   },
915
916   { 
917     'key'         => 'invoice_sections',
918     'section'     => 'billing',
919     'description' => 'Split invoice into sections and label according to package class when enabled.',
920     'type'        => 'checkbox',
921   },
922
923   { 
924     'key'         => 'separate_usage',
925     'section'     => 'billing',
926     'description' => 'Split the rated call usage into a separate line from the recurring charges.',
927     'type'        => 'checkbox',
928   },
929
930   {
931     'key'         => 'payment_receipt_email',
932     'section'     => 'billing',
933     '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/dist/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>',
934     'type'        => [qw( checkbox textarea )],
935   },
936
937   {
938     'key'         => 'lpr',
939     'section'     => 'required',
940     'description' => 'Print command for paper invoices, for example `lpr -h\'',
941     'type'        => 'text',
942   },
943
944   {
945     'key'         => 'lpr-postscript_prefix',
946     'section'     => 'billing',
947     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
948     'type'        => 'text',
949   },
950
951   {
952     'key'         => 'lpr-postscript_suffix',
953     'section'     => 'billing',
954     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
955     'type'        => 'text',
956   },
957
958   {
959     'key'         => 'money_char',
960     'section'     => '',
961     'description' => 'Currency symbol - defaults to `$\'',
962     'type'        => 'text',
963   },
964
965   {
966     'key'         => 'defaultrecords',
967     'section'     => 'BIND',
968     'description' => 'DNS entries to add automatically when creating a domain',
969     'type'        => 'editlist',
970     'editlist_parts' => [ { type=>'text' },
971                           { type=>'immutable', value=>'IN' },
972                           { type=>'select',
973                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
974                           { type=> 'text' }, ],
975   },
976
977   {
978     'key'         => 'passwordmin',
979     'section'     => 'password',
980     'description' => 'Minimum password length (default 6)',
981     'type'        => 'text',
982   },
983
984   {
985     'key'         => 'passwordmax',
986     'section'     => 'password',
987     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
988     'type'        => 'text',
989   },
990
991   {
992     'key' => 'password-noampersand',
993     'section' => 'password',
994     'description' => 'Disallow ampersands in passwords',
995     'type' => 'checkbox',
996   },
997
998   {
999     'key' => 'password-noexclamation',
1000     'section' => 'password',
1001     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
1002     'type' => 'checkbox',
1003   },
1004
1005   {
1006     'key'         => 'referraldefault',
1007     'section'     => 'UI',
1008     'description' => 'Default referral, specified by refnum',
1009     'type'        => 'text',
1010   },
1011
1012 #  {
1013 #    'key'         => 'registries',
1014 #    'section'     => 'required',
1015 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
1016 #  },
1017
1018   {
1019     'key'         => 'maxsearchrecordsperpage',
1020     'section'     => 'UI',
1021     'description' => 'If set, number of search records to return per page.',
1022     'type'        => 'text',
1023   },
1024
1025   {
1026     'key'         => 'session-start',
1027     'section'     => 'session',
1028     '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.',
1029     'type'        => 'text',
1030   },
1031
1032   {
1033     'key'         => 'session-stop',
1034     'section'     => 'session',
1035     '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.',
1036     'type'        => 'text',
1037   },
1038
1039   {
1040     'key'         => 'shells',
1041     'section'     => 'shell',
1042     '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.',
1043     'type'        => 'textarea',
1044   },
1045
1046   {
1047     'key'         => 'showpasswords',
1048     'section'     => 'UI',
1049     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1050     'type'        => 'checkbox',
1051   },
1052
1053   {
1054     'key'         => 'signupurl',
1055     'section'     => 'UI',
1056     'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="http://www.freeside.biz/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',
1057     'type'        => 'text',
1058   },
1059
1060   {
1061     'key'         => 'smtpmachine',
1062     'section'     => 'required',
1063     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1064     'type'        => 'text',
1065   },
1066
1067   {
1068     'key'         => 'soadefaultttl',
1069     'section'     => 'BIND',
1070     'description' => 'SOA default TTL for new domains.',
1071     'type'        => 'text',
1072   },
1073
1074   {
1075     'key'         => 'soaemail',
1076     'section'     => 'BIND',
1077     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1078     'type'        => 'text',
1079   },
1080
1081   {
1082     'key'         => 'soaexpire',
1083     'section'     => 'BIND',
1084     'description' => 'SOA expire for new domains',
1085     'type'        => 'text',
1086   },
1087
1088   {
1089     'key'         => 'soamachine',
1090     'section'     => 'BIND',
1091     'description' => 'SOA machine for new domains, with trailing `.\'',
1092     'type'        => 'text',
1093   },
1094
1095   {
1096     'key'         => 'soarefresh',
1097     'section'     => 'BIND',
1098     'description' => 'SOA refresh for new domains',
1099     'type'        => 'text',
1100   },
1101
1102   {
1103     'key'         => 'soaretry',
1104     'section'     => 'BIND',
1105     'description' => 'SOA retry for new domains',
1106     'type'        => 'text',
1107   },
1108
1109   {
1110     'key'         => 'statedefault',
1111     'section'     => 'UI',
1112     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1113     'type'        => 'text',
1114   },
1115
1116   {
1117     'key'         => 'unsuspendauto',
1118     'section'     => 'billing',
1119     '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',
1120     'type'        => 'checkbox',
1121   },
1122
1123   {
1124     'key'         => 'unsuspend-always_adjust_next_bill_date',
1125     'section'     => 'billing',
1126     '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.',
1127     'type'        => 'checkbox',
1128   },
1129
1130   {
1131     'key'         => 'usernamemin',
1132     'section'     => 'username',
1133     'description' => 'Minimum username length (default 2)',
1134     'type'        => 'text',
1135   },
1136
1137   {
1138     'key'         => 'usernamemax',
1139     'section'     => 'username',
1140     'description' => 'Maximum username length',
1141     'type'        => 'text',
1142   },
1143
1144   {
1145     'key'         => 'username-ampersand',
1146     'section'     => 'username',
1147     '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.',
1148     'type'        => 'checkbox',
1149   },
1150
1151   {
1152     'key'         => 'username-letter',
1153     'section'     => 'username',
1154     'description' => 'Usernames must contain at least one letter',
1155     'type'        => 'checkbox',
1156     'per_agent'   => 1,
1157   },
1158
1159   {
1160     'key'         => 'username-letterfirst',
1161     'section'     => 'username',
1162     'description' => 'Usernames must start with a letter',
1163     'type'        => 'checkbox',
1164   },
1165
1166   {
1167     'key'         => 'username-noperiod',
1168     'section'     => 'username',
1169     'description' => 'Disallow periods in usernames',
1170     'type'        => 'checkbox',
1171   },
1172
1173   {
1174     'key'         => 'username-nounderscore',
1175     'section'     => 'username',
1176     'description' => 'Disallow underscores in usernames',
1177     'type'        => 'checkbox',
1178   },
1179
1180   {
1181     'key'         => 'username-nodash',
1182     'section'     => 'username',
1183     'description' => 'Disallow dashes in usernames',
1184     'type'        => 'checkbox',
1185   },
1186
1187   {
1188     'key'         => 'username-uppercase',
1189     'section'     => 'username',
1190     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1191     'type'        => 'checkbox',
1192   },
1193
1194   { 
1195     'key'         => 'username-percent',
1196     'section'     => 'username',
1197     'description' => 'Allow the percent character (%) in usernames.',
1198     'type'        => 'checkbox',
1199   },
1200
1201   { 
1202     'key'         => 'username-colon',
1203     'section'     => 'username',
1204     'description' => 'Allow the colon character (:) in usernames.',
1205     'type'        => 'checkbox',
1206   },
1207
1208   {
1209     'key'         => 'safe-part_bill_event',
1210     'section'     => 'UI',
1211     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1212     'type'        => 'checkbox',
1213   },
1214
1215   {
1216     'key'         => 'show_ss',
1217     'section'     => 'UI',
1218     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
1219     'type'        => 'checkbox',
1220   },
1221
1222   {
1223     'key'         => 'show_stateid',
1224     'section'     => 'UI',
1225     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
1226     'type'        => 'checkbox',
1227   },
1228
1229   {
1230     'key'         => 'show_bankstate',
1231     'section'     => 'UI',
1232     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
1233     'type'        => 'checkbox',
1234   },
1235
1236   { 
1237     'key'         => 'agent_defaultpkg',
1238     'section'     => 'UI',
1239     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1240     'type'        => 'checkbox',
1241   },
1242
1243   {
1244     'key'         => 'legacy_link',
1245     'section'     => 'UI',
1246     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1247     'type'        => 'checkbox',
1248   },
1249
1250   {
1251     'key'         => 'legacy_link-steal',
1252     'section'     => 'UI',
1253     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1254     'type'        => 'checkbox',
1255   },
1256
1257   {
1258     'key'         => 'queue_dangerous_controls',
1259     'section'     => 'UI',
1260     '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.',
1261     'type'        => 'checkbox',
1262   },
1263
1264   {
1265     'key'         => 'security_phrase',
1266     'section'     => 'password',
1267     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1268     'type'        => 'checkbox',
1269   },
1270
1271   {
1272     'key'         => 'locale',
1273     'section'     => 'UI',
1274     'description' => 'Message locale',
1275     'type'        => 'select',
1276     'select_enum' => [ qw(en_US) ],
1277   },
1278
1279   {
1280     'key'         => 'signup_server-payby',
1281     'section'     => '',
1282     'description' => 'Acceptable payment types for the signup server',
1283     'type'        => 'selectmultiple',
1284     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1285   },
1286
1287   {
1288     'key'         => 'signup_server-default_agentnum',
1289     'section'     => '',
1290     'description' => 'Default agent for the signup server',
1291     'type'        => 'select-sub',
1292     'options_sub' => sub { require FS::Record;
1293                            require FS::agent;
1294                            map { $_->agentnum => $_->agent }
1295                                FS::Record::qsearch('agent', { disabled=>'' } );
1296                          },
1297     'option_sub'  => sub { require FS::Record;
1298                            require FS::agent;
1299                            my $agent = FS::Record::qsearchs(
1300                              'agent', { 'agentnum'=>shift }
1301                            );
1302                            $agent ? $agent->agent : '';
1303                          },
1304   },
1305
1306   {
1307     'key'         => 'signup_server-default_refnum',
1308     'section'     => '',
1309     'description' => 'Default advertising source for the signup server',
1310     'type'        => 'select-sub',
1311     'options_sub' => sub { require FS::Record;
1312                            require FS::part_referral;
1313                            map { $_->refnum => $_->referral }
1314                                FS::Record::qsearch( 'part_referral', 
1315                                                     { 'disabled' => '' }
1316                                                   );
1317                          },
1318     'option_sub'  => sub { require FS::Record;
1319                            require FS::part_referral;
1320                            my $part_referral = FS::Record::qsearchs(
1321                              'part_referral', { 'refnum'=>shift } );
1322                            $part_referral ? $part_referral->referral : '';
1323                          },
1324   },
1325
1326   {
1327     'key'         => 'signup_server-default_pkgpart',
1328     'section'     => '',
1329     'description' => 'Default package for the signup server',
1330     'type'        => 'select-sub',
1331     'options_sub' => sub { require FS::Record;
1332                            require FS::part_pkg;
1333                            map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1334                                FS::Record::qsearch( 'part_pkg',
1335                                                     { 'disabled' => ''}
1336                                                   );
1337                          },
1338     'option_sub'  => sub { require FS::Record;
1339                            require FS::part_pkg;
1340                            my $part_pkg = FS::Record::qsearchs(
1341                              'part_pkg', { 'pkgpart'=>shift }
1342                            );
1343                            $part_pkg
1344                              ? $part_pkg->pkg.' - '.$part_pkg->comment
1345                              : '';
1346                          },
1347   },
1348
1349   {
1350     'key'         => 'signup_server-default_svcpart',
1351     'section'     => '',
1352     'description' => 'Default svcpart for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
1353     'type'        => 'select-sub',
1354     'options_sub' => sub { require FS::Record;
1355                            require FS::part_svc;
1356                            map { $_->svcpart => $_->svc }
1357                                FS::Record::qsearch( 'part_svc',
1358                                                     { 'disabled' => ''}
1359                                                   );
1360                          },
1361     'option_sub'  => sub { require FS::Record;
1362                            require FS::part_svc;
1363                            my $part_svc = FS::Record::qsearchs(
1364                              'part_svc', { 'svcpart'=>shift }
1365                            );
1366                            $part_svc ? $part_svc->svc : '';
1367                          },
1368   },
1369
1370   {
1371     'key'         => 'signup_server-service',
1372     'section'     => '',
1373     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
1374     'type'        => 'select',
1375     'select_hash' => [
1376                        'svc_acct'  => 'Account (svc_acct)',
1377                        'svc_phone' => 'Phone number (svc_phone)',
1378                      ],
1379   },
1380
1381   {
1382     'key'         => 'selfservice_server-base_url',
1383     'section'     => '',
1384     'description' => 'Base URL for the self-service web interface - necessary for some widgets to find their way, including retrieval of non-US state information and phone number provisioning.',
1385     'type'        => 'text',
1386   },
1387
1388   {
1389     'key'         => 'show-msgcat-codes',
1390     'section'     => 'UI',
1391     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1392     'type'        => 'checkbox',
1393   },
1394
1395   {
1396     'key'         => 'signup_server-realtime',
1397     'section'     => '',
1398     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1399     'type'        => 'checkbox',
1400   },
1401   {
1402     'key'         => 'signup_server-classnum2',
1403     'section'     => '',
1404     'description' => 'Package Class for first optional purchase',
1405     'type'        => 'select-sub',
1406     'options_sub' => sub { require FS::Record;
1407                            require FS::pkg_class;
1408                            map { $_->classnum => $_->classname }
1409                                FS::Record::qsearch('pkg_class', {} );
1410                          },
1411     'option_sub'  => sub { require FS::Record;
1412                            require FS::pkg_class;
1413                            my $pkg_class = FS::Record::qsearchs(
1414                              'pkg_class', { 'classnum'=>shift }
1415                            );
1416                            $pkg_class ? $pkg_class->classname : '';
1417                          },
1418   },
1419
1420   {
1421     'key'         => 'signup_server-classnum3',
1422     'section'     => '',
1423     'description' => 'Package Class for second optional purchase',
1424     'type'        => 'select-sub',
1425     'options_sub' => sub { require FS::Record;
1426                            require FS::pkg_class;
1427                            map { $_->classnum => $_->classname }
1428                                FS::Record::qsearch('pkg_class', {} );
1429                          },
1430     'option_sub'  => sub { require FS::Record;
1431                            require FS::pkg_class;
1432                            my $pkg_class = FS::Record::qsearchs(
1433                              'pkg_class', { 'classnum'=>shift }
1434                            );
1435                            $pkg_class ? $pkg_class->classname : '';
1436                          },
1437   },
1438
1439   {
1440     'key'         => 'backend-realtime',
1441     'section'     => '',
1442     'description' => 'Run billing for backend signups immediately.',
1443     'type'        => 'checkbox',
1444   },
1445
1446   {
1447     'key'         => 'declinetemplate',
1448     'section'     => 'billing',
1449     'description' => 'Template file for credit card decline emails.',
1450     'type'        => 'textarea',
1451   },
1452
1453   {
1454     'key'         => 'emaildecline',
1455     'section'     => 'billing',
1456     'description' => 'Enable emailing of credit card decline notices.',
1457     'type'        => 'checkbox',
1458   },
1459
1460   {
1461     'key'         => 'emaildecline-exclude',
1462     'section'     => 'billing',
1463     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1464     'type'        => 'textarea',
1465   },
1466
1467   {
1468     'key'         => 'cancelmessage',
1469     'section'     => 'billing',
1470     'description' => 'Template file for cancellation emails.',
1471     'type'        => 'textarea',
1472   },
1473
1474   {
1475     'key'         => 'cancelsubject',
1476     'section'     => 'billing',
1477     'description' => 'Subject line for cancellation emails.',
1478     'type'        => 'text',
1479   },
1480
1481   {
1482     'key'         => 'emailcancel',
1483     'section'     => 'billing',
1484     'description' => 'Enable emailing of cancellation notices.  Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
1485     'type'        => 'checkbox',
1486   },
1487
1488   {
1489     'key'         => 'require_cardname',
1490     'section'     => 'billing',
1491     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1492     'type'        => 'checkbox',
1493   },
1494
1495   {
1496     'key'         => 'enable_taxclasses',
1497     'section'     => 'billing',
1498     'description' => 'Enable per-package tax classes',
1499     'type'        => 'checkbox',
1500   },
1501
1502   {
1503     'key'         => 'require_taxclasses',
1504     'section'     => 'billing',
1505     'description' => 'Require a taxclass to be entered for every package',
1506     'type'        => 'checkbox',
1507   },
1508
1509   {
1510     'key'         => 'enable_taxproducts',
1511     'section'     => 'billing',
1512     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
1513     'type'        => 'checkbox',
1514   },
1515
1516   {
1517     'key'         => 'taxdatadirectdownload',
1518     'section'     => 'billing',  #well
1519     'description' => 'Enable downloading tax data directly from the vendor site',
1520     'type'        => 'checkbox',
1521   },
1522
1523   {
1524     'key'         => 'ignore_incalculable_taxes',
1525     'section'     => 'billing',
1526     'description' => 'Prefer to invoice without tax over not billing at all',
1527     'type'        => 'checkbox',
1528   },
1529
1530   {
1531     'key'         => 'welcome_email',
1532     'section'     => '',
1533     '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/dist/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>',
1534     'type'        => 'textarea',
1535     'per_agent'   => 1,
1536   },
1537
1538   {
1539     'key'         => 'welcome_email-from',
1540     'section'     => '',
1541     'description' => 'From: address header for welcome email',
1542     'type'        => 'text',
1543     'per_agent'   => 1,
1544   },
1545
1546   {
1547     'key'         => 'welcome_email-subject',
1548     'section'     => '',
1549     'description' => 'Subject: header for welcome email',
1550     'type'        => 'text',
1551     'per_agent'   => 1,
1552   },
1553   
1554   {
1555     'key'         => 'welcome_email-mimetype',
1556     'section'     => '',
1557     'description' => 'MIME type for welcome email',
1558     'type'        => 'select',
1559     'select_enum' => [ 'text/plain', 'text/html' ],
1560     'per_agent'   => 1,
1561   },
1562
1563   {
1564     'key'         => 'welcome_letter',
1565     'section'     => '',
1566     '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/dist/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>',
1567     'type'        => 'textarea',
1568   },
1569
1570   {
1571     'key'         => 'warning_email',
1572     'section'     => '',
1573     '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/dist/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>',
1574     'type'        => 'textarea',
1575   },
1576
1577   {
1578     'key'         => 'warning_email-from',
1579     'section'     => '',
1580     'description' => 'From: address header for warning email',
1581     'type'        => 'text',
1582   },
1583
1584   {
1585     'key'         => 'warning_email-cc',
1586     'section'     => '',
1587     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1588     'type'        => 'text',
1589   },
1590
1591   {
1592     'key'         => 'warning_email-subject',
1593     'section'     => '',
1594     'description' => 'Subject: header for warning email',
1595     'type'        => 'text',
1596   },
1597   
1598   {
1599     'key'         => 'warning_email-mimetype',
1600     'section'     => '',
1601     'description' => 'MIME type for warning email',
1602     'type'        => 'select',
1603     'select_enum' => [ 'text/plain', 'text/html' ],
1604   },
1605
1606   {
1607     'key'         => 'payby',
1608     'section'     => 'billing',
1609     'description' => 'Available payment types.',
1610     'type'        => 'selectmultiple',
1611     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1612   },
1613
1614   {
1615     'key'         => 'payby-default',
1616     'section'     => 'UI',
1617     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1618     'type'        => 'select',
1619     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1620   },
1621
1622   {
1623     'key'         => 'paymentforcedtobatch',
1624     'section'     => 'deprecated',
1625     'description' => 'See batch-enable_payby and realtime-disable_payby.  Used to (for CHEK): Cause per customer payment entry to be forced to a batch processor rather than performed realtime.',
1626     'type'        => 'checkbox',
1627   },
1628
1629   {
1630     'key'         => 'svc_acct-notes',
1631     'section'     => 'UI',
1632     'description' => 'Extra HTML to be displayed on the Account View screen.',
1633     'type'        => 'textarea',
1634   },
1635
1636   {
1637     'key'         => 'radius-password',
1638     'section'     => '',
1639     'description' => 'RADIUS attribute for plain-text passwords.',
1640     'type'        => 'select',
1641     'select_enum' => [ 'Password', 'User-Password' ],
1642   },
1643
1644   {
1645     'key'         => 'radius-ip',
1646     'section'     => '',
1647     'description' => 'RADIUS attribute for IP addresses.',
1648     'type'        => 'select',
1649     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1650   },
1651
1652   {
1653     'key'         => 'svc_acct-alldomains',
1654     'section'     => '',
1655     '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.',
1656     'type'        => 'checkbox',
1657   },
1658
1659   {
1660     'key'         => 'dump-scpdest',
1661     'section'     => '',
1662     'description' => 'destination for scp database dumps: user@host:/path',
1663     'type'        => 'text',
1664   },
1665
1666   {
1667     'key'         => 'dump-pgpid',
1668     'section'     => '',
1669     '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.",
1670     'type'        => 'text',
1671   },
1672
1673   {
1674     'key'         => 'credit_card-recurring_billing_flag',
1675     'section'     => 'billing',
1676     'description' => 'This controls when the system passes the "recurring_billing" flag on credit card transactions.  If supported by your processor (and the Business::OnlinePayment processor module), passing the flag indicates this is a recurring transaction and may turn off the CVV requirement. ',
1677     'type'        => 'select',
1678     'select_hash' => [
1679                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
1680                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
1681                      ],
1682   },
1683
1684   {
1685     'key'         => 'credit_card-recurring_billing_acct_code',
1686     'section'     => 'billing',
1687     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
1688     'type'        => 'checkbox',
1689   },
1690
1691   {
1692     'key'         => 'cvv-save',
1693     'section'     => 'billing',
1694     '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.',
1695     'type'        => 'selectmultiple',
1696     'select_enum' => \@card_types,
1697   },
1698
1699   {
1700     'key'         => 'allow_negative_charges',
1701     'section'     => 'billing',
1702     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
1703     'type'        => 'checkbox',
1704   },
1705   {
1706       'key'         => 'auto_unset_catchall',
1707       'section'     => '',
1708       '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.',
1709       'type'        => 'checkbox',
1710   },
1711
1712   {
1713     'key'         => 'system_usernames',
1714     'section'     => 'username',
1715     '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.',
1716     'type'        => 'textarea',
1717   },
1718
1719   {
1720     'key'         => 'cust_pkg-change_svcpart',
1721     'section'     => '',
1722     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1723     'type'        => 'checkbox',
1724   },
1725
1726   {
1727     'key'         => 'disable_autoreverse',
1728     'section'     => 'BIND',
1729     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1730     'type'        => 'checkbox',
1731   },
1732
1733   {
1734     'key'         => 'svc_www-enable_subdomains',
1735     'section'     => '',
1736     'description' => 'Enable selection of specific subdomains for virtual host creation.',
1737     'type'        => 'checkbox',
1738   },
1739
1740   {
1741     'key'         => 'svc_www-usersvc_svcpart',
1742     'section'     => '',
1743     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1744     'type'        => 'textarea',
1745   },
1746
1747   {
1748     'key'         => 'selfservice_server-primary_only',
1749     'section'     => '',
1750     'description' => 'Only allow primary accounts to access self-service functionality.',
1751     'type'        => 'checkbox',
1752   },
1753
1754   {
1755     'key'         => 'selfservice_server-phone_login',
1756     'section'     => '',
1757     'description' => 'Allow login to self-service with phone number and PIN.',
1758     'type'        => 'checkbox',
1759   },
1760
1761   {
1762     'key'         => 'selfservice_server-single_domain',
1763     'section'     => '',
1764     'description' => 'If specified, only use this one domain for self-service access.',
1765     'type'        => 'text',
1766   },
1767
1768   {
1769     'key'         => 'card_refund-days',
1770     'section'     => 'billing',
1771     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
1772     'type'        => 'text',
1773   },
1774
1775   {
1776     'key'         => 'agent-showpasswords',
1777     'section'     => '',
1778     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1779     'type'        => 'checkbox',
1780   },
1781
1782   {
1783     'key'         => 'global_unique-username',
1784     'section'     => 'username',
1785     '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.',
1786     'type'        => 'select',
1787     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1788   },
1789
1790   {
1791     'key'         => 'global_unique-phonenum',
1792     'section'     => '',
1793     'description' => 'Global phone number uniqueness control: none (usual setting - check countrycode+phonenumun uniqueness per exports), or countrycode+phonenum (all countrycode+phonenum 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.',
1794     'type'        => 'select',
1795     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
1796   },
1797
1798   {
1799     'key'         => 'svc_external-skip_manual',
1800     'section'     => 'UI',
1801     '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).',
1802     'type'        => 'checkbox',
1803   },
1804
1805   {
1806     'key'         => 'svc_external-display_type',
1807     'section'     => 'UI',
1808     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1809     'type'        => 'select',
1810     'select_enum' => [ 'generic', 'artera_turbo', ],
1811   },
1812
1813   {
1814     'key'         => 'ticket_system',
1815     'section'     => '',
1816     'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="http://www.freeside.biz/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).',
1817     'type'        => 'select',
1818     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1819     'select_enum' => [ '', qw(RT_Internal RT_External) ],
1820   },
1821
1822   {
1823     'key'         => 'ticket_system-default_queueid',
1824     'section'     => '',
1825     'description' => 'Default queue used when creating new customer tickets.',
1826     'type'        => 'select-sub',
1827     'options_sub' => sub {
1828                            my $conf = new FS::Conf;
1829                            if ( $conf->config('ticket_system') ) {
1830                              eval "use FS::TicketSystem;";
1831                              die $@ if $@;
1832                              FS::TicketSystem->queues();
1833                            } else {
1834                              ();
1835                            }
1836                          },
1837     'option_sub'  => sub { 
1838                            my $conf = new FS::Conf;
1839                            if ( $conf->config('ticket_system') ) {
1840                              eval "use FS::TicketSystem;";
1841                              die $@ if $@;
1842                              FS::TicketSystem->queue(shift);
1843                            } else {
1844                              '';
1845                            }
1846                          },
1847   },
1848
1849   {
1850     'key'         => 'ticket_system-priority_reverse',
1851     'section'     => '',
1852     '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.',
1853     'type'        => 'checkbox',
1854   },
1855
1856   {
1857     'key'         => 'ticket_system-custom_priority_field',
1858     'section'     => '',
1859     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1860     'type'        => 'text',
1861   },
1862
1863   {
1864     'key'         => 'ticket_system-custom_priority_field-values',
1865     'section'     => '',
1866     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1867     'type'        => 'textarea',
1868   },
1869
1870   {
1871     'key'         => 'ticket_system-custom_priority_field_queue',
1872     'section'     => '',
1873     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1874     'type'        => 'text',
1875   },
1876
1877   {
1878     'key'         => 'ticket_system-rt_external_datasrc',
1879     'section'     => '',
1880     '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>',
1881     'type'        => 'text',
1882
1883   },
1884
1885   {
1886     'key'         => 'ticket_system-rt_external_url',
1887     'section'     => '',
1888     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1889     'type'        => 'text',
1890   },
1891
1892   {
1893     'key'         => 'company_name',
1894     'section'     => 'required',
1895     'description' => 'Your company name',
1896     'type'        => 'text',
1897     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
1898   },
1899
1900   {
1901     'key'         => 'company_address',
1902     'section'     => 'required',
1903     'description' => 'Your company address',
1904     'type'        => 'textarea',
1905     'per_agent'   => 1,
1906   },
1907
1908   {
1909     'key'         => 'address2-search',
1910     'section'     => 'UI',
1911     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
1912     'type'        => 'checkbox',
1913   },
1914
1915   {
1916     'key'         => 'cust_main-require_address2',
1917     'section'     => 'UI',
1918     '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',
1919     'type'        => 'checkbox',
1920   },
1921
1922   {
1923     'key'         => 'agent-ship_address',
1924     'section'     => '',
1925     'description' => "Use the agent's master service address as the service address (only ship_address2 can be entered, if blank on the master address).  Useful for multi-tenant applications.",
1926     'type'        => 'checkbox',
1927   },
1928
1929   { 'key'         => 'referral_credit',
1930     'section'     => 'deprecated',
1931     'description' => "Used to enable one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency).  Replace with a billing event on appropriate packages.",
1932     'type'        => 'checkbox',
1933   },
1934
1935   { 'key'         => 'selfservice_server-cache_module',
1936     'section'     => '',
1937     '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.',
1938     'type'        => 'select',
1939     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1940   },
1941
1942   {
1943     'key'         => 'hylafax',
1944     'section'     => 'billing',
1945     '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).',
1946     'type'        => [qw( checkbox textarea )],
1947   },
1948
1949   {
1950     'key'         => 'cust_bill-ftpformat',
1951     'section'     => 'billing',
1952     'description' => 'Enable FTP of raw invoice data - format.',
1953     'type'        => 'select',
1954     'select_enum' => [ '', 'default', 'billco', ],
1955   },
1956
1957   {
1958     'key'         => 'cust_bill-ftpserver',
1959     'section'     => 'billing',
1960     'description' => 'Enable FTP of raw invoice data - server.',
1961     'type'        => 'text',
1962   },
1963
1964   {
1965     'key'         => 'cust_bill-ftpusername',
1966     'section'     => 'billing',
1967     'description' => 'Enable FTP of raw invoice data - server.',
1968     'type'        => 'text',
1969   },
1970
1971   {
1972     'key'         => 'cust_bill-ftppassword',
1973     'section'     => 'billing',
1974     'description' => 'Enable FTP of raw invoice data - server.',
1975     'type'        => 'text',
1976   },
1977
1978   {
1979     'key'         => 'cust_bill-ftpdir',
1980     'section'     => 'billing',
1981     'description' => 'Enable FTP of raw invoice data - server.',
1982     'type'        => 'text',
1983   },
1984
1985   {
1986     'key'         => 'cust_bill-spoolformat',
1987     'section'     => 'billing',
1988     'description' => 'Enable spooling of raw invoice data - format.',
1989     'type'        => 'select',
1990     'select_enum' => [ '', 'default', 'billco', ],
1991   },
1992
1993   {
1994     'key'         => 'cust_bill-spoolagent',
1995     'section'     => 'billing',
1996     'description' => 'Enable per-agent spooling of raw invoice data.',
1997     'type'        => 'checkbox',
1998   },
1999
2000   {
2001     'key'         => 'svc_acct-usage_suspend',
2002     'section'     => 'billing',
2003     '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.',
2004     'type'        => 'checkbox',
2005   },
2006
2007   {
2008     'key'         => 'svc_acct-usage_unsuspend',
2009     'section'     => 'billing',
2010     '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.',
2011     'type'        => 'checkbox',
2012   },
2013
2014   {
2015     'key'         => 'svc_acct-usage_threshold',
2016     'section'     => 'billing',
2017     '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.',
2018     'type'        => 'text',
2019   },
2020
2021   {
2022     'key'         => 'cust-fields',
2023     'section'     => 'UI',
2024     'description' => 'Which customer fields to display on reports by default',
2025     'type'        => 'select',
2026     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
2027   },
2028
2029   {
2030     'key'         => 'cust_pkg-display_times',
2031     'section'     => 'UI',
2032     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
2033     'type'        => 'checkbox',
2034   },
2035
2036   {
2037     'key'         => 'cust_pkg-always_show_location',
2038     'section'     => 'UI',
2039     'description' => "Always display package locations, even when they're all the default service address.",
2040     'type'        => 'checkbox',
2041   },
2042
2043   {
2044     'key'         => 'svc_acct-edit_uid',
2045     'section'     => 'shell',
2046     'description' => 'Allow UID editing.',
2047     'type'        => 'checkbox',
2048   },
2049
2050   {
2051     'key'         => 'svc_acct-edit_gid',
2052     'section'     => 'shell',
2053     'description' => 'Allow GID editing.',
2054     'type'        => 'checkbox',
2055   },
2056
2057   {
2058     'key'         => 'zone-underscore',
2059     'section'     => 'BIND',
2060     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
2061     'type'        => 'checkbox',
2062   },
2063
2064   {
2065     'key'         => 'echeck-nonus',
2066     'section'     => 'billing',
2067     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
2068     'type'        => 'checkbox',
2069   },
2070
2071   {
2072     'key'         => 'voip-cust_cdr_spools',
2073     'section'     => '',
2074     'description' => 'Enable the per-customer option for individual CDR spools.',
2075     'type'        => 'checkbox',
2076   },
2077
2078   {
2079     'key'         => 'voip-cust_cdr_squelch',
2080     'section'     => '',
2081     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
2082     'type'        => 'checkbox',
2083   },
2084
2085   {
2086     'key'         => 'svc_forward-arbitrary_dst',
2087     'section'     => '',
2088     '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.",
2089     'type'        => 'checkbox',
2090   },
2091
2092   {
2093     'key'         => 'tax-ship_address',
2094     'section'     => 'billing',
2095     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
2096     'type'        => 'checkbox',
2097   }
2098 ,
2099   {
2100     'key'         => 'tax-pkg_address',
2101     'section'     => 'billing',
2102     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the package address instead (when present).  Note that this option is currently incompatible with vendor data taxation enabled by enable_taxproducts.',
2103     'type'        => 'checkbox',
2104   },
2105
2106   {
2107     'key'         => 'invoice-ship_address',
2108     'section'     => 'billing',
2109     'description' => 'Enable this switch to include the ship address on the invoice.',
2110     'type'        => 'checkbox',
2111   },
2112
2113   {
2114     'key'         => 'invoice-unitprice',
2115     'section'     => 'billing',
2116     'description' => 'This switch enables unit pricing on the invoice.',
2117     'type'        => 'checkbox',
2118   },
2119
2120   {
2121     'key'         => 'postal_invoice-fee_pkgpart',
2122     'section'     => 'billing',
2123     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
2124     'type'        => 'select-sub',
2125     'options_sub' => sub { require FS::Record;
2126                            require FS::part_pkg;
2127                            map { $_->pkgpart => $_->pkg }
2128                                FS::Record::qsearch('part_pkg', { disabled=>'' } );
2129                          },
2130     'option_sub'  => sub { require FS::Record;
2131                            require FS::part_pkg;
2132                            my $part_pkg = FS::Record::qsearchs(
2133                              'part_pkg', { 'pkgpart'=>shift }
2134                            );
2135                            $part_pkg ? $part_pkg->pkg : '';
2136                          },
2137   },
2138
2139   {
2140     'key'         => 'postal_invoice-recurring_only',
2141     'section'     => 'billing',
2142     'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
2143     'type'        => 'checkbox',
2144   },
2145
2146   {
2147     'key'         => 'batch-enable',
2148     'section'     => 'deprecated', #make sure batch-enable_payby is set for
2149                                    #everyone before removing
2150     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
2151     'type'        => 'checkbox',
2152   },
2153
2154   {
2155     'key'         => 'batch-enable_payby',
2156     'section'     => 'billing',
2157     'description' => 'Enable batch processing for the specified payment types.',
2158     'type'        => 'selectmultiple',
2159     'select_enum' => [qw( CARD CHEK )],
2160   },
2161
2162   {
2163     'key'         => 'realtime-disable_payby',
2164     'section'     => 'billing',
2165     'description' => 'Disable realtime processing for the specified payment types.',
2166     'type'        => 'selectmultiple',
2167     'select_enum' => [qw( CARD CHEK )],
2168   },
2169
2170   {
2171     'key'         => 'batch-default_format',
2172     'section'     => 'billing',
2173     'description' => 'Default format for batches.',
2174     'type'        => 'select',
2175     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
2176                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
2177                        'ach-spiritone',
2178                     ]
2179   },
2180
2181   {
2182     'key'         => 'batch-fixed_format-CARD',
2183     'section'     => 'billing',
2184     'description' => 'Fixed (unchangeable) format for credit card batches.',
2185     'type'        => 'select',
2186     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
2187                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
2188   },
2189
2190   {
2191     'key'         => 'batch-fixed_format-CHEK',
2192     'section'     => 'billing',
2193     'description' => 'Fixed (unchangeable) format for electronic check batches.',
2194     'type'        => 'select',
2195     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
2196                        'ach-spiritone',
2197                      ]
2198   },
2199
2200   {
2201     'key'         => 'batch-increment_expiration',
2202     'section'     => 'billing',
2203     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
2204     'type'        => 'checkbox'
2205   },
2206
2207   {
2208     'key'         => 'batchconfig-BoM',
2209     'section'     => 'billing',
2210     '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',
2211     'type'        => 'textarea',
2212   },
2213
2214   {
2215     'key'         => 'batchconfig-PAP',
2216     'section'     => 'billing',
2217     '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',
2218     'type'        => 'textarea',
2219   },
2220
2221   {
2222     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
2223     'section'     => 'billing',
2224     'description' => 'Gateway ID for Chase Canada E-xact batching',
2225     'type'        => 'text',
2226   },
2227
2228   {
2229     'key'         => 'payment_history-years',
2230     'section'     => 'UI',
2231     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
2232     'type'        => 'text',
2233   },
2234
2235   {
2236     'key'         => 'cust_main-packages-years',
2237     'section'     => 'UI',
2238     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
2239     'type'        => 'text',
2240   },
2241
2242   {
2243     'key'         => 'cust_main-use_comments',
2244     'section'     => 'UI',
2245     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
2246     'type'        => 'checkbox',
2247   },
2248
2249   {
2250     'key'         => 'cust_main-disable_notes',
2251     'section'     => 'UI',
2252     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
2253     'type'        => 'checkbox',
2254   },
2255
2256   {
2257     'key'         => 'cust_main_note-display_times',
2258     'section'     => 'UI',
2259     'description' => 'Display full timestamps (not just dates) for customer notes.',
2260     'type'        => 'checkbox',
2261   },
2262
2263   {
2264     'key'         => 'cust_main-ticket_statuses',
2265     'section'     => 'UI',
2266     'description' => 'Show tickets with these statuses on the customer view page.',
2267     'type'        => 'selectmultiple',
2268     'select_enum' => [qw( new open stalled resolved rejected deleted )],
2269   },
2270
2271   {
2272     'key'         => 'cust_main-max_tickets',
2273     'section'     => 'UI',
2274     'description' => 'Maximum number of tickets to show on the customer view page.',
2275     'type'        => 'text',
2276   },
2277
2278   {
2279     'key'         => 'cust_main-skeleton_tables',
2280     'section'     => '',
2281     '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.',
2282     'type'        => 'textarea',
2283   },
2284
2285   {
2286     'key'         => 'cust_main-skeleton_custnum',
2287     'section'     => '',
2288     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
2289     'type'        => 'text',
2290   },
2291
2292   {
2293     'key'         => 'cust_main-enable_birthdate',
2294     'section'     => 'UI',
2295     'descritpion' => 'Enable tracking of a birth date with each customer record',
2296     'type'        => 'checkbox',
2297   },
2298
2299   {
2300     'key'         => 'support-key',
2301     'section'     => '',
2302     '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.',
2303     'type'        => 'text',
2304   },
2305
2306   {
2307     'key'         => 'card-types',
2308     'section'     => 'billing',
2309     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
2310     'type'        => 'selectmultiple',
2311     'select_enum' => \@card_types,
2312   },
2313
2314   {
2315     'key'         => 'disable-fuzzy',
2316     'section'     => 'UI',
2317     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
2318     'type'        => 'checkbox',
2319   },
2320
2321   { 'key'         => 'pkg_referral',
2322     'section'     => '',
2323     'description' => 'Enable package-specific advertising sources.',
2324     'type'        => 'checkbox',
2325   },
2326
2327   { 'key'         => 'pkg_referral-multiple',
2328     'section'     => '',
2329     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
2330     'type'        => 'checkbox',
2331   },
2332
2333   {
2334     'key'         => 'dashboard-toplist',
2335     'section'     => 'UI',
2336     'description' => 'List of items to display on the top of the front page',
2337     'type'        => 'textarea',
2338   },
2339
2340   {
2341     'key'         => 'impending_recur_template',
2342     'section'     => 'billing',
2343     'description' => 'Template file for alerts about looming first time recurrant billing.  See the <a href="http://search.cpan.org/dist/Text-Template/lib/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>',
2344 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
2345     'type'        => 'textarea',
2346   },
2347
2348   {
2349     'key'         => 'logo.png',
2350     'section'     => 'billing',  #? 
2351     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
2352     'type'        => 'image',
2353     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
2354                         #old-style editor anyway...?
2355   },
2356
2357   {
2358     'key'         => 'logo.eps',
2359     'section'     => 'billing',  #? 
2360     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
2361     'type'        => 'image',
2362     'per_agent'   => 1, #XXX as above, kinda
2363   },
2364
2365   {
2366     'key'         => 'selfservice-ignore_quantity',
2367     'section'     => '',
2368     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
2369     'type'        => 'checkbox',
2370   },
2371
2372   {
2373     'key'         => 'selfservice-session_timeout',
2374     'section'     => '',
2375     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
2376     'type'        => 'select',
2377     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
2378   },
2379
2380   {
2381     'key'         => 'disable_setup_suspended_pkgs',
2382     'section'     => 'billing',
2383     'description' => 'Disables charging of setup fees for suspended packages.',
2384     'type'       => 'checkbox',
2385   },
2386
2387   {
2388     'key' => 'password-generated-allcaps',
2389     'section' => 'password',
2390     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
2391     'type' => 'checkbox',
2392   },
2393
2394   {
2395     'key'         => 'datavolume-forcemegabytes',
2396     'section'     => 'UI',
2397     'description' => 'All data volumes are expressed in megabytes',
2398     'type'        => 'checkbox',
2399   },
2400
2401   {
2402     'key'         => 'datavolume-significantdigits',
2403     'section'     => 'UI',
2404     'description' => 'number of significant digits to use to represent data volumes',
2405     'type'        => 'text',
2406   },
2407
2408   {
2409     'key'         => 'disable_void_after',
2410     'section'     => 'billing',
2411     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
2412     'type'        => 'text',
2413   },
2414
2415   {
2416     'key'         => 'disable_line_item_date_ranges',
2417     'section'     => 'billing',
2418     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
2419     'type'        => 'checkbox',
2420   },
2421
2422   {
2423     'key'         => 'support_packages',
2424     'section'     => '',
2425     '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...
2426     'type'        => 'textarea',
2427   },
2428
2429   {
2430     'key'         => 'cust_main-require_phone',
2431     'section'     => '',
2432     'description' => 'Require daytime or night phone for all customer records.',
2433     'type'        => 'checkbox',
2434   },
2435
2436   {
2437     'key'         => 'cust_main-require_invoicing_list_email',
2438     'section'     => '',
2439     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
2440     'type'        => 'checkbox',
2441   },
2442
2443   {
2444     'key'         => 'svc_acct-display_paid_time_remaining',
2445     'section'     => '',
2446     'description' => 'Show paid time remaining in addition to time remaining.',
2447     'type'        => 'checkbox',
2448   },
2449
2450   {
2451     'key'         => 'cancel_credit_type',
2452     'section'     => 'billing',
2453     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
2454     'type'        => 'select-sub',
2455     'options_sub' => sub { require FS::Record;
2456                            require FS::reason_type;
2457                            map { $_->typenum => $_->type }
2458                                FS::Record::qsearch('reason_type', { class=>'R' } );
2459                          },
2460     'option_sub'  => sub { require FS::Record;
2461                            require FS::reason_type;
2462                            my $reason_type = FS::Record::qsearchs(
2463                              'reason_type', { 'typenum' => shift }
2464                            );
2465                            $reason_type ? $reason_type->type : '';
2466                          },
2467   },
2468
2469   {
2470     'key'         => 'referral_credit_type',
2471     'section'     => 'deprecated',
2472     'description' => 'Used to be the group to use for new, automatically generated credit reasons resulting from referrals.  Now set in a package billing event for the referral.',
2473     'type'        => 'select-sub',
2474     'options_sub' => sub { require FS::Record;
2475                            require FS::reason_type;
2476                            map { $_->typenum => $_->type }
2477                                FS::Record::qsearch('reason_type', { class=>'R' } );
2478                          },
2479     'option_sub'  => sub { require FS::Record;
2480                            require FS::reason_type;
2481                            my $reason_type = FS::Record::qsearchs(
2482                              'reason_type', { 'typenum' => shift }
2483                            );
2484                            $reason_type ? $reason_type->type : '';
2485                          },
2486   },
2487
2488   {
2489     'key'         => 'signup_credit_type',
2490     'section'     => 'billing',
2491     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
2492     'type'        => 'select-sub',
2493     'options_sub' => sub { require FS::Record;
2494                            require FS::reason_type;
2495                            map { $_->typenum => $_->type }
2496                                FS::Record::qsearch('reason_type', { class=>'R' } );
2497                          },
2498     'option_sub'  => sub { require FS::Record;
2499                            require FS::reason_type;
2500                            my $reason_type = FS::Record::qsearchs(
2501                              'reason_type', { 'typenum' => shift }
2502                            );
2503                            $reason_type ? $reason_type->type : '';
2504                          },
2505   },
2506
2507   {
2508     'key'         => 'cust_main-agent_custid-format',
2509     'section'     => '',
2510     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
2511     'type'        => 'select',
2512     'select_hash' => [
2513                        ''      => 'Numeric only',
2514                        'ww?d+' => 'Numeric with one or two letter prefix',
2515                      ],
2516   },
2517
2518   {
2519     'key'         => 'card_masking_method',
2520     'section'     => 'UI',
2521     '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.  Note: You should manually remove stored paymasks if you change this value on an existing database, to avoid problems using stored cards.',
2522     'type'        => 'select',
2523     'select_hash' => [
2524                        ''            => '123456xxxxxx1234',
2525                        'first6last2' => '123456xxxxxxxx12',
2526                        'first4last4' => '1234xxxxxxxx1234',
2527                        'first4last2' => '1234xxxxxxxxxx12',
2528                        'first2last4' => '12xxxxxxxxxx1234',
2529                        'first2last2' => '12xxxxxxxxxxxx12',
2530                        'first0last4' => 'xxxxxxxxxxxx1234',
2531                        'first0last2' => 'xxxxxxxxxxxxxx12',
2532                      ],
2533   },
2534
2535   {
2536     'key'         => 'disable_previous_balance',
2537     'section'     => 'billing',
2538     'description' => 'Disable inclusion of previous balancem payment, and credit lines on invoices',
2539     'type'        => 'checkbox',
2540   },
2541
2542   {
2543     'key'         => 'previous_balance-summary_only',
2544     'section'     => 'billing',
2545     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
2546     'type'        => 'checkbox',
2547   },
2548
2549   {
2550     'key'         => 'usps_webtools-userid',
2551     'section'     => 'UI',
2552     'description' => 'Production UserID for USPS web tools.   Enables USPS address standardization.  See the <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
2553     'type'        => 'text',
2554   },
2555
2556   {
2557     'key'         => 'usps_webtools-password',
2558     'section'     => 'UI',
2559     'description' => 'Production password for USPS web tools.   Enables USPS address standardization.  See <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
2560     'type'        => 'text',
2561   },
2562
2563   {
2564     'key'         => 'cust_main-auto_standardize_address',
2565     'section'     => 'UI',
2566     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
2567     'type'        => 'checkbox',
2568   },
2569
2570   {
2571     'key'         => 'disable_acl_changes',
2572     'section'     => '',
2573     'description' => 'Disable all ACL changes, for demos.',
2574     'type'        => 'checkbox',
2575   },
2576
2577   {
2578     'key'         => 'cust_main-edit_agent_custid',
2579     'section'     => 'UI',
2580     'description' => 'Enable editing of the agent_custid field.',
2581     'type'        => 'checkbox',
2582   },
2583
2584   {
2585     'key'         => 'cust_main-default_agent_custid',
2586     'section'     => 'UI',
2587     'description' => 'Display the agent_custid field instead of the custnum field.',
2588     'type'        => 'checkbox',
2589   },
2590
2591   {
2592     'key'         => 'cust_main-auto_agent_custid',
2593     'section'     => 'UI',
2594     'description' => 'Automatically assign an agent_custid - select format',
2595     'type'        => 'select',
2596     'select_hash' => [ '' => 'No',
2597                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
2598                      ],
2599   },
2600
2601   {
2602     'key'         => 'cust_main-default_areacode',
2603     'section'     => 'UI',
2604     'description' => 'Default area code for customers.',
2605     'type'        => 'text',
2606   },
2607
2608   {
2609     'key'         => 'mcp_svcpart',
2610     'section'     => '',
2611     'description' => 'Master Control Program svcpart.  Leave this blank.',
2612     'type'        => 'text',
2613   },
2614
2615   {
2616     'key'         => 'cust_bill-max_same_services',
2617     'section'     => 'billing',
2618     'description' => 'Maximum number of the same service to list individually on invoices before condensing to a single line listing the number of services.  Defaults to 5.',
2619     'type'        => 'text',
2620   },
2621
2622   {
2623     'key'         => 'suspend_email_admin',
2624     'section'     => '',
2625     'description' => 'Destination admin email address to enable suspension notices',
2626     'type'        => 'text',
2627   },
2628
2629   {
2630     'key'         => 'email_report-subject',
2631     'section'     => '',
2632     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
2633     'type'        => 'text',
2634   },
2635
2636   {
2637     'key'         => 'selfservice-head',
2638     'section'     => '',
2639     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
2640     'type'        => 'textarea', #htmlarea?
2641   },
2642
2643
2644   {
2645     'key'         => 'selfservice-body_header',
2646     'section'     => '',
2647     'description' => 'HTML header for the self-service interface',
2648     'type'        => 'textarea', #htmlarea?
2649   },
2650
2651   {
2652     'key'         => 'selfservice-body_footer',
2653     'section'     => '',
2654     'description' => 'HTML header for the self-service interface',
2655     'type'        => 'textarea', #htmlarea?
2656   },
2657
2658
2659   {
2660     'key'         => 'selfservice-body_bgcolor',
2661     'section'     => '',
2662     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
2663     'type'        => 'text',
2664   },
2665
2666   {
2667     'key'         => 'selfservice-box_bgcolor',
2668     'section'     => '',
2669     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0"',
2670     'type'        => 'text',
2671   },
2672
2673   {
2674     'key'         => 'selfservice-bulk_format',
2675     'section'     => '',
2676     'description' => 'Parameter arrangement for selfservice bulk features',
2677     'type'        => 'select',
2678     'select_enum' => [ '', 'izoom-soap', 'izoom-ftp' ],
2679     'per_agent'   => 1,
2680   },
2681
2682   {
2683     'key'         => 'selfservice-bulk_ftp_dir',
2684     'section'     => '',
2685     'description' => 'Enable bulk ftp provisioning in this folder',
2686     'type'        => 'text',
2687     'per_agent'   => 1,
2688   },
2689
2690   {
2691     'key'         => 'signup-no_company',
2692     'section'     => '',
2693     'description' => "Don't display a field for company name on signup.",
2694     'type'        => 'checkbox',
2695   },
2696
2697   {
2698     'key'         => 'signup-recommend_email',
2699     'section'     => '',
2700     'description' => 'Encourage the entry of an invoicing email address on signup.',
2701     'type'        => 'checkbox',
2702   },
2703
2704   {
2705     'key'         => 'signup-recommend_daytime',
2706     'section'     => '',
2707     'description' => 'Encourage the entry of a daytime phone number  invoicing email address on signup.',
2708     'type'        => 'checkbox',
2709   },
2710
2711   {
2712     'key'         => 'svc_phone-radius-default_password',
2713     'section'     => '',
2714     'description' => 'Default password when exporting svc_phone records to RADIUS',
2715     'type'        => 'text',
2716   },
2717
2718   {
2719     'key'         => 'svc_phone-allow_alpha_phonenum',
2720     'section'     => '',
2721     'description' => 'Allow letters in phone numbers.',
2722     'type'        => 'checkbox',
2723   },
2724
2725   {
2726     'key'         => 'default_phone_countrycode',
2727     'section'     => '',
2728     'description' => 'Default countrcode',
2729     'type'        => 'text',
2730   },
2731
2732   {
2733     'key'         => 'cdr-charged_party-accountcode',
2734     'section'     => '',
2735     'description' => 'Set the charged_party field of CDRs to the accountcode.',
2736     'type'        => 'checkbox',
2737   },
2738
2739   {
2740     'key'         => 'cdr-charged_party-truncate_prefix',
2741     'section'     => '',
2742     'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
2743     'type'        => 'text',
2744   },
2745
2746   {
2747     'key'         => 'cdr-charged_party-truncate_length',
2748     'section'     => '',
2749     'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
2750     'type'        => 'text',
2751   },
2752
2753   {
2754     'key'         => 'cdr-charged_party_rewrite',
2755     'section'     => '',
2756     'description' => 'Do charged party rewriting in the freeside-cdrrewrited daemon; useful if CDRs are being dropped off directly in the database and require special charged_party processing such as cdr-charged_party-accountcode or cdr-charged_party-truncate*.',
2757     'type'        => 'checkbox',
2758   },
2759
2760   {
2761     'key'         => 'cdr-taqua-da_rewrite',
2762     'section'     => '',
2763     'description' => 'For the Taqua CDR format, a comma-separated list of directory assistance 800 numbers.  Any CDRs with these numbers as "BilledNumber" will be rewritten to the "CallingPartyNumber" (and CallType "12") on import.',
2764     'type'        => 'text',
2765   },
2766
2767   {
2768     'key'         => 'cust_pkg-show_autosuspend',
2769     'section'     => 'UI',
2770     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
2771     'type'       => 'checkbox',
2772   },
2773
2774   {
2775     'key'         => 'cdr-asterisk_forward_rewrite',
2776     'section'     => '',
2777     'description' => 'Enable special processing for CDRs representing forwarded calls: For CDRs that have a dcontext that starts with "Local/" but does not match dst, set charged_party to dst, parse a new dst from dstchannel, and set amaflags to "2" ("BILL"/"BILLING").',
2778     'type'        => 'checkbox',
2779   },
2780
2781   {
2782     'key'         => 'sg-multicustomer_hack',
2783     'section'     => '',
2784     'description' => "Don't use this.",
2785     'type'        => 'checkbox',
2786   },
2787
2788   {
2789     'key'         => 'disable-cust-pkg_class',
2790     'section'     => 'UI',
2791     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
2792     'type'        => 'checkbox',
2793   },
2794
2795   {
2796     'key'         => 'queued-max_kids',
2797     'section'     => '',
2798     'description' => 'Maximum number of queued processes.  Defaults to 10.',
2799     'type'        => 'text',
2800   },
2801
2802   {
2803     'key'         => 'cancelled_cust-noevents',
2804     'section'     => 'billing',
2805     'description' => "Don't run events for cancelled customers",
2806     'type'        => 'checkbox',
2807   },
2808
2809   {
2810     'key'         => 'agent-invoice_template',
2811     'section'     => 'billing',
2812     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
2813     'type'        => 'checkbox',
2814   },
2815
2816   {
2817     'key'         => 'svc_broadband-manage_link',
2818     'section'     => 'UI',
2819     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr.',
2820     'type'        => 'text',
2821   },
2822
2823   {
2824     'key'         => 'tax-report_groups',
2825     'section'     => '',
2826     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
2827     'type'        => 'textarea',
2828   },
2829
2830 );
2831
2832 1;
2833