Commit cceecb87 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

UP : Un formulaire intermédiaire permet de compléter les informations PCRU avant de les soumettre.

parent 86671465
Loading
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -31,15 +31,11 @@ use Oscar\Entity\Project;
use Oscar\Entity\ProjectMember;
use Oscar\Entity\ProjectPartner;
use Oscar\Entity\Role;
use Oscar\Entity\SpentLine;
use Oscar\Entity\SpentTypeGroup;
use Oscar\Entity\TypeDocument;
use Oscar\Entity\ValidationPeriod;
use Oscar\Entity\ValidationPeriodRepository;
use Oscar\Exception\OscarException;
use Oscar\Factory\ActivityPcruInfoFromActivityFactory;
use Oscar\Form\ActivityInfosPcruForm;
use Oscar\Form\PcruInfosForm;
use Oscar\Form\ProjectGrantForm;
use Oscar\Formatter\ActivityPaymentFormatter;
use Oscar\Formatter\ActivityToJsonFormatter;
@@ -47,8 +43,6 @@ use Oscar\Formatter\CSVDownloader;
use Oscar\Formatter\JSONFormatter;
use Oscar\Formatter\Spent\EstimatedSpentActivityHTMLFormater;
use Oscar\Formatter\Spent\EstimatedSpentActivityPDFFormater;
use Oscar\Formatter\TimesheetActivityPeriodHtmlFormatter;
use Oscar\Hydrator\ActivityInfosPCRUFormHydrator;
use Oscar\Hydrator\PcruInfosFormHydrator;
use Oscar\OscarVersion;
use Oscar\Provider\Privileges;
@@ -59,8 +53,6 @@ use Oscar\Service\OrganizationService;
use Oscar\Service\ProjectGrantService;
use Oscar\Service\TimesheetService;
use Oscar\Strategy\Activity\ExportDatas;
use Oscar\Traits\UseActivityLogService;
use Oscar\Traits\UseActivityLogServiceTrait;
use Oscar\Traits\UseNotificationService;
use Oscar\Traits\UseNotificationServiceTrait;
use Oscar\Traits\UsePCRUService;
@@ -75,7 +67,6 @@ use Oscar\Traits\UseSpentService;
use Oscar\Traits\UseSpentServiceTrait;
use Oscar\Utils\DateTimeUtils;
use Oscar\Utils\UnicaenDoctrinePaginator;
use Psr\Log\LogLevel;
use Zend\Http\PhpEnvironment\Request;
use Zend\Mvc\Console\View\Renderer;
use Zend\View\Model\JsonModel;
@@ -2850,6 +2841,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
        /** @var Activity $activity */
        $activity = $this->getActivityFromRoute();

        // Accès
        $this->getOscarUserContextService()->check(Privileges::ACTIVITY_PCRU, $activity);

        if( $this->params()->fromQuery("a") == "activate" ){

            // Formulaire
@@ -2880,16 +2874,19 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
        }


        $this->getOscarUserContextService()->check(Privileges::ACTIVITY_PCRU, $activity);

        $method = $this->getHttpXMethod();

        if ($method == 'POST') {
            die("A FACTORISER");

            $action = $this->params()->fromPost('action');
            $this->getOscarUserContextService()->check(Privileges::ACTIVITY_PCRU_ACTIVATE, $activity);
            switch ($action) {

                case 'remove-waiting';
                    $idActivityPcruInfo = intval($this->params()->fromPost('activitypcruinfo_id'));
                    $this->getProjectGrantService()->getPCRUService()->removeWaiting($idActivityPcruInfo);

                case 'add-pool':
                    $this->getProjectGrantService()->getPCRUService()->addToPool($activity);
                    break;
@@ -2906,6 +2903,15 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif

        $return = $this->getProjectGrantService()->getPCRUService()->getPreview($activity);

        /** @var ActivityPcruInfos $pcruInfos */
        $pcruInfos = $return['infos'];

        if( $pcruInfos->isWaiting() ){
            $return['deletable'] = true;
            $return['activitypcruinfo_id'] = $pcruInfos->getId();

        }

        $return['poolopen'] = $this->getProjectGrantService()->getPCRUService()->isPoolOpen();

        return $return;
+15 −8
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ class ActivityPcruInfos

    /**
     * @var boolean
     * @ORM\Column(type="boolean", name="cordinateurconsortium")
     * @ORM\Column(type="boolean", name="coordinateurconsortium")
     */
    private $coordinateurConsortium = false;

@@ -247,7 +247,7 @@ class ActivityPcruInfos

    /**
     * @var boolean
     * @ORM\Column(type="boolean", nullable=true)
     * @ORM\Column(type="boolean")
     */
    private $accordCadre = false;

@@ -265,9 +265,9 @@ class ActivityPcruInfos

    /**
     * @var string (True/False/Indéfini)
     * @ORM\Column(type="string", length=8)
     * @ORM\Column(type="boolean")
     */
    private $PresencePartenaireIndustriel = "Indéfini";
    private $PresencePartenaireIndustriel = false;

    /**
     * @var integer Identifiant du document "Contrat Signé"
@@ -294,6 +294,11 @@ class ActivityPcruInfos
        );
    }

    public function isWaiting() :bool
    {
        return $this->getStatus() == self::STATUS_FILE_READY;
    }

    public function toArray() :array
    {
        $out = [];
@@ -328,7 +333,7 @@ class ActivityPcruInfos
        $out['AccordCadre'] = $this->isAccordCadre() ? "True" : "False";
        $out['Cifre'] = $this->getCifre();
        $out['ChaireIndustrielle'] = $this->getChaireIndustrielle();
        $out['PresencePartenaireIndustriel'] = $this->getPresencePartenaireIndustriel();
        $out['PresencePartenaireIndustriel'] = $this->isPresencePartenaireIndustriel();
        return $out;
    }

@@ -1052,11 +1057,13 @@ class ActivityPcruInfos
    /**
     * @return string
     */
    public function getPresencePartenaireIndustriel(): string
    public function isPresencePartenaireIndustriel(): bool
    {
        return $this->PresencePartenaireIndustriel;
    }



    /**
     * @return int
     */
@@ -1075,9 +1082,9 @@ class ActivityPcruInfos
    }

    /**
     * @param string $PresencePartenaireIndustriel
     * @param bool $PresencePartenaireIndustriel
     */
    public function setPresencePartenaireIndustriel(string $PresencePartenaireIndustriel): self
    public function setPresencePartenaireIndustriel(bool $PresencePartenaireIndustriel): self
    {
        $this->PresencePartenaireIndustriel = $PresencePartenaireIndustriel;
        return $this;
+1 −238
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ class ActivityInfosPcruForm extends \Zend\Form\Form implements InputFilterProvid
            'type'  => 'Text',
            'attributes'    => [
                'class'       => 'form-control',
                'readonly' => 'readonly'
            ],
            'options'   => array(
                'label_attributes'  => [
@@ -470,240 +471,6 @@ class ActivityInfosPcruForm extends \Zend\Form\Form implements InputFilterProvid
        ));


//        $typesSelect = [];
//        $typesSelect[] = "";
//        foreach ($this->types as $t ){
//            $typesSelect[$t->getId()] = (string)$t;
//        }
//
//        $this->add(array(
//            'name'  => 'id',
//            'type'  => 'Hidden',
//        ));
//
//        $this->add(array(
//            'name'  => 'label',
//            'type'  => 'Text',
//            'attributes'    => [
//                'class'       => 'form-control',
//                'placeholder'   => 'Nom du projet'
//            ],
//            'options'   => array(
//                'label' => 'Nom du projet',
//                'label_attributes'  => [
//                    'class' => 'form-label required'
//                ]
//            )
//        ));
//
//        // Type
//        $this->add([
//            'name'   => 'typeObj',
//            'options' => [
//                'label' => 'Type d\'organisation',
//                'value_options' => $typesSelect
//            ],
//            'attributes' => [
//                'class' => 'form-control'
//            ],
//            'type'=>'Select'
//        ]);
//
//
//        $shortName = new Element\Text('shortName');
//        $shortName->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Acronyme'
//        ]);
//        $this->add($shortName);
//
//        $labintel = new Element\Text('labintel');
//        $labintel->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Code LABINTEL'
//        ]);
//        $this->add($labintel);
//
//        $duns = new Element\Text('duns');
//        $duns->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'N°DUNS'
//        ]);
//        $this->add($duns);
//
//        $tvaintra = new Element\Text('tvaintra');
//        $tvaintra->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'TVA Intracommunautaire'
//        ]);
//        $this->add($tvaintra);
//
//        $rnsr = new Element\Text('rnsr');
//        $rnsr->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'N°RNSR'
//        ]);
//        $this->add($rnsr);
//
//        $fullName = new Element\Text('fullName');
//        $fullName->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Nom complet',
//        ]);
//        $this->add($fullName);
//
//        // Source
//        $this->add([
//            'name'   => 'type',
//            'options' => [
//                'label' => "Type"
//            ],
//            'attributes' => [
//                'class' => 'form-control',
//                'list' => 'types'
//            ],
//            'type'=>'Text'
//        ]);
//
//        ////////////////////////////////////////////////////////////////////////
//        // Connectors (Ajout dynamique des champs pour les valeurs des connectors)
//        foreach( $this->connectors as $connector ){
//            $this->add([
//                'name'   => 'connector_' . $connector,
//                'options' => [
//                    'label' => 'N° ' . $connector
//                ],
//                'attributes' => [
//                    'class' => 'form-control',
//                    'placeholder'   => 'N° ' . $connector
//                ],
//                'type'=>'Text'
//            ]);
//        }
//
//        // DateStart
//        $this->add([
//            'name'   => 'dateStart',
//            'options' => [
//                'label' => 'Début du contrat',
//                'format' => 'Y-m-d'
//            ],
//            'attributes' => [
//                'class' => 'input-date form-control'
//            ],
//            'type'=>'DateTime'
//        ]);
//
//        // DateEnd
//        $this->add([
//            'name'   => 'dateEnd',
//            'options' => [
//                'label' => 'Date de fermeture',
//                'format' => 'Y-m-d'
//            ],
//            'attributes' => [
//                'class' => 'input-date form-control'
//            ],
//            'type'=>'DateTime'
//        ]);
//
//
//
//        $eotp = new Element\Text('code');
//        $eotp->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Code interne'
//        ]);
//        $this->add($eotp);
//
//        $email = new Element\Text('email');
//        $email->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Email'
//        ]);
//        $this->add($email);
//
//        $url = new Element\Text('url');
//        $url->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'URL'
//        ]);
//        $this->add($url);
//
//        $zipCode = new Element\Text('zipCode');
//        $zipCode->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Code Postal'
//        ]);
//        $this->add($zipCode);
//
//        $city = new Element\Text('city');
//        $city->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Ville'
//        ]);
//        $this->add($city);
//
//        $this->add([
//            'name'   => 'country',
//            'options' => [
//                'label' => 'Pays (ISO)',
//                'value_options' => $this->countries
//            ],
//            'attributes' => [
//                'class' => 'form-control',
//                'placeholder'   => 'Pays'
//            ],
//            'type'=>'Select'
//        ]);
//
//        $phone = new Element\Text('phone');
//        $phone->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Téléphone'
//        ]);
//        $this->add($phone);
//
//        $street1 = new Element\Text('street1');
//        $street1->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Adresse 1'
//        ]);
//        $this->add($street1);
//
//        $street2 = new Element\Text('street2');
//        $street2->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Adresse 2'
//        ]);
//        $this->add($street2);
//
//        $street3 = new Element\Text('street3');
//        $street3->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Adresse 3'
//        ]);
//        $this->add($street3);
//
//        $siret = new Element\Text('siret');
//        $siret->setAttributes([
//            'class' => 'form-control',
//            'placeholder' => 'N° de SIRET'
//        ]);
//        $this->add($siret);
//
//        $description = new Element\Textarea('description');
//        $description->setAttributes([
//            'class'       => 'form-control',
//            'placeholder'   => 'Description',
//            'row'           => 5
//        ]);
//        $this->add($description);
//
//        $this->add(array(
//            'name'  => 'secure',
//            'type'  => 'Csrf',
//        ));
    }

    public function getInputFilterSpecification()
@@ -715,10 +482,6 @@ class ActivityInfosPcruForm extends \Zend\Form\Form implements InputFilterProvid

            'dateEnd'=> [
                'required' => false,
            ],

            'country' => [
                'required' => false
            ]
        ];
    }
+0 −488

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ class ActivityPcruInfosToFormArray
            'accordCadre' => $activityPcruInfos->isAccordCadre(),
            'cifre' => $activityPcruInfos->getCifre(),
            'chaireIndustrielle' => $activityPcruInfos->getChaireIndustrielle(),
            'resencepartenaireindustriel' => $activityPcruInfos->getPresencePartenaireIndustriel(),
            'presencepartenaireindustriel' => $activityPcruInfos->isPresencePartenaireIndustriel(),
        ];
    }
}
 No newline at end of file
Loading