Skip to content
Snippets Groups Projects
Commit e493aa6b authored by Quentin Ribac's avatar Quentin Ribac
Browse files

FIX #20786 TIME 0:05 fix attachment status check

parent 06c160cc
No related branches found
No related tags found
No related merge requests found
......@@ -853,8 +853,8 @@ class ResController extends ResourceControlController
$attachments = AttachmentModel::get([
'select' => ['count(1)'],
'where' => ['res_id_master = ?', 'status in (?)', 'attachment_type not in (?)'],
'data' => [$args['resId'], ['TRA', 'A_TRA', 'FRZ'], AttachmentTypeController::HIDDEN_ATTACHMENT_TYPES]
'where' => ['res_id_master = ?', 'status not in (?)', 'attachment_type not in (?)'],
'data' => [$args['resId'], ['DEL', 'OBS'], AttachmentTypeController::HIDDEN_ATTACHMENT_TYPES]
]);
$formattedData['attachments'] = $attachments[0]['count'];
......
......@@ -837,17 +837,17 @@ class SearchController
}
if (!empty($body['attachment_type']) && !empty($body['attachment_type']['values']) && is_array($body['attachment_type']['values'])) {
$args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where attachment_type in (?) and status in (\'TRA\', \'A_TRA\', \'FRZ\'))';
$args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where attachment_type in (?) and status not in (\'DEL\', \'OBS\'))';
$args['searchData'][] = $body['attachment_type']['values'];
}
if (!empty($body['attachment_creationDate']) && !empty($body['attachment_creationDate']['values']) && is_array($body['attachment_creationDate']['values'])) {
if (Validator::date()->notEmpty()->validate($body['attachment_creationDate']['values']['start'])) {
$args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where creation_date >= ? and attachment_type not in (?) and status in (\'TRA\', \'A_TRA\', \'FRZ\'))';
$args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where creation_date >= ? and attachment_type not in (?) and status not in (\'DEL\', \'OBS\'))';
$args['searchData'][] = $body['attachment_creationDate']['values']['start'];
$args['searchData'][] = AttachmentTypeController::HIDDEN_ATTACHMENT_TYPES;
}
if (Validator::date()->notEmpty()->validate($body['attachment_creationDate']['values']['end'])) {
$args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where creation_date <= ? and attachment_type not in (?) and status in (\'TRA\', \'A_TRA\', \'FRZ\'))';
$args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where creation_date <= ? and attachment_type not in (?) and status not in (\'DEL\', \'OBS\'))';
$args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['attachment_creationDate']['values']['end']]);
$args['searchData'][] = AttachmentTypeController::HIDDEN_ATTACHMENT_TYPES;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment