Skip to content
Snippets Groups Projects
Commit 8586369d authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #13272 TIME 2:30 added visa + opinion workflow to export resource list

parent 949b073c
No related branches found
No related tags found
No related merge requests found
......@@ -273,6 +273,10 @@ class ExportController
$csvContent[] = empty($acknwoledgementSendDate[$resource['res_id']]) ? '' : $acknwoledgementSendDate[$resource['res_id']];
} elseif (strpos($value['value'], 'custom_', 0) !== false) {
$csvContent[] = ExportController::getCustomFieldValue(['custom' => $value['value'], 'resId' => $resource['res_id']]);
} elseif ($value['value'] == 'getVisaCircuit') {
$csvContent[] = ExportController::getCircuit(['listType' => 'VISA_CIRCUIT', 'resId' => $resource['res_id']]);
} elseif ($value['value'] == 'getOpinionCircuit') {
$csvContent[] = ExportController::getCircuit(['listType' => 'AVIS_CIRCUIT', 'resId' => $resource['res_id']]);
}
} else {
$allDates = ['doc_date', 'departure_date', 'admission_date', 'process_limit_date', 'opinion_limit_date', 'closing_date'];
......@@ -385,6 +389,10 @@ class ExportController
$content[] = empty($acknwoledgementSendDate[$resource['res_id']]) ? '' : $acknwoledgementSendDate[$resource['res_id']];
} elseif (strpos($value['value'], 'custom_', 0) !== false) {
$content[] = ExportController::getCustomFieldValue(['custom' => $value['value'], 'resId' => $resource['res_id']]);
} elseif ($value['value'] == 'getVisaCircuit') {
$content[] = ExportController::getCircuit(['listType' => 'VISA_CIRCUIT', 'resId' => $resource['res_id']]);
} elseif ($value['value'] == 'getOpinionCircuit') {
$content[] = ExportController::getCircuit(['listType' => 'AVIS_CIRCUIT', 'resId' => $resource['res_id']]);
}
} else {
$allDates = ['doc_date', 'departure_date', 'admission_date', 'process_limit_date', 'opinion_limit_date', 'closing_date'];
......@@ -763,4 +771,40 @@ class ExportController
return $customValues;
}
private static function getCircuit(array $args)
{
ValidatorModel::notEmpty($args, ['resId', 'listType']);
ValidatorModel::intVal($args, ['resId']);
ValidatorModel::stringType($args, ['listType']);
$list = [];
$roles = EntityModel::getRoles();
$roles = array_column($roles, 'label', 'id');
$listInstances = ListInstanceModel::get([
'select' => ['item_id', 'item_mode'],
'where' => ['res_id in (?)', 'item_type = ?', 'difflist_type = ?'],
'data' => [$args['resId'], 'user_id', $args['listType']],
'order_by' => ['sequence']
]);
foreach ($listInstances as $listInstance) {
$user = UserModel::getById(['id' => $listInstance['item_id'], 'select' => ['firstname', 'lastname']]);
if ($args['listType'] == 'VISA_CIRCUIT') {
if ($listInstance['item_mode'] == 'cc') {
$listInstance['item_mode'] = 'copy';
}
$roleLabel = $roles[$listInstance['item_mode']];
$list[] = "{$user['firstname']} {$user['lastname']} ({$roleLabel})";
} else {
$list[] = "{$user['firstname']} {$user['lastname']}";
}
}
return implode("\n", $list);
}
}
......@@ -17,7 +17,6 @@ declare var $: any;
})
export class ExportComponent implements OnInit {
loading: boolean = false;
loadingExport: boolean = false;
......@@ -204,6 +203,16 @@ export class ExportComponent implements OnInit {
label: this.translate.instant('lang.acknowledgementSendDate'),
isFunction: true
},
{
value: 'getVisaCircuit',
label: this.translate.instant('lang.getVisaWorkflow'),
isFunction: true
},
{
value: 'getOpinionCircuit',
label: this.translate.instant('lang.opinionCircuit'),
isFunction: true
},
{
value: '',
label: this.translate.instant('lang.comment'),
......
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