add global_unique-pbx_title to disable duplicate checking on svc_pbx.title
[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 conf KEY [ AGENTNUM [ NODEFAULT ] ]
80
81 Returns the L<FS::conf> record for the key and agent.
82
83 =cut
84
85 sub conf {
86   my $self = shift;
87   $self->_config(@_);
88 }
89
90 =item config KEY [ AGENTNUM [ NODEFAULT ] ]
91
92 Returns the configuration value or values (depending on context) for key.
93 The optional agent number selects an agent specific value instead of the
94 global default if one is present.  If NODEFAULT is true only the agent
95 specific value(s) is returned.
96
97 =cut
98
99 sub _usecompat {
100   my ($self, $method) = (shift, shift);
101   carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
102     if use_confcompat;
103   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
104   $compat->$method(@_);
105 }
106
107 sub _config {
108   my($self,$name,$agentnum,$agentonly)=@_;
109   my $hashref = { 'name' => $name };
110   $hashref->{agentnum} = $agentnum;
111   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
112   my $cv = FS::Record::qsearchs('conf', $hashref);
113   if (!$agentonly && !$cv && defined($agentnum) && $agentnum) {
114     $hashref->{agentnum} = '';
115     $cv = FS::Record::qsearchs('conf', $hashref);
116   }
117   return $cv;
118 }
119
120 sub config {
121   my $self = shift;
122   return $self->_usecompat('config', @_) if use_confcompat;
123
124   carp "FS::Conf->config(". join(', ', @_). ") called"
125     if $DEBUG > 1;
126
127   my $cv = $self->_config(@_) or return;
128
129   if ( wantarray ) {
130     my $v = $cv->value;
131     chomp $v;
132     (split "\n", $v, -1);
133   } else {
134     (split("\n", $cv->value))[0];
135   }
136 }
137
138 =item config_binary KEY [ AGENTNUM [ NODEFAULT ] ]
139
140 Returns the exact scalar value for key.
141
142 =cut
143
144 sub config_binary {
145   my $self = shift;
146   return $self->_usecompat('config_binary', @_) if use_confcompat;
147
148   my $cv = $self->_config(@_) or return;
149   length($cv->value) ? decode_base64($cv->value) : '';
150 }
151
152 =item exists KEY [ AGENTNUM [ NODEFAULT ] ]
153
154 Returns true if the specified key exists, even if the corresponding value
155 is undefined.
156
157 =cut
158
159 sub exists {
160   my $self = shift;
161   return $self->_usecompat('exists', @_) if use_confcompat;
162
163   my($name, $agentnum)=@_;
164
165   carp "FS::Conf->exists(". join(', ', @_). ") called"
166     if $DEBUG > 1;
167
168   defined($self->_config(@_));
169 }
170
171 =item config_orbase KEY SUFFIX
172
173 Returns the configuration value or values (depending on context) for 
174 KEY_SUFFIX, if it exists, otherwise for KEY
175
176 =cut
177
178 # outmoded as soon as we shift to agentnum based config values
179 # well, mostly.  still useful for e.g. late notices, etc. in that we want
180 # these to fall back to standard values
181 sub config_orbase {
182   my $self = shift;
183   return $self->_usecompat('config_orbase', @_) if use_confcompat;
184
185   my( $name, $suffix ) = @_;
186   if ( $self->exists("${name}_$suffix") ) {
187     $self->config("${name}_$suffix");
188   } else {
189     $self->config($name);
190   }
191 }
192
193 =item key_orbase KEY SUFFIX
194
195 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
196 KEY.  Useful for determining which exact configuration option is returned by
197 config_orbase.
198
199 =cut
200
201 sub key_orbase {
202   my $self = shift;
203   #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
204
205   my( $name, $suffix ) = @_;
206   if ( $self->exists("${name}_$suffix") ) {
207     "${name}_$suffix";
208   } else {
209     $name;
210   }
211 }
212
213 =item invoice_templatenames
214
215 Returns all possible invoice template names.
216
217 =cut
218
219 sub invoice_templatenames {
220   my( $self ) = @_;
221
222   my %templatenames = ();
223   foreach my $item ( $self->config_items ) {
224     foreach my $base ( @base_items ) {
225       my( $main, $ext) = split(/\./, $base);
226       $ext = ".$ext" if $ext;
227       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
228       $templatenames{$1}++;
229       }
230     }
231   }
232   
233   map { $_ } #handle scalar context
234   sort keys %templatenames;
235
236 }
237
238 =item touch KEY [ AGENT ];
239
240 Creates the specified configuration key if it does not exist.
241
242 =cut
243
244 sub touch {
245   my $self = shift;
246   return $self->_usecompat('touch', @_) if use_confcompat;
247
248   my($name, $agentnum) = @_;
249   unless ( $self->exists($name, $agentnum) ) {
250     $self->set($name, '', $agentnum);
251   }
252 }
253
254 =item set KEY VALUE [ AGENTNUM ];
255
256 Sets the specified configuration key to the given value.
257
258 =cut
259
260 sub set {
261   my $self = shift;
262   return $self->_usecompat('set', @_) if use_confcompat;
263
264   my($name, $value, $agentnum) = @_;
265   $value =~ /^(.*)$/s;
266   $value = $1;
267
268   warn "[FS::Conf] SET $name\n" if $DEBUG;
269
270   my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
271   my $new = new FS::conf { $old ? $old->hash 
272                                 : ('name' => $name, 'agentnum' => $agentnum)
273                          };
274   $new->value($value);
275
276   my $error;
277   if ($old) {
278     $error = $new->replace($old);
279   } else {
280     $error = $new->insert;
281   }
282
283   die "error setting configuration value: $error \n"
284     if $error;
285
286 }
287
288 =item set_binary KEY VALUE [ AGENTNUM ]
289
290 Sets the specified configuration key to an exact scalar value which
291 can be retrieved with config_binary.
292
293 =cut
294
295 sub set_binary {
296   my $self  = shift;
297   return if use_confcompat;
298
299   my($name, $value, $agentnum)=@_;
300   $self->set($name, encode_base64($value), $agentnum);
301 }
302
303 =item delete KEY [ AGENTNUM ];
304
305 Deletes the specified configuration key.
306
307 =cut
308
309 sub delete {
310   my $self = shift;
311   return $self->_usecompat('delete', @_) if use_confcompat;
312
313   my($name, $agentnum) = @_;
314   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
315     warn "[FS::Conf] DELETE $name\n";
316
317     my $oldAutoCommit = $FS::UID::AutoCommit;
318     local $FS::UID::AutoCommit = 0;
319     my $dbh = dbh;
320
321     my $error = $cv->delete;
322
323     if ( $error ) {
324       $dbh->rollback if $oldAutoCommit;
325       die "error setting configuration value: $error \n"
326     }
327
328     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
329
330   }
331 }
332
333 =item import_config_item CONFITEM DIR 
334
335   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
336 the database as a conf record (see L<FS::conf>).  Imports from the file
337 in the directory DIR.
338
339 =cut
340
341 sub import_config_item { 
342   my ($self,$item,$dir) = @_;
343   my $key = $item->key;
344   if ( -e "$dir/$key" && ! use_confcompat ) {
345     warn "Inserting $key\n" if $DEBUG;
346     local $/;
347     my $value = readline(new IO::File "$dir/$key");
348     if ($item->type =~ /^(binary|image)$/ ) {
349       $self->set_binary($key, $value);
350     }else{
351       $self->set($key, $value);
352     }
353   }else {
354     warn "Not inserting $key\n" if $DEBUG;
355   }
356 }
357
358 =item verify_config_item CONFITEM DIR 
359
360   Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
361 the database to the legacy file value in DIR.
362
363 =cut
364
365 sub verify_config_item { 
366   return '' if use_confcompat;
367   my ($self,$item,$dir) = @_;
368   my $key = $item->key;
369   my $type = $item->type;
370
371   my $compat = new FS::Conf_compat17 $dir;
372   my $error = '';
373   
374   $error .= "$key fails existential comparison; "
375     if $self->exists($key) xor $compat->exists($key);
376
377   if ( $type !~ /^(binary|image)$/ ) {
378
379     {
380       no warnings;
381       $error .= "$key fails scalar comparison; "
382         unless scalar($self->config($key)) eq scalar($compat->config($key));
383     }
384
385     my (@new) = $self->config($key);
386     my (@old) = $compat->config($key);
387     unless ( scalar(@new) == scalar(@old)) { 
388       $error .= "$key fails list comparison; ";
389     }else{
390       my $r=1;
391       foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
392       $error .= "$key fails list comparison; "
393         unless $r;
394     }
395
396   } else {
397
398     $error .= "$key fails binary comparison; "
399       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
400
401   }
402
403 #remove deprecated config on our own terms, not freeside-upgrade's
404 #  if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
405 #    my $proto;
406 #    for ( @config_items ) { $proto = $_; last if $proto->key eq $key;  }
407 #    unless ($proto->key eq $key) { 
408 #      warn "removed config item $error\n" if $DEBUG;
409 #      $error = '';
410 #    }
411 #  }
412
413   $error;
414 }
415
416 #item _orbase_items OPTIONS
417 #
418 #Returns all of the possible extensible config items as FS::ConfItem objects.
419 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
420 #options include
421 #
422 # dir - the directory to search for configuration option files instead
423 #       of using the conf records in the database
424 #
425 #cut
426
427 #quelle kludge
428 sub _orbase_items {
429   my ($self, %opt) = @_; 
430
431   my $listmaker = sub { my $v = shift;
432                         $v =~ s/_/!_/g;
433                         if ( $v =~ /\.(png|eps)$/ ) {
434                           $v =~ s/\./!_%./;
435                         }else{
436                           $v .= '!_%';
437                         }
438                         map { $_->name }
439                           FS::Record::qsearch( 'conf',
440                                                {},
441                                                '',
442                                                "WHERE name LIKE '$v' ESCAPE '!'"
443                                              );
444                       };
445
446   if (exists($opt{dir}) && $opt{dir}) {
447     $listmaker = sub { my $v = shift;
448                        if ( $v =~ /\.(png|eps)$/ ) {
449                          $v =~ s/\./_*./;
450                        }else{
451                          $v .= '_*';
452                        }
453                        map { basename $_ } glob($opt{dir}. "/$v" );
454                      };
455   }
456
457   ( map { 
458           my $proto;
459           my $base = $_;
460           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
461           die "don't know about $base items" unless $proto->key eq $base;
462
463           map { new FS::ConfItem { 
464                   'key'         => $_,
465                   'base_key'    => $proto->key,
466                   'section'     => $proto->section,
467                   '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.',
468                   'type'        => $proto->type,
469                 };
470               } &$listmaker($base);
471         } @base_items,
472   );
473 }
474
475 =item config_items
476
477 Returns all of the possible global/default configuration items as
478 FS::ConfItem objects.  See L<FS::ConfItem>.
479
480 =cut
481
482 sub config_items {
483   my $self = shift; 
484   return $self->_usecompat('config_items', @_) if use_confcompat;
485
486   ( @config_items, $self->_orbase_items(@_) );
487 }
488
489 =back
490
491 =head1 SUBROUTINES
492
493 =over 4
494
495 =item init-config DIR
496
497 Imports the configuration items from DIR (1.7 compatible)
498 to conf records in the database.
499
500 =cut
501
502 sub init_config {
503   my $dir = shift;
504
505   {
506     local $FS::UID::use_confcompat = 0;
507     my $conf = new FS::Conf;
508     foreach my $item ( $conf->config_items(dir => $dir) ) {
509       $conf->import_config_item($item, $dir);
510       my $error = $conf->verify_config_item($item, $dir);
511       return $error if $error;
512     }
513   
514     my $compat = new FS::Conf_compat17 $dir;
515     foreach my $item ( $compat->config_items ) {
516       my $error = $conf->verify_config_item($item, $dir);
517       return $error if $error;
518     }
519   }
520
521   $FS::UID::use_confcompat = 0;
522   '';  #success
523 }
524
525 =back
526
527 =head1 BUGS
528
529 If this was more than just crud that will never be useful outside Freeside I'd
530 worry that config_items is freeside-specific and icky.
531
532 =head1 SEE ALSO
533
534 "Configuration" in the web interface (config/config.cgi).
535
536 =cut
537
538 #Business::CreditCard
539 @card_types = (
540   "VISA card",
541   "MasterCard",
542   "Discover card",
543   "American Express card",
544   "Diner's Club/Carte Blanche",
545   "enRoute",
546   "JCB",
547   "BankCard",
548   "Switch",
549   "Solo",
550 );
551
552 @base_items = qw (
553                    invoice_template
554                    invoice_latex
555                    invoice_latexreturnaddress
556                    invoice_latexfooter
557                    invoice_latexsmallfooter
558                    invoice_latexnotes
559                    invoice_latexcoupon
560                    invoice_html
561                    invoice_htmlreturnaddress
562                    invoice_htmlfooter
563                    invoice_htmlnotes
564                    logo.png
565                    logo.eps
566                  );
567
568 #Billing (81 items)
569 #Invoicing (50 items)
570 #UI (69 items)
571 #Self-service (29 items)
572 #...
573 #Unclassified (77 items)
574
575
576 @config_items = map { new FS::ConfItem $_ } (
577
578   {
579     'key'         => 'address',
580     'section'     => 'deprecated',
581     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
582     'type'        => 'text',
583   },
584
585   {
586     'key'         => 'alert_expiration',
587     'section'     => 'billing',
588     'description' => 'Enable alerts about billing method expiration (i.e. expiring credit cards).',
589     'type'        => 'checkbox',
590     'per_agent'   => 1,
591   },
592
593   {
594     'key'         => 'alerter_template',
595     'section'     => 'billing',
596     'description' => 'Template file for billing method expiration alerts (i.e. expiring credit cards).  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.',
597     'type'        => 'textarea',
598     'per_agent'   => 1,
599   },
600
601   {
602     'key'         => 'apacheip',
603     #not actually deprecated yet
604     #'section'     => 'deprecated',
605     #'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',
606     'section'     => '',
607     'description' => 'IP address to assign to new virtual hosts',
608     'type'        => 'text',
609   },
610
611   {
612     'key'         => 'encryption',
613     'section'     => 'billing',
614     'description' => 'Enable encryption of credit cards.',
615     'type'        => 'checkbox',
616   },
617
618   {
619     'key'         => 'encryptionmodule',
620     'section'     => 'billing',
621     'description' => 'Use which module for encryption?',
622     'type'        => 'text',
623   },
624
625   {
626     'key'         => 'encryptionpublickey',
627     'section'     => 'billing',
628     'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
629     'type'        => 'textarea',
630   },
631
632   {
633     'key'         => 'encryptionprivatekey',
634     'section'     => 'billing',
635     '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.',
636     'type'        => 'textarea',
637   },
638
639   {
640     'key'         => 'billco-url',
641     'section'     => 'billing',
642     'description' => 'The url to use for performing uploads to the invoice mailing service.',
643     'type'        => 'text',
644     'per_agent'   => 1,
645   },
646
647   {
648     'key'         => 'billco-username',
649     'section'     => 'billing',
650     'description' => 'The login name to use for uploads to the invoice mailing service.',
651     'type'        => 'text',
652     'per_agent'   => 1,
653     'agentonly'   => 1,
654   },
655
656   {
657     'key'         => 'billco-password',
658     'section'     => 'billing',
659     'description' => 'The password to use for uploads to the invoice mailing service.',
660     'type'        => 'text',
661     'per_agent'   => 1,
662     'agentonly'   => 1,
663   },
664
665   {
666     'key'         => 'billco-clicode',
667     'section'     => 'billing',
668     'description' => 'The clicode to use for uploads to the invoice mailing service.',
669     'type'        => 'text',
670     'per_agent'   => 1,
671   },
672
673   {
674     'key'         => 'business-onlinepayment',
675     'section'     => 'billing',
676     '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.',
677     'type'        => 'textarea',
678   },
679
680   {
681     'key'         => 'business-onlinepayment-ach',
682     'section'     => 'billing',
683     '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.',
684     'type'        => 'textarea',
685   },
686
687   {
688     'key'         => 'business-onlinepayment-namespace',
689     'section'     => 'billing',
690     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
691     'type'        => 'select',
692     'select_hash' => [
693                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
694                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
695                      ],
696   },
697
698   {
699     'key'         => 'business-onlinepayment-description',
700     'section'     => 'billing',
701     '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 - not available in all situations)',
702     'type'        => 'text',
703   },
704
705   {
706     'key'         => 'business-onlinepayment-email-override',
707     'section'     => 'billing',
708     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
709     'type'        => 'text',
710   },
711
712   {
713     'key'         => 'business-onlinepayment-email_customer',
714     'section'     => 'billing',
715     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
716     'type'        => 'checkbox',
717   },
718
719   {
720     'key'         => 'business-onlinepayment-test_transaction',
721     'section'     => 'billing',
722     'description' => 'Turns on the Business::OnlinePayment test_transaction flag.  Note that not all gateway modules support this flag; if yours does not, transactions will still be sent live.',
723     'type'        => 'checkbox',
724   },
725
726   {
727     'key'         => 'countrydefault',
728     'section'     => 'UI',
729     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
730     'type'        => 'text',
731   },
732
733   {
734     'key'         => 'date_format',
735     'section'     => 'UI',
736     'description' => 'Format for displaying dates',
737     'type'        => 'select',
738     'select_hash' => [
739                        '%m/%d/%Y' => 'MM/DD/YYYY',
740                        '%d/%m/%Y' => 'DD/MM/YYYY',
741                        '%Y/%m/%d' => 'YYYY/MM/DD',
742                      ],
743   },
744
745   {
746     'key'         => 'deletecustomers',
747     'section'     => 'UI',
748     'description' => 'Enable customer deletions.  Be very careful!  Deleting a customer will remove all traces that the 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.',
749     'type'        => 'checkbox',
750   },
751
752   {
753     'key'         => 'deleteinvoices',
754     'section'     => 'UI',
755     'description' => 'Enable invoices deletions.  Be very careful!  Deleting an invoice will remove all traces that the invoice ever existed!  Normally, you would apply a credit against the invoice instead.',  #invoice voiding?
756     'type'        => 'checkbox',
757   },
758
759   {
760     'key'         => 'deletepayments',
761     'section'     => 'billing',
762     '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.',
763     'type'        => [qw( checkbox text )],
764   },
765
766   {
767     'key'         => 'deletecredits',
768     #not actually deprecated yet
769     #'section'     => 'deprecated',
770     #'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.',
771     'section'     => '',
772     'description' => 'One or more comma-separated email addresses to be notified when a credit is deleted.',
773     'type'        => [qw( checkbox text )],
774   },
775
776   {
777     'key'         => 'deleterefunds',
778     'section'     => 'billing',
779     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
780     'type'        => 'checkbox',
781   },
782
783   {
784     'key'         => 'unapplypayments',
785     'section'     => 'deprecated',
786     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable "unapplication" of unclosed payments.',
787     'type'        => 'checkbox',
788   },
789
790   {
791     'key'         => 'unapplycredits',
792     'section'     => 'deprecated',
793     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to nable "unapplication" of unclosed credits.',
794     'type'        => 'checkbox',
795   },
796
797   {
798     'key'         => 'dirhash',
799     'section'     => 'shell',
800     '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>',
801     'type'        => 'text',
802   },
803
804   {
805     'key'         => 'disable_cust_attachment',
806     'section'     => '',
807     'description' => 'Disable customer file attachments',
808     'type'        => 'checkbox',
809   },
810
811   {
812     'key'         => 'max_attachment_size',
813     'section'     => '',
814     'description' => 'Maximum size for customer file attachments (leave blank for unlimited)',
815     'type'        => 'text',
816   },
817
818   {
819     'key'         => 'disable_customer_referrals',
820     'section'     => 'UI',
821     'description' => 'Disable new customer-to-customer referrals in the web interface',
822     'type'        => 'checkbox',
823   },
824
825   {
826     'key'         => 'editreferrals',
827     'section'     => 'UI',
828     'description' => 'Enable advertising source modification for existing customers',
829     'type'        => 'checkbox',
830   },
831
832   {
833     'key'         => 'emailinvoiceonly',
834     'section'     => 'invoicing',
835     'description' => 'Disables postal mail invoices',
836     'type'        => 'checkbox',
837   },
838
839   {
840     'key'         => 'disablepostalinvoicedefault',
841     'section'     => 'invoicing',
842     '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>.',
843     'type'        => 'checkbox',
844   },
845
846   {
847     'key'         => 'emailinvoiceauto',
848     'section'     => 'invoicing',
849     'description' => 'Automatically adds new accounts to the email invoice list',
850     'type'        => 'checkbox',
851   },
852
853   {
854     'key'         => 'emailinvoiceautoalways',
855     'section'     => 'invoicing',
856     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
857     'type'        => 'checkbox',
858   },
859
860   {
861     'key'         => 'emailinvoice-apostrophe',
862     'section'     => 'invoicing',
863     'description' => 'Allows the apostrophe (single quote) character in the email addresses in the email invoice list.',
864     'type'        => 'checkbox',
865   },
866
867   {
868     'key'         => 'exclude_ip_addr',
869     'section'     => '',
870     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
871     'type'        => 'textarea',
872   },
873   
874   {
875     'key'         => 'auto_router',
876     'section'     => '',
877     'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
878     'type'        => 'checkbox',
879   },
880   
881   {
882     'key'         => 'hidecancelledpackages',
883     'section'     => 'UI',
884     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
885     'type'        => 'checkbox',
886   },
887
888   {
889     'key'         => 'hidecancelledcustomers',
890     'section'     => 'UI',
891     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
892     'type'        => 'checkbox',
893   },
894
895   {
896     'key'         => 'home',
897     'section'     => 'shell',
898     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
899     'type'        => 'text',
900   },
901
902   {
903     'key'         => 'invoice_from',
904     'section'     => 'required',
905     'description' => 'Return address on email invoices',
906     'type'        => 'text',
907     'per_agent'   => 1,
908   },
909
910   {
911     'key'         => 'invoice_subject',
912     'section'     => 'invoicing',
913     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
914     'type'        => 'text',
915     'per_agent'   => 1,
916   },
917
918   {
919     'key'         => 'invoice_usesummary',
920     'section'     => 'invoicing',
921     'description' => 'Indicates that html and latex invoices should be in summary style and make use of invoice_latexsummary.',
922     'type'        => 'checkbox',
923   },
924
925   {
926     'key'         => 'invoice_template',
927     'section'     => 'invoicing',
928     '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.',
929     'type'        => 'textarea',
930   },
931
932   {
933     'key'         => 'invoice_html',
934     'section'     => 'invoicing',
935     '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.',
936
937     'type'        => 'textarea',
938   },
939
940   {
941     'key'         => 'invoice_htmlnotes',
942     'section'     => 'invoicing',
943     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
944     'type'        => 'textarea',
945     'per_agent'   => 1,
946   },
947
948   {
949     'key'         => 'invoice_htmlfooter',
950     'section'     => 'invoicing',
951     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
952     'type'        => 'textarea',
953     'per_agent'   => 1,
954   },
955
956   {
957     'key'         => 'invoice_htmlsummary',
958     'section'     => 'invoicing',
959     'description' => 'Summary initial page for HTML invoices.',
960     'type'        => 'textarea',
961     'per_agent'   => 1,
962   },
963
964   {
965     'key'         => 'invoice_htmlreturnaddress',
966     'section'     => 'invoicing',
967     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
968     'type'        => 'textarea',
969   },
970
971   {
972     'key'         => 'invoice_latex',
973     'section'     => 'invoicing',
974     '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.',
975     'type'        => 'textarea',
976   },
977
978   {
979     'key'         => 'invoice_latextopmargin',
980     'section'     => 'invoicing',
981     'description' => 'Optional LaTeX invoice topmargin setting. Include units.',
982     'type'        => 'text',
983     'per_agent'   => 1,
984     'validate'    => sub { shift =~
985                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
986                              ? '' : 'Invalid LaTex length';
987                          },
988   },
989
990   {
991     'key'         => 'invoice_latexheadsep',
992     'section'     => 'invoicing',
993     'description' => 'Optional LaTeX invoice headsep setting. Include units.',
994     'type'        => 'text',
995     'per_agent'   => 1,
996     'validate'    => sub { shift =~
997                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
998                              ? '' : 'Invalid LaTex length';
999                          },
1000   },
1001
1002   {
1003     'key'         => 'invoice_latexaddresssep',
1004     'section'     => 'invoicing',
1005     'description' => 'Optional LaTeX invoice separation between invoice header
1006 and customer address. Include units.',
1007     'type'        => 'text',
1008     'per_agent'   => 1,
1009     'validate'    => sub { shift =~
1010                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1011                              ? '' : 'Invalid LaTex length';
1012                          },
1013   },
1014
1015   {
1016     'key'         => 'invoice_latextextheight',
1017     'section'     => 'invoicing',
1018     'description' => 'Optional LaTeX invoice textheight setting. Include units.',
1019     'type'        => 'text',
1020     'per_agent'   => 1,
1021     'validate'    => sub { shift =~
1022                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1023                              ? '' : 'Invalid LaTex length';
1024                          },
1025   },
1026
1027   {
1028     'key'         => 'invoice_latexnotes',
1029     'section'     => 'invoicing',
1030     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
1031     'type'        => 'textarea',
1032     'per_agent'   => 1,
1033   },
1034
1035   {
1036     'key'         => 'invoice_latexfooter',
1037     'section'     => 'invoicing',
1038     'description' => 'Footer for LaTeX typeset PostScript invoices.',
1039     'type'        => 'textarea',
1040     'per_agent'   => 1,
1041   },
1042
1043   {
1044     'key'         => 'invoice_latexsummary',
1045     'section'     => 'invoicing',
1046     'description' => 'Summary initial page for LaTeX typeset PostScript invoices.',
1047     'type'        => 'textarea',
1048     'per_agent'   => 1,
1049   },
1050
1051   {
1052     'key'         => 'invoice_latexcoupon',
1053     'section'     => 'invoicing',
1054     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
1055     'type'        => 'textarea',
1056     'per_agent'   => 1,
1057   },
1058
1059   {
1060     'key'         => 'invoice_latexextracouponspace',
1061     'section'     => 'invoicing',
1062     'description' => 'Optional LaTeX invoice textheight space to reserve for a tear off coupon. Include units.',
1063     'type'        => 'text',
1064     'per_agent'   => 1,
1065     'validate'    => sub { shift =~
1066                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1067                              ? '' : 'Invalid LaTex length';
1068                          },
1069   },
1070
1071   {
1072     'key'         => 'invoice_latexcouponfootsep',
1073     'section'     => 'invoicing',
1074     'description' => 'Optional LaTeX invoice separation between tear off coupon and footer. Include units.',
1075     'type'        => 'text',
1076     'per_agent'   => 1,
1077     'validate'    => sub { shift =~
1078                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1079                              ? '' : 'Invalid LaTex length';
1080                          },
1081   },
1082
1083   {
1084     'key'         => 'invoice_latexcouponamountenclosedsep',
1085     'section'     => 'invoicing',
1086     'description' => 'Optional LaTeX invoice separation between total due and amount enclosed line. Include units.',
1087     'type'        => 'text',
1088     'per_agent'   => 1,
1089     'validate'    => sub { shift =~
1090                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1091                              ? '' : 'Invalid LaTex length';
1092                          },
1093   },
1094   {
1095     'key'         => 'invoice_latexcoupontoaddresssep',
1096     'section'     => 'invoicing',
1097     'description' => 'Optional LaTeX invoice separation between invoice data and the to address (usually invoice_latexreturnaddress).  Include units.',
1098     'type'        => 'text',
1099     'per_agent'   => 1,
1100     'validate'    => sub { shift =~
1101                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1102                              ? '' : 'Invalid LaTex length';
1103                          },
1104   },
1105
1106   {
1107     'key'         => 'invoice_latexreturnaddress',
1108     'section'     => 'invoicing',
1109     'description' => 'Return address for LaTeX typeset PostScript invoices.',
1110     'type'        => 'textarea',
1111   },
1112
1113   {
1114     'key'         => 'invoice_latexverticalreturnaddress',
1115     'section'     => 'invoicing',
1116     'description' => 'Place the return address under the company logo rather than beside it.',
1117     'type'        => 'checkbox',
1118     'per_agent'   => 1,
1119   },
1120
1121   {
1122     'key'         => 'invoice_latexcouponaddcompanytoaddress',
1123     'section'     => 'invoicing',
1124     'description' => 'Add the company name to the To address on the remittance coupon because the return address does not contain it.',
1125     'type'        => 'checkbox',
1126     'per_agent'   => 1,
1127   },
1128
1129   {
1130     'key'         => 'invoice_latexsmallfooter',
1131     'section'     => 'invoicing',
1132     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
1133     'type'        => 'textarea',
1134     'per_agent'   => 1,
1135   },
1136
1137   {
1138     'key'         => 'invoice_email_pdf',
1139     'section'     => 'invoicing',
1140     '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.',
1141     'type'        => 'checkbox'
1142   },
1143
1144   {
1145     'key'         => 'invoice_email_pdf_note',
1146     'section'     => 'invoicing',
1147     'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
1148     'type'        => 'textarea'
1149   },
1150
1151   {
1152     'key'         => 'invoice_print_pdf',
1153     'section'     => 'invoicing',
1154     'description' => 'Store postal invoices for download in PDF format rather than printing them directly.',
1155     'type'        => 'checkbox',
1156   },
1157
1158   { 
1159     'key'         => 'invoice_default_terms',
1160     'section'     => 'invoicing',
1161     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
1162     'type'        => 'select',
1163     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 20', 'Net 30', 'Net 45', 'Net 60' ],
1164   },
1165
1166   { 
1167     'key'         => 'invoice_show_prior_due_date',
1168     'section'     => 'invoicing',
1169     'description' => 'Show previous invoice due dates when showing prior balances.  Default is to show invoice date.',
1170     'type'        => 'checkbox',
1171   },
1172
1173   { 
1174     'key'         => 'invoice_include_aging',
1175     'section'     => 'invoicing',
1176     'description' => 'Show an aging line after the prior balance section.  Only valud when invoice_sections is enabled.',
1177     'type'        => 'checkbox',
1178   },
1179
1180   { 
1181     'key'         => 'invoice_sections',
1182     'section'     => 'invoicing',
1183     'description' => 'Split invoice into sections and label according to package category when enabled.',
1184     'type'        => 'checkbox',
1185   },
1186
1187   { 
1188     'key'         => 'usage_class_as_a_section',
1189     'section'     => 'invoicing',
1190     'description' => 'Split usage into sections and label according to usage class name when enabled.  Only valid when invoice_sections is enabled.',
1191     'type'        => 'checkbox',
1192   },
1193
1194   { 
1195     'key'         => 'svc_phone_sections',
1196     'section'     => 'invoicing',
1197     'description' => 'Create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',
1198     'type'        => 'checkbox',
1199   },
1200
1201   {
1202     'key'         => 'finance_pkgclass',
1203     'section'     => 'billing',
1204     'description' => 'The default package class for late fee charges, used if the fee event does not specify a package class itself.',
1205     'type'        => 'select-pkg_class',
1206   },
1207
1208   { 
1209     'key'         => 'separate_usage',
1210     'section'     => 'invoicing',
1211     'description' => 'Split the rated call usage into a separate line from the recurring charges.',
1212     'type'        => 'checkbox',
1213   },
1214
1215   {
1216     'key'         => 'invoice_send_receipts',
1217     'section'     => 'deprecated',
1218     'description' => '<b>DEPRECATED</b>, this used to send an invoice copy on payments and credits.  See the payment_receipt_email and XXXX instead.',
1219     'type'        => 'checkbox',
1220   },
1221
1222   {
1223     'key'         => 'payment_receipt_email',
1224     'section'     => 'billing',
1225     '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<li><code>$pkg</code> - Package (requires payment_receipt-trigger set to "when payment is applied".)</ul>',
1226     'type'        => [qw( checkbox textarea )],
1227   },
1228
1229   {
1230     'key'         => 'payment_receipt-trigger',
1231     'section'     => 'billing',
1232     'description' => 'When payment receipts are triggered.  Defaults to when payment is made.',
1233     'type'        => 'select',
1234     'select_hash' => [
1235                        'cust_pay'          => 'When payment is made.',
1236                        'cust_bill_pay_pkg' => 'When payment is applied.',
1237                      ],
1238   },
1239
1240   {
1241     'key'         => 'trigger_export_insert_on_payment',
1242     'section'     => 'billing',
1243     'description' => 'Enable exports on payment application.',
1244     'type'        => 'checkbox',
1245   },
1246
1247   {
1248     'key'         => 'lpr',
1249     'section'     => 'required',
1250     'description' => 'Print command for paper invoices, for example `lpr -h\'',
1251     'type'        => 'text',
1252   },
1253
1254   {
1255     'key'         => 'lpr-postscript_prefix',
1256     'section'     => 'billing',
1257     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1258     'type'        => 'text',
1259   },
1260
1261   {
1262     'key'         => 'lpr-postscript_suffix',
1263     'section'     => 'billing',
1264     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1265     'type'        => 'text',
1266   },
1267
1268   {
1269     'key'         => 'money_char',
1270     'section'     => '',
1271     'description' => 'Currency symbol - defaults to `$\'',
1272     'type'        => 'text',
1273   },
1274
1275   {
1276     'key'         => 'defaultrecords',
1277     'section'     => 'BIND',
1278     'description' => 'DNS entries to add automatically when creating a domain',
1279     'type'        => 'editlist',
1280     'editlist_parts' => [ { type=>'text' },
1281                           { type=>'immutable', value=>'IN' },
1282                           { type=>'select',
1283                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
1284                           { type=> 'text' }, ],
1285   },
1286
1287   {
1288     'key'         => 'passwordmin',
1289     'section'     => 'password',
1290     'description' => 'Minimum password length (default 6)',
1291     'type'        => 'text',
1292   },
1293
1294   {
1295     'key'         => 'passwordmax',
1296     'section'     => 'password',
1297     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
1298     'type'        => 'text',
1299   },
1300
1301   {
1302     'key'         => 'password-noampersand',
1303     'section'     => 'password',
1304     'description' => 'Disallow ampersands in passwords',
1305     'type'        => 'checkbox',
1306   },
1307
1308   {
1309     'key'         => 'password-noexclamation',
1310     'section'     => 'password',
1311     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
1312     'type'        => 'checkbox',
1313   },
1314
1315   {
1316     'key'         => 'default-password-encoding',
1317     'section'     => 'password',
1318     'description' => 'Default storage format for passwords',
1319     'type'        => 'select',
1320     'select_hash' => [
1321       'plain'       => 'Plain text',
1322       'crypt-des'   => 'Unix password (DES encrypted)',
1323       'crypt-md5'   => 'Unix password (MD5 digest)',
1324       'ldap-plain'  => 'LDAP (plain text)',
1325       'ldap-crypt'  => 'LDAP (DES encrypted)',
1326       'ldap-md5'    => 'LDAP (MD5 digest)',
1327       'ldap-sha1'   => 'LDAP (SHA1 digest)',
1328       'legacy'      => 'Legacy mode',
1329     ],
1330   },
1331
1332   {
1333     'key'         => 'referraldefault',
1334     'section'     => 'UI',
1335     'description' => 'Default referral, specified by refnum',
1336     'type'        => 'text',
1337   },
1338
1339 #  {
1340 #    'key'         => 'registries',
1341 #    'section'     => 'required',
1342 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
1343 #  },
1344
1345   {
1346     'key'         => 'report_template',
1347     'section'     => 'deprecated',
1348     'description' => 'Deprecated template file for reports.',
1349     'type'        => 'textarea',
1350   },
1351
1352   {
1353     'key'         => 'maxsearchrecordsperpage',
1354     'section'     => 'UI',
1355     'description' => 'If set, number of search records to return per page.',
1356     'type'        => 'text',
1357   },
1358
1359   {
1360     'key'         => 'session-start',
1361     'section'     => 'session',
1362     '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.',
1363     'type'        => 'text',
1364   },
1365
1366   {
1367     'key'         => 'session-stop',
1368     'section'     => 'session',
1369     '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.',
1370     'type'        => 'text',
1371   },
1372
1373   {
1374     'key'         => 'shells',
1375     'section'     => 'shell',
1376     '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.',
1377     'type'        => 'textarea',
1378   },
1379
1380   {
1381     'key'         => 'showpasswords',
1382     'section'     => 'UI',
1383     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1384     'type'        => 'checkbox',
1385   },
1386
1387   {
1388     'key'         => 'report-showpasswords',
1389     'section'     => 'UI',
1390     'description' => 'This is a terrible idea.  Do not enable it.  STRONGLY NOT RECOMMENDED.  Enables display of passwords on services reports.',
1391     'type'        => 'checkbox',
1392   },
1393
1394   {
1395     'key'         => 'signupurl',
1396     'section'     => 'UI',
1397     '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',
1398     'type'        => 'text',
1399   },
1400
1401   {
1402     'key'         => 'smtpmachine',
1403     'section'     => 'required',
1404     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1405     'type'        => 'text',
1406   },
1407
1408   {
1409     'key'         => 'smtp-username',
1410     'section'     => '',
1411     'description' => 'Optional SMTP username for Freeside\'s outgoing mail',
1412     'type'        => 'text',
1413   },
1414
1415   {
1416     'key'         => 'smtp-password',
1417     'section'     => '',
1418     'description' => 'Optional SMTP password for Freeside\'s outgoing mail',
1419     'type'        => 'text',
1420   },
1421
1422   {
1423     'key'         => 'smtp-encryption',
1424     'section'     => '',
1425     'description' => 'Optional SMTP encryption method.  The STARTTLS methods require smtp-username and smtp-password to be set.',
1426     'type'        => 'select',
1427     'select_hash' => [ '25'           => 'None (port 25)',
1428                        '25-starttls'  => 'STARTTLS (port 25)',
1429                        '587-starttls' => 'STARTTLS / submission (port 587)',
1430                        '465-tls'      => 'SMTPS (SSL) (port 465)',
1431                      ],
1432   },
1433
1434   {
1435     'key'         => 'soadefaultttl',
1436     'section'     => 'BIND',
1437     'description' => 'SOA default TTL for new domains.',
1438     'type'        => 'text',
1439   },
1440
1441   {
1442     'key'         => 'soaemail',
1443     'section'     => 'BIND',
1444     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1445     'type'        => 'text',
1446   },
1447
1448   {
1449     'key'         => 'soaexpire',
1450     'section'     => 'BIND',
1451     'description' => 'SOA expire for new domains',
1452     'type'        => 'text',
1453   },
1454
1455   {
1456     'key'         => 'soamachine',
1457     'section'     => 'BIND',
1458     'description' => 'SOA machine for new domains, with trailing `.\'',
1459     'type'        => 'text',
1460   },
1461
1462   {
1463     'key'         => 'soarefresh',
1464     'section'     => 'BIND',
1465     'description' => 'SOA refresh for new domains',
1466     'type'        => 'text',
1467   },
1468
1469   {
1470     'key'         => 'soaretry',
1471     'section'     => 'BIND',
1472     'description' => 'SOA retry for new domains',
1473     'type'        => 'text',
1474   },
1475
1476   {
1477     'key'         => 'statedefault',
1478     'section'     => 'UI',
1479     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1480     'type'        => 'text',
1481   },
1482
1483   {
1484     'key'         => 'unsuspendauto',
1485     'section'     => 'billing',
1486     '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',
1487     'type'        => 'checkbox',
1488   },
1489
1490   {
1491     'key'         => 'unsuspend-always_adjust_next_bill_date',
1492     'section'     => 'billing',
1493     '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.',
1494     'type'        => 'checkbox',
1495   },
1496
1497   {
1498     'key'         => 'usernamemin',
1499     'section'     => 'username',
1500     'description' => 'Minimum username length (default 2)',
1501     'type'        => 'text',
1502   },
1503
1504   {
1505     'key'         => 'usernamemax',
1506     'section'     => 'username',
1507     'description' => 'Maximum username length',
1508     'type'        => 'text',
1509   },
1510
1511   {
1512     'key'         => 'username-ampersand',
1513     'section'     => 'username',
1514     '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.',
1515     'type'        => 'checkbox',
1516   },
1517
1518   {
1519     'key'         => 'username-letter',
1520     'section'     => 'username',
1521     'description' => 'Usernames must contain at least one letter',
1522     'type'        => 'checkbox',
1523     'per_agent'   => 1,
1524   },
1525
1526   {
1527     'key'         => 'username-letterfirst',
1528     'section'     => 'username',
1529     'description' => 'Usernames must start with a letter',
1530     'type'        => 'checkbox',
1531   },
1532
1533   {
1534     'key'         => 'username-noperiod',
1535     'section'     => 'username',
1536     'description' => 'Disallow periods in usernames',
1537     'type'        => 'checkbox',
1538   },
1539
1540   {
1541     'key'         => 'username-nounderscore',
1542     'section'     => 'username',
1543     'description' => 'Disallow underscores in usernames',
1544     'type'        => 'checkbox',
1545   },
1546
1547   {
1548     'key'         => 'username-nodash',
1549     'section'     => 'username',
1550     'description' => 'Disallow dashes in usernames',
1551     'type'        => 'checkbox',
1552   },
1553
1554   {
1555     'key'         => 'username-uppercase',
1556     'section'     => 'username',
1557     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1558     'type'        => 'checkbox',
1559   },
1560
1561   { 
1562     'key'         => 'username-percent',
1563     'section'     => 'username',
1564     'description' => 'Allow the percent character (%) in usernames.',
1565     'type'        => 'checkbox',
1566   },
1567
1568   { 
1569     'key'         => 'username-colon',
1570     'section'     => 'username',
1571     'description' => 'Allow the colon character (:) in usernames.',
1572     'type'        => 'checkbox',
1573   },
1574
1575   {
1576     'key'         => 'safe-part_bill_event',
1577     'section'     => 'UI',
1578     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
1579     'type'        => 'checkbox',
1580   },
1581
1582   {
1583     'key'         => 'show_ss',
1584     'section'     => 'UI',
1585     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
1586     'type'        => 'checkbox',
1587   },
1588
1589   {
1590     'key'         => 'show_stateid',
1591     'section'     => 'UI',
1592     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
1593     'type'        => 'checkbox',
1594   },
1595
1596   {
1597     'key'         => 'show_bankstate',
1598     'section'     => 'UI',
1599     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
1600     'type'        => 'checkbox',
1601   },
1602
1603   { 
1604     'key'         => 'agent_defaultpkg',
1605     'section'     => 'UI',
1606     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1607     'type'        => 'checkbox',
1608   },
1609
1610   {
1611     'key'         => 'legacy_link',
1612     'section'     => 'UI',
1613     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1614     'type'        => 'checkbox',
1615   },
1616
1617   {
1618     'key'         => 'legacy_link-steal',
1619     'section'     => 'UI',
1620     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1621     'type'        => 'checkbox',
1622   },
1623
1624   {
1625     'key'         => 'queue_dangerous_controls',
1626     'section'     => 'UI',
1627     '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.',
1628     'type'        => 'checkbox',
1629   },
1630
1631   {
1632     'key'         => 'security_phrase',
1633     'section'     => 'password',
1634     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
1635     'type'        => 'checkbox',
1636   },
1637
1638   {
1639     'key'         => 'locale',
1640     'section'     => 'UI',
1641     'description' => 'Message locale',
1642     'type'        => 'select',
1643     'select_enum' => [ qw(en_US) ],
1644   },
1645
1646   {
1647     'key'         => 'signup_server-payby',
1648     'section'     => 'self-service',
1649     'description' => 'Acceptable payment types for the signup server',
1650     'type'        => 'selectmultiple',
1651     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1652   },
1653
1654   {
1655     'key'         => 'selfservice-save_unchecked',
1656     'section'     => 'self-service',
1657     'description' => 'In self-service, uncheck "Remember information" checkboxes by default (normally, they are checked by default).',
1658     'type'        => 'checkbox',
1659   },
1660
1661   {
1662     'key'         => 'signup_server-default_agentnum',
1663     'section'     => 'self-service',
1664     'description' => 'Default agent for the signup server',
1665     'type'        => 'select-sub',
1666     'options_sub' => sub { require FS::Record;
1667                            require FS::agent;
1668                            map { $_->agentnum => $_->agent }
1669                                FS::Record::qsearch('agent', { disabled=>'' } );
1670                          },
1671     'option_sub'  => sub { require FS::Record;
1672                            require FS::agent;
1673                            my $agent = FS::Record::qsearchs(
1674                              'agent', { 'agentnum'=>shift }
1675                            );
1676                            $agent ? $agent->agent : '';
1677                          },
1678   },
1679
1680   {
1681     'key'         => 'signup_server-default_refnum',
1682     'section'     => 'self-service',
1683     'description' => 'Default advertising source for the signup server',
1684     'type'        => 'select-sub',
1685     'options_sub' => sub { require FS::Record;
1686                            require FS::part_referral;
1687                            map { $_->refnum => $_->referral }
1688                                FS::Record::qsearch( 'part_referral', 
1689                                                     { 'disabled' => '' }
1690                                                   );
1691                          },
1692     'option_sub'  => sub { require FS::Record;
1693                            require FS::part_referral;
1694                            my $part_referral = FS::Record::qsearchs(
1695                              'part_referral', { 'refnum'=>shift } );
1696                            $part_referral ? $part_referral->referral : '';
1697                          },
1698   },
1699
1700   {
1701     'key'         => 'signup_server-default_pkgpart',
1702     'section'     => 'self-service',
1703     'description' => 'Default package for the signup server',
1704     'type'        => 'select-part_pkg',
1705   },
1706
1707   {
1708     'key'         => 'signup_server-default_svcpart',
1709     'section'     => 'self-service',
1710     'description' => 'Default service definition for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
1711     'type'        => 'select-part_svc',
1712   },
1713
1714   {
1715     'key'         => 'signup_server-mac_addr_svcparts',
1716     'section'     => 'self-service',
1717     'description' => 'Service definitions which can receive mac addresses (current mapped to username for svc_acct).',
1718     'type'        => 'select-part_svc',
1719     'multiple'    => 1,
1720   },
1721
1722   {
1723     'key'         => 'signup_server-nomadix',
1724     'section'     => 'self-service',
1725     'description' => 'Signup page Nomadix integration',
1726     'type'        => 'checkbox',
1727   },
1728
1729   {
1730     'key'         => 'signup_server-service',
1731     'section'     => 'self-service',
1732     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
1733     'type'        => 'select',
1734     'select_hash' => [
1735                        'svc_acct'  => 'Account (svc_acct)',
1736                        'svc_phone' => 'Phone number (svc_phone)',
1737                      ],
1738   },
1739
1740   {
1741     'key'         => 'selfservice_server-base_url',
1742     'section'     => 'self-service',
1743     '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.',
1744     'type'        => 'text',
1745   },
1746
1747   {
1748     'key'         => 'show-msgcat-codes',
1749     'section'     => 'UI',
1750     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
1751     'type'        => 'checkbox',
1752   },
1753
1754   {
1755     'key'         => 'signup_server-realtime',
1756     'section'     => 'self-service',
1757     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1758     'type'        => 'checkbox',
1759   },
1760
1761   {
1762     'key'         => 'signup_server-classnum2',
1763     'section'     => 'self-service',
1764     'description' => 'Package Class for first optional purchase',
1765     'type'        => 'select-pkg_class',
1766   },
1767
1768   {
1769     'key'         => 'signup_server-classnum3',
1770     'section'     => 'self-service',
1771     'description' => 'Package Class for second optional purchase',
1772     'type'        => 'select-pkg_class',
1773   },
1774
1775   {
1776     'key'         => 'selfservice-xmlrpc',
1777     'section'     => 'self-service',
1778     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
1779     'type'        => 'checkbox',
1780   },
1781
1782   {
1783     'key'         => 'backend-realtime',
1784     'section'     => 'billing',
1785     'description' => 'Run billing for backend signups immediately.',
1786     'type'        => 'checkbox',
1787   },
1788
1789   {
1790     'key'         => 'declinetemplate',
1791     'section'     => 'billing',
1792     'description' => 'Template file for credit card and electronic check decline emails.',
1793     'type'        => 'textarea',
1794   },
1795
1796   {
1797     'key'         => 'emaildecline',
1798     'section'     => 'billing',
1799     'description' => 'Enable emailing of credit card and electronic check decline notices.',
1800     'type'        => 'checkbox',
1801   },
1802
1803   {
1804     'key'         => 'emaildecline-exclude',
1805     'section'     => 'billing',
1806     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1807     'type'        => 'textarea',
1808   },
1809
1810   {
1811     'key'         => 'cancelmessage',
1812     'section'     => 'billing',
1813     'description' => 'Template file for cancellation emails.',
1814     'type'        => 'textarea',
1815   },
1816
1817   {
1818     'key'         => 'cancelsubject',
1819     'section'     => 'billing',
1820     'description' => 'Subject line for cancellation emails.',
1821     'type'        => 'text',
1822   },
1823
1824   {
1825     'key'         => 'emailcancel',
1826     'section'     => 'billing',
1827     'description' => 'Enable emailing of cancellation notices.  Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
1828     'type'        => 'checkbox',
1829   },
1830
1831   {
1832     'key'         => 'bill_usage_on_cancel',
1833     'section'     => 'billing',
1834     'description' => 'Enable automatic generation of an invoice for usage when a package is cancelled.  Not all packages can do this.  Usage data must already be available.',
1835     'type'        => 'checkbox',
1836   },
1837
1838   {
1839     'key'         => 'require_cardname',
1840     'section'     => 'billing',
1841     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1842     'type'        => 'checkbox',
1843   },
1844
1845   {
1846     'key'         => 'enable_taxclasses',
1847     'section'     => 'billing',
1848     'description' => 'Enable per-package tax classes',
1849     'type'        => 'checkbox',
1850   },
1851
1852   {
1853     'key'         => 'require_taxclasses',
1854     'section'     => 'billing',
1855     'description' => 'Require a taxclass to be entered for every package',
1856     'type'        => 'checkbox',
1857   },
1858
1859   {
1860     'key'         => 'enable_taxproducts',
1861     'section'     => 'billing',
1862     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
1863     'type'        => 'checkbox',
1864   },
1865
1866   {
1867     'key'         => 'taxdatadirectdownload',
1868     'section'     => 'billing',  #well
1869     'description' => 'Enable downloading tax data directly from the vendor site. at least three lines: URL, username, and password.j',
1870     'type'        => 'textarea',
1871   },
1872
1873   {
1874     'key'         => 'ignore_incalculable_taxes',
1875     'section'     => 'billing',
1876     'description' => 'Prefer to invoice without tax over not billing at all',
1877     'type'        => 'checkbox',
1878   },
1879
1880   {
1881     'key'         => 'welcome_email',
1882     'section'     => '',
1883     '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>',
1884     'type'        => 'textarea',
1885     'per_agent'   => 1,
1886   },
1887
1888   {
1889     'key'         => 'welcome_email-from',
1890     'section'     => '',
1891     'description' => 'From: address header for welcome email',
1892     'type'        => 'text',
1893     'per_agent'   => 1,
1894   },
1895
1896   {
1897     'key'         => 'welcome_email-subject',
1898     'section'     => '',
1899     'description' => 'Subject: header for welcome email',
1900     'type'        => 'text',
1901     'per_agent'   => 1,
1902   },
1903   
1904   {
1905     'key'         => 'welcome_email-mimetype',
1906     'section'     => '',
1907     'description' => 'MIME type for welcome email',
1908     'type'        => 'select',
1909     'select_enum' => [ 'text/plain', 'text/html' ],
1910     'per_agent'   => 1,
1911   },
1912
1913   {
1914     'key'         => 'welcome_letter',
1915     'section'     => '',
1916     '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>',
1917     'type'        => 'textarea',
1918   },
1919
1920   {
1921     'key'         => 'warning_email',
1922     'section'     => '',
1923     '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>',
1924     'type'        => 'textarea',
1925   },
1926
1927   {
1928     'key'         => 'warning_email-from',
1929     'section'     => '',
1930     'description' => 'From: address header for warning email',
1931     'type'        => 'text',
1932   },
1933
1934   {
1935     'key'         => 'warning_email-cc',
1936     'section'     => '',
1937     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1938     'type'        => 'text',
1939   },
1940
1941   {
1942     'key'         => 'warning_email-subject',
1943     'section'     => '',
1944     'description' => 'Subject: header for warning email',
1945     'type'        => 'text',
1946   },
1947   
1948   {
1949     'key'         => 'warning_email-mimetype',
1950     'section'     => '',
1951     'description' => 'MIME type for warning email',
1952     'type'        => 'select',
1953     'select_enum' => [ 'text/plain', 'text/html' ],
1954   },
1955
1956   {
1957     'key'         => 'payby',
1958     'section'     => 'billing',
1959     'description' => 'Available payment types.',
1960     'type'        => 'selectmultiple',
1961     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1962   },
1963
1964   {
1965     'key'         => 'payby-default',
1966     'section'     => 'UI',
1967     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1968     'type'        => 'select',
1969     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1970   },
1971
1972   {
1973     'key'         => 'paymentforcedtobatch',
1974     'section'     => 'deprecated',
1975     '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.',
1976     'type'        => 'checkbox',
1977   },
1978
1979   {
1980     'key'         => 'svc_acct-notes',
1981     'section'     => 'deprecated',
1982     'description' => 'Extra HTML to be displayed on the Account View screen.',
1983     'type'        => 'textarea',
1984   },
1985
1986   {
1987     'key'         => 'radius-password',
1988     'section'     => '',
1989     'description' => 'RADIUS attribute for plain-text passwords.',
1990     'type'        => 'select',
1991     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
1992   },
1993
1994   {
1995     'key'         => 'radius-ip',
1996     'section'     => '',
1997     'description' => 'RADIUS attribute for IP addresses.',
1998     'type'        => 'select',
1999     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
2000   },
2001
2002   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
2003   {
2004     'key'         => 'radius-chillispot-max',
2005     'section'     => '',
2006     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
2007     'type'        => 'checkbox',
2008   },
2009
2010   {
2011     'key'         => 'svc_acct-alldomains',
2012     'section'     => '',
2013     '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.',
2014     'type'        => 'checkbox',
2015   },
2016
2017   {
2018     'key'         => 'dump-scpdest',
2019     'section'     => '',
2020     'description' => 'destination for scp database dumps: user@host:/path',
2021     'type'        => 'text',
2022   },
2023
2024   {
2025     'key'         => 'dump-pgpid',
2026     'section'     => '',
2027     '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.",
2028     'type'        => 'text',
2029   },
2030
2031   {
2032     'key'         => 'users-allow_comp',
2033     'section'     => 'deprecated',
2034     'description' => '<b>DEPRECATED</b>, enable the <i>Complimentary customer</i> access right instead.  Was: Usernames (Freeside users, created with <a href="../docs/man/bin/freeside-adduser.html">freeside-adduser</a>) which can create complimentary customers, one per line.  If no usernames are entered, all users can create complimentary accounts.',
2035     'type'        => 'textarea',
2036   },
2037
2038   {
2039     'key'         => 'credit_card-recurring_billing_flag',
2040     'section'     => 'billing',
2041     '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. ',
2042     'type'        => 'select',
2043     'select_hash' => [
2044                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
2045                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
2046                      ],
2047   },
2048
2049   {
2050     'key'         => 'credit_card-recurring_billing_acct_code',
2051     'section'     => 'billing',
2052     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
2053     'type'        => 'checkbox',
2054   },
2055
2056   {
2057     'key'         => 'cvv-save',
2058     'section'     => 'billing',
2059     '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.',
2060     'type'        => 'selectmultiple',
2061     'select_enum' => \@card_types,
2062   },
2063
2064   {
2065     'key'         => 'manual_process-pkgpart',
2066     'section'     => 'billing',
2067     'description' => 'Package to add to each manual credit card and ACH payments entered from the backend.  Enabling this option may be in violation of your merchant agreement(s), so please check them carefully before enabling this option.',
2068     'type'        => 'select-part_pkg',
2069   },
2070
2071   {
2072     'key'         => 'manual_process-display',
2073     'section'     => 'billing',
2074     'description' => 'When using manual_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2075     'type'        => 'select',
2076     'select_hash' => [
2077                        'add'      => 'Add fee to amount entered',
2078                        'subtract' => 'Subtract fee from amount entered',
2079                      ],
2080   },
2081
2082   {
2083     'key'         => 'manual_process-skip_first',
2084     'section'     => 'billing',
2085     'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
2086     'type'        => 'checkbox',
2087   },
2088
2089   {
2090     'key'         => 'allow_negative_charges',
2091     'section'     => 'billing',
2092     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
2093     'type'        => 'checkbox',
2094   },
2095   {
2096       'key'         => 'auto_unset_catchall',
2097       'section'     => '',
2098       '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.',
2099       'type'        => 'checkbox',
2100   },
2101
2102   {
2103     'key'         => 'system_usernames',
2104     'section'     => 'username',
2105     '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.',
2106     'type'        => 'textarea',
2107   },
2108
2109   {
2110     'key'         => 'cust_pkg-change_svcpart',
2111     'section'     => '',
2112     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
2113     'type'        => 'checkbox',
2114   },
2115
2116   {
2117     'key'         => 'cust_pkg-change_pkgpart-bill_now',
2118     'section'     => '',
2119     'description' => "When changing packages, bill the new package immediately.  Useful for prepaid situations with RADIUS where an Expiration attribute based on the package must be present at all times.",
2120     'type'        => 'checkbox',
2121   },
2122
2123   {
2124     'key'         => 'disable_autoreverse',
2125     'section'     => 'BIND',
2126     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
2127     'type'        => 'checkbox',
2128   },
2129
2130   {
2131     'key'         => 'svc_www-enable_subdomains',
2132     'section'     => '',
2133     'description' => 'Enable selection of specific subdomains for virtual host creation.',
2134     'type'        => 'checkbox',
2135   },
2136
2137   {
2138     'key'         => 'svc_www-usersvc_svcpart',
2139     'section'     => '',
2140     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
2141     'type'        => 'select-part_svc',
2142     'multiple'    => 1,
2143   },
2144
2145   {
2146     'key'         => 'selfservice_server-primary_only',
2147     'section'     => 'self-service',
2148     'description' => 'Only allow primary accounts to access self-service functionality.',
2149     'type'        => 'checkbox',
2150   },
2151
2152   {
2153     'key'         => 'selfservice_server-phone_login',
2154     'section'     => 'self-service',
2155     'description' => 'Allow login to self-service with phone number and PIN.',
2156     'type'        => 'checkbox',
2157   },
2158
2159   {
2160     'key'         => 'selfservice_server-single_domain',
2161     'section'     => 'self-service',
2162     'description' => 'If specified, only use this one domain for self-service access.',
2163     'type'        => 'text',
2164   },
2165
2166   {
2167     'key'         => 'card_refund-days',
2168     'section'     => 'billing',
2169     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
2170     'type'        => 'text',
2171   },
2172
2173   {
2174     'key'         => 'agent-showpasswords',
2175     'section'     => '',
2176     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
2177     'type'        => 'checkbox',
2178   },
2179
2180   {
2181     'key'         => 'global_unique-username',
2182     'section'     => 'username',
2183     '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.',
2184     'type'        => 'select',
2185     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
2186   },
2187
2188   {
2189     'key'         => 'global_unique-phonenum',
2190     'section'     => '',
2191     '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.',
2192     'type'        => 'select',
2193     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
2194   },
2195
2196   {
2197     'key'         => 'global_unique-pbx_title',
2198     'section'     => '',
2199     'description' => 'Global phone number uniqueness control: enabled (usual setting - title must e unique), or disabled turns off duplicate checking for this field.',
2200     'type'        => 'select',
2201     'select_enum' => [ 'enabled', 'disabled' ],
2202   },
2203
2204   {
2205     'key'         => 'svc_external-skip_manual',
2206     'section'     => 'UI',
2207     '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).',
2208     'type'        => 'checkbox',
2209   },
2210
2211   {
2212     'key'         => 'svc_external-display_type',
2213     'section'     => 'UI',
2214     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
2215     'type'        => 'select',
2216     'select_enum' => [ 'generic', 'artera_turbo', ],
2217   },
2218
2219   {
2220     'key'         => 'ticket_system',
2221     'section'     => '',
2222     '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).',
2223     'type'        => 'select',
2224     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
2225     'select_enum' => [ '', qw(RT_Internal RT_External) ],
2226   },
2227
2228   {
2229     'key'         => 'ticket_system-default_queueid',
2230     'section'     => '',
2231     'description' => 'Default queue used when creating new customer tickets.',
2232     'type'        => 'select-sub',
2233     'options_sub' => sub {
2234                            my $conf = new FS::Conf;
2235                            if ( $conf->config('ticket_system') ) {
2236                              eval "use FS::TicketSystem;";
2237                              die $@ if $@;
2238                              FS::TicketSystem->queues();
2239                            } else {
2240                              ();
2241                            }
2242                          },
2243     'option_sub'  => sub { 
2244                            my $conf = new FS::Conf;
2245                            if ( $conf->config('ticket_system') ) {
2246                              eval "use FS::TicketSystem;";
2247                              die $@ if $@;
2248                              FS::TicketSystem->queue(shift);
2249                            } else {
2250                              '';
2251                            }
2252                          },
2253   },
2254
2255   {
2256     'key'         => 'ticket_system-selfservice_queueid',
2257     'section'     => '',
2258     'description' => 'Queue used when creating new customer tickets from self-service.  Defautls to ticket_system-default_queueid if not specified.',
2259     #false laziness w/above
2260     'type'        => 'select-sub',
2261     'options_sub' => sub {
2262                            my $conf = new FS::Conf;
2263                            if ( $conf->config('ticket_system') ) {
2264                              eval "use FS::TicketSystem;";
2265                              die $@ if $@;
2266                              FS::TicketSystem->queues();
2267                            } else {
2268                              ();
2269                            }
2270                          },
2271     'option_sub'  => sub { 
2272                            my $conf = new FS::Conf;
2273                            if ( $conf->config('ticket_system') ) {
2274                              eval "use FS::TicketSystem;";
2275                              die $@ if $@;
2276                              FS::TicketSystem->queue(shift);
2277                            } else {
2278                              '';
2279                            }
2280                          },
2281   },
2282
2283   {
2284     'key'         => 'ticket_system-priority_reverse',
2285     'section'     => '',
2286     '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.',
2287     'type'        => 'checkbox',
2288   },
2289
2290   {
2291     'key'         => 'ticket_system-custom_priority_field',
2292     'section'     => '',
2293     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
2294     'type'        => 'text',
2295   },
2296
2297   {
2298     'key'         => 'ticket_system-custom_priority_field-values',
2299     'section'     => '',
2300     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
2301     'type'        => 'textarea',
2302   },
2303
2304   {
2305     'key'         => 'ticket_system-custom_priority_field_queue',
2306     'section'     => '',
2307     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
2308     'type'        => 'text',
2309   },
2310
2311   {
2312     'key'         => 'ticket_system-rt_external_datasrc',
2313     'section'     => '',
2314     '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>',
2315     'type'        => 'text',
2316
2317   },
2318
2319   {
2320     'key'         => 'ticket_system-rt_external_url',
2321     'section'     => '',
2322     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
2323     'type'        => 'text',
2324   },
2325
2326   {
2327     'key'         => 'company_name',
2328     'section'     => 'required',
2329     'description' => 'Your company name',
2330     'type'        => 'text',
2331     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
2332   },
2333
2334   {
2335     'key'         => 'company_address',
2336     'section'     => 'required',
2337     'description' => 'Your company address',
2338     'type'        => 'textarea',
2339     'per_agent'   => 1,
2340   },
2341
2342   {
2343     'key'         => 'echeck-void',
2344     'section'     => 'deprecated',
2345     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable local-only voiding of echeck payments in addition to refunds against the payment gateway',
2346     'type'        => 'checkbox',
2347   },
2348
2349   {
2350     'key'         => 'cc-void',
2351     'section'     => 'deprecated',
2352     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable local-only voiding of credit card payments in addition to refunds against the payment gateway',
2353     'type'        => 'checkbox',
2354   },
2355
2356   {
2357     'key'         => 'unvoid',
2358     'section'     => 'deprecated',
2359     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
2360     'type'        => 'checkbox',
2361   },
2362
2363   {
2364     'key'         => 'address1-search',
2365     'section'     => 'UI',
2366     'description' => 'Enable the ability to search the address1 field from customer search.',
2367     'type'        => 'checkbox',
2368   },
2369
2370   {
2371     'key'         => 'address2-search',
2372     'section'     => 'UI',
2373     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
2374     'type'        => 'checkbox',
2375   },
2376
2377   {
2378     'key'         => 'cust_main-require_address2',
2379     'section'     => 'UI',
2380     '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',
2381     'type'        => 'checkbox',
2382   },
2383
2384   {
2385     'key'         => 'agent-ship_address',
2386     'section'     => '',
2387     '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.",
2388     'type'        => 'checkbox',
2389   },
2390
2391   { 'key'         => 'referral_credit',
2392     'section'     => 'deprecated',
2393     '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.",
2394     'type'        => 'checkbox',
2395   },
2396
2397   { 'key'         => 'selfservice_server-cache_module',
2398     'section'     => 'self-service',
2399     '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.',
2400     'type'        => 'select',
2401     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
2402   },
2403
2404   {
2405     'key'         => 'hylafax',
2406     'section'     => 'billing',
2407     '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).',
2408     'type'        => [qw( checkbox textarea )],
2409   },
2410
2411   {
2412     'key'         => 'cust_bill-ftpformat',
2413     'section'     => 'invoicing',
2414     'description' => 'Enable FTP of raw invoice data - format.',
2415     'type'        => 'select',
2416     'select_enum' => [ '', 'default', 'billco', ],
2417   },
2418
2419   {
2420     'key'         => 'cust_bill-ftpserver',
2421     'section'     => 'invoicing',
2422     'description' => 'Enable FTP of raw invoice data - server.',
2423     'type'        => 'text',
2424   },
2425
2426   {
2427     'key'         => 'cust_bill-ftpusername',
2428     'section'     => 'invoicing',
2429     'description' => 'Enable FTP of raw invoice data - server.',
2430     'type'        => 'text',
2431   },
2432
2433   {
2434     'key'         => 'cust_bill-ftppassword',
2435     'section'     => 'invoicing',
2436     'description' => 'Enable FTP of raw invoice data - server.',
2437     'type'        => 'text',
2438   },
2439
2440   {
2441     'key'         => 'cust_bill-ftpdir',
2442     'section'     => 'invoicing',
2443     'description' => 'Enable FTP of raw invoice data - server.',
2444     'type'        => 'text',
2445   },
2446
2447   {
2448     'key'         => 'cust_bill-spoolformat',
2449     'section'     => 'invoicing',
2450     'description' => 'Enable spooling of raw invoice data - format.',
2451     'type'        => 'select',
2452     'select_enum' => [ '', 'default', 'billco', ],
2453   },
2454
2455   {
2456     'key'         => 'cust_bill-spoolagent',
2457     'section'     => 'invoicing',
2458     'description' => 'Enable per-agent spooling of raw invoice data.',
2459     'type'        => 'checkbox',
2460   },
2461
2462   {
2463     'key'         => 'svc_acct-usage_suspend',
2464     'section'     => 'billing',
2465     '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.',
2466     'type'        => 'checkbox',
2467   },
2468
2469   {
2470     'key'         => 'svc_acct-usage_unsuspend',
2471     'section'     => 'billing',
2472     '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.',
2473     'type'        => 'checkbox',
2474   },
2475
2476   {
2477     'key'         => 'svc_acct-usage_threshold',
2478     'section'     => 'billing',
2479     '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.',
2480     'type'        => 'text',
2481   },
2482
2483   {
2484     'key'         => 'overlimit_groups',
2485     'section'     => '',
2486     'description' => 'RADIUS group (or comma-separated groups) to assign to svc_acct which has exceeded its bandwidth or time limit.',
2487     'type'        => 'text',
2488     'per_agent'   => 1,
2489   },
2490
2491   {
2492     'key'         => 'cust-fields',
2493     'section'     => 'UI',
2494     'description' => 'Which customer fields to display on reports by default',
2495     'type'        => 'select',
2496     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
2497   },
2498
2499   {
2500     'key'         => 'cust_pkg-display_times',
2501     'section'     => 'UI',
2502     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
2503     'type'        => 'checkbox',
2504   },
2505
2506   {
2507     'key'         => 'cust_pkg-always_show_location',
2508     'section'     => 'UI',
2509     'description' => "Always display package locations, even when they're all the default service address.",
2510     'type'        => 'checkbox',
2511   },
2512
2513   {
2514     'key'         => 'cust_pkg-show_fcc_voice_grade_equivalent',
2515     'section'     => 'UI',
2516     'description' => "Show a field on package definitions for assigning a DSO equivalency number suitable for use on FCC form 477.",
2517     'type'        => 'checkbox',
2518   },
2519
2520   {
2521     'key'         => 'svc_acct-edit_uid',
2522     'section'     => 'shell',
2523     'description' => 'Allow UID editing.',
2524     'type'        => 'checkbox',
2525   },
2526
2527   {
2528     'key'         => 'svc_acct-edit_gid',
2529     'section'     => 'shell',
2530     'description' => 'Allow GID editing.',
2531     'type'        => 'checkbox',
2532   },
2533
2534   {
2535     'key'         => 'zone-underscore',
2536     'section'     => 'BIND',
2537     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
2538     'type'        => 'checkbox',
2539   },
2540
2541   {
2542     'key'         => 'echeck-nonus',
2543     'section'     => 'billing',
2544     'description' => 'Disable ABA-format account checking for Electronic Check payment info',
2545     'type'        => 'checkbox',
2546   },
2547
2548   {
2549     'key'         => 'voip-cust_cdr_spools',
2550     'section'     => '',
2551     'description' => 'Enable the per-customer option for individual CDR spools.',
2552     'type'        => 'checkbox',
2553   },
2554
2555   {
2556     'key'         => 'voip-cust_cdr_squelch',
2557     'section'     => '',
2558     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
2559     'type'        => 'checkbox',
2560   },
2561
2562   {
2563     'key'         => 'voip-cdr_email',
2564     'section'     => '',
2565     'description' => 'Include the call details on emailed invoices even if the customer is configured for not printing them on the invoices.',
2566     'type'        => 'checkbox',
2567   },
2568
2569   {
2570     'key'         => 'voip-cust_email_csv_cdr',
2571     'section'     => '',
2572     'description' => 'Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.',
2573     'type'        => 'checkbox',
2574   },
2575
2576   {
2577     'key'         => 'cgp_rule-domain_templates',
2578     'section'     => '',
2579     'description' => 'Communigate Pro rule templates for domains, one per line, "svcnum Name"',
2580     'type'        => 'textarea',
2581   },
2582
2583   {
2584     'key'         => 'svc_forward-no_srcsvc',
2585     'section'     => '',
2586     'description' => "Don't allow forwards from existing accounts, only arbitrary addresses.  Useful when exporting to systems such as Communigate Pro which treat forwards in this fashion.",
2587     'type'        => 'checkbox',
2588   },
2589
2590   {
2591     'key'         => 'svc_forward-arbitrary_dst',
2592     'section'     => '',
2593     '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.",
2594     'type'        => 'checkbox',
2595   },
2596
2597   {
2598     'key'         => 'tax-ship_address',
2599     'section'     => 'billing',
2600     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
2601     'type'        => 'checkbox',
2602   }
2603 ,
2604   {
2605     'key'         => 'tax-pkg_address',
2606     'section'     => 'billing',
2607     '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.',
2608     'type'        => 'checkbox',
2609   },
2610
2611   {
2612     'key'         => 'invoice-ship_address',
2613     'section'     => 'invoicing',
2614     'description' => 'Include the shipping address on invoices.',
2615     'type'        => 'checkbox',
2616   },
2617
2618   {
2619     'key'         => 'invoice-unitprice',
2620     'section'     => 'invoicing',
2621     'description' => 'Enable unit pricing on invoices.',
2622     'type'        => 'checkbox',
2623   },
2624
2625   {
2626     'key'         => 'invoice-smallernotes',
2627     'section'     => 'invoicing',
2628     'description' => 'Display the notes section in a smaller font on invoices.',
2629     'type'        => 'checkbox',
2630   },
2631
2632   {
2633     'key'         => 'invoice-smallerfooter',
2634     'section'     => 'invoicing',
2635     'description' => 'Display footers in a smaller font on invoices.',
2636     'type'        => 'checkbox',
2637   },
2638
2639   {
2640     'key'         => 'postal_invoice-fee_pkgpart',
2641     'section'     => 'billing',
2642     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
2643     'type'        => 'select-part_pkg',
2644   },
2645
2646   {
2647     'key'         => 'postal_invoice-recurring_only',
2648     'section'     => 'billing',
2649     'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
2650     'type'        => 'checkbox',
2651   },
2652
2653   {
2654     'key'         => 'batch-enable',
2655     'section'     => 'deprecated', #make sure batch-enable_payby is set for
2656                                    #everyone before removing
2657     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
2658     'type'        => 'checkbox',
2659   },
2660
2661   {
2662     'key'         => 'batch-enable_payby',
2663     'section'     => 'billing',
2664     'description' => 'Enable batch processing for the specified payment types.',
2665     'type'        => 'selectmultiple',
2666     'select_enum' => [qw( CARD CHEK )],
2667   },
2668
2669   {
2670     'key'         => 'realtime-disable_payby',
2671     'section'     => 'billing',
2672     'description' => 'Disable realtime processing for the specified payment types.',
2673     'type'        => 'selectmultiple',
2674     'select_enum' => [qw( CARD CHEK )],
2675   },
2676
2677   {
2678     'key'         => 'batch-default_format',
2679     'section'     => 'billing',
2680     'description' => 'Default format for batches.',
2681     'type'        => 'select',
2682     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
2683                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
2684                        'paymentech', 'ach-spiritone', 'RBC'
2685                     ]
2686   },
2687
2688   #lists could be auto-generated from pay_batch info
2689   {
2690     'key'         => 'batch-fixed_format-CARD',
2691     'section'     => 'billing',
2692     'description' => 'Fixed (unchangeable) format for credit card batches.',
2693     'type'        => 'select',
2694     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
2695                        'csv-chase_canada-E-xactBatch', 'paymentech' ]
2696   },
2697
2698   {
2699     'key'         => 'batch-fixed_format-CHEK',
2700     'section'     => 'billing',
2701     'description' => 'Fixed (unchangeable) format for electronic check batches.',
2702     'type'        => 'select',
2703     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
2704                        'paymentech', 'ach-spiritone', 'RBC'
2705                      ]
2706   },
2707
2708   {
2709     'key'         => 'batch-increment_expiration',
2710     'section'     => 'billing',
2711     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
2712     'type'        => 'checkbox'
2713   },
2714
2715   {
2716     'key'         => 'batchconfig-BoM',
2717     'section'     => 'billing',
2718     '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',
2719     'type'        => 'textarea',
2720   },
2721
2722   {
2723     'key'         => 'batchconfig-PAP',
2724     'section'     => 'billing',
2725     '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',
2726     'type'        => 'textarea',
2727   },
2728
2729   {
2730     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
2731     'section'     => 'billing',
2732     'description' => 'Gateway ID for Chase Canada E-xact batching',
2733     'type'        => 'text',
2734   },
2735
2736   {
2737     'key'         => 'batchconfig-paymentech',
2738     'section'     => 'billing',
2739     'description' => 'Configuration for Chase Paymentech batching, five lines: 1. BIN, 2. Terminal ID, 3. Merchant ID, 4. Username, 5. Password (for batch uploads)',
2740     'type'        => 'textarea',
2741   },
2742
2743   {
2744     'key'         => 'batchconfig-RBC',
2745     'section'     => 'billing',
2746     'description' => 'Configuration for Royal Bank of Canada PDS batching, four lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code.',
2747     'type'        => 'textarea',
2748   },
2749
2750   {
2751     'key'         => 'payment_history-years',
2752     'section'     => 'UI',
2753     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
2754     'type'        => 'text',
2755   },
2756
2757   {
2758     'key'         => 'change_history-years',
2759     'section'     => 'UI',
2760     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
2761     'type'        => 'text',
2762   },
2763
2764   {
2765     'key'         => 'cust_main-packages-years',
2766     'section'     => 'UI',
2767     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
2768     'type'        => 'text',
2769   },
2770
2771   {
2772     'key'         => 'cust_main-use_comments',
2773     'section'     => 'UI',
2774     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
2775     'type'        => 'checkbox',
2776   },
2777
2778   {
2779     'key'         => 'cust_main-disable_notes',
2780     'section'     => 'UI',
2781     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
2782     'type'        => 'checkbox',
2783   },
2784
2785   {
2786     'key'         => 'cust_main_note-display_times',
2787     'section'     => 'UI',
2788     'description' => 'Display full timestamps (not just dates) for customer notes.',
2789     'type'        => 'checkbox',
2790   },
2791
2792   {
2793     'key'         => 'cust_main-ticket_statuses',
2794     'section'     => 'UI',
2795     'description' => 'Show tickets with these statuses on the customer view page.',
2796     'type'        => 'selectmultiple',
2797     'select_enum' => [qw( new open stalled resolved rejected deleted )],
2798   },
2799
2800   {
2801     'key'         => 'cust_main-max_tickets',
2802     'section'     => 'UI',
2803     'description' => 'Maximum number of tickets to show on the customer view page.',
2804     'type'        => 'text',
2805   },
2806
2807   {
2808     'key'         => 'cust_main-skeleton_tables',
2809     'section'     => '',
2810     '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.',
2811     'type'        => 'textarea',
2812   },
2813
2814   {
2815     'key'         => 'cust_main-skeleton_custnum',
2816     'section'     => '',
2817     'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
2818     'type'        => 'text',
2819   },
2820
2821   {
2822     'key'         => 'cust_main-enable_birthdate',
2823     'section'     => 'UI',
2824     'descritpion' => 'Enable tracking of a birth date with each customer record',
2825     'type'        => 'checkbox',
2826   },
2827
2828   {
2829     'key'         => 'support-key',
2830     'section'     => '',
2831     '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.',
2832     'type'        => 'text',
2833   },
2834
2835   {
2836     'key'         => 'card-types',
2837     'section'     => 'billing',
2838     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
2839     'type'        => 'selectmultiple',
2840     'select_enum' => \@card_types,
2841   },
2842
2843   {
2844     'key'         => 'disable-fuzzy',
2845     'section'     => 'UI',
2846     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
2847     'type'        => 'checkbox',
2848   },
2849
2850   { 'key'         => 'pkg_referral',
2851     'section'     => '',
2852     'description' => 'Enable package-specific advertising sources.',
2853     'type'        => 'checkbox',
2854   },
2855
2856   { 'key'         => 'pkg_referral-multiple',
2857     'section'     => '',
2858     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
2859     'type'        => 'checkbox',
2860   },
2861
2862   {
2863     'key'         => 'dashboard-install_welcome',
2864     'section'     => 'UI',
2865     'description' => 'New install welcome screen.',
2866     'type'        => 'select',
2867     'select_enum' => [ '', 'ITSP_fsinc_hosted', ],
2868   },
2869
2870   {
2871     'key'         => 'dashboard-toplist',
2872     'section'     => 'UI',
2873     'description' => 'List of items to display on the top of the front page',
2874     'type'        => 'textarea',
2875   },
2876
2877   {
2878     'key'         => 'impending_recur_template',
2879     'section'     => 'billing',
2880     '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>',
2881 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
2882     'type'        => 'textarea',
2883   },
2884
2885   {
2886     'key'         => 'logo.png',
2887     'section'     => 'UI',  #'invoicing' ?
2888     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
2889     'type'        => 'image',
2890     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
2891                         #old-style editor anyway...?
2892   },
2893
2894   {
2895     'key'         => 'logo.eps',
2896     'section'     => 'invoicing',
2897     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
2898     'type'        => 'image',
2899     'per_agent'   => 1, #XXX as above, kinda
2900   },
2901
2902   {
2903     'key'         => 'selfservice-ignore_quantity',
2904     'section'     => 'self-service',
2905     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
2906     'type'        => 'checkbox',
2907   },
2908
2909   {
2910     'key'         => 'selfservice-session_timeout',
2911     'section'     => 'self-service',
2912     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
2913     'type'        => 'select',
2914     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
2915   },
2916
2917   {
2918     'key'         => 'disable_setup_suspended_pkgs',
2919     'section'     => 'billing',
2920     'description' => 'Disables charging of setup fees for suspended packages.',
2921     'type'        => 'checkbox',
2922   },
2923
2924   {
2925     'key'         => 'password-generated-allcaps',
2926     'section'     => 'password',
2927     'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
2928     'type'        => 'checkbox',
2929   },
2930
2931   {
2932     'key'         => 'datavolume-forcemegabytes',
2933     'section'     => 'UI',
2934     'description' => 'All data volumes are expressed in megabytes',
2935     'type'        => 'checkbox',
2936   },
2937
2938   {
2939     'key'         => 'datavolume-significantdigits',
2940     'section'     => 'UI',
2941     'description' => 'number of significant digits to use to represent data volumes',
2942     'type'        => 'text',
2943   },
2944
2945   {
2946     'key'         => 'disable_void_after',
2947     'section'     => 'billing',
2948     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
2949     'type'        => 'text',
2950   },
2951
2952   {
2953     'key'         => 'disable_line_item_date_ranges',
2954     'section'     => 'billing',
2955     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
2956     'type'        => 'checkbox',
2957   },
2958
2959   {
2960     'key'         => 'support_packages',
2961     'section'     => '',
2962     '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...
2963     'type'        => 'select-part_pkg',
2964     'multiple'    => 1,
2965   },
2966
2967   {
2968     'key'         => 'cust_main-require_phone',
2969     'section'     => '',
2970     'description' => 'Require daytime or night phone for all customer records.',
2971     'type'        => 'checkbox',
2972   },
2973
2974   {
2975     'key'         => 'cust_main-require_invoicing_list_email',
2976     'section'     => '',
2977     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
2978     'type'        => 'checkbox',
2979   },
2980
2981   {
2982     'key'         => 'svc_acct-display_paid_time_remaining',
2983     'section'     => '',
2984     'description' => 'Show paid time remaining in addition to time remaining.',
2985     'type'        => 'checkbox',
2986   },
2987
2988   {
2989     'key'         => 'cancel_credit_type',
2990     'section'     => 'billing',
2991     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
2992     'type'        => 'select-sub',
2993     'options_sub' => sub { require FS::Record;
2994                            require FS::reason_type;
2995                            map { $_->typenum => $_->type }
2996                                FS::Record::qsearch('reason_type', { class=>'R' } );
2997                          },
2998     'option_sub'  => sub { require FS::Record;
2999                            require FS::reason_type;
3000                            my $reason_type = FS::Record::qsearchs(
3001                              'reason_type', { 'typenum' => shift }
3002                            );
3003                            $reason_type ? $reason_type->type : '';
3004                          },
3005   },
3006
3007   {
3008     'key'         => 'referral_credit_type',
3009     'section'     => 'deprecated',
3010     '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.',
3011     'type'        => 'select-sub',
3012     'options_sub' => sub { require FS::Record;
3013                            require FS::reason_type;
3014                            map { $_->typenum => $_->type }
3015                                FS::Record::qsearch('reason_type', { class=>'R' } );
3016                          },
3017     'option_sub'  => sub { require FS::Record;
3018                            require FS::reason_type;
3019                            my $reason_type = FS::Record::qsearchs(
3020                              'reason_type', { 'typenum' => shift }
3021                            );
3022                            $reason_type ? $reason_type->type : '';
3023                          },
3024   },
3025
3026   {
3027     'key'         => 'signup_credit_type',
3028     'section'     => 'billing', #self-service?
3029     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
3030     'type'        => 'select-sub',
3031     'options_sub' => sub { require FS::Record;
3032                            require FS::reason_type;
3033                            map { $_->typenum => $_->type }
3034                                FS::Record::qsearch('reason_type', { class=>'R' } );
3035                          },
3036     'option_sub'  => sub { require FS::Record;
3037                            require FS::reason_type;
3038                            my $reason_type = FS::Record::qsearchs(
3039                              'reason_type', { 'typenum' => shift }
3040                            );
3041                            $reason_type ? $reason_type->type : '';
3042                          },
3043   },
3044
3045   {
3046     'key'         => 'cust_main-agent_custid-format',
3047     'section'     => '',
3048     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
3049     'type'        => 'select',
3050     'select_hash' => [
3051                        ''      => 'Numeric only',
3052                        'ww?d+' => 'Numeric with one or two letter prefix',
3053                      ],
3054   },
3055
3056   {
3057     'key'         => 'card_masking_method',
3058     'section'     => 'UI',
3059     '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.',
3060     'type'        => 'select',
3061     'select_hash' => [
3062                        ''            => '123456xxxxxx1234',
3063                        'first6last2' => '123456xxxxxxxx12',
3064                        'first4last4' => '1234xxxxxxxx1234',
3065                        'first4last2' => '1234xxxxxxxxxx12',
3066                        'first2last4' => '12xxxxxxxxxx1234',
3067                        'first2last2' => '12xxxxxxxxxxxx12',
3068                        'first0last4' => 'xxxxxxxxxxxx1234',
3069                        'first0last2' => 'xxxxxxxxxxxxxx12',
3070                      ],
3071   },
3072
3073   {
3074     'key'         => 'disable_previous_balance',
3075     'section'     => 'invoicing',
3076     'description' => 'Disable inclusion of previous balance, payment, and credit lines on invoices',
3077     'type'        => 'checkbox',
3078   },
3079
3080   {
3081     'key'         => 'previous_balance-exclude_from_total',
3082     'section'     => 'invoicing',
3083     'description' => 'Do not include previous balance in the \'Total\' line.  Only meaningful when invoice_sections is false.  Optionally provide text to override the Total New Charges description',
3084     'type'        => [ qw(checkbox text) ],
3085   },
3086
3087   {
3088     'key'         => 'previous_balance-summary_only',
3089     'section'     => 'invoicing',
3090     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
3091     'type'        => 'checkbox',
3092   },
3093
3094   {
3095     'key'         => 'balance_due_below_line',
3096     'section'     => 'invoicing',
3097     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
3098     'type'        => 'checkbox',
3099   },
3100
3101   {
3102     'key'         => 'usps_webtools-userid',
3103     'section'     => 'UI',
3104     '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.',
3105     'type'        => 'text',
3106   },
3107
3108   {
3109     'key'         => 'usps_webtools-password',
3110     'section'     => 'UI',
3111     '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.',
3112     'type'        => 'text',
3113   },
3114
3115   {
3116     'key'         => 'cust_main-auto_standardize_address',
3117     'section'     => 'UI',
3118     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
3119     'type'        => 'checkbox',
3120   },
3121
3122   {
3123     'key'         => 'cust_main-require_censustract',
3124     'section'     => 'UI',
3125     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
3126     'type'        => 'checkbox',
3127   },
3128
3129   {
3130     'key'         => 'census_year',
3131     'section'     => 'UI',
3132     'description' => 'The year to use in census tract lookups',
3133     'type'        => 'select',
3134     'select_enum' => [ qw( 2009 2008 2007 2006 ) ],
3135   },
3136
3137   {
3138     'key'         => 'company_latitude',
3139     'section'     => 'UI',
3140     'description' => 'Your company latitude (-90 through 90)',
3141     'type'        => 'text',
3142   },
3143
3144   {
3145     'key'         => 'company_longitude',
3146     'section'     => 'UI',
3147     'description' => 'Your company longitude (-180 thru 180)',
3148     'type'        => 'text',
3149   },
3150
3151   {
3152     'key'         => 'disable_acl_changes',
3153     'section'     => '',
3154     'description' => 'Disable all ACL changes, for demos.',
3155     'type'        => 'checkbox',
3156   },
3157
3158   {
3159     'key'         => 'disable_settings_changes',
3160     'section'     => '',
3161     'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.',
3162     'type'        => [qw( checkbox text )],
3163   },
3164
3165   {
3166     'key'         => 'cust_main-edit_agent_custid',
3167     'section'     => 'UI',
3168     'description' => 'Enable editing of the agent_custid field.',
3169     'type'        => 'checkbox',
3170   },
3171
3172   {
3173     'key'         => 'cust_main-default_agent_custid',
3174     'section'     => 'UI',
3175     'description' => 'Display the agent_custid field when available instead of the custnum field.',
3176     'type'        => 'checkbox',
3177   },
3178
3179   {
3180     'key'         => 'cust_bill-default_agent_invid',
3181     'section'     => 'UI',
3182     'description' => 'Display the agent_invid field when available instead of the invnum field.',
3183     'type'        => 'checkbox',
3184   },
3185
3186   {
3187     'key'         => 'cust_main-auto_agent_custid',
3188     'section'     => 'UI',
3189     'description' => 'Automatically assign an agent_custid - select format',
3190     'type'        => 'select',
3191     'select_hash' => [ '' => 'No',
3192                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
3193                      ],
3194   },
3195
3196   {
3197     'key'         => 'cust_main-default_areacode',
3198     'section'     => 'UI',
3199     'description' => 'Default area code for customers.',
3200     'type'        => 'text',
3201   },
3202
3203   {
3204     'key'         => 'mcp_svcpart',
3205     'section'     => '',
3206     'description' => 'Master Control Program svcpart.  Leave this blank.',
3207     'type'        => 'text', #select-part_svc
3208   },
3209
3210   {
3211     'key'         => 'cust_bill-max_same_services',
3212     'section'     => 'invoicing',
3213     '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.',
3214     'type'        => 'text',
3215   },
3216
3217   {
3218     'key'         => 'cust_bill-consolidate_services',
3219     'section'     => 'invoicing',
3220     'description' => 'Consolidate service display into fewer lines on invoices rather than one per service.',
3221     'type'        => 'checkbox',
3222   },
3223
3224   {
3225     'key'         => 'suspend_email_admin',
3226     'section'     => '',
3227     'description' => 'Destination admin email address to enable suspension notices',
3228     'type'        => 'text',
3229   },
3230
3231   {
3232     'key'         => 'email_report-subject',
3233     'section'     => '',
3234     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
3235     'type'        => 'text',
3236   },
3237
3238   {
3239     'key'         => 'selfservice-head',
3240     'section'     => 'self-service',
3241     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
3242     'type'        => 'textarea', #htmlarea?
3243     'per_agent'   => 1,
3244   },
3245
3246
3247   {
3248     'key'         => 'selfservice-body_header',
3249     'section'     => 'self-service',
3250     'description' => 'HTML header for the self-service interface',
3251     'type'        => 'textarea', #htmlarea?
3252     'per_agent'   => 1,
3253   },
3254
3255   {
3256     'key'         => 'selfservice-body_footer',
3257     'section'     => 'self-service',
3258     'description' => 'HTML footer for the self-service interface',
3259     'type'        => 'textarea', #htmlarea?
3260     'per_agent'   => 1,
3261   },
3262
3263
3264   {
3265     'key'         => 'selfservice-body_bgcolor',
3266     'section'     => 'self-service',
3267     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
3268     'type'        => 'text',
3269     'per_agent'   => 1,
3270   },
3271
3272   {
3273     'key'         => 'selfservice-box_bgcolor',
3274     'section'     => 'self-service',
3275     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0',
3276     'type'        => 'text',
3277     'per_agent'   => 1,
3278   },
3279
3280   {
3281     'key'         => 'selfservice-text_color',
3282     'section'     => 'self-service',
3283     'description' => 'HTML text color for the self-service interface, for example, #000000',
3284     'type'        => 'text',
3285     'per_agent'   => 1,
3286   },
3287
3288   {
3289     'key'         => 'selfservice-link_color',
3290     'section'     => 'self-service',
3291     'description' => 'HTML link color for the self-service interface, for example, #0000FF',
3292     'type'        => 'text',
3293     'per_agent'   => 1,
3294   },
3295
3296   {
3297     'key'         => 'selfservice-vlink_color',
3298     'section'     => 'self-service',
3299     'description' => 'HTML visited link color for the self-service interface, for example, #FF00FF',
3300     'type'        => 'text',
3301     'per_agent'   => 1,
3302   },
3303
3304   {
3305     'key'         => 'selfservice-hlink_color',
3306     'section'     => 'self-service',
3307     'description' => 'HTML hover link color for the self-service interface, for example, #808080',
3308     'type'        => 'text',
3309     'per_agent'   => 1,
3310   },
3311
3312   {
3313     'key'         => 'selfservice-alink_color',
3314     'section'     => 'self-service',
3315     'description' => 'HTML active (clicked) link color for the self-service interface, for example, #808080',
3316     'type'        => 'text',
3317     'per_agent'   => 1,
3318   },
3319
3320   {
3321     'key'         => 'selfservice-font',
3322     'section'     => 'self-service',
3323     'description' => 'HTML font CSS for the self-service interface, for example, 0.9em/1.5em Arial, Helvetica, Geneva, sans-serif',
3324     'type'        => 'text',
3325     'per_agent'   => 1,
3326   },
3327
3328   {
3329     'key'         => 'selfservice-title_color',
3330     'section'     => 'self-service',
3331     'description' => 'HTML color for the self-service title, for example, #000000',
3332     'type'        => 'text',
3333     'per_agent'   => 1,
3334   },
3335
3336   {
3337     'key'         => 'selfservice-title_align',
3338     'section'     => 'self-service',
3339     'description' => 'HTML alignment for the self-service title, for example, center',
3340     'type'        => 'text',
3341     'per_agent'   => 1,
3342   },
3343   {
3344     'key'         => 'selfservice-title_size',
3345     'section'     => 'self-service',
3346     'description' => 'HTML font size for the self-service title, for example, 3',
3347     'type'        => 'text',
3348     'per_agent'   => 1,
3349   },
3350
3351   {
3352     'key'         => 'selfservice-title_left_image',
3353     'section'     => 'self-service',
3354     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
3355     'type'        => 'image',
3356     'per_agent'   => 1,
3357   },
3358
3359   {
3360     'key'         => 'selfservice-title_right_image',
3361     'section'     => 'self-service',
3362     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
3363     'type'        => 'image',
3364     'per_agent'   => 1,
3365   },
3366
3367   {
3368     'key'         => 'selfservice-menu_skipblanks',
3369     'section'     => 'self-service',
3370     'description' => 'Skip blank (spacer) entries in the self-service menu',
3371     'type'        => 'checkbox',
3372     'per_agent'   => 1,
3373   },
3374
3375   {
3376     'key'         => 'selfservice-menu_skipheadings',
3377     'section'     => 'self-service',
3378     'description' => 'Skip the unclickable heading entries in the self-service menu',
3379     'type'        => 'checkbox',
3380     'per_agent'   => 1,
3381   },
3382
3383   {
3384     'key'         => 'selfservice-menu_bgcolor',
3385     'section'     => 'self-service',
3386     'description' => 'HTML color for the self-service menu, for example, #C0C0C0',
3387     'type'        => 'text',
3388     'per_agent'   => 1,
3389   },
3390
3391   {
3392     'key'         => 'selfservice-menu_fontsize',
3393     'section'     => 'self-service',
3394     'description' => 'HTML font size for the self-service menu, for example, -1',
3395     'type'        => 'text',
3396     'per_agent'   => 1,
3397   },
3398   {
3399     'key'         => 'selfservice-menu_nounderline',
3400     'section'     => 'self-service',
3401     'description' => 'Styles menu links in the self-service without underlining.',
3402     'type'        => 'checkbox',
3403     'per_agent'   => 1,
3404   },
3405
3406
3407   {
3408     'key'         => 'selfservice-menu_top_image',
3409     'section'     => 'self-service',
3410     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
3411     'type'        => 'image',
3412     'per_agent'   => 1,
3413   },
3414
3415   {
3416     'key'         => 'selfservice-menu_body_image',
3417     'section'     => 'self-service',
3418     'description' => 'Repeating image used for the body of the menu in the self-service interface, in PNG format.',
3419     'type'        => 'image',
3420     'per_agent'   => 1,
3421   },
3422
3423   {
3424     'key'         => 'selfservice-menu_bottom_image',
3425     'section'     => 'self-service',
3426     'description' => 'Image used for the bottom of the menu in the self-service interface, in PNG format.',
3427     'type'        => 'image',
3428     'per_agent'   => 1,
3429   },
3430
3431   {
3432     'key'         => 'selfservice-bulk_format',
3433     'section'     => 'deprecated',
3434     'description' => 'Parameter arrangement for selfservice bulk features',
3435     'type'        => 'select',
3436     'select_enum' => [ '', 'izoom-soap', 'izoom-ftp' ],
3437     'per_agent'   => 1,
3438   },
3439
3440   {
3441     'key'         => 'selfservice-bulk_ftp_dir',
3442     'section'     => 'deprecated',
3443     'description' => 'Enable bulk ftp provisioning in this folder',
3444     'type'        => 'text',
3445     'per_agent'   => 1,
3446   },
3447
3448   {
3449     'key'         => 'signup-no_company',
3450     'section'     => 'self-service',
3451     'description' => "Don't display a field for company name on signup.",
3452     'type'        => 'checkbox',
3453   },
3454
3455   {
3456     'key'         => 'signup-recommend_email',
3457     'section'     => 'self-service',
3458     'description' => 'Encourage the entry of an invoicing email address on signup.',
3459     'type'        => 'checkbox',
3460   },
3461
3462   {
3463     'key'         => 'signup-recommend_daytime',
3464     'section'     => 'self-service',
3465     'description' => 'Encourage the entry of a daytime phone number  invoicing email address on signup.',
3466     'type'        => 'checkbox',
3467   },
3468
3469   {
3470     'key'         => 'svc_phone-radius-default_password',
3471     'section'     => '',
3472     'description' => 'Default password when exporting svc_phone records to RADIUS',
3473     'type'        => 'text',
3474   },
3475
3476   {
3477     'key'         => 'svc_phone-allow_alpha_phonenum',
3478     'section'     => '',
3479     'description' => 'Allow letters in phone numbers.',
3480     'type'        => 'checkbox',
3481   },
3482
3483   {
3484     'key'         => 'svc_phone-domain',
3485     'section'     => '',
3486     'description' => 'Track an optional domain association with each phone service.',
3487     'type'        => 'checkbox',
3488   },
3489
3490   {
3491     'key'         => 'svc_phone-phone_name-max_length',
3492     'section'     => '',
3493     'description' => 'Maximum length of the phone service "Name" field (svc_phone.phone_name).  Sometimes useful to limit this (to 15?) when exporting as Caller ID data.',
3494     'type'        => 'text',
3495   },
3496
3497   {
3498     'key'         => 'default_phone_countrycode',
3499     'section'     => '',
3500     'description' => 'Default countrcode',
3501     'type'        => 'text',
3502   },
3503
3504   {
3505     'key'         => 'cdr-charged_party-field',
3506     'section'     => '',
3507     'description' => 'Set the charged_party field of CDRs to this field.',
3508     'type'        => 'select-sub',
3509     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
3510                            map { $_ => $fields->{$_}||$_ }
3511                            grep { $_ !~ /^(acctid|charged_party)$/ }
3512                            FS::Schema::dbdef->table('cdr')->columns;
3513                          },
3514     'option_sub'  => sub { my $f = shift;
3515                            FS::cdr->table_info->{'fields'}{$f} || $f;
3516                          },
3517   },
3518
3519   #probably deprecate in favor of cdr-charged_party-field above
3520   {
3521     'key'         => 'cdr-charged_party-accountcode',
3522     'section'     => '',
3523     'description' => 'Set the charged_party field of CDRs to the accountcode.',
3524     'type'        => 'checkbox',
3525   },
3526
3527   {
3528     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
3529     'section'     => '',
3530     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
3531     'type'        => 'checkbox',
3532   },
3533
3534 #  {
3535 #    'key'         => 'cdr-charged_party-truncate_prefix',
3536 #    'section'     => '',
3537 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
3538 #    'type'        => 'text',
3539 #  },
3540 #
3541 #  {
3542 #    'key'         => 'cdr-charged_party-truncate_length',
3543 #    'section'     => '',
3544 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
3545 #    'type'        => 'text',
3546 #  },
3547
3548   {
3549     'key'         => 'cdr-charged_party_rewrite',
3550     'section'     => '',
3551     '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*.',
3552     'type'        => 'checkbox',
3553   },
3554
3555   {
3556     'key'         => 'cdr-taqua-da_rewrite',
3557     'section'     => '',
3558     '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.',
3559     'type'        => 'text',
3560   },
3561
3562   {
3563     'key'         => 'cust_pkg-show_autosuspend',
3564     'section'     => 'UI',
3565     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
3566     'type'        => 'checkbox',
3567   },
3568
3569   {
3570     'key'         => 'cdr-asterisk_forward_rewrite',
3571     'section'     => '',
3572     '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").',
3573     'type'        => 'checkbox',
3574   },
3575
3576   {
3577     'key'         => 'sg-multicustomer_hack',
3578     'section'     => '',
3579     'description' => "Don't use this.",
3580     'type'        => 'checkbox',
3581   },
3582
3583   {
3584     'key'         => 'sg-ping_username',
3585     'section'     => '',
3586     'description' => "Don't use this.",
3587     'type'        => 'text',
3588   },
3589
3590   {
3591     'key'         => 'sg-ping_password',
3592     'section'     => '',
3593     'description' => "Don't use this.",
3594     'type'        => 'text',
3595   },
3596
3597   {
3598     'key'         => 'sg-login_username',
3599     'section'     => '',
3600     'description' => "Don't use this.",
3601     'type'        => 'text',
3602   },
3603
3604   {
3605     'key'         => 'mc-outbound_packages',
3606     'section'     => '',
3607     'description' => "Don't use this.",
3608     'type'        => 'select-part_pkg',
3609     'multiple'    => 1,
3610   },
3611
3612   {
3613     'key'         => 'disable-cust-pkg_class',
3614     'section'     => 'UI',
3615     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
3616     'type'        => 'checkbox',
3617   },
3618
3619   {
3620     'key'         => 'queued-max_kids',
3621     'section'     => '',
3622     'description' => 'Maximum number of queued processes.  Defaults to 10.',
3623     'type'        => 'text',
3624   },
3625
3626   {
3627     'key'         => 'queued-sleep_time',
3628     'section'     => '',
3629     'description' => 'Time to sleep between attempts to find new jobs to process in the queue.  Defaults to 10.  Installations doing real-time CDR processing for prepaid may want to set it lower.',
3630     'type'        => 'text',
3631   },
3632
3633   {
3634     'key'         => 'cancelled_cust-noevents',
3635     'section'     => 'billing',
3636     'description' => "Don't run events for cancelled customers",
3637     'type'        => 'checkbox',
3638   },
3639
3640   {
3641     'key'         => 'agent-invoice_template',
3642     'section'     => 'invoicing',
3643     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
3644     'type'        => 'checkbox',
3645   },
3646
3647   {
3648     'key'         => 'svc_broadband-manage_link',
3649     'section'     => 'UI',
3650     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr.',
3651     'type'        => 'text',
3652   },
3653
3654   #more fine-grained, service def-level control could be useful eventually?
3655   {
3656     'key'         => 'svc_broadband-allow_null_ip_addr',
3657     'section'     => '',
3658     'description' => '',
3659     'type'        => 'checkbox',
3660   },
3661
3662   {
3663     'key'         => 'tax-report_groups',
3664     'section'     => '',
3665     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
3666     'type'        => 'textarea',
3667   },
3668
3669   {
3670     'key'         => 'tax-cust_exempt-groups',
3671     'section'     => '',
3672     'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name per line.  For example, "GST" would indicate the ability to exempt customers individually from taxes named "GST" (but not other taxes).',
3673     'type'        => 'textarea',
3674   },
3675
3676   {
3677     'key'         => 'cust_main-default_view',
3678     'section'     => 'UI',
3679     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
3680     'type'        => 'select',
3681     'select_hash' => [
3682       #false laziness w/view/cust_main.cgi and pref/pref.html
3683       'basics'          => 'Basics',
3684       'notes'           => 'Notes',
3685       'tickets'         => 'Tickets',
3686       'packages'        => 'Packages',
3687       'payment_history' => 'Payment History',
3688       'change_history'  => 'Change History',
3689       'jumbo'           => 'Jumbo',
3690     ],
3691   },
3692
3693   {
3694     'key'         => 'enable_tax_adjustments',
3695     'section'     => 'billing',
3696     'description' => 'Enable the ability to add manual tax adjustments.',
3697     'type'        => 'checkbox',
3698   },
3699
3700   {
3701     'key'         => 'rt-crontool',
3702     'section'     => '',
3703     'description' => 'Enable the RT CronTool extension.',
3704     'type'        => 'checkbox',
3705   },
3706
3707   {
3708     'key'         => 'pkg-balances',
3709     'section'     => 'billing',
3710     'description' => 'Enable experimental package balances.  Not recommended for general use.',
3711     'type'        => 'checkbox',
3712   },
3713
3714   {
3715     'key'         => 'pkg-addon_classnum',
3716     'section'     => 'billing',
3717     'description' => 'Enable the ability to restrict additional package orders based on package class.',
3718     'type'        => 'checkbox',
3719   },
3720
3721   {
3722     'key'         => 'cust_main-edit_signupdate',
3723     'section'     => 'UI',
3724     'descritpion' => 'Enable manual editing of the signup date.',
3725     'type'        => 'checkbox',
3726   },
3727
3728   {
3729     'key'         => 'svc_acct-disable_access_number',
3730     'section'     => 'UI',
3731     'descritpion' => 'Disable access number selection.',
3732     'type'        => 'checkbox',
3733   },
3734
3735   {
3736     'key'         => 'cust_bill_pay_pkg-manual',
3737     'section'     => 'UI',
3738     'description' => 'Allow manual application of payments to line items.',
3739     'type'        => 'checkbox',
3740   },
3741
3742   {
3743     'key'         => 'cust_credit_bill_pkg-manual',
3744     'section'     => 'UI',
3745     'description' => 'Allow manual application of credits to line items.',
3746     'type'        => 'checkbox',
3747   },
3748
3749   {
3750     'key'         => 'breakage-days',
3751     'section'     => 'billing',
3752     'description' => 'If set to a number of days, after an account goes that long without activity, recognizes any outstanding payments and credits as "breakage" by creating a breakage charge and invoice.',
3753     'type'        => 'text',
3754     'per_agent'   => 1,
3755   },
3756
3757   {
3758     'key'         => 'breakage-pkg_class',
3759     'section'     => 'billing',
3760     'description' => 'Package class to use for breakage reconciliation.',
3761     'type'        => 'select-pkg_class',
3762   },
3763
3764   {
3765     'key'         => 'disable_cron_billing',
3766     'section'     => 'billing',
3767     'description' => 'Disable billing and collection from being run by freeside-daily and freeside-monthly, while still allowing other actions to run, such as notifications and backup.',
3768     'type'        => 'checkbox',
3769   },
3770
3771   {
3772     'key'         => 'svc_domain-edit_domain',
3773     'section'     => '',
3774     'description' => 'Enable domain renaming',
3775     'type'        => 'checkbox',
3776   },
3777
3778   {
3779     'key'         => 'enable_legacy_prepaid_income',
3780     'section'     => '',
3781     'description' => "Enable legacy prepaid income reporting.  Only useful when you have imported pre-Freeside packages with longer-than-monthly duration, and need to do prepaid income reporting on them before they've been invoiced the first time.",
3782     'type'        => 'checkbox',
3783   },
3784
3785   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3786   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3787   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3788   { key => "bindprimary", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3789   { key => "bindsecondaries", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3790   { key => "bsdshellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3791   { key => "cyrus", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3792   { key => "cp_app", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3793   { key => "erpcdmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3794   { key => "icradiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3795   { key => "icradius_mysqldest", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3796   { key => "icradius_mysqlsource", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3797   { key => "icradius_secrets", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3798   { key => "maildisablecatchall", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3799   { key => "mxmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3800   { key => "nsmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3801   { key => "arecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3802   { key => "cnamerecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3803   { key => "nismachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3804   { key => "qmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3805   { key => "radiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3806   { key => "sendmailconfigpath", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3807   { key => "sendmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3808   { key => "sendmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3809   { key => "shellmachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3810   { key => "shellmachine-useradd", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3811   { key => "shellmachine-userdel", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3812   { key => "shellmachine-usermod", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3813   { key => "shellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3814   { key => "radiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3815   { key => "textradiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3816   { key => "username_policy", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3817   { key => "vpopmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3818   { key => "vpopmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3819   { key => "safe-part_pkg", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3820   { key => "selfservice_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3821   { key => "signup_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3822   { key => "signup_server-email", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3823   { key => "vonage-username", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3824   { key => "vonage-password", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3825   { key => "vonage-fromnumber", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
3826
3827 );
3828
3829 1;
3830