Commit 6c69837d authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- UP : Ajout de la date de début des négociations à la fiche activité

parent b34ba02b
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use Cocur\Slugify\Slugify;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Laminas\Permissions\Acl\Resource\ResourceInterface;
use Laminas\Validator\Date;
use Oscar\Import\Data\DataExtractorDate;
use Oscar\Service\ActivityTypeService;
use Doctrine\ORM\Mapping\OneToOne as OneToOne;
@@ -324,11 +325,19 @@ class Activity implements ResourceInterface
    /**
     * Date de la dernière mise en cache des données
     *
     * @var datetime
     * @var ?\DateTime
     * @ORM\Column(type="date", nullable=true)
     */
    private $dateCached;

    /**
     * Date de négociation
     *
     * @var ?\DateTime
     * @ORM\Column(type="date", nullable=true)
     */
    private $dateNegociation;

    /**
     * Cache
     *
@@ -1284,6 +1293,32 @@ class Activity implements ResourceInterface
        return $this;
    }


    public function getDateNegociation(): ?\DateTime
    {
        return $this->dateNegociation;
    }

    public function setDateNegociation(?\DateTime $dateNegociation): self
    {
        $this->dateNegociation = $dateNegociation;
        return $this;
    }

    /**
     * @param staring $format
     * @return string
     */
    public function getDateNegociationStr(string $format = 'Y-m-d'): string
    {
        if ($this->getDateNegociation()) {
            return $this->getDateNegociation()->format($format);
        }
        else {
            return "";
        }
    }

    /**
     * @param string $format
     * @return string
+13 −2
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ class ProjectGrantForm extends Form implements InputFilterProviderInterface, Use

    private $numbers;
    private $editable;

    private $organizations = false;
    private $organizationRoles = null;

@@ -40,7 +39,7 @@ class ProjectGrantForm extends Form implements InputFilterProviderInterface, Use
    /**
     * @return ProjectGrantService
     */
    public function getProjectGrantService()
    public function getProjectGrantService() :ProjectGrantService
    {
        return $this->getServiceContainer()->get(ProjectGrantService::class);
    }
@@ -335,6 +334,18 @@ class ProjectGrantForm extends Form implements InputFilterProviderInterface, Use
                       'type'       => 'Text'
                   ]);

        // DateNegociation
        $this->add([
                       'name'       => 'dateNegociation',
                       'options'    => [
                           'label' => "Date de début des négociations"
                       ],
                       'attributes' => [
                           'class' => 'input-date form-control'
                       ],
                       'type'       => 'Text'
                   ]);


        // DateOpened
        $this->add(new KeyValue('numbers', ['keys' => $this->numbers, 'editable' => $this->editable]));
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ class ProjectGrantFormHydrator implements HydratorInterface, UseServiceContainer
            ->setDateEnd(DateTimeUtils::toDatetime($data['dateEnd']))
            ->setDateSigned(DateTimeUtils::toDatetime($data['dateSigned']))
            ->setDateOpened(DateTimeUtils::toDatetime($data['dateOpened']))
            ->setDateNegociation(DateTimeUtils::toDatetime($data['dateNegociation']))
            ->setPcruValidPoleCompetitivite($data['pcruValidPoleCompetitivite'] == "1")
            ->setNumbers(array_key_exists('numbers', $data) ? $data['numbers'] : [])
        ;
@@ -204,6 +205,7 @@ class ProjectGrantFormHydrator implements HydratorInterface, UseServiceContainer
            'dateEnd' => $object->getDateEnd()?$object->getDateEnd()->format('Y-m-d'):'',
            'dateSigned' => $object->getDateSigned()?$object->getDateSigned()->format('Y-m-d'):'',
            'dateOpened' => $object->getDateOpened()?$object->getDateOpened()->format('Y-m-d'):'',
            'dateNegociation' => $object->getDateNegociation()?$object->getDateNegociation()->format('Y-m-d'):'',
            'currency' => $object->getCurrency() ? $object->getCurrency()->getId() : -1,
            'project' => $object->getProject(),
            'numbers' => $object->getNumbers(),
+2 −0
Original line number Diff line number Diff line
@@ -448,11 +448,13 @@ class ProjectGrantApiService implements UseEntityManager, UsePersonService, UseO
            'type'         => $activity->getActivityType() ? (string)$activity->getActivityType() : null,
            'type_chain'   => $typesJson,
            'type_id'      => $activity->getActivityType()?->getId(),
            'dateCreated'    => $this->formatDateTime($activity->getDateCreated()),
            'dateStart'    => $this->formatDateTime($activity->getDateStart()),
            'dateEnd'      => $this->formatDateTime($activity->getDateEnd()),
            'dateSigned'   => $this->formatDateTime($activity->getDateSigned()),
            'dateUpdated'  => $this->formatDateTime($activity->getDateUpdated()),
            'dateOpened'   => $this->formatDateTime($activity->getDateOpened()),
            'dateNegociation'   => $this->formatDateTime($activity->getDateNegociation()),
            'urls'         => [
                'edit'           => $urlPlugin->fromRoute('contract/edit', ['id' => $activity->getId()]),
                'change_project' => $urlPlugin->fromRoute('contract/moveToProject', ['id' => $activity->getId()]),
+6 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U
    const FILTER_ACTIVITY_DATE_END = 'adf';
    const FILTER_ACTIVITY_DATE_CREATED = 'adc';
    const FILTER_ACTIVITY_DATE_UPDATED = 'adm';
    const FILTER_ACTIVITY_DATE_NEGOCIATION = 'adn';
    const FILTER_ACTIVITY_DATE_SIGNED = 'ads';
    const FILTER_ACTIVITY_DATE_FINANCIAL_OPENED = 'adp';
    const FILTER_ACTIVITY_NO_PROJECT = 'pp';
@@ -73,6 +74,7 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U
    const SORT_DATE_UPDATED = 'dateUpdated';
    const SORT_DATE_SIGNED = 'dateSigned';
    const SORT_DATE_OPENED = 'dateOpened';
    const SORT_DATE_NEGOCIATION = 'dateNegociation';
    const SORT_DIRECTION_DESC = 'desc';
    const SORT_DIRECTON_ASC = 'asc';
    const QUERY_PARAM_PAGE = 'page';
@@ -119,6 +121,7 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U
            self::FILTER_ACTIVITY_DATE_SIGNED           => 'Date de signature',
            self::FILTER_ACTIVITY_DATE_FINANCIAL_OPENED => 'Date d\'ouverture du numéro financier (' . $this->getOscarConfigurationService(
                )->getFinancialLabel() . ')',
            self::FILTER_ACTIVITY_DATE_NEGOCIATION      => 'Date de début des négociations',
            self::FILTER_ACTIVITY_NUMBERS               => 'Ayant une numérotation',
            // Finances
            self::FILTER_ACTIVITY_FINANCIAL_IMPACT      => 'Incidence financière - AVEC',
@@ -343,6 +346,7 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U
                    break;

                case 'add' :
                case 'adn' :
                case 'adf' :
                case 'adm' :
                case 'adc' :
@@ -827,6 +831,7 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U

                    ///////////////////////////////// ACTIVITY / DATES
                    case 'add' :
                    case 'adn' :
                    case 'adf' :
                    case 'adm' :
                    case 'adc' :
@@ -1223,6 +1228,7 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U
            'adc' => self::SORT_DATE_CREATED,
            'adf' => self::SORT_DATE_END,
            'adm' => self::SORT_DATE_UPDATED,
            'adn' => self::SORT_DATE_NEGOCIATION,
            'ads' => self::SORT_DATE_SIGNED,
            'adp' => self::SORT_DATE_OPENED,
        ];
Loading