Difference between revisions of "Freeside:3:Documentation:Developer/FS/cust main/Search"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
Line 16: Line 16:
 
==SUBROUTINES==
 
==SUBROUTINES==
 
; smart_search OPTION => VALUE ...
 
; smart_search OPTION => VALUE ...
:Accepts the following options: ''search'', the string to search for. The string will be searched for as a customer number, phone number, name or company name, as an exact, or, in some cases, a substring or fuzzy match (see the source code for the exact heuristics used); ''no_fuzzy_on_exact'', causes smart_search to skip fuzzy matching when an exact match is found.
+
:Accepts the following options: ''search'', the string to search for. The string will be searched for as a customer number, phone number, name or company name, address (if address1-search is on), invoicing email address, or credit card number.
 +
 
 +
:Searches match as an exact, or, in some cases, a substring or fuzzy match (see the source code for the exact heuristics used); ''no_fuzzy_on_exact'', causes smart_search to skip fuzzy matching when an exact match is found.
  
 
:Any additional options are treated as an additional qualifier on the search (i.e. ''agentnum'').
 
:Any additional options are treated as an additional qualifier on the search (i.e. ''agentnum'').
Line 33: Line 35:
  
 
:Returns a qsearch hash expression to search for parameters specified in HASHREF. Valid parameters are
 
:Returns a qsearch hash expression to search for parameters specified in HASHREF. Valid parameters are
:; agentnum:; status:; address:; refnum:; cancelled_pkgs
+
:; agentnum:; status:; address:; zip:; refnum:; cancelled_pkgs
 
::bool
 
::bool
 
:; signupdate
 
:; signupdate
Line 40: Line 42:
 
::listref of start date, end date
 
::listref of start date, end date
 
:; spouse_birthdate
 
:; spouse_birthdate
 +
::listref of start date, end date
 +
:; anniversary_date
 
::listref of start date, end date
 
::listref of start date, end date
 
:; payby
 
:; payby
Line 53: Line 57:
  
 
==UTILITY SUBROUTINES==
 
==UTILITY SUBROUTINES==
; check_and_rebuild_fuzzyfiles; rebuild_fuzzyfiles; append_fuzzyfiles FIRSTNAME LASTNAME COMPANY ADDRESS1; all_X
+
; check_and_rebuild_fuzzyfiles; rebuild_fuzzyfiles; append_fuzzyfiles FIRSTNAME LASTNAME COMPANY ADDRESS1; append_fuzzyfiles_fuzzyfield COLUMN VALUE; append_fuzzyfiles_fuzzyfield TABLE.COLUMN VALUE; all_X
 
==BUGS==
 
==BUGS==
 
Bed bugs
 
Bed bugs
Line 63: Line 67:
 
Hey! '''The above document had some coding errors, which are explained below:'''
 
Hey! '''The above document had some coding errors, which are explained below:'''
  
; Around line 1024:
+
; Around line 1287:
 
:You forgot a '=back' before '=head1'
 
:You forgot a '=back' before '=head1'

Revision as of 14:42, 27 June 2014

NAME

FS::cust_main::Search - Customer searching

SYNOPSIS

 use FS::cust_main::Search;

 FS::cust_main::Search::smart_search(%options);

 FS::cust_main::Search::email_search(%options);

 FS::cust_main::Search->search( \%options );
 
 FS::cust_main::Search->fuzzy_search( \%fuzzy_hashref );

SUBROUTINES

smart_search OPTION => VALUE ...
Accepts the following options: search, the string to search for. The string will be searched for as a customer number, phone number, name or company name, address (if address1-search is on), invoicing email address, or credit card number.
Searches match as an exact, or, in some cases, a substring or fuzzy match (see the source code for the exact heuristics used); no_fuzzy_on_exact, causes smart_search to skip fuzzy matching when an exact match is found.
Any additional options are treated as an additional qualifier on the search (i.e. agentnum).
Returns a (possibly empty) array of FS::cust_main objects.
email_search
Accepts the following options: email, the email address to search for. The email address will be searched for as an email invoice destination and as an svc_acct account.
  1. Any additional options are treated as an additional qualifier on the search #(i.e. agentnum).
Returns a (possibly empty) array of FS::cust_main objects (but usually just none or one).

CLASS METHODS

search HASHREF
(Class method)
Returns a qsearch hash expression to search for parameters specified in HASHREF. Valid parameters are
agentnum
; status:; address:; zip:; refnum:; cancelled_pkgs
bool
signupdate
listref of start date, end date
birthdate
listref of start date, end date
spouse_birthdate
listref of start date, end date
anniversary_date
listref of start date, end date
payby
listref
paydate_year
; paydate_month:; current_balance
listref (list returned by FS::UI::Web::parse_lt_gt($cgi, 'current_balance'))
cust_fields
; flattened_pkgs
bool
fuzzy_search FUZZY_HASHREF [ OPTS ]
Performs a fuzzy (approximate) search and returns the matching FS::cust_main records. Currently, first, last, company and/or address1 may be specified.
Additional options are the same as FS::Record::qsearch

UTILITY SUBROUTINES

check_and_rebuild_fuzzyfiles; rebuild_fuzzyfiles; append_fuzzyfiles FIRSTNAME LASTNAME COMPANY ADDRESS1; append_fuzzyfiles_fuzzyfield COLUMN VALUE; append_fuzzyfiles_fuzzyfield TABLE.COLUMN VALUE; all_X

BUGS

Bed bugs

SEE ALSO

FS::cust_main, FS::Record

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 1287:
You forgot a '=back' before '=head1'