mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2011-08-29 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/map_builder.php: wrote the source code for copy the relationships between a copy of items in a visual console. Fixes: #3400124 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4836 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
4f5d5ead37
commit
c777a00149
@ -1,3 +1,10 @@
|
|||||||
|
2011-08-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* godmode/reporting/map_builder.php: wrote the source code for copy the
|
||||||
|
relationships between a copy of items in a visual console.
|
||||||
|
|
||||||
|
Fixes: #3400124
|
||||||
|
|
||||||
2011-08-29 Miguel de Dios <miguel.dedios@artica.es>
|
2011-08-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/functions_visual_map.php: fixed the clean $id_agent var for
|
* include/functions_visual_map.php: fixed the clean $id_agent var for
|
||||||
|
@ -63,18 +63,30 @@ if ($copy_layout) {
|
|||||||
// Return from DB the items of the source layout
|
// Return from DB the items of the source layout
|
||||||
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
|
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
|
||||||
|
|
||||||
if(!empty($data_layout_src)){
|
if(!empty($data_layout_src)) {
|
||||||
for ($a=0;$a < count($data_layout_src); $a++) {
|
|
||||||
|
//By default the id parent 0 is always 0.
|
||||||
|
$id_relations = array(0 => 0);
|
||||||
|
|
||||||
|
for ($a=0; $a < count($data_layout_src); $a++) {
|
||||||
|
|
||||||
// Changing the source id by the new visual console id
|
// Changing the source id by the new visual console id
|
||||||
$data_layout_src[$a]['id_layout'] = $idNewVisualConsole;
|
$data_layout_src[$a]['id_layout'] = $idNewVisualConsole;
|
||||||
|
|
||||||
|
$old_id = $data_layout_src[$a]['id'];
|
||||||
|
|
||||||
// Unsetting the source's id
|
// Unsetting the source's id
|
||||||
unset($data_layout_src[$a]['id']);
|
unset($data_layout_src[$a]['id']);
|
||||||
|
|
||||||
// Configure the cloned Console
|
// Configure the cloned Console
|
||||||
$result = db_process_sql_insert('tlayout_data', $data_layout_src[$a]);
|
$result = db_process_sql_insert('tlayout_data', $data_layout_src[$a]);
|
||||||
|
|
||||||
|
$id_relations[$old_id] = 0;
|
||||||
|
|
||||||
|
if ($result !== false) {
|
||||||
|
$id_relations[$old_id] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
if($result)
|
if($result)
|
||||||
$ninsert++;
|
$ninsert++;
|
||||||
}// for each item of console
|
}// for each item of console
|
||||||
@ -83,9 +95,22 @@ if ($copy_layout) {
|
|||||||
|
|
||||||
// If the number of inserts is correct, the copy is completed
|
// If the number of inserts is correct, the copy is completed
|
||||||
if ($ninsert == $inserts) {
|
if ($ninsert == $inserts) {
|
||||||
|
|
||||||
|
//Update the ids of parents
|
||||||
|
$items = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $idNewVisualConsole);
|
||||||
|
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$new_parent = $id_relations[$item['parent_item']];
|
||||||
|
|
||||||
|
db_process_sql_update('tlayout_data',
|
||||||
|
array('parent_item' => $new_parent), array('id' => $item['id']));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
|
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
|
||||||
db_clean_cache();
|
db_clean_cache();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
echo '<h3 class="error">'.__('Not copied. Error copying data').'</h3>';
|
echo '<h3 class="error">'.__('Not copied. Error copying data').'</h3>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user