$creditForm = new CreditForm(); | $creditForm = new CreditForm(); | ||||
if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) { | if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) { | ||||
$paymentModule->getUtils() | |||||
$paymentModule->getManager() | |||||
->creditOrDebitUser( | ->creditOrDebitUser( | ||||
$creditForm->type, | $creditForm->type, | ||||
$user, | $user, |
<?php | |||||
namespace common\logic; | |||||
abstract class AbstractManager extends AbstractService implements ManagerInterface | |||||
{ | |||||
} |
NotifierInterface::class, | NotifierInterface::class, | ||||
ResolverInterface::class, | ResolverInterface::class, | ||||
GeneratorInterface::class, | GeneratorInterface::class, | ||||
UtilsInterface::class, | |||||
ManagerInterface::class, | |||||
]; | ]; | ||||
} | } | ||||
FactoryInterface, SolverInterface ou BuilderInterface au service.'); | FactoryInterface, SolverInterface ou BuilderInterface au service.'); | ||||
} | } | ||||
protected function isSolver(): bool | |||||
{ | |||||
return $this->classImplementsInterface(SolverInterface::class); | |||||
} | |||||
protected function isBuilder(): bool | |||||
{ | |||||
return $this->classImplementsInterface(BuilderInterface::class); | |||||
} | |||||
protected function isResolver(): bool | |||||
{ | |||||
return $this->classImplementsInterface(ResolverInterface::class); | |||||
} | |||||
protected function isUtils(): bool | |||||
{ | |||||
return $this->classImplementsInterface(UtilsInterface::class); | |||||
} | |||||
protected function classImplementsInterface(string $interface, $object = null) | protected function classImplementsInterface(string $interface, $object = null) | ||||
{ | { | ||||
if(is_null($object)) { | if(is_null($object)) { |
<?php | |||||
namespace common\logic; | |||||
abstract class AbstractUtils extends AbstractService implements UtilsInterface | |||||
{ | |||||
} |
namespace common\logic\Document\Document\Module; | namespace common\logic\Document\Document\Module; | ||||
use common\logic\AbstractModule; | use common\logic\AbstractModule; | ||||
use common\logic\DefinitionInterface; | |||||
use common\logic\Document\Document\Repository\DocumentRepository; | use common\logic\Document\Document\Repository\DocumentRepository; | ||||
use common\logic\Document\Document\Service\DocumentBuilder; | use common\logic\Document\Document\Service\DocumentBuilder; | ||||
use common\logic\Document\Document\Service\DocumentDefinition; | use common\logic\Document\Document\Service\DocumentDefinition; | ||||
use common\logic\Document\Document\Service\DocumentSolver; | use common\logic\Document\Document\Service\DocumentSolver; | ||||
use common\logic\Document\Document\Service\DocumentUtils; | |||||
use common\logic\Document\Document\Service\DocumentManager; | |||||
/** | /** | ||||
* @mixin DocumentDefinition | * @mixin DocumentDefinition | ||||
* @mixin DocumentSolver | * @mixin DocumentSolver | ||||
* @mixin DocumentBuilder | * @mixin DocumentBuilder | ||||
* @mixin DocumentUtils | |||||
* @mixin DocumentManager | |||||
*/ | */ | ||||
class DocumentModule extends AbstractModule | class DocumentModule extends AbstractModule | ||||
{ | { | ||||
DocumentSolver::class, | DocumentSolver::class, | ||||
DocumentRepository::class, | DocumentRepository::class, | ||||
DocumentBuilder::class, | DocumentBuilder::class, | ||||
DocumentUtils::class, | |||||
DocumentManager::class, | |||||
]; | ]; | ||||
} | } | ||||
return DocumentBuilder::getInstance(); | return DocumentBuilder::getInstance(); | ||||
} | } | ||||
public function getUtils() | |||||
public function getManager() | |||||
{ | { | ||||
return DocumentUtils::getInstance(); | |||||
return DocumentManager::getInstance(); | |||||
} | } | ||||
} | } |
namespace common\logic\Document\Document\Service; | namespace common\logic\Document\Document\Service; | ||||
use common\helpers\GlobalParam; | |||||
use common\logic\AbstractService; | |||||
use common\logic\AbstractManager; | |||||
use common\logic\Document\Document\Model\DocumentInterface; | use common\logic\Document\Document\Model\DocumentInterface; | ||||
use common\logic\Producer\Producer\Service\ProducerSolver; | use common\logic\Producer\Producer\Service\ProducerSolver; | ||||
use common\logic\UtilsInterface; | |||||
use kartik\mpdf\Pdf; | use kartik\mpdf\Pdf; | ||||
use yii\base\ErrorException; | use yii\base\ErrorException; | ||||
use yii\helpers\Html; | use yii\helpers\Html; | ||||
class DocumentUtils extends AbstractService implements UtilsInterface | |||||
class DocumentManager extends AbstractManager | |||||
{ | { | ||||
protected DocumentSolver $documentSolver; | protected DocumentSolver $documentSolver; | ||||
protected DocumentBuilder $documentBuilder; | protected DocumentBuilder $documentBuilder; |
namespace common\logic; | namespace common\logic; | ||||
interface UtilsInterface | |||||
interface ManagerInterface | |||||
{ | { | ||||
} | } |
namespace common\logic\Opinion\Module; | namespace common\logic\Opinion\Module; | ||||
use common\logic\AbstractModule; | use common\logic\AbstractModule; | ||||
use common\logic\Opinion\Service\OpinionUtils; | |||||
use common\logic\Opinion\Service\OpinionManager; | |||||
/** | /** | ||||
* @mixin OpinionUtils | |||||
* @mixin OpinionManager | |||||
*/ | */ | ||||
class OpinionModule extends AbstractModule | class OpinionModule extends AbstractModule | ||||
{ | { | ||||
public function getServices(): array | public function getServices(): array | ||||
{ | { | ||||
return [ | return [ | ||||
OpinionUtils::class | |||||
OpinionManager::class | |||||
]; | ]; | ||||
} | } | ||||
public function getUtils(): OpinionUtils | |||||
public function getManager(): OpinionManager | |||||
{ | { | ||||
return OpinionUtils::getInstance(); | |||||
return OpinionManager::getInstance(); | |||||
} | } | ||||
} | } |
namespace common\logic\Opinion\Service; | namespace common\logic\Opinion\Service; | ||||
use common\logic\AbstractUtils; | |||||
use common\logic\AbstractManager; | |||||
use common\logic\User\User\Model\User; | use common\logic\User\User\Model\User; | ||||
use common\logic\User\User\Service\UserSolver; | use common\logic\User\User\Service\UserSolver; | ||||
class OpinionUtils extends AbstractUtils | |||||
class OpinionManager extends AbstractManager | |||||
{ | { | ||||
protected UserSolver $userSolver; | protected UserSolver $userSolver; | ||||
use common\logic\Order\Order\Service\OrderBuilder; | use common\logic\Order\Order\Service\OrderBuilder; | ||||
use common\logic\Order\Order\Service\OrderDefinition; | use common\logic\Order\Order\Service\OrderDefinition; | ||||
use common\logic\Order\Order\Service\OrderSolver; | use common\logic\Order\Order\Service\OrderSolver; | ||||
use common\logic\Order\Order\Service\OrderUtils; | |||||
use common\logic\Order\Order\Service\OrderManager; | |||||
/** | /** | ||||
* @mixin OrderDefinition | * @mixin OrderDefinition | ||||
OrderSolver::class, | OrderSolver::class, | ||||
OrderRepository::class, | OrderRepository::class, | ||||
OrderBuilder::class, | OrderBuilder::class, | ||||
OrderUtils::class | |||||
OrderManager::class | |||||
]; | ]; | ||||
} | } | ||||
return OrderBuilder::getInstance(); | return OrderBuilder::getInstance(); | ||||
} | } | ||||
public function getUtils(): OrderUtils | |||||
public function getUtils(): OrderManager | |||||
{ | { | ||||
return OrderUtils::getInstance(); | |||||
return OrderManager::getInstance(); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace common\logic\Order\Order\Service; | |||||
use common\logic\AbstractService; | |||||
use common\logic\ManagerInterface; | |||||
class OrderManager extends AbstractService implements ManagerInterface | |||||
{ | |||||
} |
<?php | |||||
namespace common\logic\Order\Order\Service; | |||||
use common\logic\AbstractService; | |||||
use common\logic\UtilsInterface; | |||||
class OrderUtils extends AbstractService implements UtilsInterface | |||||
{ | |||||
} |
use common\logic\AbstractModule; | use common\logic\AbstractModule; | ||||
use common\logic\Payment\Repository\PaymentRepository; | use common\logic\Payment\Repository\PaymentRepository; | ||||
use common\logic\Payment\Service\PaymentNotifier; | use common\logic\Payment\Service\PaymentNotifier; | ||||
use common\logic\Payment\Service\PaymentUtils; | |||||
use common\logic\Payment\Service\PaymentManager; | |||||
use common\logic\Payment\Service\PaymentBuilder; | use common\logic\Payment\Service\PaymentBuilder; | ||||
use common\logic\Payment\Service\PaymentDefinition; | use common\logic\Payment\Service\PaymentDefinition; | ||||
use common\logic\Payment\Service\PaymentSolver; | use common\logic\Payment\Service\PaymentSolver; | ||||
* @mixin PaymentSolver | * @mixin PaymentSolver | ||||
* @mixin PaymentRepository | * @mixin PaymentRepository | ||||
* @mixin PaymentBuilder | * @mixin PaymentBuilder | ||||
* @mixin PaymentUtils | |||||
* @mixin PaymentManager | |||||
*/ | */ | ||||
class PaymentModule extends AbstractModule | class PaymentModule extends AbstractModule | ||||
{ | { | ||||
PaymentBuilder::class, | PaymentBuilder::class, | ||||
PaymentRepository::class, | PaymentRepository::class, | ||||
PaymentNotifier::class, | PaymentNotifier::class, | ||||
PaymentUtils::class, | |||||
PaymentManager::class, | |||||
]; | ]; | ||||
} | } | ||||
return PaymentNotifier::getInstance(); | return PaymentNotifier::getInstance(); | ||||
} | } | ||||
public function getUtils(): PaymentUtils | |||||
public function getManager(): PaymentManager | |||||
{ | { | ||||
return PaymentUtils::getInstance(); | |||||
return PaymentManager::getInstance(); | |||||
} | } | ||||
} | } |
use common\logic\Producer\Producer\Service\ProducerSolver; | use common\logic\Producer\Producer\Service\ProducerSolver; | ||||
use common\logic\User\User\Model\User; | use common\logic\User\User\Model\User; | ||||
use common\logic\User\User\Repository\UserRepository; | use common\logic\User\User\Repository\UserRepository; | ||||
use common\logic\UtilsInterface; | |||||
use common\logic\ManagerInterface; | |||||
use yii\base\ErrorException; | use yii\base\ErrorException; | ||||
class PaymentUtils extends AbstractService implements UtilsInterface | |||||
class PaymentManager extends AbstractService implements ManagerInterface | |||||
{ | { | ||||
protected PaymentBuilder $paymentBuilder; | protected PaymentBuilder $paymentBuilder; | ||||
protected OrderSolver $orderSolver; | protected OrderSolver $orderSolver; |
use common\logic\Producer\Producer\Service\ProducerDefinition; | use common\logic\Producer\Producer\Service\ProducerDefinition; | ||||
use common\logic\Producer\Producer\Service\ProducerPageSizer; | use common\logic\Producer\Producer\Service\ProducerPageSizer; | ||||
use common\logic\Producer\Producer\Service\ProducerSolver; | use common\logic\Producer\Producer\Service\ProducerSolver; | ||||
use common\logic\Producer\Producer\Service\ProducerUtils; | |||||
use common\logic\Producer\Producer\Service\ProducerManager; | |||||
/** | /** | ||||
* @mixin ProducerDefinition | * @mixin ProducerDefinition | ||||
* @mixin ProducerSolver | * @mixin ProducerSolver | ||||
* @mixin ProducerRepository | * @mixin ProducerRepository | ||||
* @mixin ProducerBuilder | * @mixin ProducerBuilder | ||||
* @mixin ProducerUtils | |||||
* @mixin ProducerManager | |||||
* @mixin ProducerPageSizer | * @mixin ProducerPageSizer | ||||
* @mixin DolibarrProducerUtils | * @mixin DolibarrProducerUtils | ||||
*/ | */ | ||||
ProducerSolver::class, | ProducerSolver::class, | ||||
ProducerRepository::class, | ProducerRepository::class, | ||||
ProducerBuilder::class, | ProducerBuilder::class, | ||||
ProducerUtils::class, | |||||
ProducerManager::class, | |||||
ProducerPageSizer::class, | ProducerPageSizer::class, | ||||
DolibarrProducerUtils::class, | DolibarrProducerUtils::class, | ||||
]; | ]; | ||||
return ProducerBuilder::getInstance(); | return ProducerBuilder::getInstance(); | ||||
} | } | ||||
public function getUtils(): ProducerUtils | |||||
public function getUtils(): ProducerManager | |||||
{ | { | ||||
return ProducerUtils::getInstance(); | |||||
return ProducerManager::getInstance(); | |||||
} | } | ||||
public function getProducerPageSizer(): ProducerPageSizer | public function getProducerPageSizer(): ProducerPageSizer |
namespace common\logic\Producer\Producer\Service; | namespace common\logic\Producer\Producer\Service; | ||||
use common\components\DolibarrApi; | use common\components\DolibarrApi; | ||||
use common\logic\AbstractUtils; | |||||
use common\logic\AbstractManager; | |||||
use common\logic\Producer\Producer\Model\Producer; | use common\logic\Producer\Producer\Model\Producer; | ||||
use common\logic\Producer\Producer\Repository\ProducerRepository; | use common\logic\Producer\Producer\Repository\ProducerRepository; | ||||
use common\logic\Producer\ProducerPriceRange\Repository\ProducerPriceRangeRepository; | use common\logic\Producer\ProducerPriceRange\Repository\ProducerPriceRangeRepository; | ||||
use yii\base\ErrorException; | use yii\base\ErrorException; | ||||
class DolibarrProducerUtils extends AbstractUtils | |||||
class DolibarrProducerUtils extends AbstractManager | |||||
{ | { | ||||
protected DolibarrApi $dolibarrApi; | protected DolibarrApi $dolibarrApi; | ||||
protected ProducerPriceRangeRepository $producerPriceRangeRepository; | protected ProducerPriceRangeRepository $producerPriceRangeRepository; |
use common\logic\AbstractService; | use common\logic\AbstractService; | ||||
use common\logic\Producer\Producer\Model\Producer; | use common\logic\Producer\Producer\Model\Producer; | ||||
use common\logic\UtilsInterface; | |||||
use common\logic\ManagerInterface; | |||||
class ProducerUtils extends AbstractService implements UtilsInterface | |||||
class ProducerManager extends AbstractService implements ManagerInterface | |||||
{ | { | ||||
public function sendEmailNewProducer(Producer $producer): void | public function sendEmailNewProducer(Producer $producer): void | ||||
{ | { |
namespace common\logic\Producer\Producer\Service; | namespace common\logic\Producer\Producer\Service; | ||||
use common\components\PageSizer; | use common\components\PageSizer; | ||||
use common\logic\AbstractUtils; | |||||
use common\logic\AbstractManager; | |||||
use common\logic\Producer\Producer\Model\Producer; | use common\logic\Producer\Producer\Model\Producer; | ||||
class ProducerPageSizer extends AbstractUtils | |||||
class ProducerPageSizer extends AbstractManager | |||||
{ | { | ||||
protected ProducerSolver $producerSolver; | protected ProducerSolver $producerSolver; | ||||
protected ProducerBuilder $producerBuilder; | protected ProducerBuilder $producerBuilder; |
namespace common\logic\User\User\Service; | namespace common\logic\User\User\Service; | ||||
use common\logic\AbstractUtils; | |||||
use common\logic\AbstractManager; | |||||
use common\logic\User\User\Model\User; | use common\logic\User\User\Model\User; | ||||
class AuthorizationChecker extends AbstractUtils | |||||
class AuthorizationChecker extends AbstractManager | |||||
{ | { | ||||
protected UserSolver $userSolver; | protected UserSolver $userSolver; | ||||
use common\logic\User\User\Model\User; | use common\logic\User\User\Model\User; | ||||
use common\logic\User\UserProducer\Repository\UserProducerRepository; | use common\logic\User\UserProducer\Repository\UserProducerRepository; | ||||
use common\logic\User\UserProducer\Service\UserProducerBuilder; | use common\logic\User\UserProducer\Service\UserProducerBuilder; | ||||
use common\logic\UtilsInterface; | |||||
use common\logic\ManagerInterface; | |||||
class NewsletterManager extends AbstractService implements UtilsInterface | |||||
class NewsletterManager extends AbstractService implements ManagerInterface | |||||
{ | { | ||||
protected UserProducerRepository $userProducerRepository; | protected UserProducerRepository $userProducerRepository; | ||||
protected UserProducerBuilder $userProducerBuilder; | protected UserProducerBuilder $userProducerBuilder; |
use common\logic\Producer\Producer\Model\Producer; | use common\logic\Producer\Producer\Model\Producer; | ||||
use common\logic\Ticket\Ticket\Model\Ticket; | use common\logic\Ticket\Ticket\Model\Ticket; | ||||
use common\logic\User\User\Model\User; | use common\logic\User\User\Model\User; | ||||
use common\logic\UtilsInterface; | |||||
use common\logic\ManagerInterface; | |||||
class UserNotifier extends AbstractNotifier implements UtilsInterface | |||||
class UserNotifier extends AbstractNotifier implements ManagerInterface | |||||
{ | { | ||||
protected UserSolver $userSolver; | protected UserSolver $userSolver; | ||||
$opinionFormModel = new OpinionForm(); | $opinionFormModel = new OpinionForm(); | ||||
$opinionSent = false; | $opinionSent = false; | ||||
if ($opinionFormModel->load(Yii::$app->request->post()) && $opinionFormModel->validate()) { | if ($opinionFormModel->load(Yii::$app->request->post()) && $opinionFormModel->validate()) { | ||||
$this->getOpinionModule()->sendOpinionEmailAdmin($opinionFormModel, $this->getUserCurrent()); | |||||
$this->getOpinionModule()->getManager() | |||||
->sendOpinionEmailAdmin($opinionFormModel, $this->getUserCurrent()); | |||||
$opinionSent = true; | $opinionSent = true; | ||||
} | } | ||||
<?= block_feature("cog", "Une administration complète et intuitive pour gérer votre activité de producteur."); ?> | <?= block_feature("cog", "Une administration complète et intuitive pour gérer votre activité de producteur."); ?> | ||||
<div class="clr"></div> | <div class="clr"></div> | ||||
<?= block_feature("calendar", "Planification des jours de distributions."); ?> | <?= block_feature("calendar", "Planification des jours de distributions."); ?> | ||||
<?= block_feature("download-alt", "Accès à un récapitulatif des commandes par jour de distribution."); ?> | |||||
<?= block_feature("download-alt", "Récapitulatif des commandes par jour de distribution (PDF et CSV).<br />Génération d'étiquettes (PDF)."); ?> | |||||
<?= block_feature("cutlery", "Gestion des produits, catégories et prix spécifiques."); ?> | <?= block_feature("cutlery", "Gestion des produits, catégories et prix spécifiques."); ?> | ||||
<?= block_feature("map-marker", "Gestion des points de vente."); ?> | <?= block_feature("map-marker", "Gestion des points de vente."); ?> | ||||
<?= block_feature("repeat", "Gestion des abonnements pour les commandes récurrentes."); ?> | <?= block_feature("repeat", "Gestion des abonnements pour les commandes récurrentes."); ?> |