diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7f068038b1..110610295f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2010-12-20 Miguel de Dios + + * godmode/reporting/reporting_builder.php: fixed the action to sort up or + down the items in the report, and improvement the order number and now + start to each new report. + + Fixes: #3140930 + 2010-12-20 Miguel de Dios * godmode/reporting/reporting_builder.item_editor.php: fixed the copy & diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 5deb4deb08..716b86c9e0 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -246,7 +246,14 @@ switch ($action) { else { $idItem = $result; - $max = get_db_all_rows_sql('select max(`order`) as max from treport_content;'); $max = $max[0]['max']; + $max = get_db_all_rows_sql('SELECT max(`order`) AS max + FROM treport_content WHERE id_report = ' . $idReport . ';'); + if ($max === false) { + $max = 0; + } + else { + $max = $max[0]['max']; + } process_sql_update('treport_content', array('`order`' => $max + 1), array('id_rc' => $idItem)); $resultOperationDB = true; @@ -368,7 +375,8 @@ switch ($action) { } process_sql_begin(); - $resultOperationDB = process_sql_update('treport_content', array('`order`' => $oldOrder), array('`order`' => $newOrder, 'id_rc' => $idReport)); + $resultOperationDB = process_sql_update('treport_content', + array('`order`' => $oldOrder), array('`order`' => $newOrder, 'id_report' => $idReport)); if ($resultOperationDB !== false) { $resultOperationDB = process_sql_update('treport_content', array('`order`' => $newOrder), array('id_rc' => $idItem)); if ($resultOperationDB !== false) {