X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=113bac08307ef552d1f56ae17e13080415dac948;hp=9953ea54b0e909d5ffa6a4542a3b28ed2dc6dbd4;hb=f63936fb0404dc44fc8d3aa45c4edd4fa6670821;hpb=982ded2d929bdcdfa72efa810273f3bc753bf036 diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 9953ea54b..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, }, { @@ -1817,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) + }, }, { @@ -2410,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', @@ -2862,7 +2927,7 @@ 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.', + '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, @@ -3122,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' ] }, @@ -3183,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.', @@ -3261,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.', @@ -3331,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, }, { @@ -3339,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, }, { @@ -4338,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', }, { @@ -4416,6 +4506,13 @@ and customer address. Include units.', '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', + }, { 'key' => 'opensips_gwlist', @@ -4491,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', }, @@ -4524,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.',