A Ticket Contact is now optional

This commit is contained in:
johnnyq 2023-09-18 16:29:19 -04:00
parent d713031545
commit 485bb68055
3 changed files with 13 additions and 5 deletions

View File

@ -22,9 +22,10 @@ if (isset($_POST['add_ticket'])) {
$vendor_ticket_number = sanitizeInput($_POST['vendor_ticket_number']);
$vendor_id = intval($_POST['vendor']);
$asset_id = intval($_POST['asset']);
$use_primary_contact = intval($_POST['use_primary_contact']);
// If no contact is selected automatically choose the primary contact for the client
if ($client_id > 0 && $contact == 0) {
// Add the primary contact as the ticket contact if use primary contact is checked
if ($use_primary_contact == 1) {
$sql = mysqli_query($mysqli,"SELECT contact_id FROM contacts WHERE contact_client_id = $client_id AND contact_primary = 1");
$row = mysqli_fetch_array($sql);
$contact = intval($row['contact_id']);

View File

@ -71,6 +71,13 @@
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="primaryContactCheckbox" name="use_primary_contact" value="1">
<label for="primaryContactCheckbox" class="custom-control-label">Use Primary Contact</label>
</div>
</div>
<?php } ?>
<div class="form-group">
@ -126,8 +133,8 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<select class="form-control select2" name="contact" required>
<option value="">- Contact -</option>
<select class="form-control select2" name="contact">
<option value="0">- No One -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
while ($row = mysqli_fetch_array($sql)) {

View File

@ -73,7 +73,7 @@
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<select class="form-control select2" name="contact">
<option value="">No One</option>
<option value="0">No One</option>
<?php
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {