$creditHistoryManager = $this->getCreditHistoryManager(); | $creditHistoryManager = $this->getCreditHistoryManager(); | ||||
$userManager = $this->getUserManager(); | $userManager = $this->getUserManager(); | ||||
$subscriptionManager = $this->getSubscriptionManager(); | $subscriptionManager = $this->getSubscriptionManager(); | ||||
$pointSaleManager = $this->getPointSaleManager(); | |||||
$producer = $this->getProducerCurrent(); | |||||
$json = [ | $json = [ | ||||
'distribution' => [], | 'distribution' => [], | ||||
$dateEnd = strtotime('+' . $numberOfLoadedMonthes); | $dateEnd = strtotime('+' . $numberOfLoadedMonthes); | ||||
} | } | ||||
$producer = $this->getProducerCurrent(); | |||||
$json['producer'] = [ | $json['producer'] = [ | ||||
'credit' => $producer->credit, | 'credit' => $producer->credit, | ||||
'tiller' => $producer->tiller, | 'tiller' => $producer->tiller, | ||||
} | } | ||||
]) | ]) | ||||
->where([ | ->where([ | ||||
'id_producer' => GlobalParam::getCurrentProducerId(), | |||||
'id_producer' => $producer->id, | |||||
]) | ]) | ||||
->asArray() | ->asArray() | ||||
->all(); | ->all(); | ||||
$json['missing_subscriptions'] = []; | $json['missing_subscriptions'] = []; | ||||
if ($distribution->active) { | if ($distribution->active) { | ||||
foreach ($arraySubscriptions as $subscription) { | foreach ($arraySubscriptions as $subscription) { | ||||
if (!$subscription->hasOrderAlreadyExist($ordersArrayObject) | |||||
if (!$subscriptionManager->hasOrderAlreadyExist($subscription, $ordersArrayObject) | |||||
&& $subscription->productSubscription && count($subscription->productSubscription) | && $subscription->productSubscription && count($subscription->productSubscription) | ||||
&& $subscription->id_point_sale && $subscription->id_point_sale > 0) { | && $subscription->id_point_sale && $subscription->id_point_sale > 0) { | ||||
$json['missing_subscriptions'][] = [ | $json['missing_subscriptions'][] = [ | ||||
'username' => $subscription->getUsername() | |||||
'username' => $subscriptionManager->getUsername($subscription) | |||||
]; | ]; | ||||
} | } | ||||
} | } | ||||
$deliveryNoteManager->initTaxCalculationMethod($deliveryNote); | $deliveryNoteManager->initTaxCalculationMethod($deliveryNote); | ||||
$deliveryNote->id_producer = GlobalParam::getCurrentProducerId(); | $deliveryNote->id_producer = GlobalParam::getCurrentProducerId(); | ||||
$deliveryNote->id_user = $order->id_user; | $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', | 'd/m/Y', | ||||
strtotime( | strtotime( | ||||
$order->distribution->date | $order->distribution->date | ||||
) | ) | ||||
) . ')'; | ) . ')'; | ||||
$deliveryNote->address = $order->user->getFullAddress(); | |||||
$deliveryNote->address = $userManager->getFullAddress($order->user); | |||||
$deliveryNote->save(); | $deliveryNote->save(); | ||||
} | } | ||||
namespace common\components; | 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\DistributionManager; | ||||
use common\logic\Distribution\Distribution\Wrapper\DistributionContainer; | use common\logic\Distribution\Distribution\Wrapper\DistributionContainer; | ||||
use common\logic\Distribution\PointSaleDistribution\Wrapper\PointSaleDistributionContainer; | use common\logic\Distribution\PointSaleDistribution\Wrapper\PointSaleDistributionContainer; |
* termes. | * termes. | ||||
*/ | */ | ||||
namespace common\helpers; | namespace common\helpers; | ||||
use common\logic\Producer\Producer\Producer; | |||||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||||
class CSV | class CSV | ||||
{ | { | ||||
public static function array2csv(array &$array) | 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) { | if (count($array) == 0) { | ||||
return null; | return null; |
] | ] | ||||
], | ], | ||||
'Subject' => $params['subject'], | '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]); | $response = $mj->post(\Mailjet\Resources::$Email, ['body' => $body]); | ||||
$success = $response->success() ; | $success = $response->success() ; | ||||
if(!$success) { | if(!$success) { | ||||
Yii::error($response->getBody(), 'Mailjet'); | |||||
\Yii::error($response->getBody(), 'Mailjet'); | |||||
} | } | ||||
return $success ; | return $success ; |
self::CHEQUE => self::getStrBy(self::CHEQUE), | self::CHEQUE => self::getStrBy(self::CHEQUE), | ||||
self::TRANSFER => self::getStrBy(self::TRANSFER), | self::TRANSFER => self::getStrBy(self::TRANSFER), | ||||
self::OTHER => self::getStrBy(self::OTHER), | self::OTHER => self::getStrBy(self::OTHER), | ||||
self::CREDIT => self::getStrBy(self::CREDIT), | |||||
] ; | ] ; | ||||
} | } | ||||
* termes. | * termes. | ||||
*/ | */ | ||||
namespace common\helpers; | namespace common\helpers; | ||||
class Opendistrib | class Opendistrib | ||||
{ | { | ||||
public static function getVersions() | public static function getVersions() | ||||
{ | { | ||||
$versionsArray = []; | $versionsArray = []; |
namespace common\helpers; | 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; | use linslin\yii2\curl; | ||||
class Tiller | class Tiller |
{ | { | ||||
public static function frontend($action = '') | public static function frontend($action = '') | ||||
{ | { | ||||
$server_name = Yii::$app->getRequest()->serverName ; | |||||
$server_name = \Yii::$app->getRequest()->serverName ; | |||||
$address = '' ; | $address = '' ; | ||||
if($server_name == 'localhost') | if($server_name == 'localhost') | ||||
{ | { | ||||
public static function backend($action = '') | public static function backend($action = '') | ||||
{ | { | ||||
$server_name = Yii::$app->getRequest()->serverName ; | |||||
$server_name = \Yii::$app->getRequest()->serverName ; | |||||
$address = '' ; | $address = '' ; | ||||
if($server_name == 'localhost') | if($server_name == 'localhost') | ||||
{ | { | ||||
public static function env($env, $section) | public static function env($env, $section) | ||||
{ | { | ||||
$server_name = Yii::$app->getRequest()->serverName ; | |||||
$server_name = \Yii::$app->getRequest()->serverName ; | |||||
if($section == 'backend') | if($section == 'backend') | ||||
{ | { |