Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' into APOLLO-1978
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyquinton committed May 22, 2014
2 parents 4bee5f0 + f6d3d81 commit c3ffaa9
Show file tree
Hide file tree
Showing 34 changed files with 452 additions and 183 deletions.
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/Opg/Common/Model/Entity/Traits/HasSystemStatus.php
Expand Up @@ -2,7 +2,6 @@
namespace Opg\Common\Model\Entity\Traits;

use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Type;

/**
* Class HasSystemStatus
Expand All @@ -13,7 +12,6 @@ trait HasSystemStatus
/**
* @ORM\Column(type = "boolean",options={"default":1})
* @var bool
* @Type("boolean")
*/
protected $systemStatus = true;

Expand Down
2 changes: 1 addition & 1 deletion src/Opg/Common/Model/Entity/Traits/Time.php
Expand Up @@ -2,9 +2,9 @@
namespace Opg\Common\Model\Entity\Traits;

use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\Type;
use Opg\Common\Model\Entity\DateFormat as OPGDateFormat;

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Opg/Common/Model/Entity/Traits/UniqueIdentifier.php
@@ -1,7 +1,6 @@
<?php
namespace Opg\Common\Model\Entity\Traits;

use JMS\Serializer\Annotation\Type;
use Doctrine\ORM\Mapping as ORM;

/**
* Class UniqueIdentifier
Expand All @@ -15,7 +14,6 @@ trait UniqueIdentifier
*
* @ORM\Column(type = "bigint", options = {"unsigned": true}, unique = true)
* @var int
* @Type("integer")
* @Groups({"api-poa-list","api-task-list"})
*/
protected $uId;
Expand Down
9 changes: 0 additions & 9 deletions src/Opg/Core/Model/Entity/Address/Address.php
Expand Up @@ -9,7 +9,6 @@
use Zend\InputFilter\Factory as InputFactory;
use Opg\Common\Model\Entity\Traits\InputFilter as InputFilterTrait;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\Exclude;

/**
Expand Down Expand Up @@ -40,57 +39,49 @@ class Address implements EntityInterface, \IteratorAggregate
/**
* @ORM\Column(type = "integer", options = {"unsigned": true}) @ORM\GeneratedValue(strategy = "AUTO") @ORM\Id
* @var integer
* @Type("integer")
*/
protected $id;

/**
* @ORM\ManyToOne(targetEntity="Opg\Core\Model\Entity\Person\Person", inversedBy="addresses")
* @ORM\JoinColumn(name="person_id", referencedColumnName="id")
* @var \Opg\Core\Model\Entity\Person\Person
* @Type("Opg\Core\Model\Entity\Person\Person")
*/
protected $person;

/**
* @ORM\Column(type = "json_array", name="address_lines")
* @var array
* @Type("array")
*/
protected $addressLines = [];

/**
* @ORM\Column(type = "string")
* @var string
* @Type("string")
*/
protected $town = '';

/**
* @ORM\Column(type = "string")
* @var string
* @Type("string")
*/
protected $county = '';

/**
* @ORM\Column(type = "string")
* @var string
* @Type("string")
*/
protected $postcode = '';

/**
* @ORM\Column(type = "string")
* @var string
* @Type("string")
*/
protected $country = '';

/**
* @ORM\Column(type = "string")
* @var string
* @Type("string")
*/
protected $type = 'Primary';

Expand Down
28 changes: 15 additions & 13 deletions src/Opg/Core/Model/Entity/CaseItem/CaseItem.php
Expand Up @@ -16,17 +16,16 @@
use Opg\Common\Model\Entity\Traits\ToArray;
use Opg\Common\Model\Entity\Traits\UniqueIdentifier;
use Opg\Core\Model\Entity\CaseItem\Document\Document;
use Opg\Core\Model\Entity\CaseItem\Lpa\Party\Attorney;
use Opg\Core\Model\Entity\CaseItem\Note\Note;
use Opg\Core\Model\Entity\CaseItem\Task\Task;
use Opg\Core\Model\Entity\CaseItem\Validation\InputFilter\CaseItemFilter;
use Opg\Core\Model\Entity\Person\Person;
use Opg\Core\Model\Entity\User\User;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\ReadOnly;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\Type;
use Opg\Common\Model\Entity\DateFormat as OPGDateFormat;

/**
Expand Down Expand Up @@ -58,9 +57,10 @@ abstract class CaseItem implements EntityInterface, \IteratorAggregate, CaseItem


/**
* @ORM\Column(type = "integer") @ORM\GeneratedValue(strategy = "AUTO") @ORM\Id
* @var int autoincrementID
* @ORM\Column(type = "integer") @ORM\GeneratedValue(strategy = "AUTO")
* @ORM\Id
* @Type("integer")
* @var int autoincrementID
* @Serializer\Groups({"api-poa-list","api-task-list"})
*/
protected $id;
Expand All @@ -76,7 +76,7 @@ abstract class CaseItem implements EntityInterface, \IteratorAggregate, CaseItem
/**
* @ORM\Column(type = "integer", nullable=true)
* @var int
* @Type("string")
* @Type("integer")
* @Accessor(getter="getApplicationType",setter="setApplicationType")
* @Serializer\Groups({"api-poa-list","api-task-list"})
*/
Expand Down Expand Up @@ -153,7 +153,6 @@ abstract class CaseItem implements EntityInterface, \IteratorAggregate, CaseItem
/**
* @ORM\ManyToMany(cascade={"persist"}, targetEntity = "Opg\Core\Model\Entity\CaseItem\Task\Task", fetch="EAGER")
* @var ArrayCollection
* @Type("ArrayCollection<Opg\Core\Model\Entity\CaseItem\Task\Task>")
* @ReadOnly
* @Serializer\Groups("api-poa-list")
*/
Expand All @@ -162,23 +161,20 @@ abstract class CaseItem implements EntityInterface, \IteratorAggregate, CaseItem
/**
* @ORM\ManyToMany(targetEntity = "Opg\Core\Model\Entity\CaseItem\Note\Note", cascade={"persist"})
* @var ArrayCollection
* @Type("ArrayCollection<Opg\Core\Model\Entity\CaseItem\Note\Note>")
* @ReadOnly
*/
protected $notes;

/**
* @ORM\ManyToMany(targetEntity = "Opg\Core\Model\Entity\CaseItem\Document\Document", cascade={"persist"})
* @var ArrayCollection
* @Type("ArrayCollection<Opg\Core\Model\Entity\CaseItem\Document\Document>")
* @ReadOnly
*/
protected $documents;

/**
* @ORM\ManyToMany(targetEntity = "Opg\Core\Model\Entity\Correspondence\Correspondence", cascade={"persist"})
* @var ArrayCollection
* @Type("ArrayCollection<Opg\Core\Model\Entity\Correspondence\Correspondence>")
* @ReadOnly
*/
protected $correspondence;
Expand All @@ -203,6 +199,7 @@ abstract class CaseItem implements EntityInterface, \IteratorAggregate, CaseItem
* @var int
* @ReadOnly
* @Accessor(getter="getRagRating")
* @Serializer\Groups("api-poa-list")
*/
protected $ragRating;

Expand All @@ -211,6 +208,7 @@ abstract class CaseItem implements EntityInterface, \IteratorAggregate, CaseItem
* @var int
* @ReadOnly
* @Accessor(getter="getRagTotal")
* @Serializer\Groups("api-poa-list")
*/
protected $ragTotal;

Expand Down Expand Up @@ -737,9 +735,11 @@ public function getRagRating()
'3' => 0
);

if(!empty($tasks)) {
if(!empty($this->tasks)) {
foreach ($this->tasks as $taskItem) {
$rag[$taskItem->getRagRating()]++;
if($taskItem->getStatus() !== 'Completed') {
$rag[$taskItem->getRagRating()]++;
}
}
}

Expand All @@ -760,9 +760,11 @@ public function getRagTotal()
{
$total = 0;

if(!empty($tasks)) {
if(!empty($this->tasks)) {
foreach ($this->tasks as $taskItem) {
$total += $taskItem->getRagRating();
if($taskItem->getStatus() !== 'Completed') {
$total += $taskItem->getRagRating();
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/Opg/Core/Model/Entity/CaseItem/Document/Document.php
Expand Up @@ -7,7 +7,6 @@
use Zend\InputFilter\Factory as InputFactory;
use Opg\Common\Model\Entity\EntityInterface;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\ReadOnly;

Expand Down
28 changes: 21 additions & 7 deletions src/Opg/Core/Model/Entity/CaseItem/Lpa/InputFilter/LpaFilter.php
Expand Up @@ -49,21 +49,35 @@ private function setStatusValidator()
$this->inputFactory->createInput(
array(
'name' => 'status',
'required' => true,
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
//'Perfect', 'Imperfect', 'Registered'
'validators' => array(
array(
'name' => 'InArray',
'name' => 'Callback',
'options' => array(
'encoding' => 'UTF-8',
'haystack' => array('Perfect', 'Imperfect', 'Registered', 'Pending', 'Withdrawn'),
'strict' => \Zend\Validator\InArray::COMPARE_STRICT
'messages' => array(
\Zend\Validator\Callback::INVALID_VALUE =>
'The status set was invalid',
),
'callback' => function ($status) {
if (isset($status)) {
return (
in_array(
$status,
array('Perfect', 'Imperfect', 'Registered', 'Pending', 'Withdrawn'),
true
)
);
}
else {
return true;
}
}
),
)
),
)
)
)
Expand Down

0 comments on commit c3ffaa9

Please sign in to comment.