X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=bf2f189a42e3515136443bfa6453945b99f3afac;hp=e917fb5cd4b98905708d020af4fa85f48179663a;hb=f281f59e4b3f8fed53e64b57d9cb4eaedd73e8e0;hpb=679fbd2023aa5d87308c2f3d7d5360cfd3c8354a diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index e917fb5cd..bf2f189a4 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -183,7 +183,7 @@ sub exists { my $self = shift; return $self->_usecompat('exists', @_) if use_confcompat; - my($name, $agentnum)=@_; + #my($name, $agentnum)=@_; carp "FS::Conf->exists(". join(', ', @_). ") called" if $DEBUG > 1; @@ -191,6 +191,54 @@ sub exists { defined($self->_config(@_)); } +#maybe this should just be the new exists instead of getting a method of its +#own, but i wanted to avoid possible fallout + +sub config_bool { + my $self = shift; + return $self->_usecompat('exists', @_) if use_confcompat; + + my($name,$agentnum,$agentonly) = @_; + + carp "FS::Conf->config_bool(". join(', ', @_). ") called" + if $DEBUG > 1; + + #defined($self->_config(@_)); + + #false laziness w/_config + my $hashref = { 'name' => $name }; + local $FS::Record::conf = undef; # XXX evil hack prevents recursion + my $cv; + my @a = ( + ($agentnum || ()), + ($agentonly && $agentnum ? () : '') + ); + my @l = ( + ($self->{locale} || ()), + ($self->{localeonly} && $self->{locale} ? () : '') + ); + # try with the agentnum first, then fall back to no agentnum if allowed + foreach my $a (@a) { + $hashref->{agentnum} = $a; + foreach my $l (@l) { + $hashref->{locale} = $l; + $cv = FS::Record::qsearchs('conf', $hashref); + if ( $cv ) { + if ( $cv->value eq '0' + && ($hashref->{agentnum} || $hashref->{locale} ) + ) + { + return 0; #an explicit false override, don't continue looking + } else { + return 1; + } + } + } + } + return 0; + +} + =item config_orbase KEY SUFFIX Returns the configuration value or values (depending on context) for @@ -269,8 +317,13 @@ sub touch { return $self->_usecompat('touch', @_) if use_confcompat; my($name, $agentnum) = @_; - unless ( $self->exists($name, $agentnum) ) { - $self->set($name, '', $agentnum); + #unless ( $self->exists($name, $agentnum) ) { + unless ( $self->config_bool($name, $agentnum) ) { + if ( $agentnum && $self->exists($name) && $self->config($name,$agentnum) eq '0' ) { + $self->delete($name, $agentnum); + } else { + $self->set($name, '', $agentnum); + } } } @@ -357,6 +410,31 @@ sub delete { } } +#maybe this should just be the new delete instead of getting a method of its +#own, but i wanted to avoid possible fallout + +sub delete_bool { + my $self = shift; + return $self->_usecompat('delete', @_) if use_confcompat; + + my($name, $agentnum) = @_; + + warn "[FS::Conf] DELETE $name\n" if $DEBUG; + + my $cv = FS::Record::qsearchs('conf', { name => $name, + agentnum => $agentnum, + locale => $self->{locale}, + }); + + if ( $cv ) { + my $error = $cv->delete; + die $error if $error; + } elsif ( $agentnum ) { + $self->set($name, '0', $agentnum); + } + +} + =item import_config_item CONFITEM DIR Imports the item specified by the CONFITEM (see L) into @@ -632,6 +710,21 @@ my %payment_gateway_options = ( }, ); +# takes the reason class (C, R, S) as an argument +sub reason_type_options { + my $reason_class = shift; + + 'type' => 'select-sub', + 'options_sub' => sub { + map { $_->typenum => $_->type } + qsearch('reason_type', { class => $reason_class }); + }, + 'option_sub' => sub { + my $type = FS::reason_type->by_key(shift); + $type ? $type->type : ''; + } +} + #Billing (81 items) #Invoicing (50 items) #UI (69 items) @@ -679,6 +772,13 @@ my %payment_gateway_options = ( }, { + 'key' => 'part_pkg-lineage', + 'section' => '', + 'description' => 'When editing a package definition, if setup or recur fees are changed, create a new package rather than changing the existing package.', + 'type' => 'checkbox', + }, + + { 'key' => 'apacheip', #not actually deprecated yet #'section' => 'deprecated', @@ -1398,6 +1498,7 @@ and customer address. Include units.', 'description' => 'Send payment receipts.', 'type' => 'checkbox', 'per_agent' => 1, + 'agent_bool' => 1, }, { @@ -1572,6 +1673,13 @@ and customer address. Include units.', }, { + 'key' => 'disable_maxselect', + 'section' => 'UI', + 'description' => 'Prevent changing the number of records per page.', + 'type' => 'checkbox', + }, + + { 'key' => 'session-start', 'section' => 'session', '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: $ip, $nasip and $nasfqdn, 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.', @@ -1771,6 +1879,7 @@ and customer address. Include units.', 'section' => 'username', 'description' => 'Allow uppercase characters in usernames. Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.', 'type' => 'checkbox', + 'per_agent' => 1, }, { @@ -1982,6 +2091,14 @@ and customer address. Include units.', }, { + 'key' => 'signup_server-terms_of_service', + 'section' => 'self-service', + 'description' => 'Terms of Service for the signup server. May contain HTML.', + 'type' => 'textarea', + 'per_agent' => 1, + }, + + { 'key' => 'selfservice_server-base_url', 'section' => 'self-service', '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.', @@ -2260,6 +2377,13 @@ and customer address. Include units.', }, { + 'key' => 'require_cash_deposit_info', + 'section' => 'billing', + 'description' => 'When recording cash payments, display bank deposit information fields.', + 'type' => 'checkbox', + }, + + { 'key' => 'paymentforcedtobatch', 'section' => 'deprecated', '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.', @@ -2812,6 +2936,14 @@ and customer address. Include units.', }, { + 'key' => 'company_url', + 'section' => 'UI', + 'description' => 'Your company URL', + 'type' => 'text', + 'per_agent' => 1, + }, + + { 'key' => 'company_address', 'section' => 'required', 'description' => 'Your company address', @@ -2874,6 +3006,7 @@ and customer address. Include units.', 'section' => '', '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.", 'type' => 'checkbox', + 'per_agent' => 1, }, { 'key' => 'referral_credit', @@ -2901,7 +3034,7 @@ and customer address. Include units.', 'section' => 'invoicing', 'description' => 'Enable FTP of raw invoice data - format.', 'type' => 'select', - 'select_enum' => [ '', 'default', 'billco', ], + 'select_enum' => [ '', 'default', 'oneline', 'billco', ], }, { @@ -2937,7 +3070,7 @@ and customer address. Include units.', 'section' => 'invoicing', 'description' => 'Enable spooling of raw invoice data - format.', 'type' => 'select', - 'select_enum' => [ '', 'default', 'billco', ], + 'select_enum' => [ '', 'default', 'oneline', 'billco', ], }, { @@ -2998,6 +3131,24 @@ and customer address. Include units.', }, { + 'key' => 'cust_location-label_prefix', + 'section' => 'UI', + 'description' => 'Optional "site ID" to show in the location label', + 'type' => 'select', + 'select_hash' => [ '' => '', + 'CoStAg' => 'CoStAgXXXXX (country, state, agent name, locationnum)', + ], + }, + + { + 'key' => 'cust_location-agent_code', + 'section' => 'UI', + 'description' => 'Optional agent string for cust_location-label_prefix', + 'type' => 'text', + 'per_agent' => 1, + }, + + { 'key' => 'cust_pkg-display_times', 'section' => 'UI', 'description' => 'Display full timestamps (not just dates) for customer packages. Useful if you are doing real-time things like hourly prepaid.', @@ -3068,6 +3219,17 @@ and customer address. Include units.', }, { + 'key' => 'echeck-country', + 'section' => 'billing', + 'description' => 'Format electronic check information for the specified country.', + 'type' => 'select', + 'select_hash' => [ 'US' => 'United States', + 'CA' => 'Canada (enables branch)', + 'XX' => 'Other', + ], + }, + + { 'key' => 'voip-cust_accountcode_cdr', 'section' => 'telephony', 'description' => 'Enable the per-customer option for CDR breakdown by accountcode.', @@ -3537,9 +3699,19 @@ and customer address. Include units.', 'section' => 'billing', 'description' => 'Display format for line item date ranges on invoice line items.', 'type' => 'select', - 'select_hash' => [ '' => 'STARTDATE-ENDDATE', - 'month_of' => 'Month of MONTHNAME', + 'select_hash' => [ '' => 'STARTDATE-ENDDATE', + 'month_of' => 'Month of MONTHNAME', + 'X_month' => 'DATE_DESC MONTHNAME', ], + 'per_agent' => 1, + }, + + { + 'key' => 'cust_bill-line_item-date_description', + 'section' => 'billing', + 'description' => 'Text to display for "DATE_DESC" when using cust_bill-line_item-date_style DATE_DESC MONTHNAME.', + 'type' => 'text', + 'per_agent' => 1, }, { @@ -3555,6 +3727,7 @@ and customer address. Include units.', 'section' => '', 'description' => 'Require daytime or night phone for all customer records.', 'type' => 'checkbox', + 'per_agent' => 1, }, { @@ -3562,6 +3735,18 @@ and customer address. Include units.', 'section' => '', 'description' => 'Email address field is required: require at least one invoicing email address for all customer records.', 'type' => 'checkbox', + 'per_agent' => 1, + }, + + { + 'key' => 'cust_main-check_unique', + 'section' => '', + 'description' => 'Warn before creating a customer record where these fields duplicate another customer.', + 'type' => 'select', + 'multiple' => 1, + 'select_hash' => [ + 'address1' => 'Billing address', + ], }, { @@ -3575,77 +3760,35 @@ and customer address. Include units.', 'key' => 'cancel_credit_type', 'section' => 'billing', 'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.', - 'type' => 'select-sub', - 'options_sub' => sub { require FS::Record; - require FS::reason_type; - map { $_->typenum => $_->type } - FS::Record::qsearch('reason_type', { class=>'R' } ); - }, - 'option_sub' => sub { require FS::Record; - require FS::reason_type; - my $reason_type = FS::Record::qsearchs( - 'reason_type', { 'typenum' => shift } - ); - $reason_type ? $reason_type->type : ''; - }, + reason_type_options('R'), + }, + + { + 'key' => 'suspend_credit_type', + 'section' => 'billing', + 'description' => 'The group to use for new, automatically generated credit reasons resulting from package suspension.', + reason_type_options('R'), }, { 'key' => 'referral_credit_type', 'section' => 'deprecated', '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.', - 'type' => 'select-sub', - 'options_sub' => sub { require FS::Record; - require FS::reason_type; - map { $_->typenum => $_->type } - FS::Record::qsearch('reason_type', { class=>'R' } ); - }, - 'option_sub' => sub { require FS::Record; - require FS::reason_type; - my $reason_type = FS::Record::qsearchs( - 'reason_type', { 'typenum' => shift } - ); - $reason_type ? $reason_type->type : ''; - }, + reason_type_options('R'), }, { 'key' => 'signup_credit_type', 'section' => 'billing', #self-service? 'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.', - 'type' => 'select-sub', - 'options_sub' => sub { require FS::Record; - require FS::reason_type; - map { $_->typenum => $_->type } - FS::Record::qsearch('reason_type', { class=>'R' } ); - }, - 'option_sub' => sub { require FS::Record; - require FS::reason_type; - my $reason_type = FS::Record::qsearchs( - 'reason_type', { 'typenum' => shift } - ); - $reason_type ? $reason_type->type : ''; - }, + reason_type_options('R'), }, { 'key' => 'prepayment_discounts-credit_type', 'section' => 'billing', 'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.', - 'type' => 'select-sub', - 'options_sub' => sub { require FS::Record; - require FS::reason_type; - map { $_->typenum => $_->type } - FS::Record::qsearch('reason_type', { class=>'R' } ); - }, - 'option_sub' => sub { require FS::Record; - require FS::reason_type; - my $reason_type = FS::Record::qsearchs( - 'reason_type', { 'typenum' => shift } - ); - $reason_type ? $reason_type->type : ''; - }, - + reason_type_options('R'), }, { @@ -3682,6 +3825,7 @@ and customer address. Include units.', 'section' => 'invoicing', 'description' => 'Disable inclusion of previous balance, payment, and credit lines on invoices', 'type' => 'checkbox', + 'per_agent' => 1, }, { @@ -3745,7 +3889,7 @@ and customer address. Include units.', 'section' => 'UI', 'description' => 'The year to use in census tract lookups', 'type' => 'select', - 'select_enum' => [ qw( 2010 2009 2008 ) ], + 'select_enum' => [ qw( 2012 2011 2010 ) ], }, { @@ -3840,9 +3984,26 @@ and customer address. Include units.', { 'key' => 'cust_main-custnum-display_prefix', 'section' => 'UI', - 'description' => 'Prefix the customer number with this number for display purposes (and zero fill to 8 digits).', + 'description' => 'Prefix the customer number with this string for display purposes.', + 'type' => 'text', + 'per_agent' => 1, + }, + + { + 'key' => 'cust_main-custnum-display_special', + 'section' => 'UI', + 'description' => 'Use this customer number prefix format', + 'type' => 'select', + 'select_hash' => [ '' => '', + 'CoStAg' => 'CoStAg (country, state, agent name or display_prefix)', + 'CoStCl' => 'CoStCl (country, state, class name)' ], + }, + + { + 'key' => 'cust_main-custnum-display_length', + 'section' => 'UI', + 'description' => 'Zero fill the customer number to this many digits for display purposes.', 'type' => 'text', - #and then probably agent-virt this to merge these instances }, { @@ -3888,6 +4049,13 @@ and customer address. Include units.', }, { + 'key' => 'unsuspend_email_admin', + 'section' => '', + 'description' => 'Destination admin email address to enable unsuspension notices', + 'type' => 'text', + }, + + { 'key' => 'email_report-subject', 'section' => '', 'description' => 'Subject for reports emailed by freeside-fetch. Defaults to "Freeside report".', @@ -3937,6 +4105,22 @@ and customer address. Include units.', }, { + 'key' => 'selfservice-stripe1_bgcolor', + 'section' => 'self-service', + 'description' => 'HTML color for self-service interface lists (primary stripe), for example, #FFFFFF', + 'type' => 'text', + 'per_agent' => 1, + }, + + { + 'key' => 'selfservice-stripe2_bgcolor', + 'section' => 'self-service', + 'description' => 'HTML color for self-service interface lists (alternate stripe), for example, #DDDDDD', + 'type' => 'text', + 'per_agent' => 1, + }, + + { 'key' => 'selfservice-text_color', 'section' => 'self-service', 'description' => 'HTML text color for the self-service interface, for example, #000000', @@ -4103,6 +4287,20 @@ and customer address. Include units.', }, { + 'key' => 'selfservice-login_banner_image', + 'section' => 'self-service', + 'description' => 'Banner image shown on the login page, in PNG format.', + 'type' => 'image', + }, + + { + 'key' => 'selfservice-login_banner_url', + 'section' => 'self-service', + 'description' => 'Link for the login banner.', + 'type' => 'text', + }, + + { 'key' => 'selfservice-bulk_format', 'section' => 'deprecated', 'description' => 'Parameter arrangement for selfservice bulk features', @@ -4262,6 +4460,13 @@ and customer address. Include units.', }, { + 'key' => 'cdr-asterisk_australia_rewrite', + 'section' => 'telephony', + 'description' => 'For Asterisk CDRs, assign CDR type numbers based on Australian conventions.', + 'type' => 'checkbox', + }, + + { 'key' => 'cust_pkg-show_autosuspend', 'section' => 'UI', 'description' => 'Show package auto-suspend dates. Use with caution for now; can slow down customer view for large insallations.', @@ -4387,6 +4592,13 @@ and customer address. Include units.', }, { + 'key' => 'svc_hardware-check_mac_addr', + 'section' => '', #? + 'description' => 'Require the "hardware address" field in hardware services to be a valid MAC address.', + 'type' => 'checkbox', + }, + + { 'key' => 'tax-report_groups', 'section' => '', 'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).', @@ -4688,6 +4900,13 @@ and customer address. Include units.', 'select_enum' => [ 'Classic', 'Recurring' ], }, + { + 'key' => 'cust_main-print_statement_link', + 'section' => 'UI', + 'description' => 'Show a link to download a current statement for the customer.', + 'type' => 'checkbox', + }, + { 'key' => 'username-pound', 'section' => 'username', @@ -4732,13 +4951,6 @@ and customer address. Include units.', }, { - 'key' => 'cust_main-require-bank-branch', - 'section' => 'UI', - 'description' => 'An alternate DCHK/CHEK format; require entry of bank branch number.', - 'type' => 'checkbox', - }, - - { 'key' => 'cust-edit-alt-field-order', 'section' => 'UI', 'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.', @@ -4765,6 +4977,13 @@ and customer address. Include units.', }, 'option_sub' => sub { FS::Locales->description(shift) }, }, + + { + 'key' => 'cust_main-require_locale', + 'section' => 'UI', + 'description' => 'Require an explicit locale to be chosen for new customers.', + 'type' => 'checkbox', + }, { 'key' => 'translate-auto-insert', @@ -4810,7 +5029,27 @@ and customer address. Include units.', }, }, - + { + 'key' => 'brand-agent', + 'section' => 'UI', + 'description' => 'Brand the backoffice interface (currently Help->About) using the company_name, company_url and logo.png configuration settings of the selected agent. Typically used when selling or bundling hosted access to the backoffice interface. NOTE: The AGPL software license has specific requirements for source code availability in this situation.', + 'type' => 'select-agent', + }, + + { + 'key' => 'cust_class-tax_exempt', + 'section' => 'billing', + 'description' => 'Control the tax exemption flag per customer class rather than per indivual customer.', + 'type' => 'checkbox', + }, + + { + 'key' => 'selfservice-billing_history-line_items', + 'section' => 'self-service', + 'description' => 'Return line item billing detail for the self-service billing_history API call.', + 'type' => 'checkbox', + }, + { key => "apacheroot", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachine", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachines", section => "deprecated", description => "DEPRECATED", type => "text" },