From 06eed058f975516a57513e6daa6e3ea0e0302ac5 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 6 Nov 2009 01:51:17 +0000 Subject: [PATCH] add emailinvoice-apostrophe config option to allow apostrophies in invoice email addresses, RT#6464 --- FS/FS/Conf.pm | 39 +++++++++++++++++++++++---------------- FS/FS/cust_main_invoice.pm | 8 ++++++-- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 1542efefc..582313571 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -810,35 +810,42 @@ worry that config_items is freeside-specific and icky. 'key' => 'editreferrals', 'section' => 'UI', 'description' => 'Enable advertising source modification for existing customers', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { 'key' => 'emailinvoiceonly', 'section' => 'billing', 'description' => 'Disables postal mail invoices', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { 'key' => 'disablepostalinvoicedefault', 'section' => 'billing', 'description' => 'Disables postal mail invoices as the default option in the UI. Be careful not to setup customers which are not sent invoices. See emailinvoiceauto.', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { 'key' => 'emailinvoiceauto', 'section' => 'billing', 'description' => 'Automatically adds new accounts to the email invoice list', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { 'key' => 'emailinvoiceautoalways', 'section' => 'billing', 'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses', - 'type' => 'checkbox', + 'type' => 'checkbox', + }, + + { + 'key' => 'emailinvoice-apostrophe', + 'section' => 'billing', + 'description' => 'Allows the apostrophe (single quote) character in the email addresses in the email invoice list.', + 'type' => 'checkbox', }, { @@ -1123,17 +1130,17 @@ worry that config_items is freeside-specific and icky. }, { - 'key' => 'password-noampersand', - 'section' => 'password', + 'key' => 'password-noampersand', + 'section' => 'password', 'description' => 'Disallow ampersands in passwords', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { - 'key' => 'password-noexclamation', - 'section' => 'password', + 'key' => 'password-noexclamation', + 'section' => 'password', 'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { @@ -2598,14 +2605,14 @@ worry that config_items is freeside-specific and icky. 'key' => 'disable_setup_suspended_pkgs', 'section' => 'billing', 'description' => 'Disables charging of setup fees for suspended packages.', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { - 'key' => 'password-generated-allcaps', - 'section' => 'password', + 'key' => 'password-generated-allcaps', + 'section' => 'password', 'description' => 'Causes passwords automatically generated to consist entirely of capital letters', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { @@ -3041,7 +3048,7 @@ worry that config_items is freeside-specific and icky. '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.', - 'type' => 'checkbox', + 'type' => 'checkbox', }, { diff --git a/FS/FS/cust_main_invoice.pm b/FS/FS/cust_main_invoice.pm index 71148cab0..ec01842a7 100644 --- a/FS/FS/cust_main_invoice.pm +++ b/FS/FS/cust_main_invoice.pm @@ -1,7 +1,7 @@ package FS::cust_main_invoice; use strict; -use vars qw(@ISA $conf); +use vars qw(@ISA); use Exporter; use FS::Record qw( qsearchs ); use FS::Conf; @@ -127,12 +127,16 @@ sub checkdest { my $error = $self->ut_text('dest'); return $error if $error; + my $conf = new FS::Conf; + if ( $self->dest =~ /^(POST|FAX)$/ ) { #contemplate our navel } elsif ( $self->dest =~ /^(\d+)$/ ) { return "Unknown local account (specified by svcnum: ". $self->dest. ")" unless qsearchs( 'svc_acct', { 'svcnum' => $self->dest } ); - } elsif ( $self->dest =~ /^\s*([\w\.\-\&\+]+)\@(([\w\.\-]+\.)+\w+)\s*$/ ) { + } elsif ( $conf->exists('emailinvoice-apostrophe') + ? $self->dest =~ /^\s*([\w\.\-\&\+\']+)\@(([\w\.\-]+\.)+\w+)\s*$/ + : $self->dest =~ /^\s*([\w\.\-\&\+]+)\@(([\w\.\-]+\.)+\w+)\s*$/ ){ my($user, $domain) = ($1, $2); $self->dest("$1\@$2"); } else { -- 2.11.0