Database [Class]: Modify copy() method to support enable and description fields without the table name.
This commit is contained in:
@@ -1669,7 +1669,7 @@
|
|||||||
$parent_key_name = self::singular($parent_name)."_uuid";
|
$parent_key_name = self::singular($parent_name)."_uuid";
|
||||||
|
|
||||||
//build the copy array
|
//build the copy array
|
||||||
if ($row['checked'] == 'true') {
|
if (!empty($row['checked']) && $row['checked'] == 'true') {
|
||||||
//set checked to true
|
//set checked to true
|
||||||
$checked = true;
|
$checked = true;
|
||||||
|
|
||||||
@@ -1810,9 +1810,20 @@
|
|||||||
//update the parent key id
|
//update the parent key id
|
||||||
$array[$parent_name][$x][$parent_key_name] = $parent_key_value;
|
$array[$parent_name][$x][$parent_key_name] = $parent_key_value;
|
||||||
|
|
||||||
|
//set enabled
|
||||||
|
if (array_key_exists(self::singular($parent_name).'_enabled', $array[$parent_name][$x])) {
|
||||||
|
$array[$parent_name][$x][self::singular($parent_name).'_enabled'] = $row[self::singular($parent_name).'_enabled'] === true || $row[self::singular($parent_name).'_enabled'] == 'true' ? 'true' : 'false';
|
||||||
|
}
|
||||||
|
else if (array_key_exists('enabled', $array[$parent_name][$x])) {
|
||||||
|
$array[$parent_name][$x]['enabled'] = $row['enabled'] === true || $row['enabled'] == 'true' ? 'true' : 'false';
|
||||||
|
}
|
||||||
|
|
||||||
//add copy to the description
|
//add copy to the description
|
||||||
if (isset($array[$parent_name][$x][self::singular($parent_name).'_description'])) {
|
if (array_key_exists(self::singular($parent_name).'_description', $array[$parent_name][$x])) {
|
||||||
$array[$parent_name][$x][self::singular($parent_name).'_description'] = $suffix.$array[$parent_name][$x][self::singular($parent_name).'_description'];
|
$array[$parent_name][$x][self::singular($parent_name).'_description'] = trim($array[$parent_name][$x][self::singular($parent_name).'_description'].' '.$suffix);
|
||||||
|
}
|
||||||
|
else if (array_key_exists('description', $array[$parent_name][$x])) {
|
||||||
|
$array[$parent_name][$x]['description'] = trim($array[$parent_name][$x]['description'].' '.$suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
//loop through the fields
|
//loop through the fields
|
||||||
|
|||||||
Reference in New Issue
Block a user