Skip to content
Snippets Groups Projects
Commit abc1aa7d authored by Florian Azizian's avatar Florian Azizian
Browse files

Refactoring

parent ae586e62
No related branches found
No related tags found
No related merge requests found
...@@ -30,11 +30,11 @@ class ReconciliationController ...@@ -30,11 +30,11 @@ class ReconciliationController
HistoryController::add([ HistoryController::add([
'tableName' => 'res_attachments', 'tableName' => 'res_attachments',
'recordId' => $resId, 'recordId' => $resId,
'eventType' => 'ADD', 'eventType' => 'ADD',
'info' => _DOC_ADDED, 'info' => _DOC_ADDED,
'moduleId' => 'reconciliation', 'moduleId' => 'reconciliation',
'eventId' => 'attachmentadd', 'eventId' => 'attachmentadd',
]); ]);
return $response->withJson(['resId' => $resId]); return $response->withJson(['resId' => $resId]);
...@@ -42,15 +42,15 @@ class ReconciliationController ...@@ -42,15 +42,15 @@ class ReconciliationController
public function getWs($aArgs) public function getWs($aArgs)
{ {
$identifier = $aArgs['chrono']; $identifier = $aArgs['chrono'];
$res_id = (int)$aArgs['resId']; $res_id = (int)$aArgs['resId'];
$encodedContent = $aArgs['encodedFile']; $encodedContent = $aArgs['encodedFile'];
$info = ReconciliationModel::getReconciliation([ $info = ReconciliationModel::getReconciliation([
'select' => ['*'], 'select' => ['*'],
'table' => ['res_attachments'], 'table' => ['res_attachments'],
'where' => ['identifier = (?)', "status IN ('A_TRA', 'NEW','TMP')"], 'where' => ['identifier = (?)', "status IN ('A_TRA', 'NEW','TMP')"],
'data' => [$identifier], 'data' => [$identifier],
'orderBy' => ['res_id DESC'] 'orderBy' => ['res_id DESC']
])[0]; ])[0];
...@@ -58,10 +58,10 @@ class ReconciliationController ...@@ -58,10 +58,10 @@ class ReconciliationController
return false; return false;
} }
$title = $info['title']; $title = $info['title'];
$fileFormat = 'pdf'; $fileFormat = 'pdf';
$attachment_type = 'outgoing_mail_signed'; $attachment_type = 'outgoing_mail_signed';
$collId = 'letterbox_coll'; $collId = 'letterbox_coll';
$data = []; $data = [];
...@@ -124,12 +124,12 @@ class ReconciliationController ...@@ -124,12 +124,12 @@ class ReconciliationController
); );
$aArgs = [ $aArgs = [
'collId' => $collId, 'collId' => $collId,
'table' => 'res_attachments', 'table' => 'res_attachments',
'encodedFile' => $encodedContent, 'encodedFile' => $encodedContent,
'fileFormat' => $fileFormat, 'fileFormat' => $fileFormat,
'data' => $data, 'data' => $data,
'status' => 'TRA' 'status' => 'TRA'
]; ];
$resId = StoreController::storeResourceRes($aArgs); $resId = StoreController::storeResourceRes($aArgs);
...@@ -137,15 +137,15 @@ class ReconciliationController ...@@ -137,15 +137,15 @@ class ReconciliationController
// Suppression du projet de reponse // Suppression du projet de reponse
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/attachments/xml/config.xml']); $loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/attachments/xml/config.xml']);
if ($loadedXml) { if ($loadedXml) {
$reconciliationConfig = $loadedXml->RECONCILIATION->CONFIG; $reconciliationConfig = $loadedXml->RECONCILIATION->CONFIG;
$delete_response_project = $reconciliationConfig->delete_response_project; $delete_response_project = $reconciliationConfig->delete_response_project;
$close_incoming = $reconciliationConfig->close_incoming; $close_incoming = $reconciliationConfig->close_incoming;
if ($delete_response_project == 'true') { if ($delete_response_project == 'true') {
ReconciliationModel::updateReconciliation([ ReconciliationModel::updateReconciliation([
'set' => ['status' => 'DEL'], 'set' => ['status' => 'DEL'],
'where' => ['res_id = (?)'], 'where' => ['res_id = (?)'],
'data' => [$info['res_id']], 'data' => [$info['res_id']],
'table' => 'res_attachments' 'table' => 'res_attachments'
]); ]);
} }
...@@ -153,9 +153,9 @@ class ReconciliationController ...@@ -153,9 +153,9 @@ class ReconciliationController
// Cloture du courrier entrant // Cloture du courrier entrant
if ($close_incoming == 'true') { if ($close_incoming == 'true') {
ReconciliationModel::updateReconciliation([ ReconciliationModel::updateReconciliation([
'set' => ['status' => 'END'], 'set' => ['status' => 'END'],
'where' => ['res_id = (?)'], 'where' => ['res_id = (?)'],
'data' => [$res_id], 'data' => [$res_id],
'table' => 'res_letterbox' 'table' => 'res_letterbox'
]); ]);
} }
...@@ -171,10 +171,10 @@ class ReconciliationController ...@@ -171,10 +171,10 @@ class ReconciliationController
} }
$attachment = ReconciliationModel::getReconciliation([ $attachment = ReconciliationModel::getReconciliation([
'select' => ['*'], 'select' => ['*'],
'table' => ['res_attachments'], 'table' => ['res_attachments'],
'where' => ['identifier = (?)', "status IN ('A_TRA', 'NEW','TMP')"], 'where' => ['identifier = (?)', "status IN ('A_TRA', 'NEW','TMP')"],
'data' => [$aArgs['chrono']], 'data' => [$aArgs['chrono']],
'orderBy' => ['res_id DESC'] 'orderBy' => ['res_id DESC']
])[0]; ])[0];
......
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