From 8d5d2189f1b1261c95187d8eaf74679c6a045699 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Fri, 6 Feb 2015 11:19:36 +0100 Subject: [PATCH] PersonHistoryFile -> AccompanyingPeriod - refs #275 --- ...r.php => AccompanyingPeriodController.php} | 134 ++++++------ Controller/PersonController.php | 22 +- ...HistoryFile.php => AccompanyingPeriod.php} | 47 +++-- Entity/Person.php | 199 ++++++++---------- ...ileType.php => AccompanyingPeriodType.php} | 20 +- ...oryFile.orm.yml => AccompanyingPeriod.yml} | 2 +- Resources/config/routing.yml | 30 +-- Resources/config/validation.yml | 2 +- Resources/translations/messages.fr.yml | 21 +- Resources/translations/messages.nl.yml | 10 +- .../form.html.twig | 4 +- .../list.html.twig | 30 +-- Tests/Entity/AccompanyingPeriodTest.php | 101 +++++++++ Tests/Entity/HistoryFileTest.php | 103 --------- Tests/Entity/PersonTest.php | 73 +++---- 15 files changed, 394 insertions(+), 404 deletions(-) rename Controller/{HistoryController.php => AccompanyingPeriodController.php} (65%) rename Entity/{PersonHistoryFile.php => AccompanyingPeriod.php} (71%) rename Form/{PersonHistoryFileType.php => AccompanyingPeriodType.php} (81%) rename Resources/config/doctrine/{PersonHistoryFile.orm.yml => AccompanyingPeriod.yml} (92%) rename Resources/views/{History => AccompanyingPeriod}/form.html.twig (77%) rename Resources/views/{History => AccompanyingPeriod}/list.html.twig (55%) create mode 100644 Tests/Entity/AccompanyingPeriodTest.php delete mode 100644 Tests/Entity/HistoryFileTest.php diff --git a/Controller/HistoryController.php b/Controller/AccompanyingPeriodController.php similarity index 65% rename from Controller/HistoryController.php rename to Controller/AccompanyingPeriodController.php index d73076f95..f4e96de2a 100644 --- a/Controller/HistoryController.php +++ b/Controller/AccompanyingPeriodController.php @@ -1,13 +1,33 @@ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + namespace Chill\PersonBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Form\PersonHistoryFileType; -use Chill\PersonBundle\Entity\PersonHistoryFile; +use Chill\PersonBundle\Form\AccompanyingPeriodType; +use Chill\PersonBundle\Entity\AccompanyingPeriod; -class HistoryController extends Controller +class AccompanyingPeriodController extends Controller { public function listAction($person_id){ @@ -17,8 +37,8 @@ class HistoryController extends Controller return $this->createNotFoundException('Person not found'); } - return $this->render('ChillPersonBundle:History:list.html.twig', - array('histories' => $person->getHistoriesOrdered(), + return $this->render('ChillPersonBundle:AccompanyingPeriod:list.html.twig', + array('accompanying_periods' => $person->getAccompanyingPeriodsOrdered(), 'person' => $person)); } @@ -30,14 +50,14 @@ class HistoryController extends Controller return $this->createNotFoundException('Person not found'); } - $history = new PersonHistoryFile(new \DateTime()); - $history->setPerson($person) + $accompanyingPeriod = new AccompanyingPeriod(new \DateTime()); + $accompanyingPeriod->setPerson($person) ->setDateOpening(new \DateTime()) ->setDateClosing(new \DateTime()); - $form = $this->createForm(new PersonHistoryFileType(), - $history, array('period_action' => 'update')); + $form = $this->createForm(new AccompanyingPeriodType(), + $accompanyingPeriod, array('period_action' => 'update')); $request = $this->getRequest(); @@ -53,20 +73,20 @@ class HistoryController extends Controller && count($errors) === 0) { $em = $this->getDoctrine()->getManager(); - $em->persist($history); + $em->persist($accompanyingPeriod); $em->flush(); $flashBag->add('success', $this->get('translator')->trans( - 'History created!')); + 'Period created!')); - return $this->redirect($this->generateUrl('chill_person_history_list', + return $this->redirect($this->generateUrl('chill_person_accompanying_period_list', array('person_id' => $person->getId()))); } else { $flashBag->add('danger', $this->get('translator') - ->trans('Error! History not created!')); + ->trans('Error! Period not created!')); foreach($errors as $error) { $flashBag->add('info', $error->getMessage()); @@ -76,30 +96,30 @@ class HistoryController extends Controller - return $this->render('ChillPersonBundle:History:form.html.twig', + return $this->render('ChillPersonBundle:AccompanyingPeriod:form.html.twig', array( 'form' => $form->createView(), 'person' => $person, - 'history' => $history + 'accompanying_period' => $accompanyingPeriod ) ); } - public function updateAction($history_id){ + public function updateAction($person_id, $period_id){ $em = $this->getDoctrine()->getManager(); - $history = $em->getRepository('ChillPersonBundle:PersonHistoryFile') - ->find($history_id); + $accompanyingPeriod = $em->getRepository('ChillPersonBundle:AccompanyingPeriod') + ->find($period_id); - if ($history === null) { - return $this->createNotFoundException("history with id ".$history_id. + if ($accompanyingPeriod === null) { + return $this->createNotFoundException("Period with id ".$period_id. " is not found"); } - $person = $history->getPerson(); + $person = $accompanyingPeriod->getPerson(); - $form = $this->createForm(new PersonHistoryFileType(), - $history, array('period_action' => 'update')); + $form = $this->createForm(new AccompanyingPeriodType(), + $accompanyingPeriod, array('period_action' => 'update')); $request = $this->getRequest(); @@ -117,14 +137,14 @@ class HistoryController extends Controller $flashBag->add('success', $this->get('translator')->trans( - 'Updating history done')); + 'Period updating done')); - return $this->redirect($this->generateUrl('chill_person_history_list', + return $this->redirect($this->generateUrl('chill_person_accompanying_period_list', array('person_id' => $person->getId()))); } else { $flashBag->add('danger', $this->get('translator') - ->trans('Error when updating history')); + ->trans('Error when updating the period')); foreach($errors as $error) { $flashBag->add('info', $error->getMessage()); @@ -134,11 +154,11 @@ class HistoryController extends Controller - return $this->render('ChillPersonBundle:History:form.html.twig', + return $this->render('ChillPersonBundle:AccompanyingPeriod:form.html.twig', array( 'form' => $form->createView(), 'person' => $person, - 'history' => $history + 'accompanying_period' => $accompanyingPeriod ) ); } @@ -152,18 +172,18 @@ class HistoryController extends Controller if ($person->isOpen() === false) { $this->get('session')->getFlashBag() ->add('danger', $this->get('translator') - ->trans('Beware history is closed', + ->trans('Beware period is closed', array('%name%' => $person->__toString()))); return $this->redirect( - $this->generateUrl('chill_person_history_list', array( + $this->generateUrl('chill_person_accompanying_period_list', array( 'person_id' => $person->getId() ))); } - $current = $person->getCurrentHistory(); + $current = $person->getCurrentAccompanyingPeriod(); - $form = $this->createForm(new PersonHistoryFileType(), $current, array( + $form = $this->createForm(new AccompanyingPeriodType(), $current, array( 'period_action' => 'close' )); @@ -179,47 +199,38 @@ class HistoryController extends Controller if (count($errors) === 0) { $this->get('session')->getFlashBag() ->add('success', $this->get('translator') - ->trans('History closed!', + ->trans('Period closed!', array('%name%' => $person->__toString()))); $this->getDoctrine()->getManager()->flush(); return $this->redirect( - $this->generateUrl('chill_person_history_list', array( + $this->generateUrl('chill_person_accompanying_period_list', array( 'person_id' => $person->getId() )) ); } else { $this->get('session')->getFlashBag() ->add('danger', $this->get('translator') - ->trans('Error! History not closed!')); + ->trans('Error! Period not closed!')); foreach ($errors as $error) { $this->get('session')->getFlashBag() ->add('info', $error->getMessage()); } - - - - } - } else { //if form is not valid $this->get('session')->getFlashBag() ->add('danger', $this->get('translator') - ->trans('History closing form is not valide')); + ->trans('Pediod closing form is not valide')); } } - - - - - return $this->render('ChillPersonBundle:History:form.html.twig', + return $this->render('ChillPersonBundle:AccompanyingPeriod:form.html.twig', array( 'form' => $form->createView(), 'person' => $person, - 'history' => $current + 'accompanying_period' => $current )); } @@ -231,10 +242,10 @@ class HistoryController extends Controller private function _validatePerson(Person $person) { $errors = $this->get('validator')->validate($person, array('Default')); - $errors_history = $this->get('validator')->validate($person, + $errors_accompanying_period = $this->get('validator')->validate($person, array('history_consistent')); - foreach($errors_history as $error ) { + foreach($errors_accompanying_period as $error ) { $errors->add($error); } @@ -255,45 +266,45 @@ class HistoryController extends Controller if ($person->isOpen() === true) { $this->get('session')->getFlashBag() ->add('danger', $this->get('translator') - ->trans('Error! History %name% is not closed ; it can be open', + ->trans('Error! Period %name% is not closed ; it can be open', array('%name%' => $person->__toString()))); return $this->redirect( - $this->generateUrl('chill_person_history_list', array( + $this->generateUrl('chill_person_accompanying_period_list', array( 'person_id' => $person->getId() ))); } - $history = new PersonHistoryFile(new \DateTime()); + $accompanyingPeriod = new AccompanyingPeriod(new \DateTime()); - $form = $this->createForm(new PersonHistoryFileType(), $history, array( - 'period_action' => 'open')); + $form = $this->createForm(new AccompanyingPeriodType(), + $accompanyingPeriod, array('period_action' => 'open')); if ($request->getMethod() === 'POST') { $form->handleRequest($request); if ($form->isValid()) { - $person->open($history); + $person->open($accompanyingPeriod); $errors = $this->_validatePerson($person); if (count($errors) <= 0) { $this->get('session')->getFlashBag() ->add('success', $this->get('translator') - ->trans('History %name% opened!', + ->trans('Period %name% opened!', array('%name%' => $person->__toString()))); $this->getDoctrine()->getManager()->flush(); return $this->redirect( - $this->generateUrl('chill_person_history_list', array( + $this->generateUrl('chill_person_accompanying_period_list', array( 'person_id' => $person->getId() )) ); } else { $this->get('session')->getFlashBag() ->add('danger', $this->get('translator') - ->trans('History not opened')); + ->trans('Period not opened')); foreach ($errors as $error) { $this->get('session')->getFlashBag() @@ -304,16 +315,15 @@ class HistoryController extends Controller } else { // if errors in forms $this->get('session')->getFlashBag() ->add('danger', $this->get('translator') - ->trans('History not opened : form is invalid')); + ->trans('Period not opened : form is invalid')); } - } - return $this->render('ChillPersonBundle:History:form.html.twig', + return $this->render('ChillPersonBundle:AccompanyingPeriod:form.html.twig', array( 'form' => $form->createView(), 'person' => $person, - 'history' => $history + 'accompanying_period' => $accompanyingPeriod )); } diff --git a/Controller/PersonController.php b/Controller/PersonController.php index a0c0152f2..cffab8fe7 100644 --- a/Controller/PersonController.php +++ b/Controller/PersonController.php @@ -3,7 +3,7 @@ /* * Chill is a software for social workers * - * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, + * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -223,20 +223,20 @@ class PersonController extends Controller * @param \Chill\PersonBundle\Entity\Person $person * @return \Symfony\Component\Validator\ConstraintViolationListInterface */ - private function _validatePersonAndHistory(Person $person) + private function _validatePersonAndAccompanyingPeriod(Person $person) { $errors = $this->get('validator') - ->validate($person, array('creation')); + ->validate($person, array('creation')); - //validate history - $histories = $person->getHistories(); + //validate accompanying periods + $periods = $person->getAccompanyingPeriods(); - foreach ($histories as $history) { - $errors_history = $this->get('validator') - ->validate($history); + foreach ($periods as $period) { + $period_errors = $this->get('validator') + ->validate($period); //group errors : - foreach($errors_history as $error) { + foreach($period_errors as $error) { $errors->add($error); } } @@ -262,7 +262,7 @@ class PersonController extends Controller $person = $this->_bindCreationForm($form); - $errors = $this->_validatePersonAndHistory($person); + $errors = $this->_validatePersonAndAccompanyingPeriod($person); if ( count($errors) > 0) { $flashBag = $this->get('session')->getFlashBag(); @@ -339,7 +339,7 @@ class PersonController extends Controller $person = $this->_bindCreationForm($form); - $errors = $this->_validatePersonAndHistory($person); + $errors = $this->_validatePersonAndAccompanyingPeriod($person); if ($errors->count() === 0) { $em = $this->getDoctrine()->getManager(); diff --git a/Entity/PersonHistoryFile.php b/Entity/AccompanyingPeriod.php similarity index 71% rename from Entity/PersonHistoryFile.php rename to Entity/AccompanyingPeriod.php index c28034499..c9698bc2b 100644 --- a/Entity/PersonHistoryFile.php +++ b/Entity/AccompanyingPeriod.php @@ -1,14 +1,34 @@ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + namespace Chill\PersonBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\ExecutionContextInterface; /** - * PersonHistoryFile + * AccompanyingPeriod */ -class PersonHistoryFile +class AccompanyingPeriod { /** * @var integer @@ -44,7 +64,7 @@ class PersonHistoryFile /** * * @param \DateTime $dateOpening - * @uses PersonHistoryFile::setDateClosing() + * @uses AccompanyingPeriod::setDateClosing() */ public function __construct(\DateTime $dateOpening) { $this->setDateOpening($dateOpening); @@ -65,7 +85,7 @@ class PersonHistoryFile * Set date_opening * * @param \DateTime $dateOpening - * @return PersonHistoryFile + * @return AccompanyingPeriod */ public function setDateOpening($dateOpening) { @@ -90,7 +110,7 @@ class PersonHistoryFile * For closing a Person file, you should use Person::setClosed instead. * * @param \DateTime $dateClosing - * @return PersonHistoryFile + * @return AccompanyingPeriod * */ public function setDateClosing($dateClosing) @@ -126,7 +146,7 @@ class PersonHistoryFile * Set memo * * @param string $memo - * @return PersonHistoryFile + * @return AccompanyingPeriod */ public function setMemo($memo) { @@ -152,11 +172,11 @@ class PersonHistoryFile /** * Set person. * - * For consistency, you should use Person::addHistoryFile instead. + * For consistency, you should use Person::addAccompanyingPeriod instead. * * @param \Chill\PersonBundle\Entity\Person $person - * @return PersonHistoryFile - * @see Person::addHistoryFile + * @return AccompanyingPeriod + * @see Person::addAccompanyingPeriod */ public function setPerson(\Chill\PersonBundle\Entity\Person $person = null) { @@ -196,19 +216,19 @@ class PersonHistoryFile return; } - if ($this->isClosingAfterOpening() === false) { + if (! $this->isClosingAfterOpening()) { $context->addViolationAt('dateClosing', - 'validation.PersonHistoryFile.constraint.dateOfClosing_before_dateOfOpening', - array(), null); + 'validation.PersonHistoryFile.constraint.dateOfClosing_before_dateOfOpening', + array(), null); } } /** + * Returns true if the closing date is after the opening date. * * @return boolean */ public function isClosingAfterOpening() { - $diff = $this->getDateOpening()->diff($this->getDateClosing()); if ($diff->invert === 0) { @@ -216,6 +236,5 @@ class PersonHistoryFile } else { return false; } - } } diff --git a/Entity/Person.php b/Entity/Person.php index ad7b6e6cd..b2a5822ff 100644 --- a/Entity/Person.php +++ b/Entity/Person.php @@ -5,12 +5,13 @@ namespace Chill\PersonBundle\Entity; /* * Chill is a software for social workers * - * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, + * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, + * * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as + * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. + * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -120,65 +121,65 @@ class Person { $opening = new \DateTime(); } - $this->open(new PersonHistoryFile($opening)); + $this->open(new AccompanyingPeriod($opening)); } /** * - * @param \Chill\PersonBundle\Entity\PersonHistoryFile $history - * @uses PersonHistoryFile::setPerson + * @param \Chill\PersonBundle\Entity\AccompanyingPeriod $period + * @uses AccompanyingPeriod::setPerson */ - public function addHistoryFile(PersonHistoryFile $history) { - $history->setPerson($this); - $this->history->add($history); + public function addAccompanyingPeriod(AccompanyingPeriod $period) { + $period->setPerson($this); + $this->history->add($period); } /** * set the Person file as open at the given date. * - * For updating a opening's date, you should update PersonHistoryFile instance + * For updating a opening's date, you should update AccompanyingPeriod instance * directly. * * For closing a file, @see this::close * - * To check if the Person and his history is consistent, use validation. + * To check if the Person and its accompanying period is consistent, use validation. * - * @param \DateTime $date + * @param \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod */ - public function open(PersonHistoryFile $accompanyingPeriod) { + public function open(AccompanyingPeriod $accompanyingPeriod) { $this->proxyHistoryOpenState = true; - $this->addHistoryFile($accompanyingPeriod); + $this->addAccompanyingPeriod($accompanyingPeriod); } /** * * Set the Person file as closed at the given date. * - * For update a closing date, you should update PersonHistoryFile instance + * For update a closing date, you should update AccompanyingPeriod instance * directly. * - * To check if the Person and his history are consistent, use validation. + * To check if the Person and its accompanying period are consistent, use validation. * - * @param PersonHistoryFile - * @throws \Exception if two lines of history are open. + * @param AccompanyingPeriod + * @throws \Exception if two lines of the accompanying period are open. */ - public function close(PersonHistoryFile $accompanyingPeriod) + public function close(AccompanyingPeriod $accompanyingPeriod) { $this->proxyHistoryOpenState = false; } /** * - * @return null|PersonHistoryFile + * @return null|AccompanyingPeriod */ - public function getCurrentHistory() { + public function getCurrentAccompanyingPeriod() { if ($this->proxyHistoryOpenState === false) { return null; } - foreach ($this->history as $history) { - if ($history->isOpen()) { - return $history; + foreach ($this->history as $period) { + if ($period->isOpen()) { + return $period; } } } @@ -187,19 +188,19 @@ class Person { * * @return \Doctrine\Common\Collections\ArrayCollection */ - public function getHistories() { + public function getAccompanyingPeriods() { return $this->history; } /** * - * @return PersonHistoryFile[] + * @return AccompanyingPeriod[] */ - public function getHistoriesOrdered() { - $histories = $this->getHistories()->toArray(); + public function getAccompanyingPeriodsOrdered() { + $periods = $this->getAccompanyingPeriods()->toArray(); //order by date : - usort($histories, function($a, $b) { + usort($periods, function($a, $b) { $dateA = $a->getDateOpening(); $dateB = $b->getDateOpening(); @@ -227,7 +228,7 @@ class Person { }); - return $histories; + return $periods; } public function isOpen() { @@ -370,10 +371,11 @@ class Person { * @return int */ public function getGenreNumeric() { - if ($this->getGenre() == self::GENRE_WOMAN) + if ($this->getGenre() == self::GENRE_WOMAN) { return 1; - else + } else { return 0; + } } /** @@ -390,11 +392,8 @@ class Person { if ($this->memo !== $memo) { $this->memo = $memo; - } - - return $this; } @@ -560,112 +559,96 @@ class Person { } // VALIDATION - public function isHistoryValid(ExecutionContextInterface $context) { - $r = $this->checkHistoryIsNotCovering(); - + public function isAccompanyingPeriodValid(ExecutionContextInterface $context) { + $r = $this->checkAccompanyingPeriodIsNotCovering(); if ($r !== true) { if ($r['result'] === self::ERROR_OPENING_NOT_CLOSED_IS_BEFORE_NEW_LINE) { $context->addViolationAt('history', - 'History not closed is before the new line', + 'Accompanying period not closed is before the new line', array() ); return; } - $context->addViolationAt('history', - 'Periods are collapsing', - array( - '%dateOpening%' => $r['dateOpening']->format('d-m-Y'), - '%dateClosing%' => $r['dateClosing']->format('d-m-Y'), - '%date%' => $r['date']->format('d-m-Y') - ) - ); - - - + $context->addViolationAt('history', 'Periods are collapsing', + array( + '%dateOpening%' => $r['dateOpening']->format('d-m-Y'), + '%dateClosing%' => $r['dateClosing']->format('d-m-Y'), + '%date%' => $r['date']->format('d-m-Y') + ) + ); } } - - const ERROR_OPENING_IS_INSIDE_CLOSING = 1; const ERROR_OPENING_NOT_CLOSED_IS_BEFORE_NEW_LINE = 2; - const ERROR_OPENING_NOT_CLOSE_IS_INSIDE_CLOSED_HISTORY_LINE = 3; + const ERROR_OPENING_NOT_CLOSE_IS_INSIDE_CLOSED_ACCOMPANYING_PERIOD_LINE = 3; const ERROR_OPENING_IS_BEFORE_OTHER_LINE_AND_CLOSED_IS_AFTER_THIS_LINE = 4; - public function checkHistoryIsNotCovering() { + public function checkAccompanyingPeriodIsNotCovering() + { + $periods = $this->getAccompanyingPeriodsOrdered(); - $histories = $this->getHistoriesOrdered(); - - - //check order : - $oldOpening = array(); - $oldClosing = array(); - $i = 0; + $i = 0; - foreach ($histories as $key => $history) { - //history is open : we must check the arent any history after - if ($history->isOpen()) { - foreach ($histories as $subKey => $against) { - //if we are checking the same, continue - if ($key === $subKey) { - continue; - } + foreach ($periods as $key => $period) { + //accompanying period is open : we must check the arent any period after + if ($period->isOpen()) { + foreach ($periods as $subKey => $against) { + //if we are checking the same, continue + if ($key === $subKey) { + continue; + } - if ($history->getDateOpening() > $against->getDateOpening() - && $history->getDateOpening() < $against->getDateOpening()) { - // the history date opening is inside another opening line - return array( - 'result' => self::ERROR_OPENING_NOT_CLOSE_IS_INSIDE_CLOSED_HISTORY_LINE, + if ($period->getDateOpening() > $against->getDateOpening() + && $period->getDateOpening() < $against->getDateOpening()) { + // the period date opening is inside another opening line + return array( + 'result' => self::ERROR_OPENING_NOT_CLOSE_IS_INSIDE_CLOSED_ACCOMPANYING_PERIOD_LINE, 'dateOpening' => $against->getDateOpening(), 'dateClosing' => $against->getDateClosing(), - 'date' => $history->getDateOpening() - ); + 'date' => $period->getDateOpening() + ); } - if ($history->getDateOpening() < $against->getDateOpening() - && $history->getDateClosing() > $against->getDateClosing()) { - // the history date opening is inside another opening line - return array( + if ($period->getDateOpening() < $against->getDateOpening() + && $period->getDateClosing() > $against->getDateClosing()) { + // the period date opening is inside another opening line + return array( 'result' => self::ERROR_OPENING_IS_BEFORE_OTHER_LINE_AND_CLOSED_IS_AFTER_THIS_LINE, 'dateOpening' => $against->getDateOpening(), 'dateClosing' => $against->getDateClosing(), - 'date' => $history->getDateOpening() - ); - } + 'date' => $period->getDateOpening() + ); + } - //if we have an aopening later... - if ($history->getDateOpening() < $against->getDateClosing()) { - return array( 'result' => self::ERROR_OPENING_NOT_CLOSED_IS_BEFORE_NEW_LINE, + //if we have an aopening later... + if ($period->getDateOpening() < $against->getDateClosing()) { + return array( 'result' => self::ERROR_OPENING_NOT_CLOSED_IS_BEFORE_NEW_LINE, 'dateOpening' => $against->getDateOpening(), 'dateClosing' => $against->getDateClosing(), - 'date' => $history->getDateOpening() - ); - } - - - } + 'date' => $period->getDateOpening() + ); + } + } + } else { + //we must check there is not covering lines - } else { - //we must check there is not covering lines - - foreach ($histories as $subKey => $against) { - //check if dateOpening is inside an `against` line - if ($history->getDateOpening() > $against->getDateOpening() - && $history->getDateOpening() < $against->getDateClosing()) { - return array( + foreach ($periods as $subKey => $against) { + //check if dateOpening is inside an `against` line + if ($period->getDateOpening() > $against->getDateOpening() + && $period->getDateOpening() < $against->getDateClosing()) { + return array( 'result' => self::ERROR_OPENING_IS_INSIDE_CLOSING, 'dateOpening' => $against->getDateOpening(), 'dateClosing' => $against->getDateClosing(), - 'date' => $history->getDateOpening() + 'date' => $period->getDateOpening() ); - } - } - } - } - - return true; - + } + } + } + } + return true; } } \ No newline at end of file diff --git a/Form/PersonHistoryFileType.php b/Form/AccompanyingPeriodType.php similarity index 81% rename from Form/PersonHistoryFileType.php rename to Form/AccompanyingPeriodType.php index 4274d4800..98a4b2a81 100644 --- a/Form/PersonHistoryFileType.php +++ b/Form/AccompanyingPeriodType.php @@ -8,17 +8,14 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; -class PersonHistoryFileType extends AbstractType +class AccompanyingPeriodType extends AbstractType { - - /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { - //if the period_action is close, date opening should not be seen if ($options['period_action'] !== 'close') { $builder @@ -39,7 +36,7 @@ class PersonHistoryFileType extends AbstractType ($options['period_action'] === 'close') OR ($options['period_action'] === 'update' AND !$accompanyingPeriod->isOpen()) - ){ + ) { $form->add('date_closing', 'date', array('required' => true, 'widget' => 'single_text')); $form->add('closingMotive', 'closing_motive'); @@ -58,15 +55,14 @@ class PersonHistoryFileType extends AbstractType public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => 'Chill\PersonBundle\Entity\PersonHistoryFile' + 'data_class' => 'Chill\PersonBundle\Entity\AccompanyingPeriod' )); $resolver - ->setRequired(array('period_action')) - ->addAllowedTypes(array('period_action' => 'string')) - ->addAllowedValues(array('period_action' => array( - 'update', 'open', 'close'))) - ; + ->setRequired(array('period_action')) + ->addAllowedTypes(array('period_action' => 'string')) + ->addAllowedValues(array('period_action' => array( + 'update', 'open', 'close'))); } /** @@ -74,6 +70,6 @@ class PersonHistoryFileType extends AbstractType */ public function getName() { - return 'cl_chill_personbundle_personhistoryfile'; + return 'chill_personbundle_accompanyingperiod'; } } diff --git a/Resources/config/doctrine/PersonHistoryFile.orm.yml b/Resources/config/doctrine/AccompanyingPeriod.yml similarity index 92% rename from Resources/config/doctrine/PersonHistoryFile.orm.yml rename to Resources/config/doctrine/AccompanyingPeriod.yml index 5307fb27d..59f658084 100644 --- a/Resources/config/doctrine/PersonHistoryFile.orm.yml +++ b/Resources/config/doctrine/AccompanyingPeriod.yml @@ -1,4 +1,4 @@ -Chill\PersonBundle\Entity\PersonHistoryFile: +Chill\PersonBundle\Entity\AccompanyingPeriod: type: entity table: person_history_file id: diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml index bc4e467b3..2b1f45f15 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -45,30 +45,30 @@ chill_person_search: order: 30 label: Search within persons -chill_person_history_list: - pattern: /{_locale}/person/{person_id}/history - defaults: { _controller: ChillPersonBundle:History:list } +chill_person_accompanying_period_list: + pattern: /{_locale}/person/{person_id}/accompanying-period + defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:list } # options: # menus: # person: # order: 100 # label: menu.person.history -chill_person_history_create: - pattern: /{_locale}/person/{person_id}/history/create - defaults: { _controller: ChillPersonBundle:History:create } +chill_person_accompanying_period_create: + pattern: /{_locale}/person/{person_id}/accompanying-period/create + defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:create } -chill_person_history_update: - pattern: /{_locale}/person/history/{history_id}/update - defaults: { _controller: ChillPersonBundle:History:update } +chill_person_accompanying_period_update: + pattern: /{_locale}/person/{person_id}/accompanying-period/{period_id}/update + defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:update } -chill_person_history_close: - pattern: /{_locale}/person/{person_id}/history/close - defaults: { _controller: ChillPersonBundle:History:close } +chill_person_accompanying_period_close: + pattern: /{_locale}/person/{person_id}/accompanying-period/close + defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:close } -chill_person_history_open: - pattern: /{_locale}/person/{person_id}/history/open - defaults: { _controller: ChillPersonBundle:History:open } +chill_person_accompanying_period_open: + pattern: /{_locale}/person/{person_id}/accompanying-period/open + defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:open } chill_person_admin: pattern: /{_locale}/admin/person diff --git a/Resources/config/validation.yml b/Resources/config/validation.yml index 667008b35..c3ae20aa5 100644 --- a/Resources/config/validation.yml +++ b/Resources/config/validation.yml @@ -30,7 +30,7 @@ Chill\PersonBundle\Entity\Person: traverse: true constraints: - Callback: - methods: [isHistoryValid] + methods: [isAccompanyingPeriodValid] groups: [history_consistent] Chill\PersonBundle\Entity\PersonHistoryFile: diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 5b3145ef5..e14fb5b5f 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -57,24 +57,13 @@ Reset: 'Remise à zéro' 'Search within persons': 'Recherche parmi les personnes' '%total% persons matching the search %pattern%': '{0} Aucune personne ne correspond aux termes de recherche "%pattern%" | {1} Une personne a été trouvée par la recherche "%pattern%" | ]1,Inf] %total% personnes correspondent aux termes de recherche "%pattern%".' 'Last opening since %last_opening%': 'Dernière ouverture le %last_opening%.' -'Close person history': Clotûrer -'Person history - %name%': 'Historique du dossier - %name%' +'Close person accompanying period': Clotûrer +'Person accompanying period - %name%': 'Historique du dossier - %name%' 'Opening date': 'Date d''ouverture' 'Closing date': 'Date de fermeture' 'Still open': 'Toujours en cours' -'Close history': 'Clôre le dossier' -'Open history': 'Ouvrir le dossier' -'Create history': 'Nouvel ouverture-fermeture à une autre date' +'Close accompanying period': 'Clôre le dossier' +'Open accompanying period': 'Ouvrir le dossier' +'Create accompanying period': 'Nouvel ouverture-fermeture à une autre date' 'Closing motive': 'Motif de clôture' -'History created!': 'Bravo ! Le dossier est maintenant ouvert.' -'Error! History not created!': 'Erreur ! Le dossier n''a pas pu être ouvert.' -'Updating history done': 'Bravo ! La mise à jour de l''historique a réussi !' -'Error when updating history': 'Les données introduites ne sont pas valides. Veuillez vérifier les informations ci-dessous.' -'Beware history is closed': 'Attention le dossier est déjà fermé' -'History closed!': 'Bravo ! Le dossier de %name% a été clotûré.' -'Error! History not closed!': 'Les informations introduites ne sont pas valides. Le dossier n''a pu être clos.' -'History closing form is not valide': 'Le formulaire n''est pas valide.' -'Error! History %name% is not closed ; it can be open': 'Le dossier de %name% n''est pas fermé. Il ne peut donc être ouvert.' -'History %name% opened!': 'Bravo ! Le dossier de %name a été ouvert' -'History not opened': 'Les informations introduites ne sont pas valides. Le dossier n''a pu être ouvert.' 'Person details': 'Détails de la personne' diff --git a/Resources/translations/messages.nl.yml b/Resources/translations/messages.nl.yml index 872d95dc7..e80490302 100644 --- a/Resources/translations/messages.nl.yml +++ b/Resources/translations/messages.nl.yml @@ -58,12 +58,12 @@ Reset: Delete '%total% persons matching the search %pattern%': '{0} Geen personen stemmen met het gezocht "%pattern%" overeen. | {1} Één persoon stemd met het gezocht "%pattern%" overeen. | ]1,Inf] %total% personen stemmen met het gezocht "%pattern%" overeen.' 'Person details': 'Details van de persoon' 'Last opening since %last_opening%': '__Last opening since %last_opening%' -'Close person history': '__Close person history' -'Person history - %name%': '__Person history - %name%' +'Close person accompanying period ': '__Close person accompanying period ' +'Person accompanying period - %name%': '__Person accompanying period - %name%' 'Opening date': '__Opening date' 'Closing date': '__Closing date' 'Still open': '__Still open' -'Create history': '__Create history' -'Close history': '__Close history' -'Open history': '__Open history' +'Create accompanying period': '__Create accompanying period' +'Close accompanying period ': '__Close accompanying period ' +'Open accompanying period': '__Open accompanying period' 'Unknown spoken languages': 'Spreektalen onbekend' diff --git a/Resources/views/History/form.html.twig b/Resources/views/AccompanyingPeriod/form.html.twig similarity index 77% rename from Resources/views/History/form.html.twig rename to Resources/views/AccompanyingPeriod/form.html.twig index 0fdaa7c9c..2e23c9832 100644 --- a/Resources/views/History/form.html.twig +++ b/Resources/views/AccompanyingPeriod/form.html.twig @@ -10,7 +10,7 @@ {{ form_start(form) }} {{ 'Last opening since %last_opening%'|trans( - { '%last_opening%' : history.dateOpening|localizeddate('long', 'none', app.request.locale) }) }} + { '%last_opening%' : accompanying_period.dateOpening|localizeddate('long', 'none', app.request.locale) }) }} {% if form.dateClosing is defined %} {{ form_row(form.dateClosing, {'label' : 'Closing date'} ) }} @@ -25,7 +25,7 @@ {{ form_rest(form) }}
- +
{{ form_end(form) }} diff --git a/Resources/views/History/list.html.twig b/Resources/views/AccompanyingPeriod/list.html.twig similarity index 55% rename from Resources/views/History/list.html.twig rename to Resources/views/AccompanyingPeriod/list.html.twig index 8f36d951d..0bf66624a 100644 --- a/Resources/views/History/list.html.twig +++ b/Resources/views/AccompanyingPeriod/list.html.twig @@ -1,8 +1,8 @@ {% extends "ChillPersonBundle::layout.html.twig" %} -{% set activeRouteKey = 'chill_person_history_list' %} +{% set activeRouteKey = 'chill_person_accompanying_period_list' %} -{% block title %}{{ 'Person history - %name%'|trans({ '%name%' : person.__toString}) }}{% endblock title %} +{% block title %}{{ 'Person accompanying period - %name%'|trans({ '%name%' : person.__toString}) }}{% endblock title %} {% block personcontent %} @@ -16,28 +16,28 @@ {% set i = 0 %} - {% for history in histories %} + {% for accompanying_period in accompanying_periods %} - + - {% if history.memo is not empty %} + {% if accompanying_period.memo is not empty %} {% endif %} @@ -49,8 +49,8 @@
@@ -63,12 +63,12 @@ {% endif %}{% endspaceless %}"> {% spaceless %} {% if person.isOpen == true %} - - {{'Close history'|trans }} + + {{'Close accompanying period'|trans }} {% else %} - - {{'Open history'|trans }} + + {{'Open accompanying period'|trans }} {% endif %} {% endspaceless %} diff --git a/Tests/Entity/AccompanyingPeriodTest.php b/Tests/Entity/AccompanyingPeriodTest.php new file mode 100644 index 000000000..99bd24677 --- /dev/null +++ b/Tests/Entity/AccompanyingPeriodTest.php @@ -0,0 +1,101 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\PersonBundle\Tests\Entity; + +use Chill\PersonBundle\Entity\AccompanyingPeriod; + +class AccompanyingPeriodTest extends \PHPUnit_Framework_TestCase +{ + public function testClosingIsAfterOpeningConsistency() + { + $datetime1 = new \DateTime('now'); + $datetime2 = new \DateTime('tomorrow'); + + $period = new AccompanyingPeriod($datetime1); + $period->setDateClosing($datetime2); + + $r = $period->isClosingAfterOpening(); + + $this->assertTrue($r); + } + + public function testClosingIsBeforeOpeningConsistency() { + $datetime1 = new \DateTime('tomorrow'); + $datetime2 = new \DateTime('now'); + + $period = new AccompanyingPeriod($datetime1); + $period->setDateClosing($datetime2); + + $this->assertFalse($period->isClosingAfterOpening()); + } + + public function testClosingEqualOpening() { + $datetime = new \DateTime('now'); + + $period = new AccompanyingPeriod($datetime); + $period->setDateClosing($datetime); + + $this->assertTrue($period->isClosingAfterOpening()); + } + + public function testIsOpen() { + $period = new AccompanyingPeriod(new \DateTime()); + + $this->assertTrue($period->isOpen()); + } + + public function testIsClosed() { + $period = new AccompanyingPeriod(new \DateTime()); + $period->setDateClosing(new \DateTime('tomorrow')); + + $this->assertFalse($period->isOpen()); + } + + /** + * This test seems only to test ordering datetime... Maybe delete ? + */ + public function testOrder() { + $d = new \DateTime(); $d->setDate(2013, 2, 1); + $g = new \DateTime(); $g->setDate(2013, 4, 1); + $f = new \DateTime(); $f->setDate(2013, 1, 1); + $e = new \DateTime(); $e->setDate(2013,3,1); + + $a = array($d, $g, $f, $e); + + usort($a, function($a, $b) { + if ($a === $b) { + return 0; + } + + if ($a < $b) { + return -1; + } else { + return 1; + } + }); + + $date = $a[0]->format('Y-m-d'); + + $this->assertEquals($date, '2013-01-01'); + } +} \ No newline at end of file diff --git a/Tests/Entity/HistoryFileTest.php b/Tests/Entity/HistoryFileTest.php deleted file mode 100644 index 095a3cf6a..000000000 --- a/Tests/Entity/HistoryFileTest.php +++ /dev/null @@ -1,103 +0,0 @@ -setDateClosing($datetime2); - - - $r = $history->isClosingAfterOpening(); - - $this->assertTrue($r); - } - - public function testClosingIsBeforeOpeningConsistency() { - $datetime1 = new \DateTime('tomorrow'); - - - $history = new PersonHistoryFile($datetime1); - - - $datetime2 = new \DateTime('now'); - - $history->setDateClosing($datetime2); - - $this->assertFalse($history->isClosingAfterOpening()); - } - - public function testClosingEqualOpening() { - $datetime = new \DateTime('now'); - - $history = new PersonHistoryFile($datetime); - $history->setDateClosing($datetime); - - $this->assertTrue($history->isClosingAfterOpening()); - } - - public function testIsOpen() { - $history = new PersonHistoryFile(new \DateTime()); - - $this->assertTrue($history->isOpen()); - } - - public function testIsClosed() { - $history = new PersonHistoryFile(new \DateTime()); - - $history->setDateClosing(new \DateTime('tomorrow')); - - $this->assertFalse($history->isOpen()); - } - - - - - - - - /** - * This test seems only to test ordering datetime... Maybe delete ? - */ - public function testOrder() { - $d = new \DateTime(); $d->setDate(2013, 2, 1); - $g = new \DateTime(); $g->setDate(2013, 4, 1); - $f = new \DateTime(); $f->setDate(2013, 1, 1); - $e = new \DateTime(); $e->setDate(2013,3,1); - - $a = array($d, $g, $f, $e); - - - usort($a, function($a, $b) { - if ($a === $b) { - return 0; - } - - if ($a < $b) { - return -1; - } else { - return 1; - } - }); - - - $date = $a[0]->format('Y-m-d'); - - $this->assertEquals($date, '2013-01-01'); - - } - - - -} diff --git a/Tests/Entity/PersonTest.php b/Tests/Entity/PersonTest.php index f2b721af9..5a7eef2f4 100644 --- a/Tests/Entity/PersonTest.php +++ b/Tests/Entity/PersonTest.php @@ -2,7 +2,7 @@ /* * Chill is a software for social workers - * Copyright (C) 2014 Julien Fastré + * Copyright (C) 2014-2015 Champs-Libres Coopérative * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -21,7 +21,7 @@ namespace Chill\PersonBundle\Tests\Entity; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Entity\PersonHistoryFile; +use Chill\PersonBundle\Entity\AccompanyingPeriod; /** * Unit tests on person @@ -30,106 +30,102 @@ use Chill\PersonBundle\Entity\PersonHistoryFile; */ class PersonTest extends \PHPUnit_Framework_TestCase { - public function testGetCurrentHistory() + public function testGetCurrentAccompanyingPeriod() { $d = new \DateTime('yesterday'); $p = new Person($d); - $history = $p->getCurrentHistory(); + $period = $p->getCurrentAccompanyingPeriod(); - $this->assertInstanceOf('Chill\PersonBundle\Entity\PersonHistoryFile', $history); - $this->assertTrue($history->isOpen()); - $this->assertEquals($d, $history->getDateOpening()); + $this->assertInstanceOf('Chill\PersonBundle\Entity\AccompanyingPeriod', $period); + $this->assertTrue($period->isOpen()); + $this->assertEquals($d, $period->getDateOpening()); //close and test - $history->setDateClosing(new \DateTime('tomorrow')); + $period->setDateClosing(new \DateTime('tomorrow')); - $shouldBeNull = $p->getCurrentHistory(); + $shouldBeNull = $p->getCurrentAccompanyingPeriod(); $this->assertNull($shouldBeNull); } - public function testHistoryOrderWithUnorderedHistory() { + public function testAccompanyingPeriodOrderWithUnorderedAccompanyingPeriod() { $d = new \DateTime(); $d->setDate(2013, 2, 1); $p = new Person($d); $e = new \DateTime(); $e->setDate(2013, 3, 1); - $history = $p->getCurrentHistory()->setDateClosing($e); - $p->close($history); + $period = $p->getCurrentAccompanyingPeriod()->setDateClosing($e); + $p->close($period); $f = new \DateTime(); $f->setDate(2013, 1, 1); - $p->open(new PersonHistoryFile($f)); + $p->open(new AccompanyingPeriod($f)); $g = new \DateTime(); $g->setDate(2013, 4, 1); - $history = $p->getCurrentHistory()->setDateClosing($g); - $p->close($history); + $period = $p->getCurrentAccompanyingPeriod()->setDateClosing($g); + $p->close($period); - $r = $p->getHistoriesOrdered(); + $r = $p->getAccompanyingPeriodsOrdered(); $date = $r[0]->getDateOpening()->format('Y-m-d'); - $this->assertEquals($date, '2013-01-01'); } - public function testHistoryOrderSameDateOpening() { + public function testAccompanyingPeriodOrderSameDateOpening() { $d = new \DateTime(); $d->setDate(2013, 2, 1); $p = new Person($d); $e = new \DateTime(); $e->setDate(2013, 3, 1); - $history = $p->getCurrentHistory()->setDateClosing($e); - $p->close($history); + $period = $p->getCurrentAccompanyingPeriod()->setDateClosing($e); + $p->close($period); $f = new \DateTime(); $f->setDate(2013, 2, 1); - $p->open(new PersonHistoryFile($f)); + $p->open(new AccompanyingPeriod($f)); $g = new \DateTime(); $g->setDate(2013, 4, 1); - $history = $p->getCurrentHistory()->setDateClosing($g); - $p->close($history); + $period = $p->getCurrentAccompanyingPeriod()->setDateClosing($g); + $p->close($period); - $r = $p->getHistoriesOrdered(); + $r = $p->getAccompanyingPeriodsOrdered(); $date = $r[0]->getDateClosing()->format('Y-m-d'); - $this->assertEquals($date, '2013-03-01'); } - public function testDateCoveringWithCoveringHistory() { + public function testDateCoveringWithCoveringAccompanyingPeriod() { $d = new \DateTime(); $d->setDate(2013, 2, 1); $p = new Person($d); $e = new \DateTime(); $e->setDate(2013, 3, 1); - $history = $p->getCurrentHistory()->setDateClosing($e); - $p->close($history); + $period = $p->getCurrentAccompanyingPeriod()->setDateClosing($e); + $p->close($period); $f = new \DateTime(); $f->setDate(2013, 1, 1); - $p->open(new PersonHistoryFile($f)); + $p->open(new AccompanyingPeriod($f)); $g = new \DateTime(); $g->setDate(2013, 4, 1); - $history = $p->getCurrentHistory()->setDateClosing($g); - $p->close($history); + $period = $p->getCurrentAccompanyingPeriod()->setDateClosing($g); + $p->close($period); - $r = $p->checkHistoryIsNotCovering(); + $r = $p->checkAccompanyingPeriodIsNotCovering(); $this->assertEquals($r['result'], Person::ERROR_OPENING_IS_INSIDE_CLOSING); } - - public function testNotOpenAFileReOpenedLater() { $d = new \DateTime(); $d->setDate(2013, 2, 1); @@ -137,15 +133,14 @@ class PersonTest extends \PHPUnit_Framework_TestCase $e = new \DateTime(); $e->setDate(2013, 3, 1); - $history = $p->getCurrentHistory()->setDateClosing($e); - $p->close($history); + $period = $p->getCurrentAccompanyingPeriod()->setDateClosing($e); + $p->close($period); $f = new \DateTime(); $f->setDate(2013, 1, 1); - $p->open(new PersonHistoryFile($f)); - + $p->open(new AccompanyingPeriod($f)); - $r = $p->checkHistoryIsNotCovering(); + $r = $p->checkAccompanyingPeriodIsNotCovering(); $this->assertEquals($r['result'], Person::ERROR_OPENING_NOT_CLOSED_IS_BEFORE_NEW_LINE); }
{{ history.dateOpening|localizeddate('long', 'none', app.request.locale) }}{{ accompanying_period.dateOpening|localizeddate('long', 'none', app.request.locale) }} {% spaceless %} - {% if history.isOpen %} + {% if accompanying_period.isOpen %} {{ 'Still open'|trans }} {% else %} - {{ history.dateClosing|localizeddate('long', 'none', app.request.locale) }} + {{ accompanying_period.dateClosing|localizeddate('long', 'none', app.request.locale) }} {% endif %} {% endspaceless %}
-
{{ history.memo }}
+
{{ accompanying_period.memo }}