Initial commit

This commit is contained in:
2020-01-27 08:56:08 +01:00
commit b7525048d6
27129 changed files with 3409855 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace ForcePhone\Constraints;
use Symfony\Component\Validator\Constraint;
class AtLeastOnePhone extends Constraint
{
}

View File

@@ -0,0 +1,41 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace ForcePhone\Constraints;
use ForcePhone\ForcePhone;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Thelia\Core\Translation\Translator;
class AtLeastOnePhoneValidator extends ConstraintValidator
{
/**
* Checks if at least one phone number is provided
*
* @param mixed $value The value that should be validated
* @param Constraint $constraint The constraint for the validation
*
* @api
*/
public function validate($value, Constraint $constraint)
{
$data = $this->context->getRoot()->getData();
if (empty($data["phone"]) && empty($data["cellphone"])) {
$this->context->addViolationAt(
"phone",
Translator::getInstance()->trans("Please enter at least one phone number.", [], ForcePhone::DOMAIN_NAME)
);
}
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="AtLeastOnePhone.php" server="51.254.220.106//web/" local="131360718000000000" remote="131360718000000000" />
<file name="AtLeastOnePhoneValidator.php" server="51.254.220.106//web/" local="131360718000000000" remote="131360718000000000" />
</dwsync>