Skip to content
Snippets Groups Projects
Commit 6e94f060 authored by Damien's avatar Damien
Browse files

[FEAT] [PARA V2] Refactoring

parent 9ce9d613
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
namespace Visa\Controllers; namespace Visa\Controllers;
use Core\Models\AttachmentModel;
use Core\Models\UserModel; use Core\Models\UserModel;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
...@@ -73,7 +74,7 @@ class VisaController ...@@ -73,7 +74,7 @@ class VisaController
] ]
); );
$attachmentTypes = $this->getAttachmentsTypesByXML(); $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
$resListIndex = 0; $resListIndex = 0;
foreach ($resList as $key => $value) { foreach ($resList as $key => $value) {
...@@ -165,31 +166,6 @@ class VisaController ...@@ -165,31 +166,6 @@ class VisaController
return $response->withJson($this->getAttachmentsForSignatureBook(['resId' => $resId])); return $response->withJson($this->getAttachmentsForSignatureBook(['resId' => $resId]));
} }
private function getAttachmentsTypesByXML()
{
if (file_exists('custom/' .$_SESSION['custom_override_id']. '/apps/maarch_entreprise/xml/entreprise.xml')) {
$path = 'custom/' .$_SESSION['custom_override_id']. '/apps/maarch_entreprise/xml/entreprise.xml';
} else {
$path = 'apps/maarch_entreprise/xml/entreprise.xml';
}
$xmlfile = simplexml_load_file($path);
$attachmentTypes = [];
$attachmentTypesXML = $xmlfile->attachment_types;
if (count($attachmentTypesXML) > 0) {
foreach ($attachmentTypesXML->type as $value) {
$label = defined((string) $value->label) ? constant((string) $value->label) : (string) $value->label;
$attachmentTypes[(string) $value->id] = [
'label' => $label,
'icon' => (string)$value['icon'],
'sign' => (empty($value['sign']) || (string)$value['sign'] == 'true') ? true : false
];
}
}
return $attachmentTypes;
}
private function getIncomingMailAndAttachmentsForSignatureBook(array $aArgs = []) private function getIncomingMailAndAttachmentsForSignatureBook(array $aArgs = [])
{ {
$resId = $aArgs['resId']; $resId = $aArgs['resId'];
...@@ -257,7 +233,7 @@ class VisaController ...@@ -257,7 +233,7 @@ class VisaController
private function getAttachmentsForSignatureBook(array $aArgs = []) private function getAttachmentsForSignatureBook(array $aArgs = [])
{ {
$attachmentTypes = $this->getAttachmentsTypesByXML(); $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
$orderBy = "CASE attachment_type WHEN 'response_project' THEN 1"; $orderBy = "CASE attachment_type WHEN 'response_project' THEN 1";
$c = 2; $c = 2;
......
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