$productOrderModule = $this->getProductOrderModule(); | $productOrderModule = $this->getProductOrderModule(); | ||||
$userProducerModule = $this->getUserProducerModule(); | $userProducerModule = $this->getUserProducerModule(); | ||||
if ($ordersArray) { | if ($ordersArray) { | ||||
foreach ($ordersArray as &$order) { | foreach ($ordersArray as &$order) { | ||||
'productOrder' => $productOrderArray, | 'productOrder' => $productOrderArray, | ||||
'paymentsArray' => $paymentArray, | 'paymentsArray' => $paymentArray, | ||||
'oneProductUnactivated' => $oneProductUnactivated, | '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, | 'debitCredit' => false, | ||||
'deliveryNote' => $order->deliveryNote ? $order->deliveryNote->getAttributes() : null | 'deliveryNote' => $order->deliveryNote ? $order->deliveryNote->getAttributes() : null | ||||
]); | ]); |
<?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'); | |||||
} | |||||
} |
public function afterFind() | public function afterFind() | ||||
{ | { | ||||
// @TODO : à optimiser | |||||
if ($this->taxRate == null) { | if ($this->taxRate == null) { | ||||
if(GlobalParam::getCurrentProducerId() && $this->id_producer == GlobalParam::getCurrentProducerId()) { | if(GlobalParam::getCurrentProducerId() && $this->id_producer == GlobalParam::getCurrentProducerId()) { | ||||
$producer = GlobalParam::getCurrentProducer(); | $producer = GlobalParam::getCurrentProducer(); |
public function verifyEmail($attribute, $params) | public function verifyEmail($attribute, $params) | ||||
{ | { | ||||
if ($this->id) { | 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 { | } 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) { | if ($user) { |
public function getDefaultOptionsSearch(): array | public function getDefaultOptionsSearch(): array | ||||
{ | { | ||||
return [ | return [ | ||||
self::WITH => ['producer'], | |||||
self::WITH => [], | |||||
self::JOIN_WITH => [], | self::JOIN_WITH => [], | ||||
self::ORDER_BY => '', | self::ORDER_BY => '', | ||||
self::ATTRIBUTE_ID_PRODUCER => 'user_producer.id_producer' | self::ATTRIBUTE_ID_PRODUCER => 'user_producer.id_producer' |