projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a8336c2
)
add cust_main-require_phone and cust_main-require_invoicing_list_email options
author
ivan
<ivan>
Tue, 11 Sep 2007 01:33:50 +0000
(
01:33
+0000)
committer
ivan
<ivan>
Tue, 11 Sep 2007 01:33:50 +0000
(
01:33
+0000)
FS/FS/Conf.pm
patch
|
blob
|
history
FS/FS/cust_main.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Conf.pm
b/FS/FS/Conf.pm
index
0d37fea
..
bd1e67a
100644
(file)
--- a/
FS/FS/Conf.pm
+++ b/
FS/FS/Conf.pm
@@
-2054,6
+2054,20
@@
httemplate/docs/config.html
'type' => 'textarea',
},
'type' => 'textarea',
},
+ {
+ 'key' => 'cust_main-require_phone',
+ 'section' => '',
+ 'description' => 'Require daytime or night for all customer records.',
+ 'type' => 'checkbox',
+ },
+
+ {
+ 'key' => 'cust_main-require_invoicing_list_email',
+ 'section' => '',
+ 'description' => 'Require at least one invoicing email address for all customer records.',
+ 'type' => 'checkbox',
+ },
+
);
1;
);
1;
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
9030f7e
..
bb3dcdb
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-350,7
+350,8
@@
sub insert {
$error = $self->check_invoicing_list( $invoicing_list );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
$error = $self->check_invoicing_list( $invoicing_list );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "checking invoicing_list (transaction rolled back): $error";
+ #return "checking invoicing_list (transaction rolled back): $error";
+ return $error;
}
$self->invoicing_list( $invoicing_list );
}
}
$self->invoicing_list( $invoicing_list );
}
@@
-1274,6
+1275,21
@@
sub check {
;
return $error if $error;
;
return $error if $error;
+ if ( $conf->exists('cust_main-require_phone')
+ && ! length($self->daytime) && ! length($self->night)
+ ) {
+
+ my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
+ ? 'Day Phone'
+ : FS::Msgcat::_gettext('daytime');
+ my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/
+ ? 'Night Phone'
+ : FS::Msgcat::_gettext('night');
+
+ return "$daytime_label or $night_label is required"
+
+ }
+
my @addfields = qw(
last first company address1 address2 city county state zip
country daytime night fax
my @addfields = qw(
last first company address1 address2 city county state zip
country daytime night fax
@@
-4131,7
+4147,8
@@
is an error, returns the error, otherwise returns false.
sub check_invoicing_list {
my( $self, $arrayref ) = @_;
sub check_invoicing_list {
my( $self, $arrayref ) = @_;
- foreach my $address ( @{$arrayref} ) {
+
+ foreach my $address ( @$arrayref ) {
if ($address eq 'FAX' and $self->getfield('fax') eq '') {
return 'Can\'t add FAX invoice destination with a blank FAX number.';
if ($address eq 'FAX' and $self->getfield('fax') eq '') {
return 'Can\'t add FAX invoice destination with a blank FAX number.';
@@
-4146,7
+4163,13
@@
sub check_invoicing_list {
: $cust_main_invoice->checkdest
;
return $error if $error;
: $cust_main_invoice->checkdest
;
return $error if $error;
+
}
}
+
+ return "Email address required"
+ if $conf->exists('cust_main-require_invoicing_list_email')
+ && ! grep { $_ !~ /^([A-Z]+)$/ } @$arrayref;
+
'';
}
'';
}