mirror of https://github.com/itflow-org/itflow
Change client - fix code smell
This commit is contained in:
parent
c55d2a8cda
commit
a26f3087fc
|
|
@ -3,16 +3,15 @@
|
|||
*/
|
||||
|
||||
// Modal loaded listener - populate client select
|
||||
changeClientModalLoad = document.getElementById('clientChangeTicketModalLoad');
|
||||
const changeClientModalLoad = document.getElementById('clientChangeTicketModalLoad');
|
||||
changeClientModalLoad.addEventListener('click', function() {
|
||||
populateChangeClientModal_Clients();
|
||||
})
|
||||
|
||||
// Client selected listener - populate contact select
|
||||
// We seem to have to use jQuery to listen for events, as the client input is a select2 component?
|
||||
clientSelectDropdown = document.getElementById("changeClientSelect");
|
||||
const clientSelectDropdown = document.getElementById("changeClientSelect");
|
||||
$(clientSelectDropdown).on('select2:select', function (e) {
|
||||
console.log("Fired contacts listener!!!!!!")
|
||||
let client_id = $(this).find(':selected').val();
|
||||
populateChangeClientModal_Contacts(client_id);
|
||||
});
|
||||
|
|
@ -43,7 +42,7 @@ function populateChangeClientModal_Clients() {
|
|||
// Client dropdown already defined in listeners as clientSelectDropdown
|
||||
|
||||
// Clear dropdown
|
||||
var i, L = clientSelectDropdown.options.length -1;
|
||||
let i, L = clientSelectDropdown.options.length - 1;
|
||||
for (i = L; i >= 0; i--) {
|
||||
clientSelectDropdown.remove(i);
|
||||
}
|
||||
|
|
@ -76,10 +75,10 @@ function populateChangeClientModal_Contacts(client_id) {
|
|||
const contacts = response.contacts;
|
||||
|
||||
// Contacts dropdown
|
||||
var contactSelectDropdown = document.getElementById("changeContactSelect");
|
||||
const contactSelectDropdown = document.getElementById("changeContactSelect");
|
||||
|
||||
// Clear Category dropdown
|
||||
var i, L = contactSelectDropdown.options.length -1;
|
||||
let i, L = contactSelectDropdown.options.length - 1;
|
||||
for (i = L; i >= 0; i--) {
|
||||
contactSelectDropdown.remove(i);
|
||||
}
|
||||
|
|
|
|||
2
post.php
2
post.php
|
|
@ -6515,7 +6515,7 @@ if(isset($_POST['change_client_ticket'])){
|
|||
mysqli_query($mysqli, "UPDATE tickets SET ticket_client_id = $client_id, ticket_contact_id = $contact_id WHERE ticket_id = $ticket_id LIMIT 1");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Ticket Reply', log_action = 'Modify', log_description = '$session_name modified ticket - client changed', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $ticket_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket Reply', log_action = 'Modify', log_description = '$session_name modified ticket - client changed', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $ticket_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Ticket client updated";
|
||||
|
||||
|
|
|
|||
|
|
@ -651,10 +651,10 @@ if (isset($_GET['ticket_id'])) {
|
|||
</div>
|
||||
|
||||
<?php
|
||||
require("ticket_edit_modal.php");
|
||||
require("ticket_change_client_modal.php");
|
||||
require("ticket_merge_modal.php");
|
||||
require("ticket_invoice_add_modal.php");
|
||||
require_once("ticket_edit_modal.php");
|
||||
require_once("ticket_change_client_modal.php");
|
||||
require_once("ticket_merge_modal.php");
|
||||
require_once("ticket_invoice_add_modal.php");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>New Contact <strong class="text-danger">*</strong></label>
|
||||
<label>New Contact</label>
|
||||
<div class="input-group">
|
||||
<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="new_contact_id" id="changeContactSelect" required>
|
||||
<select class="form-control select2" name="new_contact_id" id="changeContactSelect">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue