namespace backend\controllers; | namespace backend\controllers; | ||||
use common\helpers\Opendistrib; | |||||
use common\helpers\Souke; | |||||
use yii\filters\AccessControl; | use yii\filters\AccessControl; | ||||
/** | /** | ||||
public function actionIndex() | public function actionIndex() | ||||
{ | { | ||||
$producerModule = $this->getProducerModule(); | $producerModule = $this->getProducerModule(); | ||||
$versionsArray = Opendistrib::getVersions(); | |||||
$versionsArray = Souke::getVersions(); | |||||
$versionsRenderArray = []; | $versionsRenderArray = []; | ||||
foreach ($versionsArray as $version) { | foreach ($versionsArray as $version) { | ||||
$versionsRenderArray[$version] = [ | $versionsRenderArray[$version] = [ |
namespace common\helpers; | namespace common\helpers; | ||||
class Opendistrib | |||||
class Souke | |||||
{ | { | ||||
public static function getVersions() | public static function getVersions() | ||||
{ | { |
$productsArray = $this->productRepository->findProductsByDistribution($distribution, true,'product.order ASC'); | $productsArray = $this->productRepository->findProductsByDistribution($distribution, true,'product.order ASC'); | ||||
$ordersArray = $this->orderRepository->findOrdersByDistribution($distribution); | $ordersArray = $this->orderRepository->findOrdersByDistribution($distribution); | ||||
$datas[] = [ | |||||
'Produit', | |||||
'Quantité (pièces)', | |||||
'Poids' | |||||
]; | |||||
foreach($productsArray as $product) { | foreach($productsArray as $product) { | ||||
$datas[] = [ | $datas[] = [ | ||||
$this->productSolver->getNameExport($product), | $this->productSolver->getNameExport($product), | ||||
$this->orderSolver->getProductQuantityPiecesByOrders($product, $ordersArray) | |||||
$this->orderSolver->getProductQuantityPiecesByOrders($product, $ordersArray), | |||||
$this->productSolver->getWeightAsString($product) | |||||
]; | ]; | ||||
} | } | ||||
namespace domain\Producer\Producer; | namespace domain\Producer\Producer; | ||||
use common\helpers\Opendistrib; | |||||
use common\helpers\Souke; | |||||
use common\helpers\Password; | use common\helpers\Password; | ||||
use common\helpers\Upload; | use common\helpers\Upload; | ||||
use common\helpers\Url; | use common\helpers\Url; | ||||
public function updateOpendistribVersion(Producer $producer): void | public function updateOpendistribVersion(Producer $producer): void | ||||
{ | { | ||||
$versionsArray = Opendistrib::getVersions(); | |||||
$versionsArray = Souke::getVersions(); | |||||
$producer->latest_version_opendistrib = reset($versionsArray); | $producer->latest_version_opendistrib = reset($versionsArray); | ||||
$this->update($producer); | $this->update($producer); |