From de0eb7b681f189e256438a98a4357cb3ee404aad Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 20 Dec 2010 20:45:58 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3672 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++++ .../godmode/reporting/reporting_builder.php | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) 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) {