From 0c7072ea5a69e61f2837c0717724b30cbd08eef9 Mon Sep 17 00:00:00 2001 From: Laurent Giovannoni <laurent.giovannoni@maarch.org> Date: Wed, 5 Sep 2012 16:22:29 +0000 Subject: [PATCH] evo: action process rm --- core/trunk/core/manage_action.php | 49 ++++++++++++++++----------- core/trunk/core/xml/actions_pages.xml | 8 +++++ 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/core/trunk/core/manage_action.php b/core/trunk/core/manage_action.php index ce1da803a8c..cdce605b1c1 100644 --- a/core/trunk/core/manage_action.php +++ b/core/trunk/core/manage_action.php @@ -136,18 +136,23 @@ elseif(trim($_POST['req']) == 'change_status' && !empty($_POST['values']) && !em $arr_id = explode(',', $_POST['values']); $result = ''; $db->connect(); - for($i=0; $i<count($arr_id );$i++) - { + for ($i=0; $i<count($arr_id );$i++) { $arr_id[$i] = str_replace('#', '', $arr_id[$i]); $result .= $arr_id[$i].'#'; - $query_str = "update ".$_POST['table']. " set status = '".$_POST['new_status']."' where res_id = ".$arr_id[$i]; - // echo $query_str; - $req = $db->query($query_str, true); - if(!$req) - { - $_SESSION['action_error'] = _SQL_ERROR.' : '.$query_str; - echo "{status : 1, error_txt : '".addslashes(_ERROR_WITH_STATUS)." ".$query_str."'}"; - exit(); + if (trim($_POST['new_status']) <> '') { + if ($_POST['table'] == 'rm_ios') { + $query_str = "update " . $_POST['table'] . " set status = '" + . $_POST['new_status'] . "' where io_id = " . $arr_id[$i]; + } else { + $query_str = "update " . $_POST['table'] . " set status = '" + . $_POST['new_status'] . "' where res_id = " . $arr_id[$i]; + } + $req = $db->query($query_str, true); + if (!$req) { + $_SESSION['action_error'] = _SQL_ERROR.' : '.$query_str; + echo "{status : 1, error_txt : '".addslashes(_ERROR_WITH_STATUS)." ".$query_str."'}"; + exit(); + } } } echo "{status : 0, error_txt : '".addslashes(_STATUS_UPDATED.' : '.$_POST['new_status'])."'}"; @@ -207,17 +212,23 @@ else // Update the status $result = ''; - for($i=0; $i<count($arr_id );$i++) - { + for ($i=0;$i<count($arr_id );$i++) { $arr_id[$i] = str_replace('#', '', $arr_id[$i]); $result .= $arr_id[$i].'#'; - $query_str = "update ".$_POST['table']. " set status = '".$status."' where res_id = ".$arr_id[$i]; - $req = $db->query($query_str, true); - if(!$req) - { - $_SESSION['action_error'] = _SQL_ERROR.' : '.$query_str; - echo "{status : 7, error_txt : '".addslashes($label_action.' : '.$_SESSION['action_error'])."'}"; - exit(); + if (trim($status) <> '') { + if ($_POST['table'] == 'rm_ios') { + $query_str = "update " . $_POST['table'] . " set status = '" + . $status . "' where io_id = " . $arr_id[$i]; + } else { + $query_str = "update " . $_POST['table'] . " set status = '" + . $status . "' where res_id = " . $arr_id[$i]; + } + $req = $db->query($query_str, true); + if (!$req) { + $_SESSION['action_error'] = _SQL_ERROR . ' : ' . $query_str; + echo "{status : 7, error_txt : '" . addslashes($label_action . ' : ' . $_SESSION['action_error']) . "'}"; + exit(); + } } } $res_action = array('result' => $result, 'history_msg' => ''); diff --git a/core/trunk/core/xml/actions_pages.xml b/core/trunk/core/xml/actions_pages.xml index 0508b768a9d..02b6dac0ad5 100644 --- a/core/trunk/core/xml/actions_pages.xml +++ b/core/trunk/core/xml/actions_pages.xml @@ -135,4 +135,12 @@ An action page is described in a ACTIONPAGE tag : <KEYWORD>indexing</KEYWORD> <FLAG_CREATE>true</FLAG_CREATE> </ACTIONPAGE> + <ACTIONPAGE> + <ID>process_rm</ID> + <LABEL>_PROCESS_ARCHIVE</LABEL> + <NAME>process_rm</NAME> + <ORIGIN>module</ORIGIN> + <MODULE>records_management</MODULE> + <FLAG_CREATE>false</FLAG_CREATE> + </ACTIONPAGE> </ROOT> -- GitLab