Commit 8d5d2189 authored by Marc Ducobu's avatar Marc Ducobu

PersonHistoryFile -> AccompanyingPeriod - refs #275

parent 58d05123
......@@ -3,7 +3,7 @@
/*
* Chill is a software for social workers
*
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* 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();
......
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>
*
* 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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
}
This diff is collapsed.
......@@ -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';
}
}
Chill\PersonBundle\Entity\PersonHistoryFile:
Chill\PersonBundle\Entity\AccompanyingPeriod:
type: entity
table: person_history_file
id:
......
......@@ -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
......
......@@ -30,7 +30,7 @@ Chill\PersonBundle\Entity\Person:
traverse: true
constraints:
- Callback:
methods: [isHistoryValid]
methods: [isAccompanyingPeriodValid]
groups: [history_consistent]
Chill\PersonBundle\Entity\PersonHistoryFile:
......
......@@ -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 <em>%name%</em> 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 <em>%name%</em> n''est pas fermé. Il ne peut donc être ouvert.'
'History %name% opened!': 'Bravo ! Le dossier de <em>%name</em> 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'
......@@ -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'
......@@ -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) }}
<div class="medium btn danger icon-right entypo icon-lock">
<button type="submit">{{ 'Close person history'|trans }}</button>
<button type="submit">{{ 'Close person accompanying period'|trans }}</button>
</div>
{{ form_end(form) }}
......
{% 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 %}
<table class="rounded">
......@@ -16,28 +16,28 @@
</thead>
<tbody>
{% set i = 0 %}
{% for history in histories %}
{% for accompanying_period in accompanying_periods %}
<tr class="{% if i is not even %}striped{% endif %}">
<td>{{ history.dateOpening|localizeddate('long', 'none', app.request.locale) }}</td>
<td>{{ accompanying_period.dateOpening|localizeddate('long', 'none', app.request.locale) }}</td>
<td>{% 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 %}</td>
<td>
<div class="small warning btn icon-right entypo icon-pencil">
<a href="{{ path('chill_person_history_update', {'person_id' : person.id, 'history_id' : history.id } ) }}">{{ 'Edit'|trans }}</a>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}">{{ 'Edit'|trans }}</a>
</div>
</td>
</tr>
{% if history.memo is not empty %}
{% if accompanying_period.memo is not empty %}
<tr class="{% if i is not even %}striped{% endif %}">
<td colspan="3">
<pre>{{ history.memo }}</pre>
<pre>{{ accompanying_period.memo }}</pre>
</td>
</tr>
{% endif %}
......@@ -49,8 +49,8 @@
<div class="form_control">
<div class="btn small warning icon-right entypo icon-plus">
<a href="{{ path ('chill_person_history_create', {'person_id' : person.id } ) }}">
{{ 'Create history'|trans }}
<a href="{{ path ('chill_person_accompanying_period_create', {'person_id' : person.id } ) }}">
{{ 'Create accompanying period'|trans }}
</a>
</div>
......@@ -63,12 +63,12 @@
{% endif %}{% endspaceless %}">
{% spaceless %}
{% if person.isOpen == true %}
<a href="{{ path('chill_person_history_close', {'person_id' : person.id}) }}">
{{'Close history'|trans }}
<a href="{{ path('chill_person_accompanying_period_close', {'person_id' : person.id}) }}">
{{'Close accompanying period'|trans }}
</a>
{% else %}
<a href="{{ path('chill_person_history_open', {'person_id' : person.id} ) }}">
{{'Open history'|trans }}
<a href="{{ path('chill_person_accompanying_period_open', {'person_id' : person.id} ) }}">
{{'Open accompanying period'|trans }}
</a>
{% endif %}
{% endspaceless %}
......
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>
*
* 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 <http://www.gnu.org/licenses/>.
*/
namespace Chill\PersonBundle\Tests\Entity;
use Chill\PersonBundle\Entity\PersonHistoryFile;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
class HistoryFileTest extends \PHPUnit_Framework_TestCase
class AccompanyingPeriodTest extends \PHPUnit_Framework_TestCase
{
public function testClosingIsAfterOpeningConsistency()
{
$datetime1 = new \DateTime('now');
$history = new PersonHistoryFile($datetime1);
$datetime2 = new \DateTime('tomorrow');
$history->setDateClosing($datetime2);
$period = new AccompanyingPeriod($datetime1);
$period->setDateClosing($datetime2);
$r = $history->isClosingAfterOpening();
$r = $period->isClosingAfterOpening();
$this->assertTrue($r);
}
public function testClosingIsBeforeOpeningConsistency() {
$datetime1 = new \DateTime('tomorrow');
$history = new PersonHistoryFile($datetime1);
$datetime2 = new \DateTime('now');
$history->setDateClosing($datetime2);
$period = new AccompanyingPeriod($datetime1);
$period->setDateClosing($datetime2);
$this->assertFalse($history->isClosingAfterOpening());
$this->assertFalse($period->isClosingAfterOpening());
}
public function testClosingEqualOpening() {
$datetime = new \DateTime('now');
$history = new PersonHistoryFile($datetime);
$history->setDateClosing($datetime);
$period = new AccompanyingPeriod($datetime);
$period->setDateClosing($datetime);
$this->assertTrue($history->isClosingAfterOpening());
$this->assertTrue($period->isClosingAfterOpening());
}
public function testIsOpen() {
$history = new PersonHistoryFile(new \DateTime());
$period = new AccompanyingPeriod(new \DateTime());
$this->assertTrue($history->isOpen());
$this->assertTrue($period->isOpen());
}
public function testIsClosed() {
$history = new PersonHistoryFile(new \DateTime());
$period = new AccompanyingPeriod(new \DateTime());
$period->setDateClosing(new \DateTime('tomorrow'));
$history->setDateClosing(new \DateTime('tomorrow'));
$this->assertFalse($history->isOpen());
$this->assertFalse($period->isOpen());
}
/**
* This test seems only to test ordering datetime... Maybe delete ?
*/
......@@ -77,7 +81,6 @@ class HistoryFileTest extends \PHPUnit_Framework_TestCase
$e = new \DateTime(); $e->setDate(2013,3,1);
$a = array($d, $g, $f, $e);
usort($a, function($a, $b) {
if ($a === $b) {
......@@ -91,13 +94,8 @@ class HistoryFileTest extends \PHPUnit_Framework_TestCase
}
});
$date = $a[0]->format('Y-m-d');
$this->assertEquals($date, '2013-01-01');
}
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
/*
* Chill is a software for social workers
* Copyright (C) 2014 Julien Fastré <julien.fastre@champs-libres.coop>
* Copyright (C) 2014-2015 Champs-Libres Coopérative <info@champs-libres.coop>
*
* 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();