Commit 5ec6fb59 by Damien Moulard

ccas: mark transaction as ccas

parent 22a234c3
......@@ -459,6 +459,16 @@ class UserController extends AbstractController
$now = (new \Datetime('now'))->format('d/m/Y H:i:s');
$flux->setReference('Achat en Monnaie Solidaire du ' . $now);
// Mark transaction as CCAS if at the time of the transation, both adherent & presta are CCAS complient
if (
$this->getParameter('ccas_mode')
&& $adherent->getCcasEligible()
&& $adherent->getCcasAccepted()
&& $presta->getCcasOk()
) {
$flux->setIsCcas(true);
}
$this->em->persist($flux);
$this->operationUtils->executeOperations($flux);
$this->em->flush();
......
......@@ -152,12 +152,12 @@ class Adherent extends AccountableObject implements AccountableInterface
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private $ccasEligible;
private $ccasEligible = false;
/**
* @ORM\Column(type="string", length=36, nullable=true, unique=true)
*/
private $anonymousToken;
private $anonymousToken = false;
public function __construct()
......
......@@ -381,7 +381,7 @@ class Prestataire extends AccountableObject implements AccountableInterface
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private $ccasOk;
private $ccasOk = false;
public function __construct()
......
......@@ -38,6 +38,11 @@ class TransactionAdherentPrestataire extends Transaction
protected $cancellerFlux;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private $isCcas = false;
/**
* @return string
*/
public function getType(): string
......@@ -55,4 +60,16 @@ class TransactionAdherentPrestataire extends Transaction
public function setCancellerFlux($var) {$this->cancellerFlux = $var;}
public function getCancellerFlux() {return $this->cancellerFlux;}
public function getIsCcas(): ?bool
{
return $this->isCcas;
}
public function setIsCcas(bool $isCcas): self
{
$this->isCcas = $isCcas;
return $this;
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240503101225 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE flux ADD is_ccas TINYINT(1) DEFAULT \'0\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE flux DROP is_ccas');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment