diff --git a/add_client_modal.php b/add_client_modal.php index 108ade53..897a36b4 100644 --- a/add_client_modal.php +++ b/add_client_modal.php @@ -215,19 +215,6 @@
-
- -
-
- -
- -
-
-
@@ -269,7 +256,7 @@
    - +
    diff --git a/add_ticket_modal.php b/add_ticket_modal.php index c6f811a1..156469de 100644 --- a/add_ticket_modal.php +++ b/add_ticket_modal.php @@ -70,7 +70,7 @@ $client_tag_name"; + } + $client_tags_display = implode('', $client_tag_name_display_array); + //Add up all the payments for the invoice and get the total amount paid to the invoice $sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled'"); $row = mysqli_fetch_array($sql_invoice_amounts); diff --git a/client_side_nav.php b/client_side_nav.php index eeed0ff0..e218e53f 100644 --- a/client_side_nav.php +++ b/client_side_nav.php @@ -14,7 +14,7 @@

    - SUPPORT: ;"> +
    diff --git a/clients.php b/clients.php index 6ac36853..10bc9ef6 100644 --- a/clients.php +++ b/clients.php @@ -82,8 +82,10 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['date_from'])){ //Rebuild URL $url_query_strings_sortby = http_build_query(array_merge($_GET,array('sortby' => $sortby, 'order' => $order))); -$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 client_support LIKE '%$query%' OR contact_email LIKE '%$query%' OR contact_name LIKE '%$query%' OR contact_phone LIKE '%$query%' +$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%') AND DATE(client_created_at) BETWEEN '$date_from' AND '$date_to' AND clients.company_id = $session_company_id $permission_sql @@ -189,26 +191,31 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); $client_currency_code = $row['client_currency_code']; $client_net_terms = $row['client_net_terms']; $client_referral = $row['client_referral']; - $client_support = $row['client_support']; $client_notes = $row['client_notes']; $client_created_at = $row['client_created_at']; $client_updated_at = $row['client_updated_at']; - //Get Tags WIP + //Client Tags - $sql_client_tags = mysqli_query($mysqli,"SELECT * FROM client_tags, tags WHERE client_tags.client_id = $client_id AND client_tags.tag_id = tags.tag_id"); - $row = mysqli_fetch_array($sql_client_tags); + $client_tag_name_display_array = array(); + $client_tag_id_array = array(); + $sql_client_tags = mysqli_query($mysqli,"SELECT * FROM client_tags LEFT JOIN tags ON client_tags.tag_id = tags.tag_id WHERE client_tags.client_id = $client_id"); while($row = mysqli_fetch_array($sql_client_tags)){ $client_tag_id = $row['tag_id']; $client_tag_name = $row['tag_name']; $client_tag_color = $row['tag_color']; $client_tag_icon = $row['tag_icon']; + if(empty($client_tag_icon)){ + $client_tag_icon = "tag"; + } - //$client_tag_id_array = array($client_tag_id); - //$client_tag_name_array = array($client_tag_name); + $client_tag_id_array[] = $client_tag_id; + $client_tag_name_display_array[] = " $client_tag_name"; } + $client_tags_display = implode('', $client_tag_name_display_array); + //Add up all the payments for the invoice and get the total amount paid to the invoice $sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' "); $row = mysqli_fetch_array($sql_invoice_amounts); @@ -231,12 +238,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); ?> - fa-fw"> +
    - - + + + +
    +
    Added: diff --git a/db.sql b/db.sql index 47a5c546..c8cbfb6d 100644 --- a/db.sql +++ b/db.sql @@ -225,7 +225,6 @@ CREATE TABLE `clients` ( `client_referral` varchar(200) DEFAULT NULL, `client_currency_code` varchar(200) NOT NULL, `client_net_terms` int(10) NOT NULL, - `client_support` varchar(100) DEFAULT NULL, `client_notes` text DEFAULT NULL, `client_created_at` datetime NOT NULL, `client_updated_at` datetime DEFAULT NULL, @@ -908,7 +907,6 @@ CREATE TABLE `tags` ( `tag_icon` varchar(200) DEFAULT NULL, `tag_created_at` datetime NOT NULL, `tag_updated_at` datetime DEFAULT NULL, - `tag_archived_at` datetime DEFAULT NULL, `company_id` int(11) NOT NULL, PRIMARY KEY (`tag_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1154,4 +1152,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-12-22 14:33:03 +-- Dump completed on 2021-12-27 11:38:55 diff --git a/edit_client_modal.php b/edit_client_modal.php index 5bbbca84..6cd52045 100644 --- a/edit_client_modal.php +++ b/edit_client_modal.php @@ -57,19 +57,6 @@
-
- -
-
- -
- -
-
-
@@ -272,7 +259,7 @@
  • - > - + > +
  • diff --git a/edit_ticket_modal.php b/edit_ticket_modal.php index c27b892a..633f5f21 100644 --- a/edit_ticket_modal.php +++ b/edit_ticket_modal.php @@ -21,7 +21,7 @@ 0){ @@ -1031,6 +1016,14 @@ if(isset($_POST['edit_client'])){ } + //Tags + mysqli_query($mysqli,"DELETE FROM client_tags WHERE client_id = $client_id"); + + foreach($_POST['tags'] as $tag){ + intval($tag); + mysqli_query($mysqli,"INSERT INTO client_tags SET client_id = $client_id, tag_id = $tag"); + } + $_SESSION['alert_message'] = "Client $name updated"; header("Location: " . $_SERVER["HTTP_REFERER"]); @@ -1839,24 +1832,11 @@ if(isset($_POST['edit_tag'])){ } -if(isset($_GET['archive_tag'])){ - $tag_id = intval($_GET['archive_tag']); - - mysqli_query($mysqli,"UPDATE tags SET tag_archived_at = NOW() WHERE tag_id = $tag_id"); - - //logging - mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Tag', log_action = 'Archive', log_description = '$tag_id', log_created_at = NOW()"); - - $_SESSION['alert_message'] = "Tag Archived"; - - header("Location: " . $_SERVER["HTTP_REFERER"]); - -} - if(isset($_GET['delete_tag'])){ $tag_id = intval($_GET['delete_tag']); mysqli_query($mysqli,"DELETE FROM tags WHERE tag_id = $tag_id AND company_id = $session_company_id"); + mysqli_query($mysqli,"DELETE FROM client_tags WHERE tag_id = $tag_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Tag', log_action = 'Deleted', log_description = '$tag_id', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id"); diff --git a/side_nav.php b/side_nav.php index 5bd272e3..0d57672f 100644 --- a/side_nav.php +++ b/side_nav.php @@ -227,7 +227,7 @@

    Categories

    -