fix folder name

This commit is contained in:
2021-03-18 13:37:13 +01:00
parent a2f6773f5a
commit eaa0ad925f
1578 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,330 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <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 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\Context\ExecutionContextInterface;
use Chill\MainBundle\Entity\User;
/**
* AccompanyingPeriod
*
* @ORM\Entity()
* @ORM\Table(name="chill_person_accompanying_period")
*/
class AccompanyingPeriod
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var \DateTime
*
* @ORM\Column(type="date")
*/
private $openingDate;
/**
* @var \DateTime
*
* @ORM\Column(type="date", nullable=true)
*/
private $closingDate = null;
/**
* @var string
*
* @ORM\Column(type="text")
*/
private $remark = '';
/**
* @var Person
*
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\Person",
* inversedBy="accompanyingPeriods",
* cascade={"refresh"})
*/
private $person;
/**
* @var AccompanyingPeriod\ClosingMotive
*
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
* @ORM\JoinColumn(nullable=true)
*/
private $closingMotive = null;
/**
* The user making the accompanying
* @var User
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* AccompanyingPeriod constructor.
*
* @param \DateTime $dateOpening
* @uses AccompanyingPeriod::setClosingDate()
*/
public function __construct(\DateTime $dateOpening) {
$this->setOpeningDate($dateOpening);
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set openingDate
*
* @param \DateTime $dateOpening
* @return AccompanyingPeriod
*/
public function setOpeningDate($openingDate)
{
$this->openingDate = $openingDate;
return $this;
}
/**
* Get openingDate
*
* @return \DateTime
*/
public function getOpeningDate()
{
return $this->openingDate;
}
/**
* Set closingDate
*
* For closing a Person file, you should use Person::setClosed instead.
*
* @param \DateTime $dateClosing
* @return AccompanyingPeriod
*
*/
public function setClosingDate($closingDate)
{
$this->closingDate = $closingDate;
return $this;
}
/**
* Get closingDate
*
* @return \DateTime
*/
public function getClosingDate()
{
return $this->closingDate;
}
/**
* @return boolean
*/
public function isOpen(): bool
{
if ($this->getOpeningDate() > new \DateTime('now')) {
return false;
}
if ($this->getClosingDate() === null) {
return true;
} else {
return false;
}
}
/**
* Set remark
*
* @param string $remark
* @return AccompanyingPeriod
*/
public function setRemark($remark)
{
if ($remark === null) {
$remark = '';
}
$this->remark = $remark;
return $this;
}
/**
* Get remark
*
* @return string
*/
public function getRemark()
{
return $this->remark;
}
/**
* Set person.
*
* For consistency, you should use Person::addAccompanyingPeriod instead.
*
* @param Person $person
* @return AccompanyingPeriod
* @see Person::addAccompanyingPeriod
*/
public function setPerson(Person $person = null)
{
$this->person = $person;
return $this;
}
/**
* Get person
*
* @return Person
*/
public function getPerson()
{
return $this->person;
}
/**
* @return AccompanyingPeriod\ClosingMotive
*/
public function getClosingMotive()
{
return $this->closingMotive;
}
/**
* @param AccompanyingPeriod\ClosingMotive|null $closingMotive
* @return $this
*/
public function setClosingMotive(AccompanyingPeriod\ClosingMotive $closingMotive = null)
{
$this->closingMotive = $closingMotive;
return $this;
}
/**
* If the period can be reopened.
*
* This function test if the period is closed and if the period is the last
* for the associated person
*
* @return boolean
*/
public function canBeReOpened()
{
if ($this->isOpen() === true) {
return false;
}
$periods = $this->getPerson()->getAccompanyingPeriodsOrdered();
return end($periods) === $this;
}
/**
*/
public function reOpen()
{
$this->setClosingDate(null);
$this->setClosingMotive(null);
}
/**
* Validation function
*/
public function isDateConsistent(ExecutionContextInterface $context)
{
if ($this->isOpen()) {
return;
}
if (! $this->isClosingAfterOpening()) {
$context->buildViolation('The date of closing is before the date of opening')
->atPath('dateClosing')
->addViolation();
}
}
/**
* Returns true if the closing date is after the opening date.
*
* @return boolean
*/
public function isClosingAfterOpening()
{
$diff = $this->getOpeningDate()->diff($this->getClosingDate());
if ($diff->invert === 0) {
return true;
} else {
return false;
}
}
/**
* @return User|null
*/
function getUser(): ?User
{
return $this->user;
}
/**
* @param User $user
* @return AccompanyingPeriod
*/
function setUser(User $user): self
{
$this->user = $user;
return $this;
}
}

View File

@@ -0,0 +1,276 @@
<?php
/*
*
* Copyright (C) 2014-2020, 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\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/**
* ClosingMotive give an explanation why we closed the Accompanying period
*
* @ORM\Entity(
* repositoryClass="Chill\PersonBundle\Repository\ClosingMotiveRepository")
* @ORM\Table(name="chill_person_closingmotive")
*/
class ClosingMotive
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var array
*
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var boolean
*
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* @var self
*
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* inversedBy="children")
*/
private $parent = null;
/**
* Child Accompanying periods
* @var Collection
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* mappedBy="parent")
*/
private $children;
/**
* @var float
*
* @ORM\Column(type="float")
*/
private $ordering = 0.0;
/**
* ClosingMotive constructor.
*/
public function __construct()
{
$this->children = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param array $name
*
* @return ClosingMotive
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* @return bool
*/
public function isActive(): bool
{
return $this->active;
}
/**
* @param bool $active
* @return $this
*/
public function setActive(bool $active)
{
$this->active = $active;
if ($this->active === FALSE) {
foreach ($this->getChildren() as $child) {
$child->setActive(FALSE);
}
}
return $this;
}
/**
* @return ClosingMotive
*/
public function getParent()
{
return $this->parent;
}
/**
* @return Collection
*/
public function getChildren(): Collection
{
return $this->children;
}
/**
* @param ClosingMotive|null $parent
* @return ClosingMotive
*/
public function setParent(?ClosingMotive $parent): ClosingMotive
{
$this->parent = $parent;
if (NULL !== $parent) {
//$parent->addChildren($this);
}
return $this;
}
/**
* @param Collection $children
* @return ClosingMotive
*/
public function setChildren(Collection $children): ClosingMotive
{
$this->children = $children;
return $this;
}
/**
* @param ClosingMotive $child
* @return ClosingMotive
*/
public function addChildren(ClosingMotive $child): ClosingMotive
{
if ($this->children->contains($child)) {
return $this;
}
$this->children->add($child);
$child->setParent($this);
return $this;
}
/**
* @param ClosingMotive $child
* @return ClosingMotive
*/
public function removeChildren(ClosingMotive $child): ClosingMotive
{
if ($this->children->removeElement($child)) {
$child->setParent(null);
}
return $this;
}
/**
* @return float
*/
public function getOrdering(): float
{
return $this->ordering;
}
/**
* @param float $ordering
* @return $this
*/
public function setOrdering(float $ordering)
{
$this->ordering = $ordering;
return $this;
}
/**
* @return bool
*/
public function isChild(): bool
{
return $this->parent !== null;
}
/**
* @return bool
*/
public function isParent(): bool
{
return $this->children->count() > 0;
}
/**
* @return bool
*/
public function isLeaf(): bool
{
return $this->children->count() === 0;
}
/**
* @return bool
*/
public function hasParent(): bool
{
return $this->parent !== null;
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2019, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <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 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 Chill\PersonBundle\Entity\Person;
/**
* Interface which applies to entities which are associated to a single person
*
*/
interface HasPerson
{
public function setPerson(Person $person = null): HasPerson;
public function getPerson(): ?Person;
}

View File

@@ -0,0 +1,92 @@
<?php
/*
*
* 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;
/**
* MaritalStatus
*
* @ORM\Entity()
* @ORM\Table(name="chill_person_marital_status")
* @ORM\HasLifecycleCallbacks()
*/
class MaritalStatus
{
/**
* @var string
*
* @ORM\Id()
* @ORM\Column(type="string", length=7)
*/
private $id;
/**
* @var string array
* @ORM\Column(type="json_array")
*/
private $name;
/**
* Get id
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Set id
*
* @param string $id
* @return MaritalStatus
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Set name
*
* @param string array $name
* @return MaritalStatus
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string array
*/
public function getName()
{
return $this->name;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,125 @@
<?php
namespace Chill\PersonBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* PersonAltName
*
* @ORM\Table(name="chill_person_alt_name")
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonAltNameRepository")
*/
class PersonAltName
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="key", type="string", length=255)
*/
private $key;
/**
* @var string
*
* @ORM\Column(name="label", type="text")
*/
private $label;
/**
* @var Person
*
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\Person",
* inversedBy="altNames"
* )
*/
private $person;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set key.
*
* @param string $key
*
* @return PersonAltName
*/
public function setKey($key)
{
$this->key = $key;
return $this;
}
/**
* Get key.
*
* @return string
*/
public function getKey()
{
return $this->key;
}
/**
* Set label.
*
* @param string $label
*
* @return PersonAltName
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* Get label.
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* @return Person
*/
public function getPerson(): Person
{
return $this->person;
}
/**
* @param Person|null $person
* @return $this
*/
public function setPerson(?Person $person = null)
{
$this->person = $person;
return $this;
}
}