Loading module/Oscar/src/Oscar/Controller/ProjectController.php +15 −0 Original line number Diff line number Diff line Loading @@ -241,9 +241,24 @@ class ProjectController extends AbstractOscarController $rolesOrganizations = $this->getOscarUserContextService()->getRolesOrganizationInActivity(); $rolesPersons = $this->getOscarUserContextService()->getAllRoleIdPersonInActivity(); // Calcule de l'accès aux dépense $nbrSpent = 0; $nbrSpentAllow = 0; $spentActivitiesIds = []; foreach ($entity->getActivities() as $activity) { if( $activity->getCodeEOTP() ){ $nbrSpent++; if( $this->getOscarUserContextService()->hasPrivileges(Privileges::DEPENSE_SHOW, $activity) ){ $nbrSpentAllow++; $spentActivitiesIds[] = $activity->getId(); } } } return array( // 'access' => $this->getAccessResolverService()->getProjectAccess($entity), 'spentActivitiesIds' => $spentActivitiesIds, 'spentMissingAcces' => $nbrSpentAllow < $nbrSpent, 'project' => $entity, 'documents' => $documents, 'rolesOrganizations' => $rolesOrganizations, Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +62 −46 Original line number Diff line number Diff line Loading @@ -1824,14 +1824,27 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif // Identifiant de l'activité $id = $this->params()->fromRoute('id'); /** @var Activity $entity */ $entity = $this->getEntityManager()->getRepository(Activity::class)->find($id); // Multiple ids $ids = explode(",", $id); // Check access try { $masses = $this->getOscarConfigurationService()->getMasses(); $pfis = []; $lastUpdate = null; foreach ($ids as $id) { /** @var Activity $entity */ $entity = $this->getActivityService()->getActivityById($id, true); $this->getOscarUserContextService()->check(Privileges::DEPENSE_SHOW, $entity); $pfis[] = $entity->getCodeEOTP(); if( $lastUpdate == null || $entity->getDateTotalSpent() > $lastUpdate ){ $lastUpdate = $entity->getDateTotalSpent(); } } // $masses = $this->getOscarConfigurationService()->getMasses(); // Check access $pfis = array_unique($pfis); // Method $method = $this->getHttpXMethod(); Loading @@ -1851,37 +1864,40 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif return $this->getResponseOk("Affectation des comptes terminée"); } $pfi = $entity->getCodeEOTP(); if (!$pfi) { return $this->getResponseInternalError("Cette activité n'a pas de PFI"); if (count($pfis) == 0) { return $this->getResponseInternalError("Pas de PFI"); } $out = $this->baseJsonResponse(); $out['error'] = null; // Affiche les erreurs survenue lors de la récupération/synchronisation des données $out['warning'] = null; // Affiche les avertissements if ($this->getOscarConfigurationService()->getAutoUpdateSpent()) { if (!$this->getOscarUserContextService()->hasPrivileges(Privileges::DEPENSE_SYNC, $entity)) { $out['warning'] = "Vous n'êtes pas autorisé à mettre à jour les dépenses, les données peuvent ne pas être à jour"; } else { try { $this->spentService->syncSpentsByEOTP($pfi); } catch (\Exception $e) { $out['error'] = $e->getMessage(); } } } // if ($this->getOscarConfigurationService()->getAutoUpdateSpent()) { // if (!$this->getOscarUserContextService()->hasPrivileges(Privileges::DEPENSE_SYNC, $entity)) { // $out['warning'] = "Vous n'êtes pas autorisé à mettre à jour les dépenses, les données peuvent ne pas être à jour"; // } else { // try { // $this->spentService->syncSpentsByEOTP($pfi); // } catch (\Exception $e) { // $out['error'] = $e->getMessage(); // } // } // } // Construction des données de dépense $out['masses'] = $masses; $out['dateUpdated'] = $entity->getDateTotalSpent(); $out['synthesis'] = $this->getSpentService()->getSynthesisDatasPFI( $pfi, $pfis, $this->getOscarUserContextService()->hasPrivileges( Privileges::MAINTENANCE_SPENDTYPEGROUP_MANAGE ) ); } catch (\Exception $e) { return $this->getResponseInternalError("Impossible de charger les dépenses pour la/les activité(s)"); } return $this->jsonOutput($out); } Loading module/Oscar/src/Oscar/Service/SpentService.php +11 −1 Original line number Diff line number Diff line Loading @@ -697,6 +697,16 @@ class SpentService implements UseLoggerService, UseOscarConfigurationService, Us return $cacheCompte[$code]; } public function getSpentsByPFIs($pfis){ $out = []; foreach ($pfis as $pfi) { $spents = $this->getSpentsByPFI($pfi); foreach ($spents as $s) { $out[] = $s; } } return $out; } public function getSpentsByPFI($pfi) { Loading Loading @@ -808,7 +818,7 @@ class SpentService implements UseLoggerService, UseOscarConfigurationService, Us { // Récupération des dépenses $spents = $this->getSpentsByPFI($pfi); $spents = $this->getSpentsByPFIs($pfi); // Récupération des Masses comptable configurées dans config $masses = $this->getOscarConfigurationService()->getMasses(); Loading module/Oscar/view/oscar/contract-document/list-item.phtml +6 −4 Original line number Diff line number Diff line Loading @@ -4,13 +4,15 @@ $showDelete = isset($showDelete) && $showDelete === true ? true : false; /** @var \Oscar\Entity\ContractDocument $document */ ?> <article class="card xs" data-openable> <div class="card-title"> <div> <i class="picto icon-doc doc-<?= $document->getExtension() ?>"></i> <small class="text-light"><?= $document->getTypeDocument() ?> ~ </small> <small class="text-light"><?= $document->getTypeDocument() ?> ~ </small> <br> <strong><?= $document->getFileName() ?></strong> </div> <small class="text-light"> (<?= $this->fileSize($document->getFileSize()) ?>)</small> </div> <div class="card-content"> <p class="text-highlight"> <p class="text-highlight" style="display: none"> Fichier <strong><?= $document->getExtension() ?></strong> version <?= $document->getVersion()?>, téléversé le <time><?= $this->moment($document->getDateUpdoad())->full() ?></time> par <?= $this->link()->person($document->getPerson()) ?> </p> Loading module/Oscar/view/oscar/project/show.phtml +172 −120 Original line number Diff line number Diff line Loading @@ -91,6 +91,9 @@ h2.tv-serie-label { border-bottom: none; } </div> </section> <section class="row"> <div class="col-md-8"> <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> <!-- ACTIVITÉS de RECHERCHE --> <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> Loading Loading @@ -199,6 +202,72 @@ h2.tv-serie-label { border-bottom: none; } <?php endif; ?> </section> </div> <div class="col-md-4"> <!-- %%%%%%%%%%%%%%%%%%%%%%%% DEPENSES %%%%%%%%%%%%%%%%%%%%%%%% --> <?php /* 'spentActivitiesIds' => $spentActivitiesIds, 'spentMissingAcces' => $nbrSpentAllow < $nbrSpent, */ // ------------------------------------------------------------------------------------------------ DÉPENSES if (count($spentActivitiesIds) > 0) : ?> <section> <h2><i class="icon-book"></i> Dépenses</h2> <div id="depenses">DÉPENSES</div> <script> require(['vue', 'vue-resource', 'activityspentsynthesis', 'VueFilters', 'moment'], function (Vue, VueResource, ActivitySpendSynthesis, VueFilters, moment) { Vue.use(VueResource); Vue.filter('money', VueFilters.default.money); Vue.filter('dateFull', function (date) { var m = moment(date); return "le " + m.format('dddd D MMMM YYYY') + ', ' + moment(date).fromNow(); }); new Vue({ el: "#depenses", render: function (h) { return h(ActivitySpendSynthesis.default, { "props": { "manageDepense": '<?= $this->grant( \Oscar\Provider\Privileges::MAINTENANCE_SPENDTYPEGROUP_MANAGE ) ? $this->url('depense/manage') : "null" ?>', "url": "<?= $this->url( 'contract/spent-synthesis', ['id' => implode(',', $spentActivitiesIds)] ) ?>" } }); } }) }) </script> </section> <?php endif; ?> <!-- %%%%%%%%%%%%%%%%%%%%%%%% DOCUMENTS %%%%%%%%%%%%%%%%%%%%%%%% --> <?php if($this->grant()->privilege(\Oscar\Provider\Privileges::PROJECT_DOCUMENT_SHOW, $project)): ?> <section id="documents" class=""> <h2><i class="icon-book"></i>Documents</h2> <p class="help-block">Les documents ci-dessous sont issus des activités de recherche</p> <?php if( count($documents) ): ?> <?php /** @var \Oscar\Entity\ContractDocument $document */ foreach( $documents as $document ): ?> <?= $this->partial('oscar/contract-document/list-item.phtml', ['document' => $document, 'showActivity'=>true]) ?> <?php endforeach; ?> <?php else: ?> <p class="no-data">Aucun document pour les activités de recherche de ce projet</p> <?php endif; ?> </section> <?php endif; ?> </div> </section> <section> <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::PROJECT_PERSON_MANAGE, $project)): ?> Loading Loading @@ -299,23 +368,6 @@ h2.tv-serie-label { border-bottom: none; } <?php endif; ?> </section> <?php if($this->grant()->privilege(\Oscar\Provider\Privileges::PROJECT_DOCUMENT_SHOW, $project)): ?> <section id="documents" class=""> <h2><i class="icon-book"></i>Documents</h2> <p class="help-block">Les documents ci-dessous sont issus des activités de recherche</p> <?php if( count($documents) ): ?> <?php /** @var \Oscar\Entity\ContractDocument $document */ foreach( $documents as $document ): ?> <?= $this->partial('oscar/contract-document/list-item.phtml', ['document' => $document, 'showActivity'=>true]) ?> <?php endforeach; ?> <?php else: ?> <p class="no-data">Aucun document pour les activités de recherche de ce projet</p> <?php endif; ?> </section> <?php endif; ?> <?php if( $this->grant()->privilege(\Oscar\Provider\Privileges::MAINTENANCE_MENU_ADMIN) ): ?> <section id="documents" class=""> <h2> Loading Loading
module/Oscar/src/Oscar/Controller/ProjectController.php +15 −0 Original line number Diff line number Diff line Loading @@ -241,9 +241,24 @@ class ProjectController extends AbstractOscarController $rolesOrganizations = $this->getOscarUserContextService()->getRolesOrganizationInActivity(); $rolesPersons = $this->getOscarUserContextService()->getAllRoleIdPersonInActivity(); // Calcule de l'accès aux dépense $nbrSpent = 0; $nbrSpentAllow = 0; $spentActivitiesIds = []; foreach ($entity->getActivities() as $activity) { if( $activity->getCodeEOTP() ){ $nbrSpent++; if( $this->getOscarUserContextService()->hasPrivileges(Privileges::DEPENSE_SHOW, $activity) ){ $nbrSpentAllow++; $spentActivitiesIds[] = $activity->getId(); } } } return array( // 'access' => $this->getAccessResolverService()->getProjectAccess($entity), 'spentActivitiesIds' => $spentActivitiesIds, 'spentMissingAcces' => $nbrSpentAllow < $nbrSpent, 'project' => $entity, 'documents' => $documents, 'rolesOrganizations' => $rolesOrganizations, Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +62 −46 Original line number Diff line number Diff line Loading @@ -1824,14 +1824,27 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif // Identifiant de l'activité $id = $this->params()->fromRoute('id'); /** @var Activity $entity */ $entity = $this->getEntityManager()->getRepository(Activity::class)->find($id); // Multiple ids $ids = explode(",", $id); // Check access try { $masses = $this->getOscarConfigurationService()->getMasses(); $pfis = []; $lastUpdate = null; foreach ($ids as $id) { /** @var Activity $entity */ $entity = $this->getActivityService()->getActivityById($id, true); $this->getOscarUserContextService()->check(Privileges::DEPENSE_SHOW, $entity); $pfis[] = $entity->getCodeEOTP(); if( $lastUpdate == null || $entity->getDateTotalSpent() > $lastUpdate ){ $lastUpdate = $entity->getDateTotalSpent(); } } // $masses = $this->getOscarConfigurationService()->getMasses(); // Check access $pfis = array_unique($pfis); // Method $method = $this->getHttpXMethod(); Loading @@ -1851,37 +1864,40 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif return $this->getResponseOk("Affectation des comptes terminée"); } $pfi = $entity->getCodeEOTP(); if (!$pfi) { return $this->getResponseInternalError("Cette activité n'a pas de PFI"); if (count($pfis) == 0) { return $this->getResponseInternalError("Pas de PFI"); } $out = $this->baseJsonResponse(); $out['error'] = null; // Affiche les erreurs survenue lors de la récupération/synchronisation des données $out['warning'] = null; // Affiche les avertissements if ($this->getOscarConfigurationService()->getAutoUpdateSpent()) { if (!$this->getOscarUserContextService()->hasPrivileges(Privileges::DEPENSE_SYNC, $entity)) { $out['warning'] = "Vous n'êtes pas autorisé à mettre à jour les dépenses, les données peuvent ne pas être à jour"; } else { try { $this->spentService->syncSpentsByEOTP($pfi); } catch (\Exception $e) { $out['error'] = $e->getMessage(); } } } // if ($this->getOscarConfigurationService()->getAutoUpdateSpent()) { // if (!$this->getOscarUserContextService()->hasPrivileges(Privileges::DEPENSE_SYNC, $entity)) { // $out['warning'] = "Vous n'êtes pas autorisé à mettre à jour les dépenses, les données peuvent ne pas être à jour"; // } else { // try { // $this->spentService->syncSpentsByEOTP($pfi); // } catch (\Exception $e) { // $out['error'] = $e->getMessage(); // } // } // } // Construction des données de dépense $out['masses'] = $masses; $out['dateUpdated'] = $entity->getDateTotalSpent(); $out['synthesis'] = $this->getSpentService()->getSynthesisDatasPFI( $pfi, $pfis, $this->getOscarUserContextService()->hasPrivileges( Privileges::MAINTENANCE_SPENDTYPEGROUP_MANAGE ) ); } catch (\Exception $e) { return $this->getResponseInternalError("Impossible de charger les dépenses pour la/les activité(s)"); } return $this->jsonOutput($out); } Loading
module/Oscar/src/Oscar/Service/SpentService.php +11 −1 Original line number Diff line number Diff line Loading @@ -697,6 +697,16 @@ class SpentService implements UseLoggerService, UseOscarConfigurationService, Us return $cacheCompte[$code]; } public function getSpentsByPFIs($pfis){ $out = []; foreach ($pfis as $pfi) { $spents = $this->getSpentsByPFI($pfi); foreach ($spents as $s) { $out[] = $s; } } return $out; } public function getSpentsByPFI($pfi) { Loading Loading @@ -808,7 +818,7 @@ class SpentService implements UseLoggerService, UseOscarConfigurationService, Us { // Récupération des dépenses $spents = $this->getSpentsByPFI($pfi); $spents = $this->getSpentsByPFIs($pfi); // Récupération des Masses comptable configurées dans config $masses = $this->getOscarConfigurationService()->getMasses(); Loading
module/Oscar/view/oscar/contract-document/list-item.phtml +6 −4 Original line number Diff line number Diff line Loading @@ -4,13 +4,15 @@ $showDelete = isset($showDelete) && $showDelete === true ? true : false; /** @var \Oscar\Entity\ContractDocument $document */ ?> <article class="card xs" data-openable> <div class="card-title"> <div> <i class="picto icon-doc doc-<?= $document->getExtension() ?>"></i> <small class="text-light"><?= $document->getTypeDocument() ?> ~ </small> <small class="text-light"><?= $document->getTypeDocument() ?> ~ </small> <br> <strong><?= $document->getFileName() ?></strong> </div> <small class="text-light"> (<?= $this->fileSize($document->getFileSize()) ?>)</small> </div> <div class="card-content"> <p class="text-highlight"> <p class="text-highlight" style="display: none"> Fichier <strong><?= $document->getExtension() ?></strong> version <?= $document->getVersion()?>, téléversé le <time><?= $this->moment($document->getDateUpdoad())->full() ?></time> par <?= $this->link()->person($document->getPerson()) ?> </p> Loading
module/Oscar/view/oscar/project/show.phtml +172 −120 Original line number Diff line number Diff line Loading @@ -91,6 +91,9 @@ h2.tv-serie-label { border-bottom: none; } </div> </section> <section class="row"> <div class="col-md-8"> <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> <!-- ACTIVITÉS de RECHERCHE --> <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> Loading Loading @@ -199,6 +202,72 @@ h2.tv-serie-label { border-bottom: none; } <?php endif; ?> </section> </div> <div class="col-md-4"> <!-- %%%%%%%%%%%%%%%%%%%%%%%% DEPENSES %%%%%%%%%%%%%%%%%%%%%%%% --> <?php /* 'spentActivitiesIds' => $spentActivitiesIds, 'spentMissingAcces' => $nbrSpentAllow < $nbrSpent, */ // ------------------------------------------------------------------------------------------------ DÉPENSES if (count($spentActivitiesIds) > 0) : ?> <section> <h2><i class="icon-book"></i> Dépenses</h2> <div id="depenses">DÉPENSES</div> <script> require(['vue', 'vue-resource', 'activityspentsynthesis', 'VueFilters', 'moment'], function (Vue, VueResource, ActivitySpendSynthesis, VueFilters, moment) { Vue.use(VueResource); Vue.filter('money', VueFilters.default.money); Vue.filter('dateFull', function (date) { var m = moment(date); return "le " + m.format('dddd D MMMM YYYY') + ', ' + moment(date).fromNow(); }); new Vue({ el: "#depenses", render: function (h) { return h(ActivitySpendSynthesis.default, { "props": { "manageDepense": '<?= $this->grant( \Oscar\Provider\Privileges::MAINTENANCE_SPENDTYPEGROUP_MANAGE ) ? $this->url('depense/manage') : "null" ?>', "url": "<?= $this->url( 'contract/spent-synthesis', ['id' => implode(',', $spentActivitiesIds)] ) ?>" } }); } }) }) </script> </section> <?php endif; ?> <!-- %%%%%%%%%%%%%%%%%%%%%%%% DOCUMENTS %%%%%%%%%%%%%%%%%%%%%%%% --> <?php if($this->grant()->privilege(\Oscar\Provider\Privileges::PROJECT_DOCUMENT_SHOW, $project)): ?> <section id="documents" class=""> <h2><i class="icon-book"></i>Documents</h2> <p class="help-block">Les documents ci-dessous sont issus des activités de recherche</p> <?php if( count($documents) ): ?> <?php /** @var \Oscar\Entity\ContractDocument $document */ foreach( $documents as $document ): ?> <?= $this->partial('oscar/contract-document/list-item.phtml', ['document' => $document, 'showActivity'=>true]) ?> <?php endforeach; ?> <?php else: ?> <p class="no-data">Aucun document pour les activités de recherche de ce projet</p> <?php endif; ?> </section> <?php endif; ?> </div> </section> <section> <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::PROJECT_PERSON_MANAGE, $project)): ?> Loading Loading @@ -299,23 +368,6 @@ h2.tv-serie-label { border-bottom: none; } <?php endif; ?> </section> <?php if($this->grant()->privilege(\Oscar\Provider\Privileges::PROJECT_DOCUMENT_SHOW, $project)): ?> <section id="documents" class=""> <h2><i class="icon-book"></i>Documents</h2> <p class="help-block">Les documents ci-dessous sont issus des activités de recherche</p> <?php if( count($documents) ): ?> <?php /** @var \Oscar\Entity\ContractDocument $document */ foreach( $documents as $document ): ?> <?= $this->partial('oscar/contract-document/list-item.phtml', ['document' => $document, 'showActivity'=>true]) ?> <?php endforeach; ?> <?php else: ?> <p class="no-data">Aucun document pour les activités de recherche de ce projet</p> <?php endif; ?> </section> <?php endif; ?> <?php if( $this->grant()->privilege(\Oscar\Provider\Privileges::MAINTENANCE_MENU_ADMIN) ): ?> <section id="documents" class=""> <h2> Loading