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