X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=94669ffbd1c794f2b529158d205b1733b30e9169;hp=633d5c5ee2761e256cc819f2a3bf0c6b39b13b77;hb=653530ba04e038b70dc2b392ca36e9c6c6920d88;hpb=42cb4ccd7ef9ddb418b31405500925863703dd3b diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 633d5c5ee..94669ffbd 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,38 @@ and customer address. Include units.', 'type' => 'select-part_svc', 'multiple' => 1, }, - + + { + 'key' => 'selfservice-svc_forward_svcpart', + 'section' => 'self-service', + 'description' => 'Service for self-service forward editing.', + 'type' => 'select-part_svc', + }, + + { + '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 and supress sending (emailing, printing, faxing) them. 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', @@ -2556,14 +2650,28 @@ and customer address. Include units.', { 'key' => 'network_monitoring_system', - 'section' => '', + 'section' => 'network_monitoring', 'description' => 'Networking monitoring system (NMS) integration. Torrus_Internal uses the built-in Torrus ticketing system (see the integrated networking monitoring system installation instructions).', 'type' => 'select', - #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ], 'select_enum' => [ '', qw(Torrus_Internal) ], }, { + 'key' => 'nms-auto_add-svc_ips', + 'section' => 'network_monitoring', + 'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.', + 'type' => 'selectmultiple', + 'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ], + }, + + { + 'key' => 'nms-auto_add-community', + 'section' => 'network_monitoring', + 'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.', + 'type' => 'text', + }, + + { 'key' => 'ticket_system-default_queueid', 'section' => 'ticketing', 'description' => 'Default queue used when creating new customer tickets.', @@ -3188,6 +3296,14 @@ and customer address. Include units.', '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', }, { @@ -3269,6 +3385,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.', @@ -3339,6 +3462,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, }, { @@ -3347,6 +3471,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, }, { @@ -3518,9 +3643,9 @@ and customer address. Include units.', 'description' => 'Enables searching of various formatted values in cust_main.agent_custid', 'type' => 'select', 'select_hash' => [ - '' => 'Numeric only', - '\d{7}' => 'Numeric only, exactly 7 digits', - 'ww?d+' => 'Numeric with one or two letter prefix', + '' => 'Numeric only', + '\d{7}' => 'Numeric only, exactly 7 digits', + 'ww?d+' => 'Numeric with one or two letter prefix', ], }, @@ -3679,6 +3804,14 @@ 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).', + 'type' => 'text', + #and then probably agent-virt this to merge these instances + }, + + { 'key' => 'cust_main-default_areacode', 'section' => 'UI', 'description' => 'Default area code for customers.', @@ -4171,6 +4304,31 @@ 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', + ], + }, + + { + 'key' => 'svc_broadband-manage_link-new_window', + 'section' => 'UI', + 'description' => 'Open the "Manage Device" link in a new window', + 'type' => 'checkbox', + }, + #more fine-grained, service def-level control could be useful eventually? { 'key' => 'svc_broadband-allow_null_ip_addr', @@ -4346,8 +4504,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, and "$usernum" will be replaced with the employee number.', + 'type' => 'textarea', }, { @@ -4424,6 +4582,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', @@ -4499,7 +4664,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', }, @@ -4530,6 +4695,27 @@ and customer address. Include units.', 'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.', 'type' => 'checkbox', }, + + { + 'key' => 'cust_bill-enable_promised_date', + 'section' => 'UI', + 'description' => 'Enable display/editing of the "promised payment date" field on invoices.', + 'type' => 'checkbox', + }, + + { + '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',