@@ -38,12 +38,8 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use backend\models\AccessUserProducerForm; | |||
use common\logic\Document\DeliveryNote\DeliveryNoteManager; | |||
use common\logic\Producer\Producer\ProducerManager; | |||
use common\logic\User\User\User; | |||
use common\logic\User\User\UserSearch; | |||
use common\logic\User\User\Model\UserSearch; | |||
use yii\filters\AccessControl; | |||
use yii\filters\VerbFilter; | |||
@@ -38,10 +38,10 @@ | |||
namespace backend\controllers; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Product\Product\Product; | |||
use common\controllers\CommonController; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Product\Product\Model\Product; | |||
class BackendController extends CommonController | |||
{ |
@@ -39,7 +39,7 @@ | |||
namespace backend\controllers; | |||
use backend\models\MailForm; | |||
use common\logic\User\User\User; | |||
use common\logic\User\User\Model\User; | |||
use yii\filters\AccessControl; | |||
use yii\filters\VerbFilter; | |||
use yii\web\NotFoundHttpException; |
@@ -38,10 +38,10 @@ | |||
namespace backend\controllers; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\User\CreditHistory\CreditHistory; | |||
use common\logic\User\User\User; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\User\CreditHistory\Model\CreditHistory; | |||
use common\logic\User\User\Model\User; | |||
use Yii; | |||
use yii\filters\VerbFilter; | |||
use yii\filters\AccessControl; | |||
@@ -85,8 +85,13 @@ class CronController extends BackendController | |||
public function actionInitDemo($key = '') | |||
{ | |||
if ($key == '45432df6e842ac71aa0b5bb6b9f25d44') { | |||
$producerManager = $this->getProducerManager(); | |||
$distributionManager = $this->getDistributionManager(); | |||
$producer = $producerManager->findOneProducerDemoAccount(); | |||
$producerManager->setProducerContext($producer); | |||
$distributionManager->setProducerContext($producer); | |||
if ($producer) { | |||
// initialisation de la distribution à J+7 | |||
@@ -102,8 +107,7 @@ class CronController extends BackendController | |||
} | |||
if ($activeDistribution) { | |||
$distributionManager = $this->getDistributionManager(); | |||
$distribution = $distributionManager->createDistributionIfNotExist($producer, date('Y-m-d', $dateTime)); | |||
$distribution = $distributionManager->createDistributionIfNotExist(date('Y-m-d', $dateTime)); | |||
$distributionManager->activeDistribution($distribution); | |||
} | |||
} |
@@ -38,12 +38,11 @@ | |||
namespace backend\controllers; | |||
use common\logic\Document\DeliveryNote\DeliveryNoteSearch; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNoteSearch; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
use yii\filters\VerbFilter; | |||
class DeliveryNoteController extends DocumentController | |||
{ | |||
public function behaviors() | |||
@@ -84,5 +83,4 @@ class DeliveryNoteController extends DocumentController | |||
'dataProvider' => $dataProvider, | |||
]); | |||
} | |||
} |
@@ -44,23 +44,20 @@ use common\helpers\MeanPayment; | |||
use common\helpers\Password; | |||
use common\helpers\Price; | |||
use common\helpers\Tiller; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution; | |||
use common\logic\Distribution\ProductDistribution\ProductDistribution; | |||
use common\logic\Document\DeliveryNote\DeliveryNote; | |||
use common\logic\Document\Document\Document; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\User\User\User; | |||
use common\logic\User\UserProducer\UserProducer; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNote; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\User\UserProducer\Model\UserProducer; | |||
use DateTime; | |||
use kartik\mpdf\Pdf; | |||
use yii\filters\AccessControl; | |||
use yii\web\User; | |||
class DistributionController extends BackendController | |||
{ | |||
public function behaviors() | |||
{ | |||
return [ | |||
@@ -168,7 +165,7 @@ class DistributionController extends BackendController | |||
$json['distributions'] = $distributionsArray; | |||
if ($dateObject && $dateObject->format($format) === $date) { | |||
$distribution = $distributionManager->createDistributionIfNotExist($producer, $date); | |||
$distribution = $distributionManager->createDistributionIfNotExist($date); | |||
$json['distribution'] = [ | |||
'id' => $distribution->id, | |||
'active' => $distribution->active, | |||
@@ -1323,7 +1320,7 @@ class DistributionController extends BackendController | |||
$format = 'Y-m-d'; | |||
$dateObject = DateTime::createFromFormat($format, $date); | |||
if ($dateObject && $dateObject->format($format) === $date) { | |||
$distribution = $distributionManager->createDistributionIfNotExist($producerCurrent, $date); | |||
$distribution = $distributionManager->createDistributionIfNotExist($date); | |||
} | |||
if ($distribution) { | |||
@@ -1718,7 +1715,7 @@ class DistributionController extends BackendController | |||
$user = $userManager->findOneUserById($deliveryNote->id_user); | |||
$userProducer = $userProducerManager->findOneUserProducer($user, $producerCurrent); | |||
} else { | |||
$user = new User; | |||
$user = new User(); | |||
$user->type = User::TYPE_LEGAL_PERSON; | |||
$user->name_legal_person = $firstOrder->pointSale->name; | |||
$user->address = $firstOrder->pointSale->address; |
@@ -40,18 +40,20 @@ namespace backend\controllers; | |||
use common\helpers\CSV; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Document\DeliveryNote\DeliveryNote; | |||
use common\logic\Document\Document\Document; | |||
use common\logic\Document\Invoice\Invoice; | |||
use common\logic\Document\Quotation\Quotation; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Order\ProductOrder\ProductOrder; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNote; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Document\Invoice\Model\Invoice; | |||
use common\logic\Document\Quotation\Model\Quotation; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\ProductOrder\Model\ProductOrder; | |||
use common\logic\Product\Product\Model\Product; | |||
use kartik\mpdf\Pdf; | |||
use yii\base\UserException; | |||
use yii; | |||
use yii\filters\VerbFilter; | |||
use yii\filters\AccessControl; | |||
use yii\web\NotFoundHttpException; | |||
use yii\helpers\Html; | |||
class DocumentController extends BackendController | |||
{ | |||
@@ -789,5 +791,4 @@ class DocumentController extends BackendController | |||
throw new NotFoundHttpException('The requested page does not exist.'); | |||
} | |||
} | |||
} |
@@ -38,9 +38,8 @@ | |||
namespace backend\controllers; | |||
use common\logic\Document\Invoice\InvoiceSearch; | |||
use common\logic\Order\Order\Order; | |||
use Yii; | |||
use common\logic\Document\Invoice\Model\InvoiceSearch; | |||
use common\logic\Order\Order\Model\Order; | |||
class InvoiceController extends DocumentController | |||
{ |
@@ -41,16 +41,16 @@ namespace backend\controllers; | |||
use common\forms\SubscriptionForm; | |||
use common\helpers\CSV; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution; | |||
use common\logic\Distribution\ProductDistribution\ProductDistribution; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Order\ProductOrder\ProductOrder; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\User\CreditHistory\CreditHistory; | |||
use common\logic\User\User\User; | |||
use common\logic\User\UserProducer\UserProducer; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution; | |||
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\ProductOrder\Model\ProductOrder; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\User\CreditHistory\Model\CreditHistory; | |||
use common\logic\User\User\Model\User; | |||
use common\logic\User\UserProducer\Model\UserProducer; | |||
use yii\filters\AccessControl; | |||
use yii\helpers\Html; | |||
@@ -125,7 +125,7 @@ class OrderController extends BackendController | |||
$date = \Yii::$app->getRequest()->post('date_order_point_sale_' . $point->id, 0); | |||
$oneProduct = false; | |||
foreach ($products as $product) { | |||
$quantity = Yii::$app->getRequest()->post('product_point_sale_' . $point->id . '_' . $product->id, 0); | |||
$quantity = \Yii::$app->getRequest()->post('product_point_sale_' . $point->id . '_' . $product->id, 0); | |||
if ($quantity) { | |||
$oneProduct = true; | |||
} | |||
@@ -144,7 +144,7 @@ class OrderController extends BackendController | |||
foreach ($products as $product) { | |||
$quantity = \Yii::$app->getRequest()->post('product_point_sale_' . $point->id . '_' . $product->id, 0); | |||
if ($quantity) { | |||
$productOrder = new ProductOrder; | |||
$productOrder = new ProductOrder(); | |||
$productOrder->id_order = $order->id; | |||
$productOrder->id_product = $product->id; | |||
$productOrder->quantity = $quantity; | |||
@@ -188,7 +188,7 @@ class OrderController extends BackendController | |||
$arrayUsers[$user->id] = $user->name . ' ' . $user->lastname; | |||
} | |||
$distribution = $distributionManager->createDistributionIfNotExist($this->getProducerCurrent(), $date); | |||
$distribution = $distributionManager->createDistributionIfNotExist($date); | |||
if ($distribution) { | |||
$arrayPointsSale = PointSale::find() | |||
@@ -666,7 +666,7 @@ class OrderController extends BackendController | |||
public function actionChangeState(string $date, bool $active, bool $redirect = true) | |||
{ | |||
$distributionManager = $this->getDistributionManager(); | |||
$distribution = $distributionManager->createDistributionIfNotExist($this->getProducerCurrent(), $date); | |||
$distribution = $distributionManager->createDistributionIfNotExist($date); | |||
$distributionManager->activeDistribution($distribution, $active); | |||
if ($redirect) { |
@@ -39,11 +39,11 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\PointSale\PointSale\PointSaleSearch; | |||
use common\logic\PointSale\UserPointSale\UserPointSale; | |||
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\PointSale\PointSale\Model\PointSaleSearch; | |||
use common\logic\PointSale\UserPointSale\Model\UserPointSale; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
use yii\web\NotFoundHttpException; |
@@ -38,9 +38,9 @@ | |||
namespace backend\controllers; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Product\Product\Model\Product; | |||
use Yii; | |||
use yii\web\NotFoundHttpException; | |||
use yii\filters\VerbFilter; |
@@ -39,8 +39,8 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Producer\ProducerPriceRange\ProducerPriceRange; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Producer\ProducerPriceRange\Model\ProducerPriceRange; | |||
use Yii; | |||
use yii\data\ActiveDataProvider; | |||
use yii\web\NotFoundHttpException; |
@@ -38,7 +38,7 @@ | |||
namespace backend\controllers; | |||
use common\logic\Producer\ProducerPriceRange\ProducerPriceRange; | |||
use common\logic\Producer\ProducerPriceRange\Model\ProducerPriceRange; | |||
use Yii; | |||
use yii\web\NotFoundHttpException; | |||
use yii\filters\VerbFilter; |
@@ -39,8 +39,8 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Product\ProductCategory\ProductCategorySearch; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\Product\ProductCategory\Model\ProductCategorySearch; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
use yii\web\NotFoundHttpException; |
@@ -39,14 +39,14 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Distribution\ProductDistribution\ProductDistribution; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Product\Product\ProductSearch; | |||
use common\logic\Product\ProductPointSale\ProductPointSale; | |||
use common\logic\Product\ProductPrice\ProductPrice; | |||
use common\logic\Product\ProductPrice\ProductPriceSearch; | |||
use common\logic\User\UserProducer\UserProducer; | |||
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\Product\Product\Model\ProductSearch; | |||
use common\logic\Product\ProductPointSale\Model\ProductPointSale; | |||
use common\logic\Product\ProductPrice\Model\ProductPrice; | |||
use common\logic\Product\ProductPrice\Model\ProductPriceSearch; | |||
use common\logic\User\UserProducer\Model\UserProducer; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
use yii\helpers\Html; |
@@ -39,8 +39,8 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Document\Quotation\QuotationSearch; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Document\Quotation\Model\QuotationSearch; | |||
use common\logic\Order\Order\Model\Order; | |||
use Yii; | |||
use yii\base\UserException; | |||
use yii\filters\AccessControl; |
@@ -40,7 +40,6 @@ namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\helpers\Price; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
@@ -39,11 +39,11 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\User\User\User; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\User\User\Model\User; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
use common\forms\LoginForm; |
@@ -47,7 +47,6 @@ use DatePeriod; | |||
class StatsController extends BackendController | |||
{ | |||
public function behaviors() | |||
{ | |||
return [ |
@@ -39,8 +39,8 @@ namespace backend\controllers; | |||
use common\forms\SubscriptionForm; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Subscription\Subscription\SubscriptionSearch; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\Subscription\Subscription\Model\SubscriptionSearch; | |||
use yii\filters\AccessControl; | |||
use yii\web\NotFoundHttpException; | |||
@@ -43,14 +43,13 @@ use common\helpers\GlobalParam; | |||
use common\helpers\Mailjet; | |||
use backend\models\MailForm; | |||
use common\helpers\Password; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Order\Order\OrderSearch; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\PointSale\UserPointSale\UserPointSale; | |||
use common\logic\User\CreditHistory\CreditHistory; | |||
use common\logic\User\User\UserSearch; | |||
use common\logic\User\UserProducer\UserProducer; | |||
use common\logic\User\UserUserGroup\UserUserGroup; | |||
use common\logic\Order\Order\Model\OrderSearch; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\PointSale\UserPointSale\Model\UserPointSale; | |||
use common\logic\User\CreditHistory\Model\CreditHistory; | |||
use common\logic\User\User\Model\UserSearch; | |||
use common\logic\User\UserProducer\Model\UserProducer; | |||
use common\logic\User\UserUserGroup\Model\UserUserGroup; | |||
use yii\base\UserException; | |||
use yii\debug\models\search\User; | |||
use yii\filters\AccessControl; |
@@ -39,8 +39,8 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\logic\User\UserGroup\UserGroupSearch; | |||
use common\logic\User\UserUserGroup\UserUserGroup; | |||
use common\logic\User\UserGroup\Model\UserGroupSearch; | |||
use common\logic\User\UserUserGroup\Model\UserUserGroup; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
use yii\web\NotFoundHttpException; |
@@ -39,9 +39,9 @@ | |||
use yii\helpers\Html; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\User\User\User; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\User\User\Model\User; | |||
$userManager = $this->getUserManager(); | |||
$producerManager = $this->getProducerManager(); |
@@ -65,14 +65,14 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord | |||
public static function searchBy($params = [], $options = []) | |||
{ | |||
$class = get_called_class(); | |||
$repositoryClass = $class.'Repository'; | |||
$repositoryClass = str_replace('\\Model\\', '\\Repository\\', $class).'Repository'; | |||
$repository = $repositoryClass::getInstance(); | |||
if (is_callable([$repositoryClass, 'getDefaultOptionsSearch'])) { | |||
$repository = $repositoryClass::getInstance(); | |||
if(method_exists($repository , 'getDefaultOptionsSearch')) { | |||
$default_options = $repository->getDefaultOptionsSearch(); | |||
} else { | |||
throw new \ErrorException('La méthode "getDefaultOptionsSearch" n\'est ' | |||
. 'pas définie dans la classe "' . $class . '"'); | |||
. 'pas définie dans la classe "' . $repositoryClass . '"'); | |||
} | |||
$options = array_merge($default_options, $options); | |||
@@ -81,7 +81,8 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord | |||
$pk = $class::tableName() . '.' . $pk[0]; | |||
if (isset($options['attribute_id_producer']) && strlen($options['attribute_id_producer']) | |||
&& !isset($params[$options['attribute_id_producer']]) && !\Yii::$app->user->isGuest) { | |||
&& !isset($params[$options['attribute_id_producer']]) && !\Yii::$app->user->isGuest | |||
) { | |||
$params[$options['attribute_id_producer']] = GlobalParam::getCurrentProducerId(); | |||
} | |||
@@ -2,30 +2,7 @@ | |||
namespace common\components; | |||
use common\logic\Config\TaxRate\TaxRateContainer; | |||
use common\logic\Distribution\Distribution\DistributionContainer; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionContainer; | |||
use common\logic\Distribution\ProductDistribution\ProductDistributionContainer; | |||
use common\logic\Document\Document\DocumentContainer; | |||
use common\logic\Order\Order\OrderContainer; | |||
use common\logic\Order\Order\OrderManager; | |||
use common\logic\Order\OrderStatusHistory\OrderStatusHistoryContainer; | |||
use common\logic\Order\ProductOrder\ProductOrderContainer; | |||
use common\logic\PointSale\PointSale\PointSaleContainer; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Producer\Producer\ProducerContainer; | |||
use common\logic\Producer\ProducerPriceRange\ProducerPriceRangeContainer; | |||
use common\logic\Product\Product\ProductContainer; | |||
use common\logic\Product\ProductCategory\ProductCategoryContainer; | |||
use common\logic\Product\ProductPointSale\ProductPointSaleContainer; | |||
use common\logic\Product\ProductPrice\ProductPriceContainer; | |||
use common\logic\Subscription\ProductSubscription\ProductSubscriptionContainer; | |||
use common\logic\Subscription\Subscription\SubscriptionContainer; | |||
use common\logic\User\CreditHistory\CreditHistoryContainer; | |||
use common\logic\User\User\UserContainer; | |||
use common\logic\User\UserGroup\UserGroupContainer; | |||
use common\logic\User\UserProducer\UserProducerContainer; | |||
use common\logic\User\UserUserGroup\UserUserGroupContainer; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use yii\base\ErrorException; | |||
class BusinessLogic |
@@ -4,53 +4,53 @@ namespace common\components; | |||
use common\logic\Config\TaxRate\TaxRateContainer; | |||
use common\logic\Config\TaxRate\TaxRateManager; | |||
use common\logic\Distribution\Distribution\DistributionContainer; | |||
use common\logic\Distribution\Distribution\DistributionManager; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionContainer; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionManager; | |||
use common\logic\Distribution\ProductDistribution\ProductDistributionContainer; | |||
use common\logic\Distribution\ProductDistribution\ProductDistributionManager; | |||
use common\logic\Document\DeliveryNote\DeliveryNoteManager; | |||
use common\logic\Document\Document\DocumentContainer; | |||
use common\logic\Document\Document\DocumentManager; | |||
use common\logic\Document\Invoice\InvoiceManager; | |||
use common\logic\Document\Invoice\QuotationManager; | |||
use common\logic\Order\Order\OrderContainer; | |||
use common\logic\Order\Order\OrderManager; | |||
use common\logic\Order\OrderStatusHistory\OrderStatusHistoryContainer; | |||
use common\logic\Order\OrderStatusHistory\OrderStatusHistoryManager; | |||
use common\logic\Order\ProductOrder\ProductOrderContainer; | |||
use common\logic\Order\ProductOrder\ProductOrderManager; | |||
use common\logic\PointSale\PointSale\PointSaleContainer; | |||
use common\logic\PointSale\PointSale\PointSaleManager; | |||
use common\logic\PointSale\UserPointSale\UserPointSaleContainer; | |||
use common\logic\PointSale\UserPointSale\UserPointSaleManager; | |||
use common\logic\Producer\Producer\ProducerContainer; | |||
use common\logic\Producer\Producer\ProducerManager; | |||
use common\logic\Producer\ProducerPriceRange\ProducerPriceRangeContainer; | |||
use common\logic\Producer\ProducerPriceRange\ProducerPriceRangeManager; | |||
use common\logic\Product\Product\ProductContainer; | |||
use common\logic\Product\Product\ProductManager; | |||
use common\logic\Product\ProductCategory\ProductCategoryContainer; | |||
use common\logic\Product\ProductCategory\ProductCategoryManager; | |||
use common\logic\Product\ProductPointSale\ProductPointSaleContainer; | |||
use common\logic\Product\ProductPointSale\ProductPointSaleManager; | |||
use common\logic\Product\ProductPrice\ProductPriceContainer; | |||
use common\logic\Product\ProductPrice\ProductPriceManager; | |||
use common\logic\Subscription\ProductSubscription\ProductSubscriptionContainer; | |||
use common\logic\Subscription\ProductSubscription\ProductSubscriptionManager; | |||
use common\logic\Subscription\Subscription\SubscriptionContainer; | |||
use common\logic\Subscription\Subscription\SubscriptionManager; | |||
use common\logic\User\CreditHistory\CreditHistoryContainer; | |||
use common\logic\User\CreditHistory\CreditHistoryManager; | |||
use common\logic\User\User\UserContainer; | |||
use common\logic\User\User\UserManager; | |||
use common\logic\User\UserGroup\UserGroupContainer; | |||
use common\logic\User\UserGroup\UserGroupManager; | |||
use common\logic\User\UserProducer\UserProducerContainer; | |||
use common\logic\User\UserProducer\UserProducerManager; | |||
use common\logic\User\UserUserGroup\UserUserGroupContainer; | |||
use common\logic\User\UserUserGroup\UserUserGroupManager; | |||
use common\logic\Distribution\Distribution\Wrapper\DistributionContainer; | |||
use common\logic\Distribution\PointSaleDistribution\Wrapper\PointSaleDistributionContainer; | |||
use common\logic\Distribution\PointSaleDistribution\Wrapper\PointSaleDistributionManager; | |||
use common\logic\Distribution\ProductDistribution\Wrapper\ProductDistributionContainer; | |||
use common\logic\Distribution\ProductDistribution\Wrapper\ProductDistributionManager; | |||
use common\logic\Document\DeliveryNote\Wrapper\DeliveryNoteManager; | |||
use common\logic\Document\Document\Wrapper\DocumentContainer; | |||
use common\logic\Document\Document\Wrapper\DocumentManager; | |||
use common\logic\Document\Invoice\Wrapper\InvoiceManager; | |||
use common\logic\Document\Invoice\Wrapper\QuotationManager; | |||
use common\logic\Order\Order\Wrapper\OrderContainer; | |||
use common\logic\Order\Order\Wrapper\OrderManager; | |||
use common\logic\Order\OrderStatusHistory\Wrapper\OrderStatusHistoryContainer; | |||
use common\logic\Order\OrderStatusHistory\Wrapper\OrderStatusHistoryManager; | |||
use common\logic\Order\ProductOrder\Wrapper\ProductOrderContainer; | |||
use common\logic\Order\ProductOrder\Wrapper\ProductOrderManager; | |||
use common\logic\PointSale\PointSale\Wrapper\PointSaleContainer; | |||
use common\logic\PointSale\PointSale\Wrapper\PointSaleManager; | |||
use common\logic\PointSale\UserPointSale\Wrapper\UserPointSaleContainer; | |||
use common\logic\PointSale\UserPointSale\Wrapper\UserPointSaleManager; | |||
use common\logic\Producer\Producer\Wrapper\ProducerContainer; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use common\logic\Producer\ProducerPriceRange\Wrapper\ProducerPriceRangeContainer; | |||
use common\logic\Producer\ProducerPriceRange\Wrapper\ProducerPriceRangeManager; | |||
use common\logic\Product\Product\Wrapper\ProductContainer; | |||
use common\logic\Product\Product\Wrapper\ProductManager; | |||
use common\logic\Product\ProductCategory\Wrapper\ProductCategoryContainer; | |||
use common\logic\Product\ProductCategory\Wrapper\ProductCategoryManager; | |||
use common\logic\Product\ProductPointSale\Wrapper\ProductPointSaleContainer; | |||
use common\logic\Product\ProductPointSale\Wrapper\ProductPointSaleManager; | |||
use common\logic\Product\ProductPrice\Wrapper\ProductPriceContainer; | |||
use common\logic\Product\ProductPrice\Wrapper\ProductPriceManager; | |||
use common\logic\Subscription\ProductSubscription\Wrapper\ProductSubscriptionContainer; | |||
use common\logic\Subscription\ProductSubscription\Wrapper\ProductSubscriptionManager; | |||
use common\logic\Subscription\Subscription\Wrapper\SubscriptionContainer; | |||
use common\logic\Subscription\Subscription\Wrapper\SubscriptionManager; | |||
use common\logic\User\CreditHistory\Wrapper\CreditHistoryContainer; | |||
use common\logic\User\CreditHistory\Wrapper\CreditHistoryManager; | |||
use common\logic\User\User\Wrapper\UserContainer; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\UserGroup\Wrapper\UserGroupContainer; | |||
use common\logic\User\UserGroup\Wrapper\UserGroupManager; | |||
use common\logic\User\UserProducer\Wrapper\UserProducerContainer; | |||
use common\logic\User\UserProducer\Wrapper\UserProducerManager; | |||
use common\logic\User\UserUserGroup\Wrapper\UserUserGroupContainer; | |||
use common\logic\User\UserUserGroup\Wrapper\UserUserGroupManager; | |||
trait BusinessLogicTrait | |||
{ |
@@ -61,7 +61,7 @@ return [ | |||
], | |||
'user' => [ | |||
'class' => 'yii\web\User', | |||
'identityClass' => 'common\logic\User\User\User', | |||
'identityClass' => 'common\logic\User\User\Model\User', | |||
'enableAutoLogin' => true, | |||
'identityCookie' => [ | |||
'name' => 'distrib', |
@@ -40,7 +40,7 @@ namespace common\controllers; | |||
use common\components\BusinessLogic; | |||
use common\components\BusinessLogicTrait; | |||
use common\logic\User\User\User; | |||
use common\logic\User\User\Model\User; | |||
use yii; | |||
class CommonController extends \yii\web\Controller |
@@ -38,8 +38,8 @@ termes. | |||
namespace common\forms; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\User\User\User; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\User\User\Model\User; | |||
use Yii; | |||
use yii\base\Model; | |||
@@ -38,8 +38,8 @@ | |||
namespace common\helpers; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\User\User\UserSolver; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\User\User\Service\UserSolver; | |||
class GlobalParam | |||
{ |
@@ -38,7 +38,9 @@ | |||
namespace common\helpers; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Producer\Producer\ProducerManager; | |||
use linslin\yii2\curl; | |||
class Tiller | |||
@@ -52,10 +54,12 @@ class Tiller | |||
public function __construct() | |||
{ | |||
$producerManager = ProducerManager::getInstance(); | |||
$this->curl = new curl\Curl(); | |||
$this->producer_tiller = Producer::getConfig('tiller'); | |||
$this->provider_token = Producer::getConfig('tiller_provider_token'); | |||
$this->restaurant_token = Producer::getConfig('tiller_restaurant_token'); | |||
$this->producer_tiller = $producerManager->getConfig('tiller'); | |||
$this->provider_token = $producerManager->getConfig('tiller_provider_token'); | |||
$this->restaurant_token = $producerManager->getConfig('tiller_restaurant_token'); | |||
} | |||
public function getOrders($date) |
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\Distribution\Distribution\Event; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use yii\base\Event; | |||
class DistributionActiveEvent extends Event | |||
{ | |||
public Distribution $distribution; | |||
} |
@@ -36,14 +36,14 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Distribution\Distribution; | |||
namespace common\logic\Distribution\Distribution\Model; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution; | |||
use common\logic\Distribution\ProductDistribution\ProductDistribution; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\components\ActiveRecordCommon; | |||
use common\logic\Subscription\Subscription\SubscriptionEventSubscriber; | |||
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution; | |||
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Subscription\Subscription\Event\SubscriptionEventSubscriber; | |||
class Distribution extends ActiveRecordCommon | |||
{ |
@@ -1,12 +1,14 @@ | |||
<?php | |||
namespace common\logic\Distribution\Distribution; | |||
namespace common\logic\Distribution\Distribution\Repository; | |||
use common\helpers\GlobalParam; | |||
use common\logic\AbstractRepository; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Subscription\Subscription\Subscription; | |||
use common\logic\Subscription\Subscription\SubscriptionSolver; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\Distribution\Service\DistributionSolver; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Subscription\Subscription\Model\Subscription; | |||
use common\logic\Subscription\Subscription\Service\SubscriptionSolver; | |||
class DistributionRepository extends AbstractRepository | |||
{ | |||
@@ -125,11 +127,11 @@ class DistributionRepository extends AbstractRepository | |||
$incomingDistributions->params($params); | |||
$incomingDistributionsArray = $incomingDistributions->all(); | |||
$this->subscriptionSolver->filterDistributionsByDateDelay($incomingDistributionsArray); | |||
$this->distributionSolver->filterDistributionsByDateDelay($incomingDistributionsArray); | |||
$matchedIncomingDistributionsArray = []; | |||
foreach ($incomingDistributionsArray as $incomingDistribution) { | |||
if ($this->subscriptionSolver->matchWith($subscription, $incomingDistribution->date)) { | |||
if ($this->subscriptionSolver->isSubscriptionMatchWith($subscription, $incomingDistribution->date)) { | |||
$matchedIncomingDistributionsArray[] = $incomingDistribution; | |||
} | |||
} |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Distribution\Distribution; | |||
namespace common\logic\Distribution\Distribution\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,22 +1,19 @@ | |||
<?php | |||
namespace common\logic\Distribution\Distribution; | |||
namespace common\logic\Distribution\Distribution\Service; | |||
use common\logic\AbstractBuilder; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionBuilder; | |||
use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionRepository; | |||
use common\logic\Distribution\ProductDistribution\ProductDistribution; | |||
use common\logic\Distribution\ProductDistribution\ProductDistributionBuilder; | |||
use common\logic\Distribution\ProductDistribution\ProductDistributionRepository; | |||
use common\logic\Order\Order\OrderRepository; | |||
use common\logic\Order\ProductOrder\ProductOrderBuilder; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Product\Product\ProductRepository; | |||
use common\logic\User\UserProducer\UserProducerRepository; | |||
use yii\base\Event; | |||
use common\logic\Distribution\Distribution\Event\DistributionActiveEvent; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\Distribution\Repository\DistributionRepository; | |||
use common\logic\Distribution\PointSaleDistribution\Repository\PointSaleDistributionRepository; | |||
use common\logic\Distribution\PointSaleDistribution\Service\PointSaleDistributionBuilder; | |||
use common\logic\Distribution\ProductDistribution\Repository\ProductDistributionRepository; | |||
use common\logic\Distribution\ProductDistribution\Service\ProductDistributionBuilder; | |||
use common\logic\Order\Order\Repository\OrderRepository; | |||
use common\logic\Order\ProductOrder\Service\ProductOrderBuilder; | |||
use common\logic\Product\Product\Repository\ProductRepository; | |||
use common\logic\User\UserProducer\Repository\UserProducerRepository; | |||
class DistributionBuilder extends AbstractBuilder | |||
{ | |||
@@ -39,6 +36,7 @@ class DistributionBuilder extends AbstractBuilder | |||
$this->pointSaleDistributionBuilder = $this->loadService(PointSaleDistributionBuilder::class); | |||
$this->productRepository = $this->loadService(ProductRepository::class); | |||
$this->productDistributionRepository = $this->loadService(ProductDistributionRepository::class); | |||
$this->productDistributionBuilder = $this->loadService(ProductDistributionBuilder::class); | |||
$this->orderRepository = $this->loadService(OrderRepository::class); | |||
$this->userProducerRepository = $this->loadService(UserProducerRepository::class); | |||
$this->productOrderBuilder = $this->loadService(ProductOrderBuilder::class); | |||
@@ -189,7 +187,10 @@ class DistributionBuilder extends AbstractBuilder | |||
$this->saveUpdate($distribution); | |||
if ($active) { | |||
$distribution->trigger(Distribution::EVENT_ACTIVE, new Event(['distribution' => $distribution])); | |||
$distributionActiveEvent = new DistributionActiveEvent(); | |||
$distributionActiveEvent->distribution = $distribution; | |||
$distribution->trigger(Distribution::EVENT_ACTIVE, $distributionActiveEvent); | |||
} | |||
} | |||
} |
@@ -1,9 +1,10 @@ | |||
<?php | |||
namespace common\logic\Distribution\Distribution; | |||
namespace common\logic\Distribution\Distribution\Service; | |||
use common\helpers\GlobalParam; | |||
use common\logic\AbstractService; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\SolverInterface; |
@@ -1,8 +1,12 @@ | |||
<?php | |||
namespace common\logic\Distribution\Distribution; | |||
namespace common\logic\Distribution\Distribution\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\Distribution\Repository\DistributionRepository; | |||
use common\logic\Distribution\Distribution\Service\DistributionBuilder; | |||
use common\logic\Distribution\Distribution\Service\DistributionSolver; | |||
class DistributionContainer extends AbstractContainer | |||
{ |
@@ -3,6 +3,10 @@ | |||
namespace common\logic\Distribution\Distribution; | |||
use common\logic\AbstractManager; | |||
use common\logic\Distribution\Distribution\Repository\DistributionRepository; | |||
use common\logic\Distribution\Distribution\Service\DistributionBuilder; | |||
use common\logic\Distribution\Distribution\Service\DistributionSolver; | |||
use common\logic\Distribution\Distribution\Wrapper\DistributionContainer; | |||
/** | |||
* @mixin DistributionSolver |
@@ -36,10 +36,10 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
namespace common\logic\Distribution\PointSaleDistribution; | |||
namespace common\logic\Distribution\PointSaleDistribution\Model; | |||
use common\components\ActiveRecordCommon ; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
class PointSaleDistribution extends ActiveRecordCommon |
@@ -1,9 +1,10 @@ | |||
<?php | |||
namespace common\logic\Distribution\PointSaleDistribution; | |||
namespace common\logic\Distribution\PointSaleDistribution\Repository; | |||
use common\logic\AbstractRepository; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
class PointSaleDistributionRepository extends AbstractRepository |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Distribution\PointSaleDistribution; | |||
namespace common\logic\Distribution\PointSaleDistribution\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,12 +1,13 @@ | |||
<?php | |||
namespace common\logic\Distribution\PointSaleDistribution; | |||
namespace common\logic\Distribution\PointSaleDistribution\Service; | |||
use common\logic\AbstractBuilder; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\Distribution\DistributionRepository; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\PointSale\PointSale\PointSaleRepository; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\Distribution\Repository\DistributionRepository; | |||
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution; | |||
use common\logic\Distribution\PointSaleDistribution\Repository\PointSaleDistributionRepository; | |||
use common\logic\PointSale\PointSale\Repository\PointSaleRepository; | |||
class PointSaleDistributionBuilder extends AbstractBuilder | |||
{ | |||
@@ -57,7 +58,7 @@ class PointSaleDistributionBuilder extends AbstractBuilder | |||
// setAll | |||
public function createAllPointSaleDistributions(Distribution $distribution, bool $delivery): void | |||
{ | |||
$pointSaleArray = $this->pointSaleRepository->findPointSaleDistributionsByDistribution($distribution); | |||
$pointSaleArray = $this->pointSaleDistributionRepository->findPointSaleDistributionsByDistribution($distribution); | |||
foreach ($pointSaleArray as $pointSale) { | |||
if (!$pointSale->pointSaleDistribution) { | |||
$this->createPointSaleDistribution($distribution, $pointSale); |
@@ -1,8 +1,11 @@ | |||
<?php | |||
namespace common\logic\Distribution\PointSaleDistribution; | |||
namespace common\logic\Distribution\PointSaleDistribution\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution; | |||
use common\logic\Distribution\PointSaleDistribution\Repository\PointSaleDistributionRepository; | |||
use common\logic\Distribution\PointSaleDistribution\Service\PointSaleDistributionBuilder; | |||
class PointSaleDistributionContainer extends AbstractContainer | |||
{ |
@@ -1,8 +1,10 @@ | |||
<?php | |||
namespace common\logic\Distribution\PointSaleDistribution; | |||
namespace common\logic\Distribution\PointSaleDistribution\Wrapper; | |||
use common\logic\AbstractManager; | |||
use common\logic\Distribution\PointSaleDistribution\Repository\PointSaleDistributionRepository; | |||
use common\logic\Distribution\PointSaleDistribution\Service\PointSaleDistributionBuilder; | |||
/** | |||
* @mixin PointSaleDistributionRepository |
@@ -36,10 +36,10 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
namespace common\logic\Distribution\ProductDistribution; | |||
namespace common\logic\Distribution\ProductDistribution\Model; | |||
use common\components\ActiveRecordCommon ; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Product\Product\Product; | |||
class ProductDistribution extends ActiveRecordCommon |
@@ -1,9 +1,10 @@ | |||
<?php | |||
namespace common\logic\Distribution\ProductDistribution; | |||
namespace common\logic\Distribution\ProductDistribution\Repository; | |||
use common\logic\AbstractRepository; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution; | |||
use common\logic\Product\Product\Product; | |||
class ProductDistributionRepository extends AbstractRepository |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Distribution\ProductDistribution; | |||
namespace common\logic\Distribution\ProductDistribution\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,13 +1,14 @@ | |||
<?php | |||
namespace common\logic\Distribution\ProductDistribution; | |||
namespace common\logic\Distribution\ProductDistribution\Service; | |||
use common\logic\AbstractBuilder; | |||
use common\logic\BuilderInterface; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\Distribution\DistributionSolver; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Product\Product\ProductSolver; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\Distribution\Service\DistributionSolver; | |||
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution; | |||
use common\logic\Distribution\ProductDistribution\Repository\ProductDistributionRepository; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\Product\Product\Service\ProductSolver; | |||
class ProductDistributionBuilder extends AbstractBuilder | |||
{ |
@@ -1,8 +1,11 @@ | |||
<?php | |||
namespace common\logic\Distribution\ProductDistribution; | |||
namespace common\logic\Distribution\ProductDistribution\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution; | |||
use common\logic\Distribution\ProductDistribution\Repository\ProductDistributionRepository; | |||
use common\logic\Distribution\ProductDistribution\Service\ProductDistributionBuilder; | |||
class ProductDistributionContainer extends AbstractContainer | |||
{ |
@@ -1,8 +1,10 @@ | |||
<?php | |||
namespace common\logic\Distribution\ProductDistribution; | |||
namespace common\logic\Distribution\ProductDistribution\Wrapper; | |||
use common\logic\AbstractManager; | |||
use common\logic\Distribution\ProductDistribution\Repository\ProductDistributionRepository; | |||
use common\logic\Distribution\ProductDistribution\Service\ProductDistributionBuilder; | |||
/** | |||
* @mixin ProductDistributionRepository |
@@ -36,7 +36,7 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Model; | |||
use common\logic\Document\Document\Document; | |||
@@ -36,10 +36,10 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Model; | |||
use common\helpers\GlobalParam; | |||
use common\logic\PointSale\PointSale\DeliveryNoteRepository; | |||
use common\logic\Document\DeliveryNote\Repository\DeliveryNoteRepository; | |||
use yii\data\ActiveDataProvider; | |||
class DeliveryNoteSearch extends DeliveryNote |
@@ -1,8 +1,9 @@ | |||
<?php | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Repository; | |||
use common\logic\AbstractRepository; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNote; | |||
class DeliveryNoteRepository extends AbstractRepository | |||
{ |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,7 +1,8 @@ | |||
<?php | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Service; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNote; | |||
use common\logic\Document\Document\DocumentBuilder; | |||
class DeliveryNoteBuilder extends DocumentBuilder |
@@ -1,7 +1,8 @@ | |||
<?php | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Service; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNote; | |||
use common\logic\Document\Document\DocumentSolver; | |||
use common\logic\Document\Invoice\Invoice; | |||
use common\logic\SolverInterface; |
@@ -1,8 +1,11 @@ | |||
<?php | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNote; | |||
use common\logic\Document\DeliveryNote\Service\DeliveryNoteBuilder; | |||
use common\logic\Document\DeliveryNote\Service\DeliveryNoteSolver; | |||
class DeliveryNoteContainer extends AbstractContainer | |||
{ |
@@ -1,9 +1,11 @@ | |||
<?php | |||
namespace common\logic\Document\DeliveryNote; | |||
namespace common\logic\Document\DeliveryNote\Wrapper; | |||
use common\logic\Document\DeliveryNote\Repository\DeliveryNoteRepository; | |||
use common\logic\Document\DeliveryNote\Service\DeliveryNoteBuilder; | |||
use common\logic\Document\DeliveryNote\Service\DeliveryNoteSolver; | |||
use common\logic\Document\Document\DocumentManager; | |||
use common\logic\PointSale\PointSale\DeliveryNoteRepository; | |||
/** | |||
* @mixin DeliveryNoteSolver |
@@ -1,8 +0,0 @@ | |||
<?php | |||
namespace common\logic\Document\Document; | |||
interface DocumentInterface | |||
{ | |||
} |
@@ -36,16 +36,13 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Document\Document; | |||
namespace common\logic\Document\Document\Model; | |||
use common\components\ActiveRecordCommon; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Order\Order\OrderRepository; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\User\User\User; | |||
use kartik\mpdf\Pdf; | |||
use yii\base\ErrorException; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\Order\Repository\OrderRepository; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\User\User\Model\User; | |||
class Document extends ActiveRecordCommon implements DocumentInterface | |||
{ |
@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace common\logic\Document\Document\Model; | |||
interface DocumentInterface | |||
{ | |||
} |
@@ -1,9 +1,11 @@ | |||
<?php | |||
namespace common\logic\Document\Document; | |||
namespace common\logic\Document\Document\Service; | |||
use common\logic\AbstractBuilder; | |||
use common\logic\Producer\Producer\ProducerRepository; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Document\Document\Model\DocumentInterface; | |||
use common\logic\Producer\Producer\Repository\ProducerRepository; | |||
class DocumentBuilder extends AbstractBuilder | |||
{ |
@@ -1,9 +1,11 @@ | |||
<?php | |||
namespace common\logic\Document\Document; | |||
namespace common\logic\Document\Document\Service; | |||
use common\helpers\Price; | |||
use common\logic\AbstractService; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Document\Document\Model\DocumentInterface; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\SolverInterface; |
@@ -1,11 +1,12 @@ | |||
<?php | |||
namespace common\logic\Document\Document; | |||
namespace common\logic\Document\Document\Service; | |||
use common\helpers\GlobalParam; | |||
use common\logic\AbstractService; | |||
use common\logic\Producer\Producer\ProducerRepository; | |||
use common\logic\Producer\Producer\ProducerSolver; | |||
use common\logic\Document\Document\Model\DocumentInterface; | |||
use common\logic\Producer\Producer\Repository\ProducerRepository; | |||
use common\logic\Producer\Producer\Service\ProducerSolver; | |||
use common\logic\UtilsInterface; | |||
use kartik\mpdf\Pdf; | |||
use yii\base\ErrorException; | |||
@@ -120,7 +121,7 @@ class DocumentUtils extends AbstractService implements UtilsInterface | |||
->setFrom([$producer->getEmailOpendistrib() => $producer->name]) | |||
->setSubject('[' . $producer->name . '] ' . $subjectEmail); | |||
$this->documentBuilder->generatePdf($document, Pdf::DEST_FILE); | |||
$this->generatePdf($document, Pdf::DEST_FILE); | |||
$email->attach($this->documentSolver->getFilenameComplete($document)); | |||
return $email->send(); |
@@ -1,8 +1,12 @@ | |||
<?php | |||
namespace common\logic\Document\Document; | |||
namespace common\logic\Document\Document\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Document\Document\Service\DocumentBuilder; | |||
use common\logic\Document\Document\Service\DocumentSolver; | |||
use common\logic\Document\Document\Service\DocumentUtils; | |||
class DocumentContainer extends AbstractContainer | |||
{ |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Document\Document; | |||
namespace common\logic\Document\Document\Wrapper; | |||
use common\logic\AbstractManager; | |||
@@ -1,17 +0,0 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice; | |||
use common\logic\Document\Document\DocumentManager; | |||
/** | |||
* @mixin InvoiceRepository | |||
* @mixin InvoiceBuilder | |||
*/ | |||
class InvoiceManager extends DocumentManager | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return InvoiceContainer::class; | |||
} | |||
} |
@@ -36,9 +36,9 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Document\Invoice; | |||
namespace common\logic\Document\Invoice\Model; | |||
use common\logic\Document\Document\Document; | |||
use common\logic\Document\Document\Model\Document; | |||
/** | |||
* This is the model class for table "invoice". |
@@ -36,10 +36,10 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Document\Invoice; | |||
namespace common\logic\Document\Invoice\Model; | |||
use common\helpers\GlobalParam; | |||
use common\logic\PointSale\PointSale\InvoiceRepository; | |||
use common\logic\Document\Invoice\Repository\InvoiceRepository; | |||
use yii\data\ActiveDataProvider; | |||
class InvoiceSearch extends Invoice |
@@ -1,8 +1,9 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice; | |||
namespace common\logic\Document\Invoice\Repository; | |||
use common\logic\AbstractRepository; | |||
use common\logic\Document\Invoice\Model\Invoice; | |||
class InvoiceRepository extends AbstractRepository | |||
{ |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice; | |||
namespace common\logic\Document\Invoice\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,8 +1,9 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice; | |||
namespace common\logic\Document\Invoice\Service; | |||
use common\logic\Document\Document\DocumentBuilder; | |||
use common\logic\Document\Document\Service\DocumentBuilder; | |||
use common\logic\Document\Invoice\Model\Invoice; | |||
class InvoiceBuilder extends DocumentBuilder | |||
{ |
@@ -1,9 +1,12 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice; | |||
namespace common\logic\Document\Invoice\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Document\Document\DocumentSolver; | |||
use common\logic\Document\Document\Service\DocumentSolver; | |||
use common\logic\Document\Invoice\Model\Invoice; | |||
use common\logic\Document\Invoice\Repository\InvoiceRepository; | |||
use common\logic\Document\Invoice\Service\InvoiceBuilder; | |||
class InvoiceContainer extends AbstractContainer | |||
{ |
@@ -0,0 +1,19 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice\Wrapper; | |||
use common\logic\Document\Document\Wrapper\DocumentManager; | |||
use common\logic\Document\Invoice\Repository\InvoiceRepository; | |||
use common\logic\Document\Invoice\Service\InvoiceBuilder; | |||
/** | |||
* @mixin InvoiceRepository | |||
* @mixin InvoiceBuilder | |||
*/ | |||
class InvoiceManager extends DocumentManager | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return InvoiceContainer::class; | |||
} | |||
} |
@@ -36,9 +36,9 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Document\Quotation; | |||
namespace common\logic\Document\Quotation\Model; | |||
use common\logic\Document\Document\Document; | |||
use common\logic\Document\Document\Model\Document; | |||
/** | |||
* This is the model class for table "quotation". |
@@ -36,10 +36,10 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Document\Quotation; | |||
namespace common\logic\Document\Quotation\Model; | |||
use common\helpers\GlobalParam; | |||
use common\logic\PointSale\PointSale\QuotationRepository; | |||
use common\logic\PointSale\PointSale\Repository\QuotationRepository; | |||
use yii\data\ActiveDataProvider; | |||
class QuotationSearch extends Quotation |
@@ -1,19 +0,0 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice; | |||
use common\logic\Document\Document\DocumentManager; | |||
use common\logic\Document\Quotation\QuotationBuilder; | |||
use common\logic\PointSale\PointSale\QuotationRepository; | |||
/** | |||
* @mixin QuotationRepository | |||
* @mixin QuotationBuilder | |||
*/ | |||
class QuotationManager extends DocumentManager | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return QuotationContainer::class; | |||
} | |||
} |
@@ -1,9 +1,9 @@ | |||
<?php | |||
namespace common\logic\PointSale\PointSale; | |||
namespace common\logic\PointSale\PointSale\Repository; | |||
use common\logic\AbstractRepository; | |||
use common\logic\Document\Quotation\QuotationRepositoryQuery; | |||
use common\logic\Document\Quotation\Repository\QuotationRepositoryQuery; | |||
class QuotationRepository extends AbstractRepository | |||
{ |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Document\Quotation; | |||
namespace common\logic\Document\Quotation\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,8 +1,9 @@ | |||
<?php | |||
namespace common\logic\Document\Quotation; | |||
namespace common\logic\Document\Quotation\Service; | |||
use common\logic\AbstractBuilder; | |||
use common\logic\Document\Quotation\Model\Quotation; | |||
class QuotationBuilder extends AbstractBuilder | |||
{ |
@@ -1,12 +1,12 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice; | |||
namespace common\logic\Document\Invoice\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Document\Document\DocumentSolver; | |||
use common\logic\Document\Quotation\QuotationBuilder; | |||
use common\logic\Document\Quotation\Quotation; | |||
use common\logic\PointSale\PointSale\QuotationRepository; | |||
use common\logic\Document\Document\Service\DocumentSolver; | |||
use common\logic\Document\Quotation\Model\Quotation; | |||
use common\logic\Document\Quotation\Service\QuotationBuilder; | |||
use common\logic\PointSale\PointSale\Repository\QuotationRepository; | |||
class QuotationContainer extends AbstractContainer | |||
{ |
@@ -0,0 +1,19 @@ | |||
<?php | |||
namespace common\logic\Document\Invoice\Wrapper; | |||
use common\logic\Document\Document\Wrapper\DocumentManager; | |||
use common\logic\Document\Quotation\Service\QuotationBuilder; | |||
use common\logic\PointSale\PointSale\Repository\QuotationRepository; | |||
/** | |||
* @mixin QuotationRepository | |||
* @mixin QuotationBuilder | |||
*/ | |||
class QuotationManager extends DocumentManager | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return QuotationContainer::class; | |||
} | |||
} |
@@ -36,17 +36,17 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Order\Order; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Document\DeliveryNote\DeliveryNote; | |||
use common\logic\Document\Invoice\Invoice; | |||
use common\logic\Document\Quotation\Quotation; | |||
use common\logic\Order\ProductOrder\ProductOrder; | |||
use common\logic\PointSale\PointSale\PointSale; | |||
use common\logic\Subscription\Subscription\Subscription; | |||
use common\logic\User\CreditHistory\CreditHistory; | |||
use common\logic\User\User\User; | |||
namespace common\logic\Order\Order\Model; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Document\DeliveryNote\Model\DeliveryNote; | |||
use common\logic\Document\Invoice\Model\Invoice; | |||
use common\logic\Document\Quotation\Model\Quotation; | |||
use common\logic\Order\ProductOrder\Model\ProductOrder; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Subscription\Subscription\Model\Subscription; | |||
use common\logic\User\CreditHistory\Model\CreditHistory; | |||
use common\logic\User\User\Model\User; | |||
use common\components\ActiveRecordCommon; | |||
/** |
@@ -36,8 +36,9 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
namespace common\logic\Order\Order ; | |||
namespace common\logic\Order\Order\Model; | |||
use common\logic\Order\Order\Repository\OrderRepository; | |||
use yii\data\ActiveDataProvider; | |||
class OrderSearch extends Order |
@@ -1,27 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\Order; | |||
use common\logic\AbstractManager; | |||
use common\logic\Config\TaxRate\TaxRate; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Document\Document\Document; | |||
use common\logic\Order\ProductOrder\ProductOrder; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Subscription\Subscription\Subscription; | |||
use common\logic\User\User\User; | |||
use yii\db\Query; | |||
/** | |||
* @mixin OrderSolver | |||
* @mixin OrderRepository | |||
* @mixin OrderBuilder | |||
*/ | |||
class OrderManager extends AbstractManager | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return OrderContainer::class; | |||
} | |||
} |
@@ -1,15 +1,17 @@ | |||
<?php | |||
namespace common\logic\Order\Order; | |||
namespace common\logic\Order\Order\Repository; | |||
use common\logic\AbstractRepository; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\ProductDistribution\ProductDistributionRepository; | |||
use common\logic\Order\ProductOrder\ProductOrderRepository; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Producer\Producer\ProducerRepository; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\User\User\User; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\ProductDistribution\Repository\ProductDistributionRepository; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\Order\Service\OrderSolver; | |||
use common\logic\Order\ProductOrder\Repository\ProductOrderRepository; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Producer\Producer\Repository\ProducerRepository; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\User\User\Model\User; | |||
use yii\helpers\Html; | |||
class OrderRepository extends AbstractRepository | |||
@@ -136,7 +138,7 @@ class OrderRepository extends AbstractRepository | |||
public function getCartSummary(Order $order, $htmlFormat = true): string | |||
{ | |||
if (!isset($order->productOrder)) { | |||
$order->productOrder = $this->productOrderRepository->getByOrder($order); | |||
$order->productOrder = $this->productOrderRepository->findProductOrdersByOrder($order); | |||
} | |||
$html = ''; | |||
@@ -170,7 +172,7 @@ class OrderRepository extends AbstractRepository | |||
{ | |||
$html = ''; | |||
$creditActive = $this->producerRepository->getConfig('credit'); | |||
$html .= $this->orderSolver->getAmountWithTax($order, Order::AMOUNT_TOTAL, true); | |||
$html .= $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true); | |||
if ($creditActive) { | |||
$html .= '<br />'; |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Order\Order; | |||
namespace common\logic\Order\Order\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,36 +1,34 @@ | |||
<?php | |||
namespace common\logic\Order\Order; | |||
namespace common\logic\Order\Order\Service; | |||
use common\helpers\GlobalParam; | |||
use common\helpers\MeanPayment; | |||
use common\helpers\Price; | |||
use common\logic\AbstractBuilder; | |||
use common\logic\AbstractService; | |||
use common\logic\BuilderInterface; | |||
use common\logic\Config\TaxRate\TaxRate; | |||
use common\logic\Distribution\Distribution\Distribution; | |||
use common\logic\Distribution\Distribution\DistributionRepository; | |||
use common\logic\Document\Document\Document; | |||
use common\logic\Order\OrderStatusHistory\OrderStatusHistoryBuilder; | |||
use common\logic\Order\ProductOrder\ProductOrder; | |||
use common\logic\Order\ProductOrder\ProductOrderBuilder; | |||
use common\logic\Order\ProductOrder\ProductOrderSolver; | |||
use common\logic\PointSale\PointSale\PointSaleBuilder; | |||
use common\logic\PointSale\PointSale\PointSaleRepository; | |||
use common\logic\PointSale\UserPointSale\UserPointSaleRepository; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Producer\Producer\ProducerRepository; | |||
use common\logic\Subscription\Subscription\Subscription; | |||
use common\logic\Subscription\Subscription\SubscriptionBuilder; | |||
use common\logic\Subscription\Subscription\SubscriptionRepository; | |||
use common\logic\Subscription\Subscription\SubscriptionSolver; | |||
use common\logic\User\CreditHistory\CreditHistory; | |||
use common\logic\User\CreditHistory\CreditHistoryBuilder; | |||
use common\logic\User\CreditHistory\CreditHistoryRepository; | |||
use common\logic\User\User\User; | |||
use common\logic\User\User\UserSolver; | |||
use common\logic\User\UserProducer\UserProducerRepository; | |||
use common\logic\Distribution\Distribution\Repository\DistributionRepository; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\Order\Repository\OrderRepository; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryBuilder; | |||
use common\logic\Order\ProductOrder\Model\ProductOrder; | |||
use common\logic\Order\ProductOrder\Service\ProductOrderBuilder; | |||
use common\logic\Order\ProductOrder\Service\ProductOrderSolver; | |||
use common\logic\PointSale\PointSale\Service\PointSaleBuilder; | |||
use common\logic\PointSale\PointSale\Repository\PointSaleRepository; | |||
use common\logic\PointSale\UserPointSale\Repository\UserPointSaleRepository; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Producer\Producer\Repository\ProducerRepository; | |||
use common\logic\Subscription\Subscription\Model\Subscription; | |||
use common\logic\Subscription\Subscription\Service\SubscriptionBuilder; | |||
use common\logic\Subscription\Subscription\Repository\SubscriptionRepository; | |||
use common\logic\Subscription\Subscription\Service\SubscriptionSolver; | |||
use common\logic\User\CreditHistory\Model\CreditHistory; | |||
use common\logic\User\CreditHistory\Service\CreditHistoryBuilder; | |||
use common\logic\User\CreditHistory\Repository\CreditHistoryRepository; | |||
use common\logic\User\User\Service\UserSolver; | |||
use common\logic\User\UserProducer\Repository\UserProducerRepository; | |||
use yii\web\NotFoundHttpException; | |||
class OrderBuilder extends AbstractBuilder | |||
@@ -105,7 +103,7 @@ class OrderBuilder extends AbstractBuilder | |||
{ | |||
$now = date('Y-m-d'); | |||
$distributionDate = date('Y-m-d', strtotime($date)); | |||
$distribution = $this->distributionRepository->getOneByDate($distributionDate); | |||
$distribution = $this->distributionRepository->findOneDistributionByDate($distributionDate); | |||
if ($distribution | |||
&& $distribution->active | |||
@@ -130,11 +128,11 @@ class OrderBuilder extends AbstractBuilder | |||
public function createAllOrdersFromSubscriptions(string $date, bool $force = false): array | |||
{ | |||
$orderArray = []; | |||
$distribution = $this->distributionRepository->getOneByDate(date('Y-m-d', strtotime($date))); | |||
$distribution = $this->distributionRepository->findOneDistributionByDate(date('Y-m-d', strtotime($date))); | |||
if ($distribution) { | |||
$orderArray = $this->orderRepository->getByDistribution($distribution); | |||
$subscriptionArray = $this->subscriptionRepository->getByDate($date); | |||
$orderArray = $this->orderRepository->findOrdersByDistribution($distribution); | |||
$subscriptionArray = $this->subscriptionRepository->findSubscriptionsByDate($date); | |||
foreach ($subscriptionArray as $subscription) { | |||
if (!$this->subscriptionSolver->hasOrderAlreadyExist($subscription, $orderArray)) { | |||
$this->createOrderFromSubscription($subscription, $date, $force); | |||
@@ -149,7 +147,7 @@ class OrderBuilder extends AbstractBuilder | |||
public function updateOrdersIncomingDistributionsFromSubscription(Subscription $subscription, $update = false): array | |||
{ | |||
$orderArray = []; | |||
$matchedDistributionsArray = $this->distributionRepository->searchMatchedIncomingDistributions($subscription); | |||
$matchedDistributionsArray = $this->distributionRepository->findDistributionsIncomingMatchWithSubscrtiption($subscription); | |||
if ($update) { | |||
$this->deleteOrdersIncomingDistributionsFromSubscription($subscription); | |||
@@ -205,12 +203,12 @@ class OrderBuilder extends AbstractBuilder | |||
if ($ordersArray && count($ordersArray)) { | |||
foreach ($ordersArray as $order) { | |||
$theOrder = $this->orderRepository->getOneById($order->id); | |||
$theOrder = $this->orderRepository->findOneOrderById($order->id); | |||
// remboursement de la commande | |||
if ($theOrder->id_user && $theOrder->getAmount(Order::AMOUNT_PAID) && $configCredit) { | |||
$this->creditHistoryBuilder->create( | |||
$this->creditHistoryBuilder->createCreditHistory( | |||
CreditHistory::TYPE_REFUND, | |||
$theOrder->getAmount(Order::AMOUNT_PAID), | |||
$theOrder->distribution->producer, | |||
@@ -234,7 +232,7 @@ class OrderBuilder extends AbstractBuilder | |||
$user = $subscription->user ?? null; | |||
foreach ($subscription->productSubscription as $productSubscription) { | |||
$this->productOrderBuilder->create( | |||
$this->productOrderBuilder->createProductOrder( | |||
$order, | |||
$productSubscription->product, | |||
$productSubscription->quantity, | |||
@@ -295,7 +293,7 @@ class OrderBuilder extends AbstractBuilder | |||
$order->auto_payment = 1; | |||
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_USER) { | |||
$userProducer = $this->userProducerRepository->getOne($order->user, $order->producer); | |||
$userProducer = $this->userProducerRepository->findOneUserProducer($order->user, $order->producer); | |||
if ($userProducer) { | |||
$order->auto_payment = $userProducer->credit_active; | |||
@@ -324,7 +322,7 @@ class OrderBuilder extends AbstractBuilder | |||
public function initOrderCommentPointSale(Order $order): void | |||
{ | |||
if($order->user && $order->pointSale) { | |||
$userPointSale = $this->userPointSaleRepository->getOne($order->user, $order->pointSale); | |||
$userPointSale = $this->userPointSaleRepository->findOneUserPointSale($order->user, $order->pointSale); | |||
if ($userPointSale && strlen($userPointSale->comment)) { | |||
$order->comment_point_sale = $userPointSale->comment; | |||
@@ -435,10 +433,10 @@ class OrderBuilder extends AbstractBuilder | |||
public function deleteOrder(Order $order, bool $force = false): bool | |||
{ | |||
// remboursement si l'utilisateur a payé pour cette commande | |||
$amountPaid = $this->orderSolver->getAmount($order, Order::AMOUNT_PAID); | |||
$amountPaid = $this->orderSolver->getOrderAmount($order, Order::AMOUNT_PAID); | |||
if ($amountPaid >= 0.01) { | |||
$this->creditHistoryBuilder->create( | |||
$this->creditHistoryBuilder->createCreditHistory( | |||
CreditHistory::TYPE_REFUND, | |||
$amountPaid, | |||
GlobalParam::getCurrentProducer(), | |||
@@ -454,7 +452,7 @@ class OrderBuilder extends AbstractBuilder | |||
($this->producerRepository->getConfig('option_behavior_cancel_order') == Producer::BEHAVIOR_DELETE_ORDER_STATUS && strlen($order->date_delete)) | |||
|| $force) { | |||
$this->productOrderBuilder->deleteByOrder($order); | |||
$this->productOrderBuilder->deleteProductOrdersByOrder($order); | |||
return $this->delete($order); | |||
} | |||
@@ -480,13 +478,13 @@ class OrderBuilder extends AbstractBuilder | |||
return; | |||
} elseif ($paymentStatus == Order::PAYMENT_SURPLUS) { | |||
$type = CreditHistory::TYPE_REFUND; | |||
$amount = $this->orderSolver->getAmount($order, Order::AMOUNT_SURPLUS); | |||
$amount = $this->orderSolver->getOrderAmount($order, Order::AMOUNT_SURPLUS); | |||
} elseif ($paymentStatus == Order::PAYMENT_UNPAID) { | |||
$type = CreditHistory::TYPE_PAYMENT; | |||
$amount = $this->orderSolver->getAmount($order, Order::AMOUNT_REMAINING); | |||
$amount = $this->orderSolver->getOrderAmount($order, Order::AMOUNT_REMAINING); | |||
} | |||
$this->creditHistoryBuilder->create( | |||
$this->creditHistoryBuilder->createCreditHistory( | |||
$type, | |||
$amount, | |||
GlobalParam::getCurrentProducer(), | |||
@@ -529,7 +527,7 @@ class OrderBuilder extends AbstractBuilder | |||
switch ($newStatus) { | |||
case 'new-order' : | |||
$this->orderStatusHistoryBuilder->create($order, $userCurrent, $newStatus, $origin); | |||
$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); | |||
$order->status = $newStatus; | |||
$order->save(); | |||
break; | |||
@@ -541,7 +539,7 @@ class OrderBuilder extends AbstractBuilder | |||
case 'refunded': | |||
case 'cancel': | |||
if (in_array($newStatus, $orderStatusArray[$order->status]['nextStatusAllow'])) { | |||
$this->orderStatusHistoryBuilder->create($order, $userCurrent, $newStatus, $origin); | |||
$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); | |||
$order->status = $newStatus; | |||
$order->save(); | |||
} | |||
@@ -555,10 +553,10 @@ class OrderBuilder extends AbstractBuilder | |||
// generateReference | |||
public function generateOrderReference(Order $order): void | |||
{ | |||
$producer = $order->producer; | |||
$producer = $this->producerRepository->findOneProducerById($order->id_producer); | |||
if (!$order->reference && $producer->option_order_reference_type == Producer::ORDER_REFERENCE_TYPE_YEARLY) { | |||
$lastOrder = $this->orderRepository->getOneLastOfYear($producer); | |||
$lastOrder = $this->orderRepository->findOneOrderLastOfYear($producer); | |||
if ($lastOrder && $lastOrder->reference && strlen($lastOrder->reference) > 0) { | |||
$pattern = '#A([0-9]+)C([0-9]+)#'; | |||
@@ -582,7 +580,7 @@ class OrderBuilder extends AbstractBuilder | |||
{ | |||
foreach ($order->productOrder as $productOrder) { | |||
if ($productOrder->product) { | |||
$this->productOrderBuilder->updateInvoicePrice($productOrder, $params); | |||
$this->productOrderBuilder->updateProductOrderInvoicePrice($productOrder, $params); | |||
} | |||
} | |||
} |
@@ -1,18 +1,15 @@ | |||
<?php | |||
namespace common\logic\Order\Order; | |||
namespace common\logic\Order\Order\Service; | |||
use common\helpers\GlobalParam; | |||
use common\helpers\Price; | |||
use common\logic\AbstractService; | |||
use common\logic\Document\Document\Document; | |||
use common\logic\Document\Document\DocumentSolver; | |||
use common\logic\Order\ProductOrder\ProductOrder; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Product\Product\Product; | |||
use common\logic\Document\Document\Service\DocumentSolver; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\SolverInterface; | |||
use common\logic\User\User\User; | |||
use common\logic\User\User\UserSolver; | |||
use common\logic\User\User\Model\User; | |||
use common\logic\User\User\Service\UserSolver; | |||
use yii\helpers\Html; | |||
@@ -61,14 +58,14 @@ class OrderSolver extends AbstractService implements SolverInterface | |||
public function getPaymentStatus(Order $order): ?string | |||
{ | |||
// payé | |||
if ($this->getAmountWithtax($order) - $this->getAmount($order, Order::AMOUNT_PAID) < 0.01 && | |||
$this->getAmountWithtax($order) - $this->getAmount($order, Order::AMOUNT_PAID) > -0.01) { | |||
if ($this->getOrderAmountWithtax($order) - $this->getOrderAmount($order, Order::AMOUNT_PAID) < 0.01 && | |||
$this->getOrderAmountWithtax($order) - $this->getOrderAmount($order, Order::AMOUNT_PAID) > -0.01) { | |||
return Order::PAYMENT_PAID; | |||
} // à rembourser | |||
elseif ($this->getAmountWithtax($order) - $this->getAmount($order, Order::AMOUNT_PAID) <= -0.01) { | |||
elseif ($this->getOrderAmountWithtax($order) - $this->getOrderAmount($order, Order::AMOUNT_PAID) <= -0.01) { | |||
return Order::PAYMENT_SURPLUS; | |||
} // reste à payer | |||
elseif ($this->getAmountWithtax($order) - $this->getAmount($order, Order::AMOUNT_PAID) >= 0.01) { | |||
elseif ($this->getOrderAmountWithtax($order) - $this->getOrderAmount($order, Order::AMOUNT_PAID) >= 0.01) { | |||
return Order::PAYMENT_UNPAID; | |||
} | |||
@@ -345,12 +342,12 @@ class OrderSolver extends AbstractService implements SolverInterface | |||
$amount = $order->paid_amount; | |||
break; | |||
case Order::AMOUNT_REMAINING : | |||
$amount = $this->getAmountWithTax($order, Order::AMOUNT_TOTAL) | |||
- $this->getAmountWithTax($order,Order::AMOUNT_PAID); | |||
$amount = $this->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL) | |||
- $this->getOrderAmountWithTax($order,Order::AMOUNT_PAID); | |||
break; | |||
case Order::AMOUNT_SURPLUS : | |||
$amount = $this->getAmountWithTax($order,Order::AMOUNT_PAID) | |||
- $this->getAmountWithTax($order,Order::AMOUNT_TOTAL); | |||
$amount = $this->getOrderAmountWithTax($order,Order::AMOUNT_PAID) | |||
- $this->getOrderAmountWithTax($order,Order::AMOUNT_TOTAL); | |||
break; | |||
} | |||
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Order\Order; | |||
namespace common\logic\Order\Order\Service; | |||
use common\logic\AbstractService; | |||
use common\logic\UtilsInterface; |
@@ -1,8 +1,13 @@ | |||
<?php | |||
namespace common\logic\Order\Order; | |||
namespace common\logic\Order\Order\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\Order\Repository\OrderRepository; | |||
use common\logic\Order\Order\Service\OrderBuilder; | |||
use common\logic\Order\Order\Service\OrderSolver; | |||
use common\logic\Order\Order\Service\OrderUtils; | |||
class OrderContainer extends AbstractContainer | |||
{ |
@@ -0,0 +1,21 @@ | |||
<?php | |||
namespace common\logic\Order\Order\Wrapper; | |||
use common\logic\AbstractManager; | |||
use common\logic\Order\Order\Repository\OrderRepository; | |||
use common\logic\Order\Order\Service\OrderBuilder; | |||
use common\logic\Order\Order\Service\OrderSolver; | |||
/** | |||
* @mixin OrderSolver | |||
* @mixin OrderRepository | |||
* @mixin OrderBuilder | |||
*/ | |||
class OrderManager extends AbstractManager | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return OrderContainer::class; | |||
} | |||
} |
@@ -1,10 +1,10 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory; | |||
namespace common\logic\Order\OrderStatusHistory\Model; | |||
use common\components\ActiveRecordCommon; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\User\User\User; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\User\User\Model\User; | |||
/** | |||
* This is the model class for table "order_status_history". |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory; | |||
namespace common\logic\Order\OrderStatusHistory\Repository; | |||
use common\logic\AbstractRepository; | |||
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory; | |||
namespace common\logic\Order\OrderStatusHistory\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
@@ -1,11 +1,12 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory; | |||
namespace common\logic\Order\OrderStatusHistory\Service; | |||
use common\logic\AbstractBuilder; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\User\User\User; | |||
use common\logic\User\User\UserSolver; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\OrderStatusHistory\Model\OrderStatusHistory; | |||
use common\logic\User\User\Model\User; | |||
use common\logic\User\User\Service\UserSolver; | |||
class OrderStatusHistoryBuilder extends AbstractBuilder | |||
{ |
@@ -1,9 +1,11 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory; | |||
namespace common\logic\Order\OrderStatusHistory\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\PointSale\PointSale\OrderStatusHistoryRepository; | |||
use common\logic\Order\OrderStatusHistory\Model\OrderStatusHistory; | |||
use common\logic\Order\OrderStatusHistory\Repository\OrderStatusHistoryRepository; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryBuilder; | |||
class OrderStatusHistoryContainer extends AbstractContainer | |||
{ |
@@ -1,9 +1,10 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory; | |||
namespace common\logic\Order\OrderStatusHistory\Wrapper; | |||
use common\logic\AbstractManager; | |||
use common\logic\PointSale\PointSale\OrderStatusHistoryRepository; | |||
use common\logic\Order\OrderStatusHistory\Repository\OrderStatusHistoryRepository; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryBuilder; | |||
/** | |||
* @mixin OrderStatusHistoryRepository |
@@ -36,13 +36,12 @@ | |||
* termes. | |||
*/ | |||
namespace common\logic\Order\ProductOrder; | |||
namespace common\logic\Order\ProductOrder\Model; | |||
use common\helpers\GlobalParam; | |||
use common\helpers\Price; | |||
use common\components\ActiveRecordCommon; | |||
use common\logic\Config\TaxRate\TaxRate; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Product\Product\Product; | |||
/** |