Skip to content

Commit 0886a6c

Browse files
author
wrongecho
committed
Client import - resiliency
- 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
1 parent 1390ca0 commit 0886a6c

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

post/client.php

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,66 +418,108 @@
418418
$duplicate_detect = 1;
419419
}
420420
}
421+
422+
$industry = '';
421423
if (isset($column[1])) {
422424
$industry = sanitizeInput($column[1]);
423425
}
426+
427+
$referral = '';
424428
if (isset($column[2])) {
425429
$referral = sanitizeInput($column[2]);
426430
}
431+
432+
$website = '';
427433
if (isset($column[3])) {
428-
$website = sanitizeInput($column[3]);
434+
$website = sanitizeInput(preg_replace("(^https?://)", "", $column[3]));
429435
}
436+
437+
$location_name = '';
430438
if (isset($column[4])) {
431439
$location_name = sanitizeInput($column[4]);
432440
}
441+
442+
$location_phone = '';
433443
if (isset($column[5])) {
434-
$location_phone = preg_replace("/[^0-9]/", '',$column[5]);
444+
$location_phone = preg_replace("/[^0-9]/", '', $column[5]);
435445
}
446+
447+
$address = '';
436448
if (isset($column[6])) {
437449
$address = sanitizeInput($column[6]);
438450
}
451+
452+
$city = '';
439453
if (isset($column[7])) {
440454
$city = sanitizeInput($column[7]);
441455
}
456+
457+
$state = '';
442458
if (isset($column[8])) {
443459
$state = sanitizeInput($column[8]);
444460
}
461+
462+
$zip = '';
445463
if (isset($column[9])) {
446464
$zip = sanitizeInput($column[9]);
447465
}
466+
467+
$country = '';
448468
if (isset($column[10])) {
449469
$country = sanitizeInput($column[10]);
450470
}
471+
472+
$contact_name = '';
451473
if (isset($column[11])) {
452474
$contact_name = sanitizeInput($column[11]);
453475
}
476+
477+
$title = '';
454478
if (isset($column[12])) {
455479
$title = sanitizeInput($column[12]);
456480
}
481+
482+
$contact_phone = '';
457483
if (isset($column[13])) {
458484
$contact_phone = preg_replace("/[^0-9]/", '',$column[13]);
459485
}
486+
487+
$contact_extension = '';
460488
if (isset($column[14])) {
461489
$contact_extension = preg_replace("/[^0-9]/", '',$column[14]);
462490
}
491+
492+
$contact_mobile = '';
463493
if (isset($column[15])) {
464494
$contact_mobile = preg_replace("/[^0-9]/", '',$column[15]);
465495
}
496+
497+
$contact_email = '';
466498
if (isset($column[16])) {
467499
$contact_email = sanitizeInput($column[16]);
468500
}
501+
502+
$hourly_rate = $config_default_hourly_rate;
469503
if (isset($column[17])) {
470504
$hourly_rate = floatval($column[17]);
471505
}
506+
507+
$currency_code = sanitizeInput($session_company_currency);
472508
if (isset($column[18])) {
473509
$currency_code = sanitizeInput($column[18]);
474510
}
511+
512+
$payment_terms = sanitizeInput($config_default_net_terms);
475513
if (isset($column[19])) {
476514
$payment_terms = intval($column[19]);
477515
}
516+
517+
$tax_id_number = '';
478518
if (isset($column[20])) {
479519
$tax_id_number = sanitizeInput($column[20]);
480520
}
521+
522+
$abbreviation = '';
481523
if (isset($column[21])) {
482524
$abbreviation = sanitizeInput($column[21]);
483525
}

settings_defaults.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<option value="0">- None -</option>
111111
<?php
112112

113-
$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");
113+
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
114114
while ($row = mysqli_fetch_array($sql)) {
115115
$account_id = intval($row['account_id']);
116116
$account_name = nullable_htmlentities($row['account_name']); ?>

0 commit comments

Comments
 (0)