ソースを参照

Refactoring services #885

refactoring
Guillaume 1年前
コミット
8c04298775
8個のファイルの変更21行の追加24行の削除
  1. +8
    -6
      backend/controllers/DistributionController.php
  2. +2
    -2
      common/components/BusinessLogicTrait.php
  3. +3
    -4
      common/helpers/CSV.php
  4. +3
    -3
      common/helpers/Mailjet.php
  5. +0
    -1
      common/helpers/MeanPayment.php
  6. +0
    -2
      common/helpers/Opendistrib.php
  7. +2
    -3
      common/helpers/Tiller.php
  8. +3
    -3
      common/helpers/Url.php

+ 8
- 6
backend/controllers/DistributionController.php ファイルの表示

@@ -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
- 2
common/components/BusinessLogicTrait.php ファイルの表示

@@ -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;

+ 3
- 4
common/helpers/CSV.php ファイルの表示

@@ -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;

+ 3
- 3
common/helpers/Mailjet.php ファイルの表示

@@ -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 ;

+ 0
- 1
common/helpers/MeanPayment.php ファイルの表示

@@ -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),
] ;
}

+ 0
- 2
common/helpers/Opendistrib.php ファイルの表示

@@ -36,12 +36,10 @@
* termes.
*/


namespace common\helpers;

class Opendistrib
{

public static function getVersions()
{
$versionsArray = [];

+ 2
- 3
common/helpers/Tiller.php ファイルの表示

@@ -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

+ 3
- 3
common/helpers/Url.php ファイルの表示

@@ -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')
{

読み込み中…
キャンセル
保存