Initialize the array if its empty

This commit is contained in:
markjcrane 2023-05-17 14:18:46 -06:00
parent 3fc342ad3e
commit af8a6991b1
1 changed files with 11 additions and 2 deletions

View File

@ -1147,10 +1147,18 @@
unset($sql, $parameters);
//add an empty row to the array
$x = (!empty($dialplan_details)) ? count($dialplan_details) : $x = 0;
if (empty($dialplan_details)) {
//create an empty array
$dialplan_details = [];
$x = 0;
}
else {
//count the rows in the array
$x = count($dialplan_details);
}
$limit = $x + 1;
while($x < $limit) {
$dialplan_details[$x]['domain_uuid'] = $domain_uuid ?? null;
$dialplan_details[$x]['domain_uuid'] = $domain_uuid;
$dialplan_details[$x]['dialplan_uuid'] = $dialplan_uuid;
$dialplan_details[$x]['dialplan_detail_type'] = '';
$dialplan_details[$x]['dialplan_detail_data'] = '';
@ -1159,6 +1167,7 @@
}
unset($limit);
//remove previous fax details
$x = 0;
foreach($dialplan_details as $row) {