Check the missing array has content before processing it.

This commit is contained in:
markjcrane 2016-05-04 00:22:35 -06:00
parent 7aa61e2d53
commit 3abaff004c
10 changed files with 63 additions and 58 deletions

View File

@ -70,7 +70,7 @@ if ($domains_processed == 1) {
}
//add the missing default settings
foreach ($missing as $row) {
if (count($missing) > 0) foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');

View File

@ -137,6 +137,7 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before next call sequence';
$x++;
//get an array of the default settings
$sql = "select * from v_default_settings ";
$prep_statement = $db->prepare($sql);
@ -160,7 +161,7 @@ if ($domains_processed == 1) {
}
//add the missing default settings
foreach ($missing as $row) {
if (count($missing) > 0) foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');

View File

@ -287,7 +287,7 @@
}
//add the missing default settings
foreach ($missing as $row) {
if (count($missing) > 0) foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');

View File

@ -66,7 +66,7 @@ if ($domains_processed == 1) {
}
//add the missing default settings
foreach ($missing as $row) {
if (count($missing) > 0) foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');

View File

@ -101,7 +101,7 @@ EOD;
function set_country_vars($db, $x) {
require "resources/countries.php";
// $country_iso=$_SESSION['domain']['country']['iso_code'];
//$country_iso=$_SESSION['domain']['country']['iso_code'];
$sql = "select default_setting_value as value from v_default_settings ";
$sql .= "where default_setting_name = 'iso_code' ";

View File

@ -77,7 +77,7 @@
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$x = 0;
foreach ($array as $row) {
if (isset($array)) foreach ($array as $row) {
$found = false;
foreach ($default_settings as $field) {
if ($row['default_setting_subcategory'] == $field['default_setting_subcategory']) {

View File

@ -330,6 +330,7 @@ if ($domains_processed == 1) {
$missing_count = $i;
//add the missing default settings
if (count($missing) > 0) {
$sql = "insert into v_default_settings (";
$sql .= "default_setting_uuid, ";
$sql .= "default_setting_category, ";
@ -357,6 +358,7 @@ if ($domains_processed == 1) {
}
$db->exec(check_sql($sql));
unset($missing);
}
//move the dynamic provision variables that from v_vars table to v_default_settings
if (count($_SESSION['provision']) == 0) {

View File

@ -239,7 +239,7 @@ if (!class_exists('switch_settings')) {
}
//add the missing default settings
if (is_array($missing)) {
if (count($missing) > 0) {
$sql = "insert into v_default_settings (";
$sql .= "default_setting_uuid, ";
$sql .= "default_setting_category, ";

View File

@ -1346,6 +1346,7 @@ if ($domains_processed == 1) {
$missing_count = $i;
//add the missing default settings
if (count($missing) > 0) {
$sql = "insert into v_default_settings (";
$sql .= "default_setting_uuid, ";
$sql .= "default_setting_category, ";
@ -1373,6 +1374,7 @@ if ($domains_processed == 1) {
}
$db->exec(check_sql($sql));
unset($missing);
}
//unset the array variable
unset($array);