Loading module/Oscar/src/Oscar/Entity/Repository/TimesheetCommentPeriodRepository.php 0 → 100644 +22 −0 Original line number Diff line number Diff line <?php namespace Oscar\Entity\Repository; use Doctrine\ORM\EntityRepository; class TimesheetCommentPeriodRepository extends EntityRepository { /** * Retourne tous les commentaires de la personne. * * @param int $personId * @return array */ public function getCommentairesPerson( int $personId ):array { return $this->createQueryBuilder('c') ->select('c') ->where('c.declarer = :personId') ->setParameter('personId', $personId) ->getQuery() ->getResult(); } } module/Oscar/src/Oscar/Entity/TimesheetCommentPeriod.php +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ use Oscar\Utils\DateTimeUtil; /** * @package Oscar\Entity * @ORM\Entity * @ORM\Entity(repositoryClass="Oscar\Entity\Repository\TimesheetCommentPeriodRepository") */ class TimesheetCommentPeriod { Loading module/Oscar/src/Oscar/Service/TimesheetService.php +37 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Oscar\Service; use Cocur\Slugify\Slugify; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\NoResultException; use Doctrine\ORM\Query; use Laminas\Mvc\Controller\Plugin\Url; Loading Loading @@ -2648,11 +2649,40 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat return $datas; } /** * Retourne les commentaires d'une personnes sous la forme : * "YYYY-MM" => [ * "commentaires => [ "comment1", "comment2" ] * ] * * @param Person $person * @return array * @throws NotSupported */ protected function getCommentairesPersonArray( Person $person ) :array { $commentaires = $this->getEntityManager()->getRepository(TimesheetCommentPeriod::class) ->getCommentairesPerson($person->getId()); $out = []; /** @var TimesheetCommentPeriod $commentaire */ foreach ($commentaires as $commentaire) { $period = DateTimeUtils::getCodePeriod($commentaire->getYear(), $commentaire->getMonth()); if( !array_key_exists($period, $out) ) { $out[$period] = []; } if( strlen($commentaire->getComment()) > 0) $out[$period][] = $commentaire->getComment(); } return $out; } /** * Retourne le résumé complet des déclarations d'une personne. * * @param Person $person * @return array * @throws OscarException */ public function getResumePerson(Person $person) { Loading @@ -2665,6 +2695,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat $datas = [ 'owner' => $person == $this->getOscarUserContextService()->getCurrentPerson(), 'person_id' => $person->getId(), 'minDate' => "", 'maxDate' => "", 'periods' => [], Loading @@ -2675,6 +2706,9 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat $periodsDetails = []; // Commentaires $commentaires = $this->getCommentairesPersonArray($person); foreach ($this->getOthersWP() as $hl) { $datas['horslots'][$hl['code']] = [ 'code' => $hl['code'], Loading Loading @@ -2725,7 +2759,6 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat 'month' => $month, 'year' => $year, 'periodDuration' => $this->getPeriodDuration($person, $year, $month), //'periodValidation' => $this->getPeriodValidation 'past' => $period < $periodNow, 'current' => $period == $periodNow, 'futur' => $period > $periodNow, Loading @@ -2739,7 +2772,8 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat 'total_activities_details' => [], 'total_horslots' => 0.0, 'validation_state' => 'none', 'validations_id' => [] 'validations_id' => [], 'commentaires' => array_key_exists($period, $commentaires)?$commentaires[$period]:[], ]; } $periodsDetails[$period]['activities_id'][] = $activity->getId(); Loading Loading @@ -4179,7 +4213,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat * @param $period * @return array * @throws OscarException * @throws \Doctrine\ORM\Exception\NotSupported * @throws NotSupported */ public function getTimesheetDatasPersonPeriod(Person $person, $period): array { Loading module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php +2 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ class OrganizationElasticSearch extends ElasticSearchEngine implements IOrganiza "match" => [ "connectors" => [ "query" => $search, 'fuzziness' => "AUTO", // "Tolérance" aux fautes, //'fuzziness' => "AUTO", // "Tolérance" aux fautes, "boost" => 9 ] ] ], Loading module/Oscar/view/oscar/timesheet/resume.phtml +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ </h1> <div class="timesheet-resume" id="timesheet-resume" <?php if( DEBUG_OSCAR ) echo ' data-debug-enabled="true"' ?> data-timesheetpreview="<?= $this->options()->hasTimesheetPreview() ? 'true':'false' ?>" data-timesheetexcel="<?= $this->options()->allowTimesheetExcel() ? 'true':'false' ?>" data-url="<?= $url ?>" ></div> <?= $this->Vite()->addJs('src/TimesheetPersonResume.js'); ?> Loading Loading
module/Oscar/src/Oscar/Entity/Repository/TimesheetCommentPeriodRepository.php 0 → 100644 +22 −0 Original line number Diff line number Diff line <?php namespace Oscar\Entity\Repository; use Doctrine\ORM\EntityRepository; class TimesheetCommentPeriodRepository extends EntityRepository { /** * Retourne tous les commentaires de la personne. * * @param int $personId * @return array */ public function getCommentairesPerson( int $personId ):array { return $this->createQueryBuilder('c') ->select('c') ->where('c.declarer = :personId') ->setParameter('personId', $personId) ->getQuery() ->getResult(); } }
module/Oscar/src/Oscar/Entity/TimesheetCommentPeriod.php +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ use Oscar\Utils\DateTimeUtil; /** * @package Oscar\Entity * @ORM\Entity * @ORM\Entity(repositoryClass="Oscar\Entity\Repository\TimesheetCommentPeriodRepository") */ class TimesheetCommentPeriod { Loading
module/Oscar/src/Oscar/Service/TimesheetService.php +37 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Oscar\Service; use Cocur\Slugify\Slugify; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\NoResultException; use Doctrine\ORM\Query; use Laminas\Mvc\Controller\Plugin\Url; Loading Loading @@ -2648,11 +2649,40 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat return $datas; } /** * Retourne les commentaires d'une personnes sous la forme : * "YYYY-MM" => [ * "commentaires => [ "comment1", "comment2" ] * ] * * @param Person $person * @return array * @throws NotSupported */ protected function getCommentairesPersonArray( Person $person ) :array { $commentaires = $this->getEntityManager()->getRepository(TimesheetCommentPeriod::class) ->getCommentairesPerson($person->getId()); $out = []; /** @var TimesheetCommentPeriod $commentaire */ foreach ($commentaires as $commentaire) { $period = DateTimeUtils::getCodePeriod($commentaire->getYear(), $commentaire->getMonth()); if( !array_key_exists($period, $out) ) { $out[$period] = []; } if( strlen($commentaire->getComment()) > 0) $out[$period][] = $commentaire->getComment(); } return $out; } /** * Retourne le résumé complet des déclarations d'une personne. * * @param Person $person * @return array * @throws OscarException */ public function getResumePerson(Person $person) { Loading @@ -2665,6 +2695,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat $datas = [ 'owner' => $person == $this->getOscarUserContextService()->getCurrentPerson(), 'person_id' => $person->getId(), 'minDate' => "", 'maxDate' => "", 'periods' => [], Loading @@ -2675,6 +2706,9 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat $periodsDetails = []; // Commentaires $commentaires = $this->getCommentairesPersonArray($person); foreach ($this->getOthersWP() as $hl) { $datas['horslots'][$hl['code']] = [ 'code' => $hl['code'], Loading Loading @@ -2725,7 +2759,6 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat 'month' => $month, 'year' => $year, 'periodDuration' => $this->getPeriodDuration($person, $year, $month), //'periodValidation' => $this->getPeriodValidation 'past' => $period < $periodNow, 'current' => $period == $periodNow, 'futur' => $period > $periodNow, Loading @@ -2739,7 +2772,8 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat 'total_activities_details' => [], 'total_horslots' => 0.0, 'validation_state' => 'none', 'validations_id' => [] 'validations_id' => [], 'commentaires' => array_key_exists($period, $commentaires)?$commentaires[$period]:[], ]; } $periodsDetails[$period]['activities_id'][] = $activity->getId(); Loading Loading @@ -4179,7 +4213,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat * @param $period * @return array * @throws OscarException * @throws \Doctrine\ORM\Exception\NotSupported * @throws NotSupported */ public function getTimesheetDatasPersonPeriod(Person $person, $period): array { Loading
module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php +2 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ class OrganizationElasticSearch extends ElasticSearchEngine implements IOrganiza "match" => [ "connectors" => [ "query" => $search, 'fuzziness' => "AUTO", // "Tolérance" aux fautes, //'fuzziness' => "AUTO", // "Tolérance" aux fautes, "boost" => 9 ] ] ], Loading
module/Oscar/view/oscar/timesheet/resume.phtml +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ </h1> <div class="timesheet-resume" id="timesheet-resume" <?php if( DEBUG_OSCAR ) echo ' data-debug-enabled="true"' ?> data-timesheetpreview="<?= $this->options()->hasTimesheetPreview() ? 'true':'false' ?>" data-timesheetexcel="<?= $this->options()->allowTimesheetExcel() ? 'true':'false' ?>" data-url="<?= $url ?>" ></div> <?= $this->Vite()->addJs('src/TimesheetPersonResume.js'); ?> Loading