Commit 15b59018 authored by Alexandre Zvenigorosky's avatar Alexandre Zvenigorosky
Browse files

Merge branches 'Centres-cout' and 'master' of git.unicaen.fr:open-source/OSE into Centres-cout

# Conflicts:
#	composer.json
#	composer.lock
parent d74499df
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -51,22 +51,6 @@ class CentreCoutStructureSaisieForm extends AbstractForm
            ->setEmptyOption("(Aucun)")
            ->setValueOptions(\UnicaenApp\Util::collectionAsOptions($this->getStructures()));

        $this->add([
            'name'    => 'code',
            'options' => [
                'label' => "Code",
            ],
            'type'    => 'Text',
        ]);

        $this->add([
            'name'    => 'code',
            'options' => [
                'label' => "Code",
            ],
            'type'    => 'Text',
        ]);

        $this->add([
            'name'    => 'unite-budgetaire',
            'options' => [
@@ -118,9 +102,6 @@ class CentreCoutStructureSaisieForm extends AbstractForm
                'required' => false,
            ],

            'source-code' => [
                'required' => false,
            ],
        ];
    }

@@ -151,9 +132,7 @@ class CentreCoutStructureHydrator implements HydratorInterface
        if (array_key_exists('structure', $data)) {
            $object->setStructure($this->getServiceStructure()->get($data['structure']));
        }
        $object->setSourceCode($data['code']);
        $object->setCentreCout($this->getServiceCentreCout()->get($data['centre-cout']));
        $object->setSource($this->getServiceSource()->getOse());
        $object->setUniteBudgetaire($data['unite-budgetaire']);

        return $object;
@@ -173,7 +152,6 @@ class CentreCoutStructureHydrator implements HydratorInterface
        $data = [
            'id'               => $object->getId(),
            'structure'        => ($s = $object->getStructure()) ? $s->getId() : null,
            'code'             => $object->getSourceCode(),
            'centre-cout'      => $object->getCentreCout()->getId(),
            'unite-budgetaire' => $object->getUniteBudgetaire(),
        ];
+29 −1
Original line number Diff line number Diff line
@@ -2,11 +2,18 @@

namespace Application\Service;

use Application\Entity\Db\CentreCoutStructure;
use Application\Service\Traits\SourceServiceAwareTrait;

/**
 * Description of TypeCentreCoutStructure
 */
class CentreCoutStructureService extends AbstractEntityService
{
    use SourceServiceAwareTrait;



    /**
     * retourne la classe des entités
     *
@@ -15,9 +22,11 @@ class CentreCoutStructureService extends AbstractEntityService
     */
    public function getEntityClass()
    {
        return \Application\Entity\Db\CentreCoutStructure::class;
        return CentreCoutStructure::class;
    }



    /**
     * Retourne l'alias d'entité courante
     *
@@ -28,4 +37,23 @@ class CentreCoutStructureService extends AbstractEntityService
        return 'ccs';
    }



    /**
     * @param  CentreCoutStructure $entity
     *
     * @return CentreCoutStructure
     */
    public function save($entity)
    {
        if (!$entity->getSource()) {
            $entity->setSource($this->getServiceSource()->getOse());
        }
        if (!$entity->getSourceCode()) {
            $entity->setSourceCode(uniqid('CCS_OSE_'));
        }

        return parent::save($entity); // TODO: Change the autogenerated stub
    }

}