mirror of https://github.com/itflow-org/itflow
You can now search by phone numbers with dashes or () before it requied you to only type in the numbers only
This commit is contained in:
parent
d7fd8cc736
commit
d1ee7ce5aa
|
|
@ -13,8 +13,14 @@ if(isset($_GET['p'])){
|
|||
|
||||
if(isset($_GET['q'])){
|
||||
$q = mysqli_real_escape_string($mysqli,$_GET['q']);
|
||||
//Phone Numbers
|
||||
$phone_query = preg_replace("/[^0-9]/", '',$q);
|
||||
if(empty($phone_query)){
|
||||
$phone_query = $q;
|
||||
}
|
||||
}else{
|
||||
$q = "";
|
||||
$phone_query = "";
|
||||
}
|
||||
|
||||
if(!empty($_GET['sb'])){
|
||||
|
|
@ -41,7 +47,7 @@ $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o
|
|||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM locations
|
||||
WHERE location_client_id = $client_id
|
||||
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$q%')
|
||||
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
|
|||
|
|
@ -13,8 +13,14 @@ if(isset($_GET['p'])){
|
|||
|
||||
if(isset($_GET['q'])){
|
||||
$q = mysqli_real_escape_string($mysqli,$_GET['q']);
|
||||
//Phone Numbers
|
||||
$phone_query = preg_replace("/[^0-9]/", '',$q);
|
||||
if(empty($phone_query)){
|
||||
$phone_query = $q;
|
||||
}
|
||||
}else{
|
||||
$q = "";
|
||||
$phone_query = "";
|
||||
}
|
||||
|
||||
if(!empty($_GET['sb'])){
|
||||
|
|
@ -41,8 +47,7 @@ $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o
|
|||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM vendors
|
||||
WHERE vendor_client_id = $client_id
|
||||
AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' )
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' OR vendor_website LIKE '%$q%' OR vendor_contact_name LIKE '%$q%' OR vendor_email LIKE '%$q%' OR vendor_phone LIKE '%$phone_query%') ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
||||
|
|
|
|||
10
clients.php
10
clients.php
|
|
@ -16,8 +16,14 @@ if(isset($_GET['p'])){
|
|||
//Custom Query Filter
|
||||
if(isset($_GET['query'])){
|
||||
$query = mysqli_real_escape_string($mysqli,$_GET['query']);
|
||||
//Phone Numbers
|
||||
$phone_query = preg_replace("/[^0-9]/", '',$query);
|
||||
if(empty($phone_query)){
|
||||
$phone_query = $query;
|
||||
}
|
||||
}else{
|
||||
$query = "";
|
||||
$number_query = "";
|
||||
}
|
||||
|
||||
//Column Filter
|
||||
|
|
@ -86,8 +92,8 @@ $url_query_strings_sortby = http_build_query(array_merge($_GET,array('sortby' =>
|
|||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM clients
|
||||
LEFT JOIN contacts ON clients.primary_contact = contacts.contact_id AND contact_archived_at IS NULL
|
||||
LEFT JOIN locations ON clients.primary_location = locations.location_id AND location_archived_at IS NULL
|
||||
WHERE (client_name LIKE '%$query%' OR client_type LIKE '%$query%' OR contact_email LIKE '%$query%' OR contact_name LIKE '%$query%' OR contact_phone LIKE '%$query%'
|
||||
OR contact_mobile LIKE '%$query%' OR location_address LIKE '%$query%' OR location_city LIKE '%$query%' OR location_state LIKE '%$query%' OR location_zip LIKE '%$query%')
|
||||
WHERE (client_name LIKE '%$query%' OR client_type LIKE '%$query%' OR contact_email LIKE '%$query%' OR contact_name LIKE '%$query%' OR contact_phone LIKE '%$phone_query%'
|
||||
OR contact_mobile LIKE '%$phone_query%' OR location_address LIKE '%$query%' OR location_city LIKE '%$query%' OR location_state LIKE '%$query%' OR location_zip LIKE '%$query%')
|
||||
AND DATE(client_created_at) BETWEEN '$date_from' AND '$date_to'
|
||||
AND clients.company_id = $session_company_id
|
||||
ORDER BY $sortby $order LIMIT $record_from, $record_to
|
||||
|
|
|
|||
|
|
@ -6,9 +6,14 @@ if(isset($_GET['query'])){
|
|||
|
||||
$query = mysqli_real_escape_string($mysqli,$_GET['query']);
|
||||
|
||||
$phone_query = preg_replace("/[^0-9]/", '',$query);
|
||||
if(empty($phone_query)){
|
||||
$phone_query = $query;
|
||||
}
|
||||
|
||||
$sql_clients = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN locations ON clients.client_id = locations.location_client_id WHERE client_name LIKE '%$query%' AND clients.company_id = $session_company_id ORDER BY client_id DESC LIMIT 5");
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts LEFT JOIN clients ON client_id = contact_client_id WHERE contact_name LIKE '%$query%' AND contacts.company_id = $session_company_id ORDER BY contact_id DESC LIMIT 5");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY vendor_id DESC LIMIT 5");
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts LEFT JOIN clients ON client_id = contact_client_id LEFT JOIN departments ON contact_department_id = department_id WHERE (contact_name LIKE '%$query%' OR contact_title LIKE '%$query%' OR contact_email LIKE '%$query%' OR contact_phone LIKE '%$phone_query%' OR contact_mobile LIKE '%$phone_query%') AND contacts.company_id = $session_company_id ORDER BY contact_id DESC LIMIT 5");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_name LIKE '%$query%' OR vendor_phone LIKE '%$phone_query%') AND company_id = $session_company_id ORDER BY vendor_id DESC LIMIT 5");
|
||||
$sql_products = mysqli_query($mysqli,"SELECT * FROM products WHERE product_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY product_id DESC LIMIT 5");
|
||||
$sql_documents = mysqli_query($mysqli, "SELECT * FROM documents LEFT JOIN clients on document_client_id = clients.client_id WHERE document_name LIKE '%$query%' AND documents.company_id = $session_company_id ORDER BY document_id DESC LIMIT 5");
|
||||
$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients on tickets.ticket_client_id = clients.client_id WHERE (ticket_subject LIKE '%$query%' OR ticket_number = '$query') AND tickets.company_id = $session_company_id ORDER BY ticket_id DESC LIMIT 5");
|
||||
|
|
@ -35,7 +40,6 @@ if(isset($_GET['query'])){
|
|||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -51,7 +55,6 @@ if(isset($_GET['query'])){
|
|||
?>
|
||||
<tr>
|
||||
<td><a href="client.php?client_id=<?php echo $client_id; ?>&tab=contacts"><?php echo $client_name; ?></a></td>
|
||||
<td><a href="mailto:<?php //echo $email; ?>"><?php //echo $client_email; ?></a></td>
|
||||
<td><?php echo $location_phone; ?></td>
|
||||
</tr>
|
||||
|
||||
|
|
@ -99,10 +102,13 @@ if(isset($_GET['query'])){
|
|||
$contact_email = $row['contact_email'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$department_name = $row['department_name'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="client.php?client_id=<?php echo $client_id; ?>&tab=contacts"><?php echo $contact_name; ?></a></td>
|
||||
<td><a href="client.php?client_id=<?php echo $client_id; ?>&tab=contacts"><?php echo $contact_name; ?></a>
|
||||
<br><small class="text-secondary"><?php echo $contact_title; ?></small>
|
||||
</td>
|
||||
<td><?php echo $contact_email; ?></td>
|
||||
<td><?php echo "$contact_phone $contact_extension"; ?></td>
|
||||
<td><?php echo $contact_mobile; ?></td>
|
||||
|
|
@ -143,7 +149,7 @@ if(isset($_GET['query'])){
|
|||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_name = $row['vendor_name'];
|
||||
$vendor_description = $row['vendor_description'];
|
||||
$vendor_phone = $row['vendor_phone'];
|
||||
$vendor_phone = formatPhoneNumber($row['vendor_phone']);
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="vendors.php?q=<?php echo $q ?>"><?php echo $vendor_name; ?></a></td>
|
||||
|
|
|
|||
|
|
@ -13,8 +13,14 @@ if(isset($_GET['p'])){
|
|||
|
||||
if(isset($_GET['q'])){
|
||||
$q = mysqli_real_escape_string($mysqli,$_GET['q']);
|
||||
//Phone Numbers
|
||||
$phone_query = preg_replace("/[^0-9]/", '',$q);
|
||||
if(empty($phone_query)){
|
||||
$phone_query = $q;
|
||||
}
|
||||
}else{
|
||||
$q = "";
|
||||
$phone_query = "";
|
||||
}
|
||||
|
||||
//Column Filter
|
||||
|
|
@ -53,7 +59,7 @@ $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o
|
|||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM vendors
|
||||
WHERE vendor_client_id = 0
|
||||
AND DATE(vendor_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%')
|
||||
AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' OR vendor_website LIKE '%$q%' OR vendor_contact_name LIKE '%$q%' OR vendor_email LIKE '%$q%' OR vendor_phone LIKE '%$phone_query%')
|
||||
AND vendor_archived_at IS NULL
|
||||
AND company_id = $session_company_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
|
|
|||
Loading…
Reference in New Issue