Skip to content

Commit

Permalink
Client import - resiliency
Browse files Browse the repository at this point in the history
- Add some resiliency to the client import function to better account for blank fields (may also fix some import errors)
- Fix the default settings page not loading due to the removal of account types
  • Loading branch information
wrongecho committed Sep 20, 2024
1 parent 1390ca0 commit 0886a6c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
46 changes: 44 additions & 2 deletions post/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,66 +418,108 @@
$duplicate_detect = 1;
}
}

$industry = '';
if (isset($column[1])) {
$industry = sanitizeInput($column[1]);
}

$referral = '';
if (isset($column[2])) {
$referral = sanitizeInput($column[2]);
}

$website = '';
if (isset($column[3])) {
$website = sanitizeInput($column[3]);
$website = sanitizeInput(preg_replace("(^https?://)", "", $column[3]));
}

$location_name = '';
if (isset($column[4])) {
$location_name = sanitizeInput($column[4]);
}

$location_phone = '';
if (isset($column[5])) {
$location_phone = preg_replace("/[^0-9]/", '',$column[5]);
$location_phone = preg_replace("/[^0-9]/", '', $column[5]);
}

$address = '';
if (isset($column[6])) {
$address = sanitizeInput($column[6]);
}

$city = '';
if (isset($column[7])) {
$city = sanitizeInput($column[7]);
}

$state = '';
if (isset($column[8])) {
$state = sanitizeInput($column[8]);
}

$zip = '';
if (isset($column[9])) {
$zip = sanitizeInput($column[9]);
}

$country = '';
if (isset($column[10])) {
$country = sanitizeInput($column[10]);
}

$contact_name = '';
if (isset($column[11])) {
$contact_name = sanitizeInput($column[11]);
}

$title = '';
if (isset($column[12])) {
$title = sanitizeInput($column[12]);
}

$contact_phone = '';
if (isset($column[13])) {
$contact_phone = preg_replace("/[^0-9]/", '',$column[13]);
}

$contact_extension = '';
if (isset($column[14])) {
$contact_extension = preg_replace("/[^0-9]/", '',$column[14]);
}

$contact_mobile = '';
if (isset($column[15])) {
$contact_mobile = preg_replace("/[^0-9]/", '',$column[15]);
}

$contact_email = '';
if (isset($column[16])) {
$contact_email = sanitizeInput($column[16]);
}

$hourly_rate = $config_default_hourly_rate;
if (isset($column[17])) {
$hourly_rate = floatval($column[17]);
}

$currency_code = sanitizeInput($session_company_currency);
if (isset($column[18])) {
$currency_code = sanitizeInput($column[18]);
}

$payment_terms = sanitizeInput($config_default_net_terms);
if (isset($column[19])) {
$payment_terms = intval($column[19]);
}

$tax_id_number = '';
if (isset($column[20])) {
$tax_id_number = sanitizeInput($column[20]);
}

$abbreviation = '';
if (isset($column[21])) {
$abbreviation = sanitizeInput($column[21]);
}
Expand Down
2 changes: 1 addition & 1 deletion settings_defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<option value="0">- None -</option>
<?php

$sql = mysqli_query($mysqli, "SELECT * FROM accounts LEFT JOIN account_types ON account_types.account_type_id = accounts.account_type WHERE account_type_parent = 1 AND account_archived_at IS NULL ORDER BY account_name ASC");
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$account_id = intval($row['account_id']);
$account_name = nullable_htmlentities($row['account_name']); ?>
Expand Down

0 comments on commit 0886a6c

Please sign in to comment.