X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=113bac08307ef552d1f56ae17e13080415dac948;hp=d5b89b70019cbc44e252142c37f1be53d9f580a1;hb=f63936fb0404dc44fc8d3aa45c4edd4fa6670821;hpb=ba5975d05c4bf88a47750fecf8651821460ab30f diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index d5b89b700..113bac083 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -47,16 +47,25 @@ but this may change in the future. =over 4 -=item new +=item new [ HASHREF ] Create a new configuration object. +HASHREF may contain options to set the configuration context. Currently +accepts C, and C to disable fallback to the null locale. + =cut sub new { - my($proto) = @_; + my($proto) = shift; + my $opts = shift || {}; my($class) = ref($proto) || $proto; - my($self) = { 'base_dir' => $base_dir }; + my $self = { + 'base_dir' => $base_dir, + 'locale' => $opts->{locale}, + 'localeonly' => $opts->{localeonly}, # for config-view.cgi ONLY + }; + warn "FS::Conf created with no locale fallback.\n" if $self->{localeonly}; bless ($self, $class); } @@ -108,14 +117,26 @@ sub _usecompat { sub _config { my($self,$name,$agentnum,$agentonly)=@_; my $hashref = { 'name' => $name }; - $hashref->{agentnum} = $agentnum; local $FS::Record::conf = undef; # XXX evil hack prevents recursion - my $cv = FS::Record::qsearchs('conf', $hashref); - if (!$agentonly && !$cv && defined($agentnum) && $agentnum) { - $hashref->{agentnum} = ''; - $cv = FS::Record::qsearchs('conf', $hashref); + 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); + return $cv if $cv; + } } - return $cv; + return undef; } sub config { @@ -268,10 +289,14 @@ sub set { warn "[FS::Conf] SET $name\n" if $DEBUG; - my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}); - my $new = new FS::conf { $old ? $old->hash - : ('name' => $name, 'agentnum' => $agentnum) - }; + my $hashref = { + name => $name, + agentnum => $agentnum, + locale => $self->{locale} + }; + + my $old = FS::Record::qsearchs('conf', $hashref); + my $new = new FS::conf { $old ? $old->hash : %$hashref }; $new->value($value); my $error; @@ -312,7 +337,7 @@ sub delete { return $self->_usecompat('delete', @_) if use_confcompat; my($name, $agentnum) = @_; - if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) { + if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum, locale => $self->{locale}}) ) { warn "[FS::Conf] DELETE $name\n" if $DEBUG; my $oldAutoCommit = $FS::UID::AutoCommit; @@ -682,7 +707,14 @@ my %payment_gateway_options = ( 'description' => 'Generate a line item on an invoice even when a package is discounted 100%', 'type' => 'checkbox', }, - + + { + 'key' => 'discount-show_available', + 'section' => 'billing', + 'description' => 'Show available prepayment discounts on invoices.', + 'type' => 'checkbox', + }, + { 'key' => 'invoice-barcode', 'section' => 'billing', @@ -820,6 +852,14 @@ my %payment_gateway_options = ( }, { + 'key' => 'business-onlinepayment-currency', + 'section' => 'billing', + 'description' => 'Currency parameter for Business::OnlinePayment transactions.', + 'type' => 'select', + 'select_enum' => [ '', qw( USD AUD CAD DKK EUR GBP ILS JPY NZD ) ], + }, + + { 'key' => 'countrydefault', 'section' => 'UI', 'description' => 'Default two-letter country code (if not supplied, the default is `US\')', @@ -1020,6 +1060,7 @@ my %payment_gateway_options = ( 'description' => 'Subject: header on email invoices. Defaults to "Invoice". The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.', 'type' => 'text', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1050,6 +1091,7 @@ my %payment_gateway_options = ( 'description' => 'Notes section for HTML invoices. Defaults to the same data in invoice_latexnotes if not specified.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1058,6 +1100,7 @@ my %payment_gateway_options = ( 'description' => 'Footer for HTML invoices. Defaults to the same data in invoice_latexfooter if not specified.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1066,6 +1109,7 @@ my %payment_gateway_options = ( 'description' => 'Summary initial page for HTML invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1073,6 +1117,7 @@ my %payment_gateway_options = ( 'section' => 'invoicing', 'description' => 'Return address for HTML invoices. Defaults to the same data in invoice_latexreturnaddress if not specified.', 'type' => 'textarea', + 'per_locale' => 1, }, { @@ -1137,6 +1182,7 @@ and customer address. Include units.', 'description' => 'Notes section for LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1145,6 +1191,7 @@ and customer address. Include units.', 'description' => 'Footer for LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1153,6 +1200,7 @@ and customer address. Include units.', 'description' => 'Summary initial page for LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1161,6 +1209,7 @@ and customer address. Include units.', 'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1239,6 +1288,7 @@ and customer address. Include units.', 'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1258,7 +1308,14 @@ and customer address. Include units.', { 'key' => 'invoice_print_pdf', 'section' => 'invoicing', - 'description' => 'Store postal invoices for download in PDF format rather than printing them directly.', + 'description' => 'For all invoice print operations, store postal invoices for download in PDF format rather than printing them directly.', + 'type' => 'checkbox', + }, + + { + 'key' => 'invoice_print_pdf-spoolagent', + 'section' => 'invoicing', + 'description' => 'Store postal invoices PDF downloads in per-agent spools.', 'type' => 'checkbox', }, @@ -1810,7 +1867,12 @@ and customer address. Include units.', 'section' => 'UI', 'description' => 'Default locale', 'type' => 'select', - 'select_enum' => [ FS::Locales->locales ], + 'options_sub' => sub { + map { $_ => FS::Locales->description($_) } FS::Locales->locales; + }, + 'option_sub' => sub { + FS::Locales->description(shift) + }, }, { @@ -2403,6 +2465,16 @@ and customer address. Include units.', 'type' => 'select-part_svc', 'multiple' => 1, }, + + { + 'key' => 'selfservice-password_reset_verification', + 'section' => 'self-service', + 'description' => 'If enabled, specifies the type of verification required for self-service password resets.', + 'type' => 'select', + 'select_hash' => [ '' => 'Password reset disabled', + 'paymask,amount,zip' => 'Verify with credit card (or bank account) last 4 digits, payment amount and zip code', + ], + }, { 'key' => 'selfservice-recent-did-age', @@ -2540,7 +2612,7 @@ and customer address. Include units.', { 'key' => 'ticket_system', - 'section' => '', + 'section' => 'ticketing', '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) ], @@ -2558,7 +2630,7 @@ and customer address. Include units.', { 'key' => 'ticket_system-default_queueid', - 'section' => '', + 'section' => 'ticketing', 'description' => 'Default queue used when creating new customer tickets.', 'type' => 'select-sub', 'options_sub' => sub { @@ -2584,13 +2656,13 @@ and customer address. Include units.', }, { 'key' => 'ticket_system-force_default_queueid', - 'section' => '', + 'section' => 'ticketing', 'description' => 'Disallow queue selection when creating new tickets from customer view.', 'type' => 'checkbox', }, { 'key' => 'ticket_system-selfservice_queueid', - 'section' => '', + 'section' => 'ticketing', 'description' => 'Queue used when creating new customer tickets from self-service. Defautls to ticket_system-default_queueid if not specified.', #false laziness w/above 'type' => 'select-sub', @@ -2618,49 +2690,63 @@ and customer address. Include units.', { 'key' => 'ticket_system-requestor', - 'section' => '', + 'section' => 'ticketing', 'description' => 'Email address to use as the requestor for new tickets. If blank, the customer\'s invoicing address(es) will be used.', 'type' => 'text', }, { 'key' => 'ticket_system-priority_reverse', - 'section' => '', + 'section' => 'ticketing', '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' => '', + 'section' => 'ticketing', 'description' => 'Custom field from the ticketing system to use as a custom priority classification.', 'type' => 'text', }, { 'key' => 'ticket_system-custom_priority_field-values', - 'section' => '', + 'section' => 'ticketing', 'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.', 'type' => 'textarea', }, { 'key' => 'ticket_system-custom_priority_field_queue', - 'section' => '', + 'section' => 'ticketing', 'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.', 'type' => 'text', }, { + 'key' => 'ticket_system-selfservice_priority_field', + 'section' => 'ticketing', + 'description' => 'Custom field from the ticket system to use as a customer-managed priority field.', + 'type' => 'text', + }, + + { + 'key' => 'ticket_system-selfservice_edit_subject', + 'section' => 'ticketing', + 'description' => 'Allow customers to edit ticket subjects through selfservice.', + 'type' => 'checkbox', + }, + + { 'key' => 'ticket_system-escalation', - 'section' => '', + 'section' => 'ticketing', 'description' => 'Enable priority escalation of tickets as part of daily batch processing.', 'type' => 'checkbox', }, { 'key' => 'ticket_system-rt_external_datasrc', - 'section' => '', + 'section' => 'ticketing', 'description' => 'With external RT integration, the DBI data source for the external RT installation, for example, DBI:Pg:user=rt_user;password=rt_word;host=rt.example.com;dbname=rt', 'type' => 'text', @@ -2668,7 +2754,7 @@ and customer address. Include units.', { 'key' => 'ticket_system-rt_external_url', - 'section' => '', + 'section' => 'ticketing', 'description' => 'With external RT integration, the URL for the external RT installation, for example, https://rt.example.com/rt', 'type' => 'text', }, @@ -2841,9 +2927,22 @@ and customer address. Include units.', { 'key' => 'overlimit_groups', 'section' => '', - 'description' => 'RADIUS group (or comma-separated groups) to assign to svc_acct which has exceeded its bandwidth or time limit.', - 'type' => 'text', + 'description' => 'RADIUS group(s) to assign to svc_acct which has exceeded its bandwidth or time limit.', + 'type' => 'select-sub', 'per_agent' => 1, + 'multiple' => 1, + 'options_sub' => sub { require FS::Record; + require FS::radius_group; + map { $_->groupnum => $_->long_description } + FS::Record::qsearch('radius_group', {} ); + }, + 'option_sub' => sub { require FS::Record; + require FS::radius_group; + my $radius_group = FS::Record::qsearchs( + 'radius_group', { 'groupnum' => shift } + ); + $radius_group ? $radius_group->long_description : ''; + }, }, { @@ -2904,6 +3003,13 @@ and customer address. Include units.', }, { + 'key' => 'svc_acct-no_edit_username', + 'section' => 'shell', + 'description' => 'Disallow username editing.', + 'type' => 'checkbox', + }, + + { 'key' => 'zone-underscore', 'section' => 'BIND', 'description' => 'Allow underscores in zone names. As underscores are illegal characters in zone names, this option is not recommended.', @@ -3081,7 +3187,8 @@ and customer address. Include units.', 'description' => 'Fixed (unchangeable) format for electronic check batches.', 'type' => 'select', 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP', - 'paymentech', 'ach-spiritone', 'RBC', 'td_eft1464' + 'paymentech', 'ach-spiritone', 'RBC', 'td_eft1464', + 'eft_canada' ] }, @@ -3142,6 +3249,21 @@ and customer address. Include units.', }, { + 'key' => 'batchconfig-eft_canada', + 'section' => 'billing', + 'description' => 'Configuration for EFT Canada batching, four lines: 1. SFTP username, 2. SFTP password, 3. Transaction code, 4. Number of days to delay process date.', + 'type' => 'textarea', + 'per_agent' => 1, + }, + + { + 'key' => 'batch-spoolagent', + 'section' => 'billing', + 'description' => 'Store payment batches per-agent.', + 'type' => 'checkbox', + }, + + { 'key' => 'payment_history-years', 'section' => 'UI', 'description' => 'Number of years of payment history to show by default. Currently defaults to 2.', @@ -3220,6 +3342,13 @@ and customer address. Include units.', }, { + 'key' => 'cust_main-edit_calling_list_exempt', + 'section' => 'UI', + 'description' => 'Display the "calling_list_exempt" checkbox on customer edit.', + 'type' => 'checkbox', + }, + + { 'key' => 'support-key', 'section' => '', '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.', @@ -3290,6 +3419,7 @@ and customer address. Include units.', 'type' => 'image', 'per_agent' => 1, #XXX just view/logo.cgi, which is for the global #old-style editor anyway...? + 'per_locale' => 1, }, { @@ -3298,6 +3428,7 @@ and customer address. Include units.', 'description' => 'Company logo for printed and PDF invoices, in EPS format.', 'type' => 'image', 'per_agent' => 1, #XXX as above, kinda + 'per_locale' => 1, }, { @@ -3912,11 +4043,18 @@ and customer address. Include units.', { 'key' => 'signup-recommend_daytime', 'section' => 'self-service', - 'description' => 'Encourage the entry of a daytime phone number invoicing email address on signup.', + 'description' => 'Encourage the entry of a daytime phone number on signup.', 'type' => 'checkbox', }, { + 'key' => 'signup-duplicate_cc-warn_hours', + 'section' => 'self-service', + 'description' => 'Issue a warning if the same credit card is used for multiple signups within this many hours.', + 'type' => 'text', + }, + + { 'key' => 'svc_phone-radius-default_password', 'section' => 'telephony', 'description' => 'Default password when exporting svc_phone records to RADIUS', @@ -4290,8 +4428,8 @@ and customer address. Include units.', { 'key' => 'cust_main-custom_link', 'section' => 'UI', - 'description' => 'URL to use as source for the "Custom" tab in the View Customer page. The custnum will be appended.', - 'type' => 'text', + 'description' => 'URL to use as source for the "Custom" tab in the View Customer page. The customer number will be appended, or you can insert "$custnum" to have it inserted elsewhere. "$agentnum" will be replaced with the agent number.', + 'type' => 'textarea', }, { @@ -4365,7 +4503,14 @@ and customer address. Include units.', { 'key' => 'svc_phone-did-summary', 'section' => 'invoicing', - 'description' => 'Enable DID activity summary for past 30 days on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage', + 'description' => 'Enable DID activity summary on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage, covering period since last invoice.', + 'type' => 'checkbox', + }, + + { + 'key' => 'svc_acct-usage_seconds', + 'section' => 'invoicing', + 'description' => 'Enable calculation of RADIUS usage time for invoices. You must modify your template to display this information.', 'type' => 'checkbox', }, @@ -4404,6 +4549,13 @@ and customer address. Include units.', }, { + 'key' => 'cust_bill-latex_lineitem_maxlength', + 'section' => 'invoicing', + 'description' => 'Truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin. Defaults to 50. ', + 'type' => 'text', + }, + + { 'key' => 'cust_main-status_module', 'section' => 'UI', 'description' => 'Which module to use for customer status display. The "Classic" module (the default) considers accounts with cancelled recurring packages but un-cancelled one-time charges Inactive. The "Recurring" module considers those customers Cancelled. Similarly for customers with suspended recurring packages but one-time charges.', #other differences? @@ -4436,7 +4588,7 @@ and customer address. Include units.', { 'key' => 'payment-history-report', 'section' => 'UI', - 'description' => 'Show a link to the payment history report in the Reports menu. DO NOT ENABLE THIS.', + 'description' => 'Show a link to the raw database payment history report in the Reports menu. DO NOT ENABLE THIS for modern installations.', 'type' => 'checkbox', }, @@ -4455,6 +4607,13 @@ 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.', @@ -4462,6 +4621,20 @@ and customer address. Include units.', }, { + 'key' => 'available-locales', + 'section' => '', + 'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.', + 'type' => 'select-sub', + 'multiple' => 1, + 'options_sub' => sub { + map { $_ => FS::Locales->description($_) } + grep { $_ ne 'en_US' } + FS::Locales->locales; + }, + 'option_sub' => sub { FS::Locales->description(shift) }, + }, + + { 'key' => 'translate-auto-insert', 'section' => '', 'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values. DO NOT TURN THIS ON.',