Now messages deleted is not deleted, only mark as deleted to that user
This commit is contained in:
parent
aafb00c640
commit
50cb7eb5bd
|
@ -61,18 +61,20 @@ if ($delete_action !== false) {
|
|||
$selected = get_parameter ('select_multiple', false);
|
||||
foreach ($selected as $k => $message_id) {
|
||||
|
||||
db_process_sql_delete ('tupdate', array('svn_version' => $message_id));
|
||||
update_manger_set_deleted_message ($message_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$offset = (int) get_parameter ('offset', 0);
|
||||
|
||||
$total_messages = update_manager_get_total_messages ();
|
||||
$total_messages = update_manager_get_not_deleted_messages ();
|
||||
if ($total_messages){
|
||||
|
||||
// Get all messages
|
||||
$sql = 'SELECT data, svn_version, filename, data_rollback, description FROM tupdate LIMIT ' . $offset . ',' . $config['block_size'];
|
||||
$sql = 'SELECT data, svn_version, filename, data_rollback, db_field_value FROM tupdate ';
|
||||
$sql .= 'WHERE description NOT LIKE \'%"' . $config['id_user'] . '":1%\' ';
|
||||
$sql .= 'LIMIT ' . $offset . ',' . $config['block_size'];
|
||||
$um_messages = array ();
|
||||
$um_messages = db_get_all_rows_sql ($sql);
|
||||
|
||||
|
@ -127,7 +129,7 @@ if ($total_messages){
|
|||
|
||||
$data[1] = $message['filename'];
|
||||
|
||||
$data[2] = $message['description'];
|
||||
$data[2] = $message['db_field_value'];
|
||||
|
||||
//~ $delete_link = 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=messages&delete_single=1&message_id=' . $message['svn_version'];
|
||||
$data[3] = html_print_checkbox_extended('select_multiple[]', $message['svn_version'], false, false, '', 'class="check_selection"', true);
|
||||
|
|
|
@ -567,4 +567,28 @@ function update_manager_get_unread_messages () {
|
|||
|
||||
return $total - $read;
|
||||
}
|
||||
|
||||
function update_manager_get_not_deleted_messages () {
|
||||
global $config;
|
||||
|
||||
$total = update_manager_get_total_messages ();
|
||||
$sql = 'SELECT COUNT(*) FROM tupdate WHERE description LIKE \'%"' . $config['id_user'] . '":1%\'';
|
||||
$read = (int) db_get_sql ($sql);
|
||||
|
||||
return $total - $read;
|
||||
}
|
||||
|
||||
function update_manger_set_deleted_message ($message_id) {
|
||||
global $config;
|
||||
|
||||
$rollback = db_get_value('description', 'tupdate', 'svn_version', $message_id);
|
||||
$users_read = json_decode ($rollback, true);
|
||||
$users_read[$config['id_user']] = 1;
|
||||
|
||||
$rollback = json_encode ($users_read);
|
||||
db_process_sql_update('tupdate', array('description' => $rollback, ), array('svn_version' => $message_id));
|
||||
|
||||
//Mark as read too
|
||||
update_manger_set_read_message ($message_id, 1);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue