mirror of https://github.com/itflow-org/itflow
Fix Adding a vendor from a template and adding country code to vendor template
This commit is contained in:
parent
6b0855cff8
commit
ca519fe4e1
|
|
@ -10,7 +10,8 @@ $vendor_name = nullable_htmlentities($row['vendor_template_name']);
|
|||
$vendor_description = nullable_htmlentities($row['vendor_template_description']);
|
||||
$vendor_account_number = nullable_htmlentities($row['vendor_template_account_number']);
|
||||
$vendor_contact_name = nullable_htmlentities($row['vendor_template_contact_name']);
|
||||
$vendor_phone = formatPhoneNumber($row['vendor_template_phone']);
|
||||
$vendor_phone_country_code = intval($row['vendor_template_phone_country_code']);
|
||||
$vendor_phone = formatPhoneNumber($row['vendor_template_phone'], $vendor_phone_country_code);
|
||||
$vendor_extension = nullable_htmlentities($row['vendor_template_extension']);
|
||||
$vendor_email = nullable_htmlentities($row['vendor_template_email']);
|
||||
$vendor_website = nullable_htmlentities($row['vendor_template_website']);
|
||||
|
|
@ -133,17 +134,20 @@ ob_start();
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
||||
</div>
|
||||
<input type="tel" class="form-control col-2" name="phone_country_code" placeholder="+" maxlength="4" value="<?php echo $vendor_phone_country_code; ?>">
|
||||
<input type="tel" class="form-control" name="phone" value="<?php echo $vendor_phone; ?>">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="global_update_vendor_phone" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Prompts" maxlength="200" value="<?php echo $vendor_extension; ?>">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="extension" placeholder="Prompts" maxlength="200" value="<?php echo $vendor_extension; ?>">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="global_update_vendor_phone" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -191,9 +191,10 @@ if (mysqli_num_rows($os_sql) > 0) {
|
|||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importAssetModal">
|
||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportAssetModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ if (isset($_POST['edit_vendor_template'])) {
|
|||
}
|
||||
|
||||
if ($_POST['global_update_vendor_phone'] == 1) {
|
||||
$sql_global_update_vendor_phone = ", vendor_phone = '$phone', vendor_extension = '$extension'";
|
||||
$sql_global_update_vendor_phone = ", vendor_phone_country_code = '$phone_country_code', vendor_phone = '$phone', vendor_extension = '$extension'";
|
||||
} else {
|
||||
$sql_global_update_vendor_phone = "";
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ if (isset($_POST['edit_vendor_template'])) {
|
|||
}
|
||||
|
||||
// Update just the template
|
||||
mysqli_query($mysqli,"UPDATE vendor_templates SET vendor_template_name = '$name', vendor_template_description = '$description', vendor_template_contact_name = '$contact_name', vendor_template_phone = '$phone', vendor_template_extension = '$extension', vendor_template_email = '$email', vendor_template_website = '$website', vendor_template_hours = '$hours', vendor_template_sla = '$sla', vendor_template_code = '$code', vendor_template_account_number = '$account_number', vendor_template_notes = '$notes' WHERE vendor_template_id = $vendor_template_id");
|
||||
mysqli_query($mysqli,"UPDATE vendor_templates SET vendor_template_name = '$name', vendor_template_description = '$description', vendor_template_contact_name = '$contact_name', vendor_template_phone_country_code = '$phone_country_code', vendor_template_phone = '$phone', vendor_template_extension = '$extension', vendor_template_email = '$email', vendor_template_website = '$website', vendor_template_hours = '$hours', vendor_template_sla = '$sla', vendor_template_code = '$code', vendor_template_account_number = '$account_number', vendor_template_notes = '$notes' WHERE vendor_template_id = $vendor_template_id");
|
||||
|
||||
if ($_POST['update_base_vendors'] == 1) {
|
||||
// Update client related vendors if anything is checked
|
||||
|
|
|
|||
|
|
@ -13,25 +13,26 @@ if (isset($_POST['add_vendor_from_template'])) {
|
|||
$vendor_template_id = intval($_POST['vendor_template_id']);
|
||||
|
||||
//GET Vendor Info
|
||||
$sql_vendor = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_id = $vendor_template_id");
|
||||
$sql_vendor_templates = mysqli_query($mysqli,"SELECT * FROM vendor_templates WHERE vendor_template_id = $vendor_template_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql_vendor);
|
||||
$row = mysqli_fetch_array($sql_vendor_templates);
|
||||
|
||||
$name = sanitizeInput($row['vendor_name']);
|
||||
$description = sanitizeInput($row['vendor_description']);
|
||||
$account_number = sanitizeInput($row['vendor_account_number']);
|
||||
$contact_name = sanitizeInput($row['vendor_contact_name']);
|
||||
$phone = preg_replace("/[^0-9]/", '',$row['vendor_phone']);
|
||||
$extension = preg_replace("/[^0-9]/", '',$row['vendor_extension']);
|
||||
$email = sanitizeInput($row['vendor_email']);
|
||||
$website = sanitizeInput($row['vendor_website']);
|
||||
$hours = sanitizeInput($row['vendor_hours']);
|
||||
$sla = sanitizeInput($row['vendor_sla']);
|
||||
$code = sanitizeInput($row['vendor_code']);
|
||||
$notes = sanitizeInput($row['vendor_notes']);
|
||||
$name = sanitizeInput($row['vendor_template_name']);
|
||||
$description = sanitizeInput($row['vendor_template_description']);
|
||||
$account_number = sanitizeInput($row['vendor_template_account_number']);
|
||||
$contact_name = sanitizeInput($row['vendor_template_contact_name']);
|
||||
$phone_country_code = preg_replace("/[^0-9]/", '',$row['vendor_template_phone_country_code']);
|
||||
$phone = preg_replace("/[^0-9]/", '',$row['vendor_template_phone']);
|
||||
$extension = preg_replace("/[^0-9]/", '',$row['vendor_template_extension']);
|
||||
$email = sanitizeInput($row['vendor_template_email']);
|
||||
$website = sanitizeInput($row['vendor_template_website']);
|
||||
$hours = sanitizeInput($row['vendor_template_hours']);
|
||||
$sla = sanitizeInput($row['vendor_template_sla']);
|
||||
$code = sanitizeInput($row['vendor_template_code']);
|
||||
$notes = sanitizeInput($row['vendor_template_notes']);
|
||||
|
||||
// Vendor add query
|
||||
mysqli_query($mysqli,"INSERT INTO vendors SET vendor_name = '$name', vendor_description = '$description', vendor_contact_name = '$contact_name', vendor_phone = '$phone', vendor_extension = '$extension', vendor_email = '$email', vendor_website = '$website', vendor_hours = '$hours', vendor_sla = '$sla', vendor_code = '$code', vendor_account_number = '$account_number', vendor_notes = '$notes', vendor_client_id = $client_id, vendor_template_id = $vendor_template_id");
|
||||
mysqli_query($mysqli,"INSERT INTO vendors SET vendor_name = '$name', vendor_description = '$description', vendor_contact_name = '$contact_name', vendor_phone_country_code = '$phone_country_code', vendor_phone = '$phone', vendor_extension = '$extension', vendor_email = '$email', vendor_website = '$website', vendor_hours = '$hours', vendor_sla = '$sla', vendor_code = '$code', vendor_account_number = '$account_number', vendor_notes = '$notes', vendor_client_id = $client_id, vendor_template_id = $vendor_template_id");
|
||||
|
||||
$vendor_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue