Loading install/privileges.json +16 −0 Original line number Diff line number Diff line Loading @@ -624,6 +624,22 @@ "fullcode": "DEPENSE-DOWNLOAD" }, "DEPENSE-RECETTES": { "category_id": 9, "spot": 7, "code": "RECETTES", "libelle": "Peut voir les recettes", "fullcode": "DEPENSE-RECETTES" }, "DEPENSE-IGNORED": { "category_id": 9, "spot": 7, "code": "IGNORED", "libelle": "Peut voir les données ignorées", "fullcode": "DEPENSE-IGNORED" }, "MAINTENANCE-SPENDTYPEGROUP_MANAGE": { "category_id": 6, "spot": 7, Loading module/Oscar/src/Oscar/Formatter/Spent/SpentActivityDetailsExcelFormater.php +27 −25 Original line number Diff line number Diff line Loading @@ -38,39 +38,41 @@ class SpentActivityDetailsExcelFormater implements IFormatter $activityNumOscar = $this->activity->getOscarNum(); $project = $this->activity->getAcronym(); // Génération des clefs $headers = ['PFI', 'PROJECT', 'ACTIVITY', 'ACTIVITYNUM','MONTANT','TEXTE','TYPE','COMPTE', 'DATE COMPTABLE', 'DATE PAIEMENT', 'ANNEE', 'NUM PIECE', 'OSCARID', 'SYNCID']; $headers = ['id', 'syncid', 'pfi', 'numSifac', 'numPiece', 'montant', 'compteBudgetaire', 'centreProfit', 'compteGeneral', 'centreFinancier', 'texteFacture', 'designation', 'dateAnneeExercice', 'datePaiement', 'datePiece', 'dateComptable', 'masse', 'compte', 'type']; $filename = sprintf('/tmp/spent-%s.csv', uniqid()); $writer = fopen($filename, 'w'); fputcsv($writer, $headers); foreach ($this->datas as $stack) { foreach ($stack['details'] as $line) { $wroteLine = [ $pfi, $project, (string)$this->activity, $activityNumOscar, $line['montant'], $line['textFacture'] ? $line['textFacture'] : $line['designation'], $line['codeStr'], $line['compteBudgetaire'], $line['dateComptable'], $line['datePaiement'], $line['dateAnneeExercice'], $line['numPiece'], $this->activity->getId(), implode(',', $line['syncIds']), ]; fputcsv($writer, $wroteLine); } foreach ($this->datas['spents'] as $line) { $line['montant'] = number_format($line['montant'], 2, ',', ' '); fputcsv($writer, $line); } fclose($writer); // if( array_key_exists('download', $options) && $options['download'] === true ){ $downloader = new CSVDownloader(); $downloader->downloadCSVToExcel($filename); $downloader->downloadCSV($filename); } } Loading module/Oscar/src/Oscar/Formatter/Spent/SpentActivityExcelFormater.php +3 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class SpentActivityExcelFormater implements IFormatter $filename = sprintf('/tmp/spent-%s.csv', uniqid()); $writer = fopen($filename, 'w'); fputcsv($writer, $headers); foreach ($this->datas as $line) { foreach ($this->datas['spents'] as $line) { $wroteLine = [ $pfi, $project, Loading @@ -61,10 +61,11 @@ class SpentActivityExcelFormater implements IFormatter $this->activity->getId(), implode(',', $line['syncIds']), ]; var_dump($wroteLine); fputcsv($writer, $wroteLine); } fclose($writer); die(); // if( array_key_exists('download', $options) && $options['download'] === true ){ $downloader = new CSVDownloader(); Loading module/Oscar/src/Oscar/Provider/Privileges.php +2 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,8 @@ class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges const DEPENSE_SHOW = 'DEPENSE-SHOW'; const DEPENSE_SYNC = 'DEPENSE-SYNC'; const DEPENSE_DOWNLOAD = 'DEPENSE-DOWNLOAD'; const DEPENSE_RECETTES = 'DEPENSE-RECETTES'; const DEPENSE_IGNORED = 'DEPENSE-IGNORED'; public static function getResourceId($privilege) { Loading module/Oscar/view/oscar/project-grant/spent-list.phtml +4 −2 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ border-collapse: collapse; } tr.total { border-top: solid 2px #999; background: #0b97c4; border-top: solid 2px #a4bbbb; background: rgb(236, 243, 245); } </style> <section class="container-fluid"> Loading Loading @@ -55,6 +55,8 @@ return h(SpentLinePFI.default, { props: { informations: <?= json_encode($activity->toArray()) ?>, masses: <?= json_encode($masses) ?>, manageRecettes: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::DEPENSE_RECETTES, $activity) ? 'true' : 'false' ?>, manageIgnored: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::DEPENSE_IGNORED, $activity) ? 'true' : 'false' ?>, url: "<?= $this->url('spent/activity-api', ['id' => $activity->getId()]) ?>", urlActivity: "<?= $this->url('contract/show', ['id' => $activity->getId()]) ?>", urlSync: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::DEPENSE_SYNC) ? Loading Loading
install/privileges.json +16 −0 Original line number Diff line number Diff line Loading @@ -624,6 +624,22 @@ "fullcode": "DEPENSE-DOWNLOAD" }, "DEPENSE-RECETTES": { "category_id": 9, "spot": 7, "code": "RECETTES", "libelle": "Peut voir les recettes", "fullcode": "DEPENSE-RECETTES" }, "DEPENSE-IGNORED": { "category_id": 9, "spot": 7, "code": "IGNORED", "libelle": "Peut voir les données ignorées", "fullcode": "DEPENSE-IGNORED" }, "MAINTENANCE-SPENDTYPEGROUP_MANAGE": { "category_id": 6, "spot": 7, Loading
module/Oscar/src/Oscar/Formatter/Spent/SpentActivityDetailsExcelFormater.php +27 −25 Original line number Diff line number Diff line Loading @@ -38,39 +38,41 @@ class SpentActivityDetailsExcelFormater implements IFormatter $activityNumOscar = $this->activity->getOscarNum(); $project = $this->activity->getAcronym(); // Génération des clefs $headers = ['PFI', 'PROJECT', 'ACTIVITY', 'ACTIVITYNUM','MONTANT','TEXTE','TYPE','COMPTE', 'DATE COMPTABLE', 'DATE PAIEMENT', 'ANNEE', 'NUM PIECE', 'OSCARID', 'SYNCID']; $headers = ['id', 'syncid', 'pfi', 'numSifac', 'numPiece', 'montant', 'compteBudgetaire', 'centreProfit', 'compteGeneral', 'centreFinancier', 'texteFacture', 'designation', 'dateAnneeExercice', 'datePaiement', 'datePiece', 'dateComptable', 'masse', 'compte', 'type']; $filename = sprintf('/tmp/spent-%s.csv', uniqid()); $writer = fopen($filename, 'w'); fputcsv($writer, $headers); foreach ($this->datas as $stack) { foreach ($stack['details'] as $line) { $wroteLine = [ $pfi, $project, (string)$this->activity, $activityNumOscar, $line['montant'], $line['textFacture'] ? $line['textFacture'] : $line['designation'], $line['codeStr'], $line['compteBudgetaire'], $line['dateComptable'], $line['datePaiement'], $line['dateAnneeExercice'], $line['numPiece'], $this->activity->getId(), implode(',', $line['syncIds']), ]; fputcsv($writer, $wroteLine); } foreach ($this->datas['spents'] as $line) { $line['montant'] = number_format($line['montant'], 2, ',', ' '); fputcsv($writer, $line); } fclose($writer); // if( array_key_exists('download', $options) && $options['download'] === true ){ $downloader = new CSVDownloader(); $downloader->downloadCSVToExcel($filename); $downloader->downloadCSV($filename); } } Loading
module/Oscar/src/Oscar/Formatter/Spent/SpentActivityExcelFormater.php +3 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class SpentActivityExcelFormater implements IFormatter $filename = sprintf('/tmp/spent-%s.csv', uniqid()); $writer = fopen($filename, 'w'); fputcsv($writer, $headers); foreach ($this->datas as $line) { foreach ($this->datas['spents'] as $line) { $wroteLine = [ $pfi, $project, Loading @@ -61,10 +61,11 @@ class SpentActivityExcelFormater implements IFormatter $this->activity->getId(), implode(',', $line['syncIds']), ]; var_dump($wroteLine); fputcsv($writer, $wroteLine); } fclose($writer); die(); // if( array_key_exists('download', $options) && $options['download'] === true ){ $downloader = new CSVDownloader(); Loading
module/Oscar/src/Oscar/Provider/Privileges.php +2 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,8 @@ class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges const DEPENSE_SHOW = 'DEPENSE-SHOW'; const DEPENSE_SYNC = 'DEPENSE-SYNC'; const DEPENSE_DOWNLOAD = 'DEPENSE-DOWNLOAD'; const DEPENSE_RECETTES = 'DEPENSE-RECETTES'; const DEPENSE_IGNORED = 'DEPENSE-IGNORED'; public static function getResourceId($privilege) { Loading
module/Oscar/view/oscar/project-grant/spent-list.phtml +4 −2 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ border-collapse: collapse; } tr.total { border-top: solid 2px #999; background: #0b97c4; border-top: solid 2px #a4bbbb; background: rgb(236, 243, 245); } </style> <section class="container-fluid"> Loading Loading @@ -55,6 +55,8 @@ return h(SpentLinePFI.default, { props: { informations: <?= json_encode($activity->toArray()) ?>, masses: <?= json_encode($masses) ?>, manageRecettes: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::DEPENSE_RECETTES, $activity) ? 'true' : 'false' ?>, manageIgnored: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::DEPENSE_IGNORED, $activity) ? 'true' : 'false' ?>, url: "<?= $this->url('spent/activity-api', ['id' => $activity->getId()]) ?>", urlActivity: "<?= $this->url('contract/show', ['id' => $activity->getId()]) ?>", urlSync: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::DEPENSE_SYNC) ? Loading