@@ -38,13 +38,7 @@ | |||
namespace backend\controllers; | |||
use common\helpers\GlobalParam; | |||
use common\helpers\Opendistrib; | |||
use common\logic\Development\Development\Development; | |||
use common\logic\Development\DevelopmentPriority\DevelopmentPriority; | |||
use Yii; | |||
use yii\data\ActiveDataProvider; | |||
use yii\web\NotFoundHttpException; | |||
use yii\filters\AccessControl; | |||
/** | |||
@@ -74,9 +68,7 @@ class DevelopmentController extends BackendController | |||
} | |||
/** | |||
* Liste les développements. | |||
* | |||
* @return mixed | |||
* Liste les versions d'Opendistrib | |||
*/ | |||
public function actionIndex() | |||
{ | |||
@@ -90,137 +82,10 @@ class DevelopmentController extends BackendController | |||
]; | |||
} | |||
$producer = $this->getProducerCurrent(); | |||
$producerManager->updateOpendistribVersion($producer); | |||
$producerManager->updateOpendistribVersion($this->getProducerCurrent()); | |||
return $this->render('index', [ | |||
'versionsArray' => $versionsRenderArray | |||
]); | |||
} | |||
public function actionDevelopment($status = Development::STATUS_OPEN) | |||
{ | |||
$dataProvider = new ActiveDataProvider([ | |||
'query' => Development::find() | |||
->with(['developmentPriority', 'developmentPriorityCurrentProducer']) | |||
->where(['status' => $status]) | |||
->orderBy('date DESC'), | |||
]); | |||
return $this->render('development', [ | |||
'dataProvider' => $dataProvider, | |||
'status' => $status | |||
]); | |||
} | |||
/** | |||
* Creates a new Developpement model. | |||
* If creation is successful, the browser will be redirected to the 'view' page. | |||
*/ | |||
public function actionCreate() | |||
{ | |||
$model = new Development(); | |||
if ($model->load(\Yii::$app->request->post())) { | |||
$model->date = date('Y-m-d H:i:s'); | |||
$model->setDateDelivery(); | |||
if ($model->save()) { | |||
$this->setFlash('success', 'Développement ajouté'); | |||
return $this->redirect(['index']); | |||
} | |||
} else { | |||
return $this->render('create', [ | |||
'model' => $model, | |||
]); | |||
} | |||
} | |||
/** | |||
* Updates an existing Developpement model. | |||
* If update is successful, the browser will be redirected to the 'view' page. | |||
* | |||
* @param integer $id | |||
* @return mixed | |||
*/ | |||
public function actionUpdate($id) | |||
{ | |||
$model = $this->findModel($id); | |||
if ($model->load(\Yii::$app->request->post())) { | |||
$model->setDateDelivery(); | |||
if ($model->save()) { | |||
$this->setFlash('success', 'Développement modifié'); | |||
return $this->redirect(['index']); | |||
} | |||
} else { | |||
return $this->render('update', [ | |||
'model' => $model, | |||
]); | |||
} | |||
} | |||
/** | |||
* Deletes an existing Developpement model. | |||
* If deletion is successful, the browser will be redirected to the 'index' page. | |||
* @param integer $id | |||
* @return mixed | |||
*/ | |||
public function actionDelete($id) | |||
{ | |||
$this->findModel($id)->delete(); | |||
$this->setFlash('success', 'Développement supprimé'); | |||
return $this->redirect(['index']); | |||
} | |||
/** | |||
* Définit une priorité pour un développement. | |||
* | |||
* @param integer $idDevelopment | |||
* @param string $priorite | |||
*/ | |||
public function actionPriority($idDevelopment, $priority = null) | |||
{ | |||
$develpmentPriority = DevelopmentPriority::searchOne([ | |||
'id_development' => $idDevelopment, | |||
]); | |||
if (in_array($priority, [DevelopmentPriority::PRIORITY_HIGH, | |||
DevelopmentPriority::PRIORITY_NORMAL, | |||
DevelopmentPriority::PRIORITY_LOW])) { | |||
if ($develpmentPriority) { | |||
$develpmentPriority->priority = $priority; | |||
$develpmentPriority->id_producer = GlobalParam::getCurrentProducerId(); | |||
} else { | |||
$develpmentPriority = new DevelopmentPriority; | |||
$develpmentPriority->id_development = $idDevelopment; | |||
$develpmentPriority->priority = $priority; | |||
$develpmentPriority->id_producer = GlobalParam::getCurrentProducerId(); | |||
} | |||
$develpmentPriority->save(); | |||
} else { | |||
if ($develpmentPriority) { | |||
$develpmentPriority->delete(); | |||
} | |||
} | |||
$this->redirect(['index']); | |||
} | |||
/** | |||
* Finds the Developpement model based on its primary key value. | |||
* If the model is not found, a 404 HTTP exception will be thrown. | |||
*/ | |||
protected function findModel($id) | |||
{ | |||
if (($model = Development::findOne($id)) !== null) { | |||
return $model; | |||
} else { | |||
throw new NotFoundHttpException('The requested page does not exist.'); | |||
} | |||
} | |||
} |
@@ -20,7 +20,6 @@ class BusinessLogic | |||
$this->getUserProducerContainer(), | |||
$this->getUserPointSaleContainer(), | |||
$this->getUserContainer(), | |||
$this->getOrderSatusHistoryContainer(), | |||
$this->getPointSaleDistributionContainer(), | |||
$this->getProductDistributionContainer(), | |||
$this->getProductCategoryContainer(), |
@@ -20,8 +20,6 @@ use common\logic\Document\Quotation\Wrapper\QuotationContainer; | |||
use common\logic\Document\Quotation\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; | |||
@@ -113,11 +111,6 @@ trait BusinessLogicTrait | |||
return QuotationManager::getInstance(); | |||
} | |||
public function getOrderStatusHistoryManager(): OrderStatusHistoryManager | |||
{ | |||
return OrderStatusHistoryManager::getInstance(); | |||
} | |||
public function getProductOrderManager(): ProductOrderManager | |||
{ | |||
return ProductOrderManager::getInstance(); | |||
@@ -278,11 +271,6 @@ trait BusinessLogicTrait | |||
return OrderContainer::getInstance(); | |||
} | |||
public function getOrderSatusHistoryContainer(): OrderStatusHistoryContainer | |||
{ | |||
return OrderStatusHistoryContainer::getInstance(); | |||
} | |||
public function getUserPointSaleContainer(): UserPointSaleContainer | |||
{ | |||
return UserPointSaleContainer::getInstance(); |
@@ -1,148 +0,0 @@ | |||
<?php | |||
/** | |||
Copyright distrib (2018) | |||
contact@opendistrib.net | |||
Ce logiciel est un programme informatique servant à aider les producteurs | |||
à distribuer leur production en circuits courts. | |||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||
sur le site "http://www.cecill.info". | |||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||
de modification et de redistribution accordés par cette licence, il n'est | |||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||
titulaire des droits patrimoniaux et les concédants successifs. | |||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||
associés au chargement, à l'utilisation, à la modification et/ou au | |||
développement et à la reproduction du logiciel par l'utilisateur étant | |||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||
avertis possédant des connaissances informatiques approfondies. Les | |||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||
pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
namespace common\logic\Development\Development; | |||
use common\helpers\GlobalParam; | |||
use Yii; | |||
use common\components\ActiveRecordCommon ; | |||
/** | |||
* This is the model class for table "development". | |||
*/ | |||
class Development extends ActiveRecordCommon | |||
{ | |||
const STATUS_OPEN = 'open'; | |||
const STATUS_CLOSED = 'closed'; | |||
const TYPE_EVOLUTION = 'evolution'; | |||
const TYPE_BUG = 'bug'; | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'development'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['subject', 'date'], 'required'], | |||
[['id', 'progress'], 'integer'], | |||
[['description'], 'string'], | |||
[['date', 'date_delivery'], 'safe'], | |||
[['time_estimate'], 'number'], | |||
[['subject', 'status', 'type'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/* | |||
* Relations | |||
*/ | |||
public function getDevelopmentPriority() | |||
{ | |||
return $this->hasMany( | |||
DevelopmentPriorityModel::className(), | |||
['id_development' => 'id']) | |||
->with('producer'); | |||
} | |||
public function getDevelopmentPriorityCurrentProducer() | |||
{ | |||
return $this->hasOne( | |||
DevelopmentPriorityModel::className(), | |||
['id_development' => 'id']) | |||
->where(['id_producer' => GlobalParam::getCurrentProducerId()]) | |||
->with('producer'); | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'subject' => 'Sujet', | |||
'description' => 'Description', | |||
'date' => 'Date', | |||
'progress' => 'Avancement', | |||
'status' => 'Statut', | |||
'time_estimate' => 'Estimation temps', | |||
'type' => 'Type', | |||
'date_delivery' => 'Date de livraison' | |||
]; | |||
} | |||
/** | |||
* Retourne les options de base nécessaires à la fonction de recherche. | |||
* | |||
* @return array | |||
*/ | |||
public static function getDefaultOptionsSearch() { | |||
return [ | |||
'with' => ['developmentPriority', 'developmentPriorityCurrentProducer'], | |||
'join_with' => [], | |||
'orderby' => 'date DESC', | |||
'attribute_id_producer' => '' | |||
] ; | |||
} | |||
/** | |||
* Définit une date de livraison. | |||
* | |||
* @param string $date | |||
*/ | |||
public function setDateDelivery($date = '') | |||
{ | |||
if (strlen($date)) { | |||
$this->date_delivery = $date; | |||
} | |||
if (strlen($this->date_delivery)) { | |||
$this->date_delivery = date('Y-m-d', strtotime($this->date_delivery)); | |||
} | |||
} | |||
} |
@@ -1,149 +0,0 @@ | |||
<?php | |||
/** | |||
Copyright distrib (2018) | |||
contact@opendistrib.net | |||
Ce logiciel est un programme informatique servant à aider les producteurs | |||
à distribuer leur production en circuits courts. | |||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||
sur le site "http://www.cecill.info". | |||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||
de modification et de redistribution accordés par cette licence, il n'est | |||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||
titulaire des droits patrimoniaux et les concédants successifs. | |||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||
associés au chargement, à l'utilisation, à la modification et/ou au | |||
développement et à la reproduction du logiciel par l'utilisateur étant | |||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||
avertis possédant des connaissances informatiques approfondies. Les | |||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||
pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
namespace common\logic\Development\DevelopmentPriority; | |||
use common\logic\Producer\Producer\Producer; | |||
use common\components\ActiveRecordCommon ; | |||
/** | |||
* This is the model class for table "development_priority". | |||
*/ | |||
class DevelopmentPriority extends ActiveRecordCommon | |||
{ | |||
const PRIORITY_HIGH = 'high'; | |||
const PRIORITY_NORMAL = 'normal'; | |||
const PRIORITY_LOW = 'low'; | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'development_priority'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['id_producer', 'id_development'], 'required'], | |||
[['id_producer', 'id_development'], 'integer'], | |||
[['priority'], 'string'], | |||
]; | |||
} | |||
/* | |||
* Relations | |||
*/ | |||
public function getProducer() | |||
{ | |||
return $this->hasOne(Producer::class, ['id' => 'id_producer']); | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id_producer' => 'Producteur', | |||
'id_development' => 'Développement', | |||
'priority' => 'Priorité' | |||
]; | |||
} | |||
/** | |||
* Retourne les options de base nécessaires à la fonction de recherche. | |||
* | |||
* @return array | |||
*/ | |||
public static function getDefaultOptionsSearch() { | |||
return [ | |||
'with' => [], | |||
'join_with' => [], | |||
'orderby' => '', | |||
'attribute_id_producer' => 'development_priority.id_producer' | |||
] ; | |||
} | |||
/** | |||
* Retourne la priorité. | |||
* | |||
* @return string | |||
*/ | |||
public function getStrPriority() | |||
{ | |||
switch ($this->priority) { | |||
case self::PRIORITY_LOW : return 'Basse'; | |||
break; | |||
case self::PRIORITY_NORMAL : return 'Normale'; | |||
break; | |||
case self::PRIORITY_HIGH : return 'Haute'; | |||
break; | |||
default: return 'Non définie'; | |||
break; | |||
} | |||
} | |||
/** | |||
* Retourne la classe CSS du bouton servant à définir la priorité. | |||
* | |||
* @return string | |||
*/ | |||
public function getClassCssStyleButton() | |||
{ | |||
$styleButton = 'default'; | |||
if ($this->priority == DevelopmentPriorityModel::PRIORITY_LOW) { | |||
$styleButton = 'info'; | |||
} | |||
elseif ($this->priority == DevelopmentPriorityModel::PRIORITY_NORMAL) { | |||
$styleButton = 'warning'; | |||
} | |||
elseif ($this->priority == DevelopmentPriorityModel::PRIORITY_HIGH) { | |||
$styleButton = 'danger'; | |||
} | |||
return $styleButton; | |||
} | |||
} |
@@ -13,7 +13,6 @@ use common\logic\Distribution\Distribution\Service\DistributionSolver; | |||
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; | |||
@@ -43,7 +42,6 @@ class OrderBuilder extends AbstractBuilder | |||
protected ProducerRepository $producerRepository; | |||
protected CreditHistoryBuilder $creditHistoryBuilder; | |||
protected ProductOrderBuilder $productOrderBuilder; | |||
protected OrderStatusHistoryBuilder $orderStatusHistoryBuilder; | |||
protected OrderRepository $orderRepository; | |||
protected DistributionRepository $distributionRepository; | |||
protected SubscriptionBuilder $subscriptionBuilder; | |||
@@ -65,7 +63,6 @@ class OrderBuilder extends AbstractBuilder | |||
$this->producerRepository = $this->loadService(ProducerRepository::class); | |||
$this->creditHistoryBuilder = $this->loadService(CreditHistoryBuilder::class); | |||
$this->productOrderBuilder = $this->loadService(ProductOrderBuilder::class); | |||
$this->orderStatusHistoryBuilder = $this->loadService(OrderStatusHistoryBuilder::class); | |||
$this->orderRepository = $this->loadService(OrderRepository::class); | |||
$this->distributionRepository = $this->loadService(DistributionRepository::class); | |||
$this->subscriptionBuilder = $this->loadService(SubscriptionBuilder::class); | |||
@@ -107,7 +104,6 @@ class OrderBuilder extends AbstractBuilder | |||
/** | |||
* Ajoute l'abonnement' pour une date donnée. | |||
*/ | |||
// add | |||
public function createOrderFromSubscription(Subscription $subscription, string $date, bool $force = false): ?Order | |||
{ | |||
$now = date('Y-m-d'); | |||
@@ -132,8 +128,6 @@ class OrderBuilder extends AbstractBuilder | |||
/** | |||
* Ajoute les commandes pour une date donnée à partir des abonnements. | |||
*/ | |||
// addAll | |||
// createAllFromSubscriptions | |||
public function createAllOrdersFromSubscriptions(string $date, bool $force = false): array | |||
{ | |||
$orderArray = []; | |||
@@ -152,7 +146,6 @@ class OrderBuilder extends AbstractBuilder | |||
return $orderArray; | |||
} | |||
// updateIncomingDistributions | |||
public function updateOrdersIncomingDistributionsFromSubscription(Subscription $subscription, $update = false): array | |||
{ | |||
$orderArray = []; | |||
@@ -254,7 +247,6 @@ class OrderBuilder extends AbstractBuilder | |||
return $productsAdd; | |||
} | |||
// updateFromSubscription | |||
public function updateOrderFromSubscription(Order $order, Subscription $subscription): void | |||
{ | |||
$this->initOrderBaseFromSubscription($order, $subscription); | |||
@@ -314,7 +306,6 @@ class OrderBuilder extends AbstractBuilder | |||
$order->tiller_synchronization = $order->auto_payment; | |||
} | |||
// addUserPointSale | |||
public function createUserPointSale(Order $order): void | |||
{ | |||
if ($order->user) { | |||
@@ -322,7 +313,6 @@ class OrderBuilder extends AbstractBuilder | |||
} | |||
} | |||
// initCommentPointSale | |||
public function initOrderCommentPointSale(Order $order): void | |||
{ | |||
if ($order->user && $order->pointSale) { | |||
@@ -392,7 +382,6 @@ class OrderBuilder extends AbstractBuilder | |||
$this->addProductOrderVat($order, $typeTotal, $price * $productOrder->quantity, $productOrder->taxRate, $taxCalculationMethod); | |||
} | |||
// addVat | |||
public function addProductOrderVat( | |||
Order $order, | |||
string $typeTotal, | |||
@@ -436,7 +425,6 @@ class OrderBuilder extends AbstractBuilder | |||
} | |||
} | |||
// delete | |||
public function deleteOrder(Order $order, bool $force = false): bool | |||
{ | |||
$this->initOrder($order); | |||
@@ -504,8 +492,6 @@ class OrderBuilder extends AbstractBuilder | |||
} | |||
} | |||
// setTillerSynchronization | |||
// updateTillerSynchronization | |||
public function updateOrderTillerSynchronization(Order $order, int $synchroTiller = null): void | |||
{ | |||
if (!is_null($synchroTiller)) { | |||
@@ -526,7 +512,6 @@ class OrderBuilder extends AbstractBuilder | |||
/** | |||
* Changement de statut d'une commande. | |||
*/ | |||
// changeOrderStatus | |||
public function updateOrderStatus(Order $order, string $newStatus, string $origin): void | |||
{ | |||
$orderStatusArray = GlobalParam::get('orderStatus'); | |||
@@ -534,7 +519,6 @@ class OrderBuilder extends AbstractBuilder | |||
switch ($newStatus) { | |||
case 'new-order' : | |||
//$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); | |||
$order->status = $newStatus; | |||
$order->save(); | |||
break; | |||
@@ -546,7 +530,6 @@ class OrderBuilder extends AbstractBuilder | |||
case 'refunded': | |||
case 'cancel': | |||
if (in_array($newStatus, $orderStatusArray[$order->status]['nextStatusAllow'])) { | |||
//$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); | |||
$order->status = $newStatus; | |||
$order->save(); | |||
} |
@@ -1,72 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory\Model; | |||
use common\components\ActiveRecordCommon; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\User\User\Model\User; | |||
/** | |||
* This is the model class for table "order_status_history". | |||
*/ | |||
class OrderStatusHistory extends ActiveRecordCommon | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'order_status_history'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['id_order', 'status', 'id_user', 'date', 'origin'], 'required'], | |||
[['id_order', 'id_user',], 'integer'], | |||
[['date'], 'safe'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'id_order' => 'Commande', | |||
'id_user' => 'Utilisateur', | |||
'status' => 'Statut', | |||
'origin' => 'Origine', | |||
'date' => 'Date', | |||
]; | |||
} | |||
/* | |||
* Relations | |||
*/ | |||
public function getOrder() | |||
{ | |||
return $this->hasOne(Order::class, ['id' => 'id_order']); | |||
} | |||
public function populateOrder(Order $order): void | |||
{ | |||
$this->populateFieldObject('id_order', 'order', $order); | |||
} | |||
public function getUser() | |||
{ | |||
return $this->hasOne(User::class, ['id' => 'id_user']); | |||
} | |||
public function populateUser(User $user): void | |||
{ | |||
$this->populateFieldObject('id_user', 'user', $user); | |||
} | |||
} |
@@ -1,25 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory\Repository; | |||
use common\logic\AbstractRepository; | |||
class OrderStatusHistoryRepository extends AbstractRepository | |||
{ | |||
protected OrderStatusHistoryRepositoryQuery $query; | |||
public function loadDependencies(): void | |||
{ | |||
$this->loadQuery(OrderStatusHistoryRepositoryQuery::class); | |||
} | |||
public function getDefaultOptionsSearch(): array | |||
{ | |||
return [ | |||
self::WITH => [], | |||
self::JOIN_WITH => ['order', 'orderStatus'], | |||
self::ORDER_BY => 'date ASC', | |||
self::ATTRIBUTE_ID_PRODUCER => '' | |||
]; | |||
} | |||
} |
@@ -1,18 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory\Repository; | |||
use common\logic\AbstractRepositoryQuery; | |||
use common\logic\Order\OrderStatusHistory\Model\OrderStatusHistory; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryDefinition; | |||
use yii\db\ActiveQuery; | |||
class OrderStatusHistoryRepositoryQuery extends AbstractRepositoryQuery | |||
{ | |||
protected OrderStatusHistoryDefinition $definition; | |||
public function loadDependencies(): void | |||
{ | |||
$this->loadDefinition(OrderStatusHistoryDefinition::class); | |||
} | |||
} |
@@ -1,39 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory\Service; | |||
use common\logic\AbstractBuilder; | |||
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 | |||
{ | |||
protected UserSolver $userSolver; | |||
public function loadDependencies(): void | |||
{ | |||
$this->userSolver = $this->loadService(UserSolver::class); | |||
} | |||
public function instanciateOrderStatusHistory(Order $order, User $user, string $status, string $origin): OrderStatusHistory | |||
{ | |||
$orderStatusHistory = new OrderStatusHistory(); | |||
$orderStatusHistory->populateOrder($order); | |||
$orderStatusHistory->populateUser($user); | |||
$orderStatusHistory->status = $status; | |||
$orderStatusHistory->origin = $origin; | |||
$orderStatusHistory->date = date('Y-m-d H:i:s'); | |||
return $orderStatusHistory; | |||
} | |||
public function createOrderStatusHistory(Order $order, User $user, string $status, string $origin): OrderStatusHistory | |||
{ | |||
$orderStatusHistory = $this->instanciateOrderStatusHistory($order, $user, $status, $origin); | |||
$this->saveCreate($orderStatusHistory); | |||
return $orderStatusHistory; | |||
} | |||
} |
@@ -1,14 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory\Service; | |||
use common\logic\AbstractDefinition; | |||
use common\logic\Order\OrderStatusHistory\Model\OrderStatusHistory; | |||
class OrderStatusHistoryDefinition extends AbstractDefinition | |||
{ | |||
public function getEntityFqcn(): string | |||
{ | |||
return OrderStatusHistory::class; | |||
} | |||
} |
@@ -1,35 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\Order\OrderStatusHistory\Repository\OrderStatusHistoryRepository; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryBuilder; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryDefinition; | |||
class OrderStatusHistoryContainer extends AbstractContainer | |||
{ | |||
public function getServices(): array | |||
{ | |||
return [ | |||
OrderStatusHistoryDefinition::class, | |||
OrderStatusHistoryRepository::class, | |||
OrderStatusHistoryBuilder::class | |||
]; | |||
} | |||
public function getDefinition(): OrderStatusHistoryDefinition | |||
{ | |||
return OrderStatusHistoryDefinition::getInstance(); | |||
} | |||
public function getRepository(): OrderStatusHistoryRepository | |||
{ | |||
return OrderStatusHistoryRepository::getInstance(); | |||
} | |||
public function getBuilder(): OrderStatusHistoryBuilder | |||
{ | |||
return OrderStatusHistoryBuilder::getInstance(); | |||
} | |||
} |
@@ -1,21 +0,0 @@ | |||
<?php | |||
namespace common\logic\Order\OrderStatusHistory\Wrapper; | |||
use common\logic\AbstractManager; | |||
use common\logic\Order\OrderStatusHistory\Repository\OrderStatusHistoryRepository; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryBuilder; | |||
use common\logic\Order\OrderStatusHistory\Service\OrderStatusHistoryDefinition; | |||
/** | |||
* @mixin OrderStatusHistoryDefinition | |||
* @mixin OrderStatusHistoryRepository | |||
* @mixin OrderStatusHistoryBuilder | |||
*/ | |||
class OrderStatusHistoryManager extends AbstractManager | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return OrderStatusHistoryContainer::class; | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
<?php | |||
use yii\db\Migration; | |||
/** | |||
* Class m230823_072853_delete_development_order_status | |||
*/ | |||
class m230823_072853_delete_development_order_status extends Migration | |||
{ | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeUp() | |||
{ | |||
$this->dropTable('development'); | |||
$this->dropTable('development_priority'); | |||
$this->dropTable('order_status'); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeDown() | |||
{ | |||
echo "m230823_072853_delete_development_order_status cannot be reverted.\n"; | |||
return false; | |||
} | |||
} |