Merge branch 'ent-6586-Al-realizar-una-accion-en-evento-no-cambia-el-owner-acknowledge-by-en-la-pestaña-general' into 'develop'

fix events acknowledge-by

See merge request artica/pandorafms!3565
This commit is contained in:
Daniel Rodriguez 2020-10-30 14:42:10 +01:00
commit 4eb5a11877
3 changed files with 51 additions and 11 deletions

View File

@ -1147,12 +1147,37 @@ if ($change_status) {
$event_ids = get_parameter('event_ids');
$new_status = get_parameter('new_status');
$return = events_change_status(explode(',', $event_ids), $new_status, $meta, $history);
$return = events_change_status(
explode(',', $event_ids),
$new_status,
$meta,
$history
);
if ($return) {
echo 'status_ok';
if ($return !== false) {
echo json_encode(
[
'status' => 'status_ok',
'user' => db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
),
]
);
} else {
echo 'status_error';
echo json_encode(
[
'status' => 'status_error',
'user' => db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
),
]
);
}
return;

View File

@ -4701,16 +4701,24 @@ function events_page_general($event)
$table_general->data[] = $data;
// If event is validated, show who and when acknowleded it.
$table_general->cellclass[8][1] = 'general_acknowleded';
$data = [];
$data[0] = __('Acknowledged by');
if ($event['estado'] == 1) {
$user_ack = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']);
if (empty($user_ack)) {
$user_ack = db_get_value(
'fullname',
'tusuario',
'id_user',
$event['id_usuario']
);
if (empty($user_ack) === true) {
$user_ack = $event['id_usuario'];
}
$date_ack = date($config['date_format'], $event['ack_utimestamp']);
$date_ack = io_safe_output($event['ack_utimestamp']);
$data[1] = $user_ack.' ('.$date_ack.')';
} else {
$data[1] = '<i>'.__('N/A').'</i>';

View File

@ -453,7 +453,6 @@ function perform_response_massive(response, response_id, out_iterator) {
// Change the status of an event to new, in process or validated.
function event_change_status(event_ids) {
var new_status = $("#estado").val();
var event_id = $("#hidden-id_event").val();
var meta = $("#hidden-meta").val();
var history = $("#hidden-history").val();
@ -472,7 +471,7 @@ function event_change_status(event_ids) {
type: "POST",
url: $("#hidden-ajax_file").val(),
async: true,
dataType: "html",
dataType: "json",
success: function(data) {
$("#button-status_button").removeAttr("disabled");
$("#response_loading").hide();
@ -485,11 +484,20 @@ function event_change_status(event_ids) {
$("#notification_status_error").hide();
}
if (data == "status_ok") {
if (data.status == "status_ok") {
if (typeof dt_events !== "undefined") {
dt_events.draw(false);
}
$("#notification_status_success").show();
if (new_status == 1) {
$("#extended_event_general_page table td.general_acknowleded").text(
data.user
);
} else {
$("#extended_event_general_page table td.general_acknowleded").text(
"N/A"
);
}
} else {
$("#notification_status_error").show();
}
@ -942,7 +950,6 @@ function execute_event_response(event_list_btn) {
});
break;
case "delete_selected":
console.log($(this));
$(".chk_val:checked").each(function() {
execute_delete_event_reponse(
dt_events,