@@ -117,6 +117,9 @@ class DistributionController extends BackendController | |||
$creditHistoryManager = $this->getCreditHistoryManager(); | |||
$userManager = $this->getUserManager(); | |||
$subscriptionManager = $this->getSubscriptionManager(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$producer = $this->getProducerCurrent(); | |||
$json = [ | |||
'distribution' => [], | |||
@@ -135,7 +138,6 @@ class DistributionController extends BackendController | |||
$dateEnd = strtotime('+' . $numberOfLoadedMonthes); | |||
} | |||
$producer = $this->getProducerCurrent(); | |||
$json['producer'] = [ | |||
'credit' => $producer->credit, | |||
'tiller' => $producer->tiller, | |||
@@ -338,7 +340,7 @@ class DistributionController extends BackendController | |||
} | |||
]) | |||
->where([ | |||
'id_producer' => GlobalParam::getCurrentProducerId(), | |||
'id_producer' => $producer->id, | |||
]) | |||
->asArray() | |||
->all(); | |||
@@ -433,11 +435,11 @@ class DistributionController extends BackendController | |||
$json['missing_subscriptions'] = []; | |||
if ($distribution->active) { | |||
foreach ($arraySubscriptions as $subscription) { | |||
if (!$subscription->hasOrderAlreadyExist($ordersArrayObject) | |||
if (!$subscriptionManager->hasOrderAlreadyExist($subscription, $ordersArrayObject) | |||
&& $subscription->productSubscription && count($subscription->productSubscription) | |||
&& $subscription->id_point_sale && $subscription->id_point_sale > 0) { | |||
$json['missing_subscriptions'][] = [ | |||
'username' => $subscription->getUsername() | |||
'username' => $subscriptionManager->getUsername($subscription) | |||
]; | |||
} | |||
} | |||
@@ -1603,13 +1605,13 @@ class DistributionController extends BackendController | |||
$deliveryNoteManager->initTaxCalculationMethod($deliveryNote); | |||
$deliveryNote->id_producer = GlobalParam::getCurrentProducerId(); | |||
$deliveryNote->id_user = $order->id_user; | |||
$deliveryNote->name = 'Bon de livraison ' . $order->getUsername() . ' (' . date( | |||
$deliveryNote->name = 'Bon de livraison ' . $orderManager->getOrderUsername($order) . ' (' . date( | |||
'd/m/Y', | |||
strtotime( | |||
$order->distribution->date | |||
) | |||
) . ')'; | |||
$deliveryNote->address = $order->user->getFullAddress(); | |||
$deliveryNote->address = $userManager->getFullAddress($order->user); | |||
$deliveryNote->save(); | |||
} | |||
@@ -2,8 +2,8 @@ | |||
namespace common\components; | |||
use common\logic\Config\TaxRate\TaxRateContainer; | |||
use common\logic\Config\TaxRate\TaxRateManager; | |||
use common\logic\Config\TaxRate\Wrapper\TaxRateContainer; | |||
use common\logic\Config\TaxRate\Wrapper\TaxRateManager; | |||
use common\logic\Distribution\Distribution\Wrapper\DistributionManager; | |||
use common\logic\Distribution\Distribution\Wrapper\DistributionContainer; | |||
use common\logic\Distribution\PointSaleDistribution\Wrapper\PointSaleDistributionContainer; |
@@ -36,17 +36,16 @@ | |||
* termes. | |||
*/ | |||
namespace common\helpers; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
class CSV | |||
{ | |||
public static function array2csv(array &$array) | |||
{ | |||
$separator = Producer::getConfig('option_csv_separator') ?: ';'; | |||
$producerManager = ProducerManager::getInstance(); | |||
$separator = $producerManager->getConfig('option_csv_separator') ?: ';'; | |||
if (count($array) == 0) { | |||
return null; |
@@ -65,8 +65,8 @@ class Mailjet | |||
] | |||
], | |||
'Subject' => $params['subject'], | |||
'TextPart' => Yii::$app->view->renderFile($params['content_view_text'], $params['content_params']), | |||
'HTMLPart' => Yii::$app->view->renderFile($params['content_view_html'], $params['content_params']) | |||
'TextPart' => \Yii::$app->view->renderFile($params['content_view_text'], $params['content_params']), | |||
'HTMLPart' => \Yii::$app->view->renderFile($params['content_view_html'], $params['content_params']) | |||
] ; | |||
$response = $mj->post(\Mailjet\Resources::$Email, ['body' => $body]); | |||
@@ -74,7 +74,7 @@ class Mailjet | |||
$success = $response->success() ; | |||
if(!$success) { | |||
Yii::error($response->getBody(), 'Mailjet'); | |||
\Yii::error($response->getBody(), 'Mailjet'); | |||
} | |||
return $success ; |
@@ -80,7 +80,6 @@ class MeanPayment { | |||
self::CHEQUE => self::getStrBy(self::CHEQUE), | |||
self::TRANSFER => self::getStrBy(self::TRANSFER), | |||
self::OTHER => self::getStrBy(self::OTHER), | |||
self::CREDIT => self::getStrBy(self::CREDIT), | |||
] ; | |||
} | |||
@@ -36,12 +36,10 @@ | |||
* termes. | |||
*/ | |||
namespace common\helpers; | |||
class Opendistrib | |||
{ | |||
public static function getVersions() | |||
{ | |||
$versionsArray = []; |
@@ -38,9 +38,8 @@ | |||
namespace common\helpers; | |||
use common\logic\Order\Order\Order; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\logic\Producer\Producer\ProducerManager; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use linslin\yii2\curl; | |||
class Tiller |
@@ -42,7 +42,7 @@ class Url | |||
{ | |||
public static function frontend($action = '') | |||
{ | |||
$server_name = Yii::$app->getRequest()->serverName ; | |||
$server_name = \Yii::$app->getRequest()->serverName ; | |||
$address = '' ; | |||
if($server_name == 'localhost') | |||
{ | |||
@@ -74,7 +74,7 @@ class Url | |||
public static function backend($action = '') | |||
{ | |||
$server_name = Yii::$app->getRequest()->serverName ; | |||
$server_name = \Yii::$app->getRequest()->serverName ; | |||
$address = '' ; | |||
if($server_name == 'localhost') | |||
{ | |||
@@ -106,7 +106,7 @@ class Url | |||
public static function env($env, $section) | |||
{ | |||
$server_name = Yii::$app->getRequest()->serverName ; | |||
$server_name = \Yii::$app->getRequest()->serverName ; | |||
if($section == 'backend') | |||
{ |