Loading module/Oscar/src/Oscar/Command/OscarTimesheetDeclarerRecallCommand.php +35 −19 Changes for module/Oscar/src/Oscar/Command/OscarTimesheetDeclarerRecallCommand.php: 35 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract const OPT_FORCE = "force"; const OPT_DECLARER = "declarer"; const OPT_PERIOD = "period"; const OPT_PROCESSDATE = "processdate"; const ARG_ALL = "all"; Loading @@ -51,6 +52,7 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract ->addOption(self::OPT_FORCE, 'f', InputOption::VALUE_NONE, "Forcer le mode non-interactif") ->addOption(self::OPT_DECLARER, 'd', InputOption::VALUE_REQUIRED, "Identifiant du déclarant") ->addOption(self::OPT_PERIOD, 'p', InputOption::VALUE_OPTIONAL, "Période") ->addOption(self::OPT_PROCESSDATE, 'c', InputOption::VALUE_OPTIONAL, "Date de relance (par défaut date actuelle)") ->addArgument(self::ARG_ALL, InputArgument::OPTIONAL, "Déclencher pour tous les déclarants", false); ; } Loading @@ -66,6 +68,13 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract /// OPTIONS and PARAMETERS $declarerId = $input->getOption(self::OPT_DECLARER); $processDate = $input->getOption(self::OPT_PROCESSDATE); if( $processDate ){ $processDate = new \DateTime($processDate); } else { $processDate = new \DateTime(); } if( $all == false && $declarerId == null ){ $io->writeln("Utiliser l'option --declarant=ID"); Loading @@ -73,6 +82,12 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract return; } if( $all != 'all' ){ $personId = $this->getPersonService()->getPersonByLdapLogin($all)->getId(); $declarerId = $personId; $all = false; } $declarerPeriod = $input->getOption(self::OPT_PERIOD); if( !$declarerPeriod ){ $today = date('Y-m-d'); Loading @@ -89,35 +104,37 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract /** @var Person $declarer */ foreach ($declarants['persons'] as $personId=>$datas) { try { $result = $this->recallDeclarer($personId, $declarerPeriod, $io); $result = $this->recallDeclarer($personId, $declarerPeriod, $io, $processDate); } catch (\Exception $e) { $io->warning($e->getMessage()); } } } else { $result = $this->recallDeclarer($declarerId, $declarerPeriod, $io); $result = $this->recallDeclarer($declarerId, $declarerPeriod, $io, $processDate); } } protected function recallDeclarer($declarerId, $declarerPeriod, SymfonyStyle $io) protected function recallDeclarer($declarerId, $declarerPeriod, SymfonyStyle $io, $processDate = null) { /** @var Person $declarer */ $declarer = $this->getPersonService()->getPersonById($declarerId); $result = $this->declarerPeriod($declarerId, $declarerPeriod); $result = $this->declarerPeriod($declarerId, $declarerPeriod, $processDate); if( $result ) { $io->title($result['person']); $io->writeln(sprintf("Message : <options=bold>%s</>", $result['message'])); $io->writeln(sprintf("Mail ? <options=bold>%s</>", $result['needSend'] ? 'Oui' : 'Non')); $io->writeln(sprintf("Déclaration (heures) : <options=bold>%s/%s</>", $result['total'], $result['needed'])); $io->writeln(sprintf("Max : <options=bold>%s</>", $result['max'])); $io->writeln(sprintf("Min : <options=bold>%s</>", $result['min'])); $io->writeln(sprintf("Mail requis : <options=bold>%s</>", $result['mailRequired'] ? "Oui" : "Non")); $io->writeln(sprintf("Mail envoyé : <options=bold>%s</>", $result['mailSend'] ? "Oui" : "Non")); $io->writeln(sprintf("Status : <options=bold>%s</>", $result['status'])); } else { if( $result['needSend'] ){ $message = $this->getMailer()->newMessage("[OSCAR] Déclaration de temps $declarerPeriod", "CONTENU : " . $result['message']); $message->setTo($declarer->getEmail()); $message->setBody("Message : " . $result['message']); $this->getMailer()->send($message); echo "MAIL !!!! \n"; } } /** Loading @@ -125,11 +142,7 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract */ protected function getMailer() { static $mailer; if( $mailer === null ){ $mailer = $this->getServicemanager()->get(MailingService::class); } return $mailer; return $this->getServicemanager()->get(MailingService::class); } /** Loading @@ -148,8 +161,11 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract //public function declarerRecall public function declarerPeriod( $declarerId, $period ){ return $this->getTimesheetService()->getPersonRecallDeclarationPeriod($declarerId, $period); public function declarerPeriod( $declarerId, $period, $processDate = null ){ if( $processDate == null ){ $processDate = new \DateTime(); } return $this->getTimesheetService()->recallProcess($declarerId, $period, $processDate); } public function declarer( InputInterface $input, OutputInterface $output, $declarerId ){ Loading Loading @@ -178,9 +194,9 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract $out = []; /** @var Person $declarer */ foreach ($declarants['persons'] as $personId=>$datas) { $out[] = [$personId, $datas['displayname'], $datas['affectation'], count($datas['declarations'])]; $out[] = [$personId, $datas['displayname'], $datas['login'], $datas['affectation'], count($datas['declarations'])]; } $headers = ['ID', 'Déclarant', 'Affectation', 'Déclaration(s)']; $headers = ['ID', 'login', 'Déclarant', 'Affectation', 'Déclaration(s)']; $io->table($headers, $out); $io->comment("Entrez la commande '".self::getName()." --". self::OPT_DECLARER . "=<ID>' pour afficher les détails"); Loading module/Oscar/src/Oscar/Command/OscarTimesheetRecallsCommand.php 0 → 100644 +84 −0 Changes for module/Oscar/src/Oscar/Command/OscarTimesheetRecallsCommand.php: 84 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * Created by PhpStorm. * User: bouvry * Date: 04/10/19 * Time: 11:49 */ namespace Oscar\Command; use Moment\Moment; use Oscar\Entity\Authentification; use Oscar\Entity\LogActivity; use Oscar\Entity\Person; use Oscar\Entity\RecallDeclaration; use Oscar\Entity\Role; use Oscar\Entity\WorkPackage; use Oscar\Entity\WorkPackagePerson; use Oscar\Service\ConnectorService; use Oscar\Service\OscarConfigurationService; use Oscar\Service\OscarUserContext; use Oscar\Service\PersonService; use Oscar\Service\TimesheetService; use Oscar\Utils\DateTimeUtils; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zend\Validator\Date; class OscarTimesheetRecallsCommand extends OscarCommandAbstract { protected static $defaultName = 'timesheets:recalls'; const OPT_DECLARER = "declarer"; const OPT_PERIOD = "period"; protected function configure() { $this ->setDescription("Afficher les relances") ; } protected function execute(InputInterface $input, OutputInterface $output) { $this->addOutputStyle($output); $io = new SymfonyStyle($input, $output); $recalls = $this->getTimesheetService()->getRecalls(); $headers = ["ID", "Date", "Depuis", "Déclarants", "Période"]; $rows = []; $moment = new Moment(); /** @var RecallDeclaration $recall */ foreach ($recalls as $recall) { $moment = new Moment($recall->getLastSend()->getTimestamp()); $row = [ $recall->getId(), $recall->getLastSend()->format('Y-m-d H:i:s'), $moment->fromNow()->getRelative(), $recall->getPerson()->__toString(), sprintf("%s %s", $recall->getPeriodMonth(), $recall->getPeriodYear()) ]; $rows[] = $row; } $io->table($headers, $rows); /// OPTIONS and PARAMETERS } /** * @return TimesheetService */ protected function getTimesheetService(){ return $this->getServicemanager()->get(TimesheetService::class); } } No newline at end of file module/Oscar/src/Oscar/Entity/Person.php +1 −0 Changes for module/Oscar/src/Oscar/Entity/Person.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -810,6 +810,7 @@ class Person implements ResourceInterface 'firstName' => $this->getFirstname(), 'lastName' => $this->getLastname(), 'displayname' => $this->getDisplayName(), 'login' => $this->getLadapLogin(), 'label' => $this->getDisplayName(), 'text' => $this->getDisplayName(), 'email' => $this->getEmail(), Loading module/Oscar/src/Oscar/Entity/RecallDeclaration.php 0 → 100644 +207 −0 Changes for module/Oscar/src/Oscar/Entity/RecallDeclaration.php: 207 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Oscar\Entity; use Doctrine\ORM\Mapping as ORM; /** * Cette classe référence les rôles GLOBAUX sur l'application. * * @ORM\Entity * @ORM\Entity(repositoryClass="RecallDeclarationRepository") */ class RecallDeclaration { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ private $id; /** * Année de référence * @var integer * @ORM\Column(type="integer") */ private $periodYear; /** * Mois de référence * @var integer * @ORM\Column(type="integer", nullable=false) */ private $periodMonth; /** * @var Person * @ORM\ManyToOne(targetEntity="Person") */ private $person; /** * @var string * @ORM\Column(type="string") */ private $context = "declarer"; /** * @var \DateTime * @ORM\Column(type="datetime") * */ private $startProcess; /** * @var \DateTime * @ORM\Column(type="datetime") */ private $lastSend; /** * @var string * @ORM\Column(type="text") */ private $history; /** * @return mixed */ public function getId() { return $this->id; } /** * @return int */ public function getPeriodYear(): int { return $this->periodYear; } /** * @param int $periodYear */ public function setPeriodYear(int $periodYear): self { $this->periodYear = $periodYear; return $this; } /** * @return int */ public function getPeriodMonth(): int { return $this->periodMonth; } /** * @param int $periodMonth */ public function setPeriodMonth(int $periodMonth): self { $this->periodMonth = $periodMonth; return $this; } /** * @return Person */ public function getPerson(): Person { return $this->person; } /** * @param Person $person */ public function setPerson(Person $person): self { $this->person = $person; return $this; } /** * @return string */ public function getContext(): string { return $this->context; } /** * @param string $context */ public function setContext(string $context): self { $this->context = $context; return $this; } /** * @return \DateTime */ public function getStartProcess(): \DateTime { return $this->startProcess; } /** * @param \DateTime $startProcess */ public function setStartProcess(\DateTime $startProcess): self { $this->startProcess = $startProcess; return $this; } /** * @return \DateTime */ public function getLastSend(): \DateTime { return $this->lastSend; } /** * @param \DateTime $lastSend */ public function setLastSend(\DateTime $lastSend): self { $this->lastSend = $lastSend; return $this; } /** * @return string */ public function getHistory(): string { return $this->history; } /** * @param string $historyLine * @return $this */ public function addHistory( string $historyLine ) :self { if( $this->history == null ){ $this->history = ""; } $this->history .= $historyLine."\n"; return $this; } public function __toString() { return sprintf('[%s] Envoyé le %s à %s pour la période %s-%s', $this->getId(), $this->getLastSend()->format('Y-m-d H:i:s'), $this->getPerson(), $this->getPeriodYear(), $this->getPeriodMonth()); } } No newline at end of file module/Oscar/src/Oscar/Entity/RecallDeclarationRepository.php 0 → 100644 +29 −0 Changes for module/Oscar/src/Oscar/Entity/RecallDeclarationRepository.php: 29 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @author Stéphane Bouvry<stephane.bouvry@unicaen.fr> * @date: 17-11-21 16:03 * @copyright Certic (c) 2017 */ namespace Oscar\Entity; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\NoResultException; class RecallDeclarationRepository extends EntityRepository { public function getRecallDeclarationsPersonPeriod( int $personId, int $periodYear, int $periodMonth ) { return $this->createQueryBuilder('r') ->where('r.person = :person AND r.periodYear = :periodYear AND r.periodMonth = :periodMonth') ->setParameters([ 'person' => $personId, 'periodYear' => $periodYear, 'periodMonth' => $periodMonth, ]) ->getQuery() ->getResult(); } } No newline at end of file Loading
module/Oscar/src/Oscar/Command/OscarTimesheetDeclarerRecallCommand.php +35 −19 Changes for module/Oscar/src/Oscar/Command/OscarTimesheetDeclarerRecallCommand.php: 35 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract const OPT_FORCE = "force"; const OPT_DECLARER = "declarer"; const OPT_PERIOD = "period"; const OPT_PROCESSDATE = "processdate"; const ARG_ALL = "all"; Loading @@ -51,6 +52,7 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract ->addOption(self::OPT_FORCE, 'f', InputOption::VALUE_NONE, "Forcer le mode non-interactif") ->addOption(self::OPT_DECLARER, 'd', InputOption::VALUE_REQUIRED, "Identifiant du déclarant") ->addOption(self::OPT_PERIOD, 'p', InputOption::VALUE_OPTIONAL, "Période") ->addOption(self::OPT_PROCESSDATE, 'c', InputOption::VALUE_OPTIONAL, "Date de relance (par défaut date actuelle)") ->addArgument(self::ARG_ALL, InputArgument::OPTIONAL, "Déclencher pour tous les déclarants", false); ; } Loading @@ -66,6 +68,13 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract /// OPTIONS and PARAMETERS $declarerId = $input->getOption(self::OPT_DECLARER); $processDate = $input->getOption(self::OPT_PROCESSDATE); if( $processDate ){ $processDate = new \DateTime($processDate); } else { $processDate = new \DateTime(); } if( $all == false && $declarerId == null ){ $io->writeln("Utiliser l'option --declarant=ID"); Loading @@ -73,6 +82,12 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract return; } if( $all != 'all' ){ $personId = $this->getPersonService()->getPersonByLdapLogin($all)->getId(); $declarerId = $personId; $all = false; } $declarerPeriod = $input->getOption(self::OPT_PERIOD); if( !$declarerPeriod ){ $today = date('Y-m-d'); Loading @@ -89,35 +104,37 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract /** @var Person $declarer */ foreach ($declarants['persons'] as $personId=>$datas) { try { $result = $this->recallDeclarer($personId, $declarerPeriod, $io); $result = $this->recallDeclarer($personId, $declarerPeriod, $io, $processDate); } catch (\Exception $e) { $io->warning($e->getMessage()); } } } else { $result = $this->recallDeclarer($declarerId, $declarerPeriod, $io); $result = $this->recallDeclarer($declarerId, $declarerPeriod, $io, $processDate); } } protected function recallDeclarer($declarerId, $declarerPeriod, SymfonyStyle $io) protected function recallDeclarer($declarerId, $declarerPeriod, SymfonyStyle $io, $processDate = null) { /** @var Person $declarer */ $declarer = $this->getPersonService()->getPersonById($declarerId); $result = $this->declarerPeriod($declarerId, $declarerPeriod); $result = $this->declarerPeriod($declarerId, $declarerPeriod, $processDate); if( $result ) { $io->title($result['person']); $io->writeln(sprintf("Message : <options=bold>%s</>", $result['message'])); $io->writeln(sprintf("Mail ? <options=bold>%s</>", $result['needSend'] ? 'Oui' : 'Non')); $io->writeln(sprintf("Déclaration (heures) : <options=bold>%s/%s</>", $result['total'], $result['needed'])); $io->writeln(sprintf("Max : <options=bold>%s</>", $result['max'])); $io->writeln(sprintf("Min : <options=bold>%s</>", $result['min'])); $io->writeln(sprintf("Mail requis : <options=bold>%s</>", $result['mailRequired'] ? "Oui" : "Non")); $io->writeln(sprintf("Mail envoyé : <options=bold>%s</>", $result['mailSend'] ? "Oui" : "Non")); $io->writeln(sprintf("Status : <options=bold>%s</>", $result['status'])); } else { if( $result['needSend'] ){ $message = $this->getMailer()->newMessage("[OSCAR] Déclaration de temps $declarerPeriod", "CONTENU : " . $result['message']); $message->setTo($declarer->getEmail()); $message->setBody("Message : " . $result['message']); $this->getMailer()->send($message); echo "MAIL !!!! \n"; } } /** Loading @@ -125,11 +142,7 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract */ protected function getMailer() { static $mailer; if( $mailer === null ){ $mailer = $this->getServicemanager()->get(MailingService::class); } return $mailer; return $this->getServicemanager()->get(MailingService::class); } /** Loading @@ -148,8 +161,11 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract //public function declarerRecall public function declarerPeriod( $declarerId, $period ){ return $this->getTimesheetService()->getPersonRecallDeclarationPeriod($declarerId, $period); public function declarerPeriod( $declarerId, $period, $processDate = null ){ if( $processDate == null ){ $processDate = new \DateTime(); } return $this->getTimesheetService()->recallProcess($declarerId, $period, $processDate); } public function declarer( InputInterface $input, OutputInterface $output, $declarerId ){ Loading Loading @@ -178,9 +194,9 @@ class OscarTimesheetDeclarerRecallCommand extends OscarCommandAbstract $out = []; /** @var Person $declarer */ foreach ($declarants['persons'] as $personId=>$datas) { $out[] = [$personId, $datas['displayname'], $datas['affectation'], count($datas['declarations'])]; $out[] = [$personId, $datas['displayname'], $datas['login'], $datas['affectation'], count($datas['declarations'])]; } $headers = ['ID', 'Déclarant', 'Affectation', 'Déclaration(s)']; $headers = ['ID', 'login', 'Déclarant', 'Affectation', 'Déclaration(s)']; $io->table($headers, $out); $io->comment("Entrez la commande '".self::getName()." --". self::OPT_DECLARER . "=<ID>' pour afficher les détails"); Loading
module/Oscar/src/Oscar/Command/OscarTimesheetRecallsCommand.php 0 → 100644 +84 −0 Changes for module/Oscar/src/Oscar/Command/OscarTimesheetRecallsCommand.php: 84 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * Created by PhpStorm. * User: bouvry * Date: 04/10/19 * Time: 11:49 */ namespace Oscar\Command; use Moment\Moment; use Oscar\Entity\Authentification; use Oscar\Entity\LogActivity; use Oscar\Entity\Person; use Oscar\Entity\RecallDeclaration; use Oscar\Entity\Role; use Oscar\Entity\WorkPackage; use Oscar\Entity\WorkPackagePerson; use Oscar\Service\ConnectorService; use Oscar\Service\OscarConfigurationService; use Oscar\Service\OscarUserContext; use Oscar\Service\PersonService; use Oscar\Service\TimesheetService; use Oscar\Utils\DateTimeUtils; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zend\Validator\Date; class OscarTimesheetRecallsCommand extends OscarCommandAbstract { protected static $defaultName = 'timesheets:recalls'; const OPT_DECLARER = "declarer"; const OPT_PERIOD = "period"; protected function configure() { $this ->setDescription("Afficher les relances") ; } protected function execute(InputInterface $input, OutputInterface $output) { $this->addOutputStyle($output); $io = new SymfonyStyle($input, $output); $recalls = $this->getTimesheetService()->getRecalls(); $headers = ["ID", "Date", "Depuis", "Déclarants", "Période"]; $rows = []; $moment = new Moment(); /** @var RecallDeclaration $recall */ foreach ($recalls as $recall) { $moment = new Moment($recall->getLastSend()->getTimestamp()); $row = [ $recall->getId(), $recall->getLastSend()->format('Y-m-d H:i:s'), $moment->fromNow()->getRelative(), $recall->getPerson()->__toString(), sprintf("%s %s", $recall->getPeriodMonth(), $recall->getPeriodYear()) ]; $rows[] = $row; } $io->table($headers, $rows); /// OPTIONS and PARAMETERS } /** * @return TimesheetService */ protected function getTimesheetService(){ return $this->getServicemanager()->get(TimesheetService::class); } } No newline at end of file
module/Oscar/src/Oscar/Entity/Person.php +1 −0 Changes for module/Oscar/src/Oscar/Entity/Person.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -810,6 +810,7 @@ class Person implements ResourceInterface 'firstName' => $this->getFirstname(), 'lastName' => $this->getLastname(), 'displayname' => $this->getDisplayName(), 'login' => $this->getLadapLogin(), 'label' => $this->getDisplayName(), 'text' => $this->getDisplayName(), 'email' => $this->getEmail(), Loading
module/Oscar/src/Oscar/Entity/RecallDeclaration.php 0 → 100644 +207 −0 Changes for module/Oscar/src/Oscar/Entity/RecallDeclaration.php: 207 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Oscar\Entity; use Doctrine\ORM\Mapping as ORM; /** * Cette classe référence les rôles GLOBAUX sur l'application. * * @ORM\Entity * @ORM\Entity(repositoryClass="RecallDeclarationRepository") */ class RecallDeclaration { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ private $id; /** * Année de référence * @var integer * @ORM\Column(type="integer") */ private $periodYear; /** * Mois de référence * @var integer * @ORM\Column(type="integer", nullable=false) */ private $periodMonth; /** * @var Person * @ORM\ManyToOne(targetEntity="Person") */ private $person; /** * @var string * @ORM\Column(type="string") */ private $context = "declarer"; /** * @var \DateTime * @ORM\Column(type="datetime") * */ private $startProcess; /** * @var \DateTime * @ORM\Column(type="datetime") */ private $lastSend; /** * @var string * @ORM\Column(type="text") */ private $history; /** * @return mixed */ public function getId() { return $this->id; } /** * @return int */ public function getPeriodYear(): int { return $this->periodYear; } /** * @param int $periodYear */ public function setPeriodYear(int $periodYear): self { $this->periodYear = $periodYear; return $this; } /** * @return int */ public function getPeriodMonth(): int { return $this->periodMonth; } /** * @param int $periodMonth */ public function setPeriodMonth(int $periodMonth): self { $this->periodMonth = $periodMonth; return $this; } /** * @return Person */ public function getPerson(): Person { return $this->person; } /** * @param Person $person */ public function setPerson(Person $person): self { $this->person = $person; return $this; } /** * @return string */ public function getContext(): string { return $this->context; } /** * @param string $context */ public function setContext(string $context): self { $this->context = $context; return $this; } /** * @return \DateTime */ public function getStartProcess(): \DateTime { return $this->startProcess; } /** * @param \DateTime $startProcess */ public function setStartProcess(\DateTime $startProcess): self { $this->startProcess = $startProcess; return $this; } /** * @return \DateTime */ public function getLastSend(): \DateTime { return $this->lastSend; } /** * @param \DateTime $lastSend */ public function setLastSend(\DateTime $lastSend): self { $this->lastSend = $lastSend; return $this; } /** * @return string */ public function getHistory(): string { return $this->history; } /** * @param string $historyLine * @return $this */ public function addHistory( string $historyLine ) :self { if( $this->history == null ){ $this->history = ""; } $this->history .= $historyLine."\n"; return $this; } public function __toString() { return sprintf('[%s] Envoyé le %s à %s pour la période %s-%s', $this->getId(), $this->getLastSend()->format('Y-m-d H:i:s'), $this->getPerson(), $this->getPeriodYear(), $this->getPeriodMonth()); } } No newline at end of file
module/Oscar/src/Oscar/Entity/RecallDeclarationRepository.php 0 → 100644 +29 −0 Changes for module/Oscar/src/Oscar/Entity/RecallDeclarationRepository.php: 29 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @author Stéphane Bouvry<stephane.bouvry@unicaen.fr> * @date: 17-11-21 16:03 * @copyright Certic (c) 2017 */ namespace Oscar\Entity; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\NoResultException; class RecallDeclarationRepository extends EntityRepository { public function getRecallDeclarationsPersonPeriod( int $personId, int $periodYear, int $periodMonth ) { return $this->createQueryBuilder('r') ->where('r.person = :person AND r.periodYear = :periodYear AND r.periodMonth = :periodMonth') ->setParameters([ 'person' => $personId, 'periodYear' => $periodYear, 'periodMonth' => $periodMonth, ]) ->getQuery() ->getResult(); } } No newline at end of file