diff --git a/lib/Db/DematpayslipArchive.php b/lib/Db/DematpayslipArchive.php index 998f7aaf820107cc4ab430097ef64ae0e3b9f4e0..3f2dfdbc31a1cafafa181ae4e6dcda2139e636f9 100644 --- a/lib/Db/DematpayslipArchive.php +++ b/lib/Db/DematpayslipArchive.php @@ -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, diff --git a/lib/Db/DematpayslipProcess.php b/lib/Db/DematpayslipProcess.php index d340469767cdb304258b9824bd10e1e1e0da5be8..61c72bab77511e08df8f1ac66307a25912ec355e 100644 --- a/lib/Db/DematpayslipProcess.php +++ b/lib/Db/DematpayslipProcess.php @@ -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) { diff --git a/templates/content/archive_list.php b/templates/content/archive_list.php index a2790210c3273563f46afa7538b570c2887c442c..b1ed0afa9a64b39f2a290108a7603e6659f7fdf5 100644 --- a/templates/content/archive_list.php +++ b/templates/content/archive_list.php @@ -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 } ?>