Skip to content
Snippets Groups Projects
Commit 08e5bb96 authored by VESSILLER's avatar VESSILLER
Browse files

NEW amelioration tache planifiee archivage avec export CSV le la liste des archives

parent 048622d5
No related branches found
No related tags found
No related merge requests found
......@@ -188,9 +188,10 @@ class DematpayslipArchive extends Entity implements JsonSerializable {
/**
* Show status label
*
* @param bool $withHtml [=false] With HTML tags
* @return string Status label
*/
public function showStatusLabel() {
public function showStatusLabel($withHtml = false) {
$pastellLastAction = $this->getPastellLastAction();
$statusLabelList = array(
......@@ -208,17 +209,21 @@ class DematpayslipArchive extends Entity implements JsonSerializable {
$statusLabel = $statusLabelList[$this->getStatus()];
if (!empty($pastellLastAction)) {
$statusLabel .= ' ';
if ($pastellLastAction == 'ar-recu-sae') {
$statusLabel .= '<span style="color: #777000;">';
} else if ($pastellLastAction == 'accepter-sae') {
$statusLabel .= '<span style="color: #007700;">';
} else if ($pastellLastAction == 'rejet-sae') {
$statusLabel .= '<span style="color: #770000;">';
} else {
$statusLabel .= '<span>';
if ($withHtml) {
if ($pastellLastAction == 'ar-recu-sae') {
$statusLabel .= '<span style="color: #777000;">';
} else if ($pastellLastAction == 'accepter-sae') {
$statusLabel .= '<span style="color: #007700;">';
} else if ($pastellLastAction == 'rejet-sae') {
$statusLabel .= '<span style="color: #770000;">';
} else {
$statusLabel .= '<span>';
}
}
$statusLabel .= '[' . $pastellLastAction . ']';
$statusLabel .= '</span>';
if ($withHtml) {
$statusLabel .= '</span>';
}
}
return $statusLabel;
......@@ -363,6 +368,8 @@ class DematpayslipArchive extends Entity implements JsonSerializable {
if ($canModifyArchive === false) {
$this->_msgList['warning'][] = $l10n->t('L\'archive "' . $this->getFilePath() . '" a déjà été créée.');
} else {
$userFolder = $rootFolder->getUserFolder($userId);
// 1. create document
if (empty($this->getPastellIdDocument())) {
$nowDateTime = new DateTime('now', $dateTimeZone);
......@@ -393,13 +400,7 @@ class DematpayslipArchive extends Entity implements JsonSerializable {
$filePath = $this->getFilePath();
$fileNode = null;
try {
$fileNodeExists = $rootFolder->nodeExists($filePath);
if ($fileNodeExists) {
//$fileNode = $rootFolder->getById($fileId)[0];
$fileNode = $rootFolder->get($filePath);
} else {
$this->_msgList['error'][] = $l10n->t('Le fichier a envoyer en archive "' . $filePath . '" [id = ' . $fileId . '] n\'a pas été trouvé [status=' . $this->getStatus() .'].');
}
$fileNode = $userFolder->getById($fileId)[0];
} catch (Exception $e) {
$this->_msgList['error'][] = $l10n->t('Impossible de récupérer le fichier a envoyer en archive "' . $filePath . '" [status=' . $this->getStatus() .'].');
}
......@@ -440,14 +441,15 @@ class DematpayslipArchive extends Entity implements JsonSerializable {
);
$jsonFileName = 'sae_config.json';
$userFolder = $rootFolder->getUserFolder($userId);
$appDataTmpPath = $userFolder->getPath() . DIRECTORY_SEPARATOR . $appDataDir . DIRECTORY_SEPARATOR . DematpayslipProcess::$appTmpDirName;
//$appDataTmpPath = $userFolder->getPath() . DIRECTORY_SEPARATOR . $appDataDir . DIRECTORY_SEPARATOR . DematpayslipProcess::$appTmpDirName;
$appDataTmpPath = $appDataDir . DIRECTORY_SEPARATOR . DematpayslipProcess::$appTmpDirName;
$saeConfigFilePath = $appDataTmpPath . DIRECTORY_SEPARATOR . uniqid('sae');
if (!$saeConfigFilePath) {
$this->_msgList['error'][] = $l10n->t('Impossible de créer le nom du fichier temporaire "' . $appDataTmpPath . '" [status=' . $this->getStatus() .'].');
} else {
try {
$tmpJsonFile = $rootFolder->newFile($saeConfigFilePath, json_encode($saeConfigArr));
//$tmpJsonFile = $rootFolder->newFile($saeConfigFilePath, json_encode($saeConfigArr));
$tmpJsonFile = $userFolder->newFile($saeConfigFilePath, json_encode($saeConfigArr));
$nowDateTime = new DateTime('now', $dateTimeZone);
$responseData = $pastellAPI->postEntityDocumentExternalData($pastellConfigFlow->getIdE(), $this->getPastellIdDocument(), 'sae_config', array(
'file_name' => $jsonFileName,
......
......@@ -2839,6 +2839,10 @@ class DematpayslipProcess extends Entity implements JsonSerializable {
$csvFields[] = $this->_l10n->t('Edition');
$csvFields[] = $this->_l10n->t('Archive');
$csvFields[] = $this->_l10n->t('Dernière action');
$csvFields[] = $this->_l10n->t('Opérations demandées');
$csvFields[] = $this->_l10n->t('Opération en cours');
$csvFields[] = $this->_l10n->t('Etat');
$csvFields[] = $this->_l10n->t('Erreur');
$res = fputcsv($csvFile, $csvFields, $csvDelimiter, $csvEnclosure);
if (!$res) {
......@@ -2859,6 +2863,10 @@ class DematpayslipProcess extends Entity implements JsonSerializable {
$csvFields[] = $dematpayslipArchive->getEditionDate();
$csvFields[] = $dematpayslipArchive->getPastellIdDocument();
$csvFields[] = $dematpayslipArchive->getPastellLastAction();
$csvFields[] = $dematpayslipArchive->showOperationAskLabel();
$csvFields[] = $dematpayslipArchive->showOperationProgressLabel();
$csvFields[] = $dematpayslipArchive->showStatusLabel();
$csvFields[] = $dematpayslipArchive->getError();
$res = fputcsv($csvFile, $csvFields, $csvDelimiter, $csvEnclosure);
if (!$res) {
......
......@@ -102,7 +102,7 @@
<td><?php if (!empty($dematpayslipArchive->getPastellUrl())) { print $dematpayslipArchive->getPastellUrl(); } else { print $dematpayslipArchive->getPastellIdDocument(); } ?></td>
<td><?php print $dematpayslipArchive->showOperationAskLabel(); ?></td>
<td><?php print $dematpayslipArchive->showOperationProgressLabel(); ?></td>
<td><?php print $dematpayslipArchive->showStatusLabel(); ?></td>
<td><?php print $dematpayslipArchive->showStatusLabel(true); ?></td>
<td><?php print $dematpayslipArchive->getError(); ?></td>
</tr>
<?php } ?>
......
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