Commit 2d145fde authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Merge branch 'refs/heads/b23'

# Conflicts:
#	module/Contrat/src/Entity/Db/Contrat.php
parents d3b67bbd a940c360
Loading
Loading
Loading
Loading
−3
Changes for data/ddl/view/V_INDICATEUR_210.sql: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -4,12 +4,9 @@ SELECT DISTINCT
  i.structure_id
FROM
  tbl_workflow w
  JOIN tbl_workflow wc ON wc.intervenant_id = w.intervenant_id
  JOIN intervenant i ON i.id = w.intervenant_id
WHERE
  w.etape_code = 'PJ_SAISIE'
  AND wc.etape_code = 'SERVICE_SAISIE'
  AND w.type_intervenant_code = 'E'
  AND wc.realisation > 0
  AND w.atteignable = 1
  AND w.objectif > w.realisation
 No newline at end of file
+37 −1
Changes for module/Contrat/src/Entity/Db/Contrat.php: 37 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Contrat\Entity\Db;

use Application\Entity\Db\Parametre;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Intervenant\Entity\Db\Intervenant;
use Laminas\Permissions\Acl\Resource\ResourceInterface;
use Mission\Entity\Db\Mission;
@@ -14,6 +16,7 @@ use UnicaenApp\Entity\HistoriqueAwareTrait;
class Contrat implements HistoriqueAwareInterface, ResourceInterface
{
    use HistoriqueAwareTrait;
    use ParametresServiceAwareTrait;

    /**
     * @var \Contrat\Entity\Db\Contrat
@@ -336,6 +339,39 @@ class Contrat implements HistoriqueAwareInterface, ResourceInterface



    public function estFinalise(): bool
    {
        // contrat historisé
        if ($this->estHistorise()) {
            return false;
        }

        // contrat pas validé
        $validation = $this->getValidation();
        if (!$validation) {
            return false;
        }

        // La validation est historisée
        if ($validation->estHistorise()) {
            return false;
        }

        $contratRegleFranchissement = $this->getServiceParametres()->get('contrat_regle_franchissement');
        switch ($contratRegleFranchissement) {
            case Parametre::CONTRAT_FRANCHI_VALIDATION:
                // déjà validé => ça suffit, c'est OK
                return true;
            case Parametre::CONTRAT_FRANCHI_DATE_RETOUR:
                // La date de retour signée doit être renseignée
                return !empty($this->getDateRetourSigne());
        }

        return true;
    }



    /**
     * Get intervenant
     *
@@ -355,7 +391,7 @@ class Contrat implements HistoriqueAwareInterface, ResourceInterface
     *
     * @return self
     */
    public function setIntervenant (\Intervenant\Entity\Db\Intervenant $intervenant = null)
    public function setIntervenant (\Application\Entity\Db\Intervenant $intervenant = null)
    {
        $this->intervenant = $intervenant;

+16 −3
Changes for module/Mission/src/Assertion/SuiviAssertion.php: 16 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ class SuiviAssertion extends AbstractAssertion
    use WorkflowServiceAwareTrait;



    protected function assertController($controller, $action = null, $privilege = null)
    {
        /* @var $role Role */
@@ -66,8 +65,7 @@ class SuiviAssertion extends AbstractAssertion
            $entity = $entity->getMission();
        }
        if ($entity instanceof Mission) {
            $structure = $entity->getStructure();
            $entity = $entity->getIntervenant();
            return $this->assertMissionEditionRealise($entity);
        }

        $wfEtape = $this->getServiceWorkflow()->getEtape($codeEtape, $entity, $structure);
@@ -90,9 +88,11 @@ class SuiviAssertion extends AbstractAssertion
        // pareil si le rôle ne possède pas le privilège adéquat
        if ($privilege && !$role->hasPrivilege($privilege)) return false;

        if ($entity instanceof Mission || $entity instanceof Intervenant || $entity instanceof VolumeHoraireMission) {
            if (!$this->assertWorkflow($entity)) {
                return false;
            }
        }

        switch (true) {
            case $entity instanceof VolumeHoraireMission:
@@ -151,6 +151,19 @@ class SuiviAssertion extends AbstractAssertion



    protected function assertMissionEditionRealise(Mission $mission)
    {
        $besoinContrat = $mission->getIntervenant()->getStatut()->getContrat();

        if (!$besoinContrat) {
            return true;
        }

        return $mission->hasContrat();
    }



    protected function assertMission(Role $role, Mission $mission)
    {
        return $this->asserts([
+1 −1
Changes for module/Mission/src/Entity/Db/Mission.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ class Mission implements HistoriqueAwareInterface, ResourceInterface, EntityMana
        $vhs = $this->getVolumesHorairesPrevus();

        foreach ($vhs as $vh) {
            if ($vh->estNonHistorise() && $vh->getContrat() && $vh->getContrat()->estNonHistorise()) {
            if ($vh->estNonHistorise() && $vh->getContrat() && $vh->getContrat()->estFinalise()) {
                return true;
            }
        }