@@ -318,6 +318,8 @@ class DistributionController extends BackendController | |||
$productOrderModule = $this->getProductOrderModule(); | |||
$userProducerModule = $this->getUserProducerModule(); | |||
if ($ordersArray) { | |||
foreach ($ordersArray as &$order) { | |||
@@ -395,15 +397,15 @@ class DistributionController extends BackendController | |||
'productOrder' => $productOrderArray, | |||
'paymentsArray' => $paymentArray, | |||
'oneProductUnactivated' => $oneProductUnactivated, | |||
'isLinkedToValidDocument' => $orderModule->isLinkedToValidDocument($order), | |||
'isLinkedToValidInvoice' => $orderModule->isLinkedToValidInvoice($order), | |||
'isCreditAutoPayment' => $orderModule->isCreditAutoPayment($order), | |||
'isCreditContext' => $orderModule->isCreditContext($order), | |||
'isPaid' => $orderModule->isOrderPaid($order), | |||
'isPaidViaInvoice' => $orderModule->isOrderPaidViaInvoice($order), | |||
'paymentLabelShort' => $orderModule->getPaymentLabelShort($order), | |||
'isCreditFunctioningMandatory' => $orderModule->isOrderCreditFunctioningMandatory($order), | |||
'isCreditFunctioningUser' => $orderModule->isOrderCreditFunctioningUser($order), | |||
'isLinkedToValidDocument' => $orderModule->getSolver()->isLinkedToValidDocument($order), | |||
'isLinkedToValidInvoice' => $orderModule->getSolver()->isLinkedToValidInvoice($order), | |||
'isCreditAutoPayment' => $orderModule->getRepository()->isCreditAutoPayment($order), | |||
'isCreditContext' => $orderModule->getRepository()->isCreditContext($order), | |||
'isPaid' => $orderModule->getRepository()->isOrderPaid($order), | |||
'isPaidViaInvoice' => $orderModule->getRepository()->isOrderPaidViaInvoice($order), | |||
'paymentLabelShort' => $orderModule->getRepository()->getPaymentLabelShort($order), | |||
'isCreditFunctioningMandatory' => $orderModule->getRepository()->isOrderCreditFunctioningMandatory($order), | |||
'isCreditFunctioningUser' => $orderModule->getRepository()->isOrderCreditFunctioningUser($order), | |||
'debitCredit' => false, | |||
'deliveryNote' => $order->deliveryNote ? $order->deliveryNote->getAttributes() : null | |||
]); |
@@ -0,0 +1,41 @@ | |||
<?php | |||
use yii\db\Migration; | |||
/** | |||
* Class m240508_093106_create_indexes_performance | |||
*/ | |||
class m240508_093106_create_indexes_performance extends Migration | |||
{ | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeUp() | |||
{ | |||
$this->createIndex('id_user', 'user_producer', 'id_user'); | |||
$this->createIndex('id_producer', 'user_producer', 'id_producer'); | |||
$this->createIndex('id_product', 'product_price', 'id_product'); | |||
$this->createIndex('status', 'user', 'status'); | |||
$this->createIndex('email', 'user', 'email'); | |||
$this->createIndex('type', 'user', 'type'); | |||
$this->createIndex('id_producer', 'user', 'id_producer'); | |||
$this->createIndex('date', 'distribution', 'date'); | |||
$this->createIndex('id_producer', 'distribution', 'id_producer'); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeDown() | |||
{ | |||
$this->dropIndex('id_user', 'user_producer'); | |||
$this->dropIndex('id_producer', 'user_producer'); | |||
$this->dropIndex('id_product', 'product_prices'); | |||
$this->dropIndex('status', 'user'); | |||
$this->dropIndex('email', 'user'); | |||
$this->dropIndex('type', 'user'); | |||
$this->dropIndex('id_producer', 'user'); | |||
$this->dropIndex('date', 'distribution'); | |||
$this->dropIndex('id_producer', 'distribution'); | |||
} | |||
} |
@@ -181,6 +181,7 @@ class Product extends ActiveRecordCommon implements StatusInterface | |||
public function afterFind() | |||
{ | |||
// @TODO : à optimiser | |||
if ($this->taxRate == null) { | |||
if(GlobalParam::getCurrentProducerId() && $this->id_producer == GlobalParam::getCurrentProducerId()) { | |||
$producer = GlobalParam::getCurrentProducer(); |
@@ -223,9 +223,9 @@ class User extends ActiveRecordCommon implements IdentityInterface | |||
public function verifyEmail($attribute, $params) | |||
{ | |||
if ($this->id) { | |||
$user = User::find()->where("email LIKE :email AND type != :guest AND id != :id")->params(array(':email' => '%' . $this->email . '%', ':id' => $this->id, ':guest' => 'guest'))->one(); | |||
$user = User::find()->where("email LIKE :email AND type != :guest AND id != :id")->params(array(':email' => $this->email, ':id' => $this->id, ':guest' => 'guest'))->one(); | |||
} else { | |||
$user = User::find()->where("email LIKE :email AND type != :guest")->params(array(':email' => '%' . $this->email . '%', ':guest' => 'guest'))->one(); | |||
$user = User::find()->where("email LIKE :email AND type != :guest")->params(array(':email' => $this->email, ':guest' => 'guest'))->one(); | |||
} | |||
if ($user) { |
@@ -17,7 +17,7 @@ class UserProducerRepository extends AbstractRepository | |||
public function getDefaultOptionsSearch(): array | |||
{ | |||
return [ | |||
self::WITH => ['producer'], | |||
self::WITH => [], | |||
self::JOIN_WITH => [], | |||
self::ORDER_BY => '', | |||
self::ATTRIBUTE_ID_PRODUCER => 'user_producer.id_producer' |