freeside/FS/FS/ClientAPI Agent.pm,1.2,1.3
ivan
ivan at pouncequick.420.am
Thu Dec 2 01:59:52 PST 2004
- Previous message: freeside/FS/FS TicketSystem.pm,NONE,1.1 cust_main.pm,1.164,1.165 Conf.pm,1.111,1.112 CGI.pm,1.27,1.28
- Next message: freeside/htetc handler.pl,1.48,1.49 global.asa,1.51,1.52
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory pouncequick:/tmp/cvs-serv24319/FS/FS/ClientAPI
Modified Files:
Agent.pm
Log Message:
second big RT integration checkin, customer linking/delinking interface
Index: Agent.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/Agent.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Agent.pm 24 Aug 2004 11:16:57 -0000 1.2
+++ Agent.pm 2 Dec 2004 09:59:47 -0000 1.3
@@ -6,9 +6,9 @@
use vars qw($cache);
use Digest::MD5 qw(md5_hex);
use Cache::SharedMemoryCache; #store in db?
-use FS::Record qw(qsearchs qsearch dbdef dbh);
+use FS::Record qw(qsearchs); # qsearch dbdef dbh);
use FS::agent;
-use FS::cust_main;
+use FS::cust_main qw(smart_search);
use FS::ClientAPI;
FS::ClientAPI->register_handlers(
@@ -102,68 +102,9 @@
my $agent = qsearchs( 'agent', { 'agentnum' => $agentnum } )
or return { 'error' => "unknown agentnum $agentnum" };
- my @cust_main = ();
-
- #warn $p->{'search'};
- if ( $p->{'search'} =~ /^\s*(\d+)\s*$/ ) { # customer # search
- push @cust_main, qsearch('cust_main', { 'agentnum' => $agentnum,
- 'custnum' => $1 } );
- } elsif ( $p->{'search'} =~ /^\s*(\S.*\S)\s*$/ ) { #value search
- my $value = lc($1);
- my $q_value = dbh->quote($value);
-
- #exact
- my $sql = " AND ( LOWER(last) = $q_value OR LOWER(company) = $q_value";
- $sql .= " OR LOWER(ship_last) = $q_value OR LOWER(ship_company) = $q_value"
- if defined dbdef->table('cust_main')->column('ship_last');
- $sql .= ' )';
-
- push @cust_main, qsearch( 'cust_main',
- { 'agentnum' => $agentnum },
- '',
- $sql
- );
-
- unless ( @cust_main ) {
- warn "no exact match, trying substring/fuzzy\n";
-
- #still some false laziness w/ search/cust_main.cgi
-
- #substring
- push @cust_main, qsearch( 'cust_main',
- { 'agentnum' => $agentnum,
- 'last' => { 'op' => 'ILIKE',
- 'value' => "%$q_value%" } } );
-
- push @cust_main, qsearch( 'cust_main',
- { 'agentnum' => $agentnum,
- 'ship_last' => { 'op' => 'ILIKE',
- 'value' => "%$q_value%" } } )
- if defined dbdef->table('cust_main')->column('ship_last');
-
- push @cust_main, qsearch( 'cust_main',
- { 'agentnum' => $agentnum,
- 'company' => { 'op' => 'ILIKE',
- 'value' => "%$q_value%" } } );
-
- push @cust_main, qsearch( 'cust_main',
- { 'agentnum' => $agentnum,
- 'ship_company' => { 'op' => 'ILIKE',
- 'value' => "%$q_value%" } } )
- if defined dbdef->table('cust_main')->column('ship_last');
-
- #fuzzy
- push @cust_main, FS::cust_main->fuzzy_search(
- { 'last' => $value },
- { 'agentnum' => $agentnum }
- );
- push @cust_main, FS::cust_main->fuzzy_search(
- { 'company' => $value },
- { 'agentnum' => $agentnum }
- );
-
- }
- }
+ my @cust_main = smart_search( 'search' => $p->{'search'},
+ 'agentnum' => $agentnum,
+ );
#aggregate searches
push @cust_main,
- Previous message: freeside/FS/FS TicketSystem.pm,NONE,1.1 cust_main.pm,1.164,1.165 Conf.pm,1.111,1.112 CGI.pm,1.27,1.28
- Next message: freeside/htetc handler.pl,1.48,1.49 global.asa,1.51,1.52
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list