X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=adc5b0ee61b613c9298465e41e84f8c03a8c5306;hb=424ccae1ae17a8ee317200b336da5b588d7c70be;hp=66fd9b30e6a90e1c19724a74487d58225c423995;hpb=cd907554f4c08175c379e204e28e26483acf957a;p=freeside.git diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 66fd9b30e..adc5b0ee6 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -74,9 +74,11 @@ sub base_dir { $1; } -=item config KEY +=item config KEY [ AGENTNUM ] Returns the configuration value or values (depending on context) for key. +The optional agent number selects an agent specific value instead of the +global default if one is present. =cut @@ -89,15 +91,13 @@ sub _usecompat { } sub _config { - my($self,$name,$agent)=@_; + my($self,$name,$agentnum)=@_; my $hashref = { 'name' => $name }; - if (defined($agent) && $agent) { - $hashref->{agent} = $agent; - } + $hashref->{agentnum} = $agentnum; local $FS::Record::conf = undef; # XXX evil hack prevents recursion my $cv = FS::Record::qsearchs('conf', $hashref); - if (!$cv && exists($hashref->{agent})) { - delete($hashref->{agent}); + if (!$cv && defined($agentnum)) { + $hashref->{agentnum} = ''; $cv = FS::Record::qsearchs('conf', $hashref); } return $cv; @@ -107,8 +107,8 @@ sub config { my $self = shift; return $self->_usecompat('config', @_) if use_confcompat; - my($name,$agent)=@_; - my $cv = $self->_config($name, $agent) or return; + my($name,$agentnum)=@_; + my $cv = $self->_config($name, $agentnum) or return; if ( wantarray ) { my $v = $cv->value; @@ -119,7 +119,7 @@ sub config { } } -=item config_binary KEY +=item config_binary KEY [ AGENTNUM ] Returns the exact scalar value for key. @@ -129,12 +129,12 @@ sub config_binary { my $self = shift; return $self->_usecompat('config_binary', @_) if use_confcompat; - my($name,$agent)=@_; - my $cv = $self->_config($name, $agent) or return; + my($name,$agentnum)=@_; + my $cv = $self->_config($name, $agentnum) or return; decode_base64($cv->value); } -=item exists KEY +=item exists KEY [ AGENTNUM ] Returns true if the specified key exists, even if the corresponding value is undefined. @@ -145,17 +145,20 @@ sub exists { my $self = shift; return $self->_usecompat('exists', @_) if use_confcompat; - my($name,$agent)=@_; - defined($self->_config($name, $agent)); + my($name,$agentnum)=@_; + defined($self->_config($name, $agentnum)); } -=item config_orbase KEY SUFFIX - -Returns the configuration value or values (depending on context) for -KEY_SUFFIX, if it exists, otherwise for KEY - -=cut +#=item config_orbase KEY SUFFIX +# +#Returns the configuration value or values (depending on context) for +#KEY_SUFFIX, if it exists, otherwise for KEY +# +#=cut +# outmoded as soon as we shift to agentnum based config values +# well, mostly. still useful for e.g. late notices, etc. in that we want +# these to fall back to standard values sub config_orbase { my $self = shift; return $self->_usecompat('config_orbase', @_) if use_confcompat; @@ -168,7 +171,31 @@ sub config_orbase { } } -=item touch KEY +=item invoice_templatenames + +Returns all possible invoice template names. + +=cut + +sub invoice_templatenames { + my( $self ) = @_; + + my %templatenames = (); + foreach my $item ( $self->config_items ) { + foreach my $base ( @base_items ) { + my( $main, $ext) = split(/\./, $base); + $ext = ".$ext" if $ext; + if ( $item->key =~ /^${main}_(.+)$ext$/ ) { + $templatenames{$1}++; + } + } + } + + sort keys %templatenames; + +} + +=item touch KEY [ AGENT ]; Creates the specified configuration key if it does not exist. @@ -178,11 +205,13 @@ sub touch { my $self = shift; return $self->_usecompat('touch', @_) if use_confcompat; - my($name, $agent) = @_; - $self->set($name, '', $agent); + my($name, $agentnum) = @_; + unless ( $self->exists($name, $agentnum) ) { + $self->set($name, '', $agentnum); + } } -=item set KEY VALUE +=item set KEY VALUE [ AGENTNUM ]; Sets the specified configuration key to the given value. @@ -192,15 +221,15 @@ sub set { my $self = shift; return $self->_usecompat('set', @_) if use_confcompat; - my($name, $value, $agent) = @_; + my($name, $value, $agentnum) = @_; $value =~ /^(.*)$/s; $value = $1; warn "[FS::Conf] SET $name\n" if $DEBUG; - my $old = FS::Record::qsearchs('conf', {name => $name, agent => $agent}); + my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}); my $new = new FS::conf { $old ? $old->hash - : ('name' => $name, 'agent' => $agent) + : ('name' => $name, 'agentnum' => $agentnum) }; $new->value($value); @@ -216,7 +245,7 @@ sub set { } -=item set_binary KEY VALUE +=item set_binary KEY VALUE [ AGENTNUM ] Sets the specified configuration key to an exact scalar value which can be retrieved with config_binary. @@ -227,11 +256,11 @@ sub set_binary { my $self = shift; return if use_confcompat; - my($name, $value, $agent)=@_; - $self->set($name, encode_base64($value), $agent); + my($name, $value, $agentnum)=@_; + $self->set($name, encode_base64($value), $agentnum); } -=item delete KEY +=item delete KEY [ AGENTNUM ]; Deletes the specified configuration key. @@ -241,9 +270,9 @@ sub delete { my $self = shift; return $self->_usecompat('delete', @_) if use_confcompat; - my($name, $agent) = @_; - if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agent => $agent}) ) { - warn "[FS::Conf] DELETE $file\n"; + my($name, $agentnum) = @_; + if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) { + warn "[FS::Conf] DELETE $name\n"; my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; @@ -391,7 +420,7 @@ sub _orbase_items { map { new FS::ConfItem { 'key' => $_, 'section' => $proto->section, - 'description' => 'Alternate ' . $proto->description . ' See the billing documentation for details.', + 'description' => 'Alternate ' . $proto->description . ' See the billing documentation for details.', 'type' => $proto->type, }; } &$listmaker($base); @@ -460,8 +489,6 @@ worry that config_items is freeside-specific and icky. "Configuration" in the web interface (config/config.cgi). -httemplate/docs/config.html - =cut #Business::CreditCard @@ -493,6 +520,21 @@ httemplate/docs/config.html logo.eps ); +@base_items = qw ( + invoice_template + invoice_latex + invoice_latexreturnaddress + invoice_latexfooter + invoice_latexsmallfooter + invoice_latexnotes + invoice_html + invoice_htmlreturnaddress + invoice_htmlfooter + invoice_htmlnotes + logo.png + logo.eps + ); + @config_items = map { new FS::ConfItem $_ } ( { @@ -505,7 +547,7 @@ httemplate/docs/config.html { 'key' => 'alerter_template', 'section' => 'billing', - 'description' => 'Template file for billing method expiration alerts. See the billing documentation for details.', + 'description' => 'Template file for billing method expiration alerts. See the billing documentation for details.', 'type' => 'textarea', }, @@ -705,14 +747,14 @@ httemplate/docs/config.html { 'key' => 'invoice_template', 'section' => 'required', - 'description' => 'Required template file for invoices. See the billing documentation for details.', + 'description' => 'Required template file for invoices. See the billing documentation for details.', 'type' => 'textarea', }, { 'key' => 'invoice_html', 'section' => 'billing', - 'description' => 'Optional HTML template for invoices. See the billing documentation for details.', + 'description' => 'Optional HTML template for invoices. See the billing documentation for details.', 'type' => 'textarea', }, @@ -741,7 +783,7 @@ httemplate/docs/config.html { 'key' => 'invoice_latex', 'section' => 'billing', - 'description' => 'Optional LaTeX template for typeset PostScript invoices. See the billing documentation for details.', + 'description' => 'Optional LaTeX template for typeset PostScript invoices. See the billing documentation for details.', 'type' => 'textarea', }, @@ -922,7 +964,7 @@ httemplate/docs/config.html { 'key' => 'signupurl', 'section' => 'UI', - 'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your signup server CGI, the customer view screen will display a customized link to the signup server with the appropriate customer as referral', + 'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your signup server CGI, the customer view screen will display a customized link to the signup server with the appropriate customer as referral', 'type' => 'text', }, @@ -1055,7 +1097,7 @@ httemplate/docs/config.html { 'key' => 'username-uppercase', 'section' => 'username', - 'description' => 'Allow uppercase characters in usernames', + 'description' => 'Allow uppercase characters in usernames. Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.', 'type' => 'checkbox', }, @@ -1303,7 +1345,7 @@ httemplate/docs/config.html { 'key' => 'emailcancel', 'section' => 'billing', - 'description' => 'Enable emailing of cancellation notices.', + 'description' => 'Enable emailing of cancellation notices. Make sure to fill in the cancelmessage and cancelsubject configuration values as well.', 'type' => 'checkbox', }, @@ -1333,6 +1375,7 @@ httemplate/docs/config.html 'section' => '', '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 Text::Template documentation for details on the template substitution language. The following variables are available', 'type' => 'textarea', + 'per_agent' => 1, }, { @@ -1340,6 +1383,7 @@ httemplate/docs/config.html 'section' => '', 'description' => 'From: address header for welcome email', 'type' => 'text', + 'per_agent' => 1, }, { @@ -1347,6 +1391,7 @@ httemplate/docs/config.html 'section' => '', 'description' => 'Subject: header for welcome email', 'type' => 'text', + 'per_agent' => 1, }, { @@ -1355,6 +1400,7 @@ httemplate/docs/config.html 'description' => 'MIME type for welcome email', 'type' => 'select', 'select_enum' => [ 'text/plain', 'text/html' ], + 'per_agent' => 1, }, { @@ -1570,7 +1616,7 @@ httemplate/docs/config.html { 'key' => 'ticket_system', 'section' => '', - 'description' => 'Ticketing system integration. RT_Internal uses the built-in RT ticketing system (see the integrated ticketing installation instructions). RT_External accesses an external RT installation in a separate database (local or remote).', + 'description' => 'Ticketing system integration. RT_Internal uses the built-in RT ticketing system (see the integrated ticketing installation instructions). RT_External accesses an external RT installation in a separate database (local or remote).', 'type' => 'select', #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ], 'select_enum' => [ '', qw(RT_Internal RT_External) ], @@ -1604,6 +1650,13 @@ httemplate/docs/config.html }, { + 'key' => 'ticket_system-priority_reverse', + 'section' => '', + '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.', + 'type' => 'checkbox', + }, + + { 'key' => 'ticket_system-custom_priority_field', 'section' => '', 'description' => 'Custom field from the ticketing system to use as a custom priority classification.', @@ -1903,6 +1956,25 @@ httemplate/docs/config.html }, { + 'key' => 'disable-fuzzy', + 'section' => 'UI', + 'description' => 'Disable fuzzy searching. Speeds up searching for large sites, but only shows exact matches.', + 'type' => 'checkbox', + }, + + { 'key' => 'pkg_referral', + 'section' => '', + 'description' => 'Enable package-specific advertising sources.', + 'type' => 'checkbox', + }, + + { 'key' => 'pkg_referral-multiple', + 'section' => '', + 'description' => 'In addition, allow multiple advertising sources to be associated with a single package.', + 'type' => 'checkbox', + }, + + { 'key' => 'dashboard-toplist', 'section' => 'UI', 'description' => 'List of items to display on the top of the front page', @@ -1980,6 +2052,34 @@ httemplate/docs/config.html 'type' => 'checkbox', }, + { + 'key' => 'support_packages', + 'section' => '', + '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... + 'type' => 'textarea', + }, + + { + 'key' => 'cust_main-require_phone', + 'section' => '', + 'description' => 'Require daytime or night for all customer records.', + 'type' => 'checkbox', + }, + + { + 'key' => 'cust_main-require_invoicing_list_email', + 'section' => '', + 'description' => 'Require at least one invoicing email address for all customer records.', + 'type' => 'checkbox', + }, + + { + 'key' => 'svc_acct-display_paid_time_remaining', + 'section' => '', + 'description' => 'Show paid time remaining in addition to time remaining.', + 'type' => 'checkbox', + }, + ); 1;