Commit d253fe1e by Yvon Kerdoncuff

fix migration (previous trick does not work due to global parameter alternate...…

fix migration (previous trick does not work due to global parameter alternate... missing when migration is executed)
parent b4acafe5
......@@ -33,11 +33,12 @@ final class Version20250502111501 extends AbstractMigration implements Container
public function up(Schema $schema) : void
{
$alternatePaymentTypes = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::ALTERNATE_AVAILABLE_PAYMENT_TYPES_COMPTOIR);
if ($alternatePaymentTypes === 'true') {
$defaultValue = "MOYEN_VIREMENT,MOYEN_ESPECE,MOYEN_AUTRE";
$containerName = trim(file_get_contents('/etc/hostname'));
if (str_contains($containerName, 'casparis20')) {
$defaultValue = 'MOYEN_VIREMENT,MOYEN_ESPECE,MOYEN_AUTRE';
} else {
$defaultValue = "MOYEN_ESPECE,MOYEN_CHEQUE,MOYEN_AUTRE";
$defaultValue = 'MOYEN_ESPECE,MOYEN_CHEQUE,MOYEN_AUTRE';
}
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'COMPTOIR_PAYMENT_TYPES', 'Définit la liste des paiements disponible aux comptoirs. Insérer les valeurs désirées dans l\'ordre séparées par une virgule sans espace. Valeurs possibles : MOYEN_CB, MOYEN_ESPECE, MOYEN_CHEQUE, MOYEN_VIREMENT, MOYEN_HELLOASSO, MOYEN_EMLC, MOYEN_MLC, MOYEN_AUTRE.', '$defaultValue', '0')");
......
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