Merge branch 'ent-6587-bug-historico-comentarios-eventos' into 'develop'

Handled comments for validated comments

Closes pandora_enterprise#6587

See merge request artica/pandorafms!3564
This commit is contained in:
Daniel Rodriguez 2020-10-30 10:46:52 +01:00
commit fe90008d17
2 changed files with 27 additions and 13 deletions

View File

@ -114,7 +114,9 @@ if ($get_comments) {
sprintf( sprintf(
' HAVING max_id_evento = %d', ' HAVING max_id_evento = %d',
$event['id_evento'] $event['id_evento']
) ),
// True for show comments of validated events.
true
); );
if ($events !== false) { if ($events !== false) {
$event = $events[0]; $event = $events[0];

View File

@ -673,15 +673,16 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
/** /**
* Retrieve all events filtered. * Retrieve all events filtered.
* *
* @param array $fields Fields to retrieve. * @param array $fields Fields to retrieve.
* @param array $filter Filters to be applied. * @param array $filter Filters to be applied.
* @param integer $offset Offset (pagination). * @param integer $offset Offset (pagination).
* @param integer $limit Limit (pagination). * @param integer $limit Limit (pagination).
* @param string $order Sort order. * @param string $order Sort order.
* @param string $sort_field Sort field. * @param string $sort_field Sort field.
* @param boolean $history Apply on historical table. * @param boolean $history Apply on historical table.
* @param boolean $return_sql Return SQL (true) or execute it (false). * @param boolean $return_sql Return SQL (true) or execute it (false).
* @param string $having Having filter. * @param string $having Having filter.
* @param boolean $validatedEvents If true, evaluate validated events.
* *
* @return array Events. * @return array Events.
* @throws Exception On error. * @throws Exception On error.
@ -695,7 +696,8 @@ function events_get_all(
$sort_field=null, $sort_field=null,
$history=false, $history=false,
$return_sql=false, $return_sql=false,
$having='' $having='',
$validatedEvents=false
) { ) {
global $config; global $config;
@ -912,10 +914,20 @@ function events_get_all(
break; break;
case EVENT_NO_VALIDATED: case EVENT_NO_VALIDATED:
// Show comments in validated events.
$validatedState = '';
if ($validatedEvents === true) {
$validatedState = sprintf(
'OR estado = %d',
EVENT_VALIDATE
);
}
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND (estado = %d OR estado = %d)', ' AND (estado = %d OR estado = %d %s)',
EVENT_NEW, EVENT_NEW,
EVENT_PROCESS EVENT_PROCESS,
$validatedState
); );
break; break;
} }