X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=e49174b20271fc16ca51cf369c0e24c1826fec1a;hp=9953ea54b0e909d5ffa6a4542a3b28ed2dc6dbd4;hb=5157ebd894ad02c85bac66ed89313d0c0dea7aeb;hpb=5fdd19665fb7c0ad425a99d3dbf9ad7e27fbf44a diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 9953ea54b..e49174b20 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', @@ -700,7 +732,7 @@ my %payment_gateway_options = ( { 'key' => 'encryption', 'section' => 'billing', - 'description' => 'Enable encryption of credit cards.', + 'description' => 'Enable encryption of credit cards and echeck numbers', 'type' => 'checkbox', }, @@ -708,20 +740,21 @@ my %payment_gateway_options = ( 'key' => 'encryptionmodule', 'section' => 'billing', 'description' => 'Use which module for encryption?', - 'type' => 'text', + 'type' => 'select', + 'select_enum' => [ '', 'Crypt::OpenSSL::RSA', ], }, { 'key' => 'encryptionpublickey', 'section' => 'billing', - 'description' => 'Your RSA Public Key - Required if Encryption is turned on.', + 'description' => 'Encryption public key', 'type' => 'textarea', }, { 'key' => 'encryptionprivatekey', 'section' => 'billing', - '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.', + 'description' => 'Encryption private key', 'type' => 'textarea', }, @@ -820,6 +853,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 +1061,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 +1092,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 +1101,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 +1110,7 @@ my %payment_gateway_options = ( 'description' => 'Summary initial page for HTML invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1073,6 +1118,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 +1183,7 @@ and customer address. Include units.', 'description' => 'Notes section for LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1145,6 +1192,7 @@ and customer address. Include units.', 'description' => 'Footer for LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1153,6 +1201,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 +1210,7 @@ and customer address. Include units.', 'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.', 'type' => 'textarea', 'per_agent' => 1, + 'per_locale' => 1, }, { @@ -1239,6 +1289,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 +1868,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) + }, }, { @@ -2241,6 +2297,13 @@ and customer address. Include units.', }, { + 'key' => 'svc_broadband-radius', + 'section' => '', + 'description' => 'Enable RADIUS groups for broadband services.', + 'type' => 'checkbox', + }, + + { 'key' => 'svc_acct-alldomains', 'section' => '', '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.', @@ -2410,7 +2473,31 @@ 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-password_reset_msgnum', + 'section' => 'self-service', + 'description' => 'Template to use for password reset emails.', + %msg_template_options, + }, + + { + 'key' => 'selfservice-hide_invoices-taxclass', + 'section' => 'self-service', + 'description' => 'Hide invoices with only this package tax class from self-service. Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.', + 'type' => 'text', + }, + { 'key' => 'selfservice-recent-did-age', 'section' => 'self-service', @@ -2862,7 +2949,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 +3209,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 +3271,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 +3364,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 +3441,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 +3450,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, }, { @@ -4163,6 +4275,25 @@ and customer address. Include units.', 'type' => 'text', }, + { + 'key' => 'svc_broadband-manage_link_text', + 'section' => 'UI', + 'description' => 'Label for "Manage Device" link', + 'type' => 'text', + }, + + { + 'key' => 'svc_broadband-manage_link_loc', + 'section' => 'UI', + 'description' => 'Location for "Manage Device" link', + 'type' => 'select', + 'select_hash' => [ + 'bottom' => 'Near Unprovision link', + 'right' => 'With export-related links', + ], + }, + + #more fine-grained, service def-level control could be useful eventually? { 'key' => 'svc_broadband-allow_null_ip_addr', @@ -4338,8 +4469,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 +4547,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 +4629,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 +4662,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.',