[freeside-commits] branch 3.0 created. d1b6cd3f7c583041bc21a799069059a746b28476
Mark Wells
mark at 420.am
Sat Oct 5 20:05:05 PDT 2013
The branch, 3.0 has been created
at d1b6cd3f7c583041bc21a799069059a746b28476 (commit)
- Log -----------------------------------------------------------------
commit d1b6cd3f7c583041bc21a799069059a746b28476
Author: Mark Wells <mark at freeside.biz>
Date: Sat Oct 5 20:03:11 2013 -0700
mark advertising source as a required field
diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html
index ebd9b92..e25506f 100644
--- a/httemplate/edit/cust_main/top_misc.html
+++ b/httemplate/edit/cust_main/top_misc.html
@@ -154,9 +154,10 @@
% } else {
- <& /elements/tr-select-part_referral.html,
- 'curr_value' => $refnum
- &>
+ <& /elements/tr-select-part_referral.html,
+ 'curr_value' => $refnum,
+ 'label' => "<B>${r}".emt('Advertising source')."</B>"
+ &>
% }
commit 76f26627c28cb5e95e61d67f21b53020f2b362b6
Author: Mark Wells <mark at freeside.biz>
Date: Sat Oct 5 20:01:42 2013 -0700
restore duplicate customer checking with 3.x locations, #16582
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index ed8a117..39a19ad 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4050,7 +4050,7 @@ and customer address. Include units.',
'type' => 'select',
'multiple' => 1,
'select_hash' => [
- #'address1' => 'Billing address',
+ 'address' => 'Billing or service address',
],
},
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index f14f897..182527f 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -610,14 +610,24 @@ sub search {
##
# address
##
- if ( $params->{'address'} =~ /\S/ ) {
- my $address = dbh->quote('%'. lc($params->{'address'}). '%');
- push @where, "EXISTS(
- SELECT 1 FROM cust_location
- WHERE cust_location.custnum = cust_main.custnum
- AND (LOWER(cust_location.address1) LIKE $address OR
- LOWER(cust_location.address2) LIKE $address)
- )";
+ if ( $params->{'address'} ) {
+ # allow this to be an arrayref
+ my @values = ($params->{'address'});
+ @values = @{$values[0]} if ref($values[0]);
+ my @orwhere;
+ foreach (grep /\S/, @values) {
+ my $address = dbh->quote('%'. lc($_). '%');
+ push @orwhere,
+ "LOWER(cust_location.address1) LIKE $address",
+ "LOWER(cust_location.address2) LIKE $address";
+ }
+ if (@orwhere) {
+ push @where, "EXISTS(
+ SELECT 1 FROM cust_location
+ WHERE cust_location.custnum = cust_main.custnum
+ AND (".join(' OR ', at orwhere).")
+ )";
+ }
}
##
diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js
index 9e18fa0..ecfcb3c 100644
--- a/httemplate/edit/cust_main/bottomfixup.js
+++ b/httemplate/edit/cust_main/bottomfixup.js
@@ -10,17 +10,20 @@ my @fixups = ('copy_payby_fields', 'standardize_locations');
push @fixups, 'confirm_censustract'
if $conf->exists('cust_main-require_censustract');
-# currently doesn't work; disable to avoid problems
-#push @fixups, 'check_unique'
-# if $conf->exists('cust_main-check_unique') and !$opt{'custnum'};
+my $uniqueness = $conf->config('cust_main-check_unique');
+push @fixups, 'check_unique'
+ if $uniqueness and !$opt{'custnum'};
push @fixups, 'do_submit'; # always last
</%init>
-
var fixups = <% encode_json(\@fixups) %>;
var fixup_position;
var running = false;
+<&| /elements/onload.js &>
+submit_abort();
+</&>
+
%# state machine to deal with all the asynchronous stuff we're doing
%# call this after each fixup on success:
function submit_continue() {
@@ -132,10 +135,14 @@ function set_censustract(tract, year) {
}
function check_unique() {
- var search_hash = new Object;
-% foreach ($conf->config('cust_main-check_unique')) {
- search_hash['<% $_ %>'] = document.CustomerForm.elements['<% $_ %>'].value;
+ var search_hash = {};
+% if ($uniqueness eq 'address') {
+ search_hash['address'] = [
+ document.CustomerForm.elements['bill_address1'].value,
+ document.CustomerForm.elements['ship_address1'].value
+ ];
% }
+%# no other options yet
%# supported in IE8+, Firefox 3.5+, WebKit, Opera 10.5+
duplicates_form(JSON.stringify(search_hash), confirm_unique);
diff --git a/httemplate/misc/xmlhttp-cust_main-duplicates.html b/httemplate/misc/xmlhttp-cust_main-duplicates.html
index 7ee00af..7cd4633 100644
--- a/httemplate/misc/xmlhttp-cust_main-duplicates.html
+++ b/httemplate/misc/xmlhttp-cust_main-duplicates.html
@@ -50,7 +50,9 @@ my $conf = new FS::Conf;
my $sub = $cgi->param('sub');
my $hashref = decode_json($cgi->param('arg'));
-my @cust_main = qsearch('cust_main', $hashref);
+my $search = FS::cust_main->search($hashref);
+#warn Dumper($search);
+my @cust_main = qsearch( $search );
my $set_to_customer = <<EOF;
var custnum_array = document.getElementsByName('dup_custnum');
-----------------------------------------------------------------------
More information about the freeside-commits
mailing list