Commit 4ff33a20 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Ajout des projets (activités) dans la liste des retards importants

parent ee0a6967
Loading
Loading
Loading
Loading
+13 −1
Changes for front/src/TimesheetHigDelay.vue: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@
          'error ': p.conflict,
          'success': p.valid == true,
          'danger': p.send == false && p.conflict != true,
          'secondary2': p.send == true && p.valid_prj == true && p.valid_sci == false,
          'secondary2': p.send == true && p.valid_adm == false,
          'warning': p.conflict != true && (p.send == true && p.valid_prj == true && p.valid_sci == true),
        }" @click.shift="debug = p">

@@ -96,6 +96,11 @@
                <span class="info-text">En attente de validation administrative</span>
              </span>
            </span>
            <span v-else>
              <span class="compact-state"><i class="icon-cube" title="En attente de validation projet"></i>
                <span class="info-text">En attente de validation projet</span>
              </span>
            </span>
          </span>

              <span class="period-label">{{ key | period }}</span>
@@ -106,6 +111,13 @@
                  <i class="icon-attention-1"></i> Pas de validateur
                </span>
              </span>

              <span>
                <span class="cartouche default xs" v-for="a in p.activities">
                  <i class="icon-cube"></i>
                  {{ a.acronym }}
                </span>
              </span>
            </div>
          </div>
        </div>
+3 −1
Changes for module/Oscar/src/Oscar/Entity/PersonRepository.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -525,7 +525,9 @@ class PersonRepository extends EntityRepository implements IConnectedRepository
            "person_id" => $personId
]       );

        return $result->fetchAllAssociative();
        $datas = $result->fetchAllAssociative();

        return $datas;
    }

    public function getIdsDeclarersBeforePeriod( string $period ): array
+4 −2
Changes for module/Oscar/src/Oscar/Entity/TimesheetRepository.php: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -109,14 +109,16 @@ class TimesheetRepository extends EntityRepository
    public function getPeriodsPerson($personId)
    {
        $qb = $this->getEntityManager()->createQueryBuilder()
            ->select('a.dateStart', 'a.dateEnd')
            ->select('a.dateStart', 'a.dateEnd', 'a.id', 'a.label', 'p.acronym')
            ->from(Activity::class, 'a')
            ->innerJoin('a.workPackages', 'awp')
            ->innerJoin('a.project', 'p')
            ->innerJoin('awp.persons', 'wpp')
            ->where('wpp.person = :personId')
            ->setParameters(['personId' => $personId]);;

        return $qb->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
        $datas = $qb->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
        return $datas;
    }

    public function getTimesheetTotalByPeriodPerson($personId)
+10 −3
Changes for module/Oscar/src/Oscar/Service/PersonService.php: 10 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -1262,7 +1262,7 @@ class PersonService implements UseOscarConfigurationService, UseEntityManager, U
            $personName = (string)$person;
            $personId = $person->getId();
            $personEmail = $person->getEmail();
            $personPeriods = $this->getTimesheetService()->getPeriodsPerson($person);
            $personPeriods = $this->getTimesheetService()->getPeriodsPerson($person, true);
            $repport = $this->getHighDelayForPerson($personId);
            $validatorsPerson = [];
            $validatorsOthers = [];
@@ -1298,7 +1298,7 @@ class PersonService implements UseOscarConfigurationService, UseEntityManager, U
                'infos' => count($repport) == 0 ? 'Aucune déclaration' : 'Déclarations faite(s)'
            ];

            foreach ($personPeriods as $pp) {
            foreach ($personPeriods as $pp=>$periodDetails) {
                $send = (array_key_exists($pp, $repport) && $repport[$pp]['send']);
                $valid = array_key_exists($pp, $repport) && $repport[$pp]['valid'] ? true : false;
                $step = array_key_exists($pp, $repport) ? $repport[$pp]['step'] : 0;
@@ -1335,7 +1335,8 @@ class PersonService implements UseOscarConfigurationService, UseEntityManager, U
                    'send' => false,
                    'conflict' => false,
                    'step' => $step,
                    'validators' => $validators
                    'validators' => $validators,
                    'activities' => $periodDetails['activities']
                ];
                if( array_key_exists($pp, $repport) ){
                    $periodInfos['valid'] = $repport[$pp]['valid'];
@@ -1362,6 +1363,12 @@ class PersonService implements UseOscarConfigurationService, UseEntityManager, U
        return $output;
    }

    /**
     * Retourne le détails des informations sur les retards importans de déclaration.
     *
     * @param int $personId
     * @return array
     */
    public function getHighDelayForPerson(int $personId)
    {
        $highdelays = $this->getPersonRepository()->getRepportDeclarationPerson($personId);
+25 −1
Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 25 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2894,17 +2894,41 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
     *
     * @param Person $declarer
     */
    public function getPeriodsPerson(Person $declarer)
    public function getPeriodsPerson(Person $declarer, $details = false)
    {
        $periodsBounds = $this->getTimesheetRepository()->getPeriodsPerson($declarer->getId());
        $periods = [];
        $output = [];
        foreach ($periodsBounds as $bounds) {

            $periods = array_merge(
                $periods,
                DateTimeUtils::allperiodsBetweenTwo($bounds['dateStart'], $bounds['dateEnd'])
            );

            $activityId = $bounds['id'];
            $activityLabel = $bounds['label'];
            $activityAcronym = $bounds['acronym'];

            $periodsActivities = DateTimeUtils::allperiodsBetweenTwo($bounds['dateStart'], $bounds['dateEnd']);
            foreach ($periodsActivities as $period) {
                if( !array_key_exists($period, $output) ){
                    $output[$period] = [
                        'period' => $period,
                        'activities' => []
                    ];
                }
                $output[$period]['activities'][$activityId] = [
                    'id' => $activityId,
                    'label' => $activityLabel,
                    'acronym' => $activityAcronym
                ];
            }
        }
        if( $details == false )
            return array_unique($periods);
        else
            return $output;
    }

    public function getPeriodsValidator(Person $validator): array
Loading