Browse Source

Refactoring CreditHistory #881

refactoring
Guillaume Bourgeois 1 year ago
parent
commit
70ef63c454
4 changed files with 11 additions and 8 deletions
  1. +3
    -2
      common/models/CreditHistorySearch.php
  2. +4
    -4
      common/models/Product.php
  3. +1
    -1
      producer/controllers/CreditController.php
  4. +3
    -1
      producer/controllers/ProducerBaseController.php

+ 3
- 2
common/models/CreditHistorySearch.php View File



use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\models\CreditHistory ; use common\models\CreditHistory ;
use common\repositories\CreditHistoryRepository;


class CreditHistorySearch extends CreditHistory class CreditHistorySearch extends CreditHistory
{ {
public function rules()
public function rules(): array
{ {
return [ return [
[['id_user', 'id_user_action', 'id_order', 'id_producer'], 'integer'], [['id_user', 'id_user_action', 'id_order', 'id_producer'], 'integer'],
public function search($params) public function search($params)
{ {
$optionsSearch = self::defaultOptionsSearch() ;
$optionsSearch = CreditHistoryRepository::defaultOptionsSearch() ;
$query = CreditHistory::find() $query = CreditHistory::find()
->with($optionsSearch['with']) ->with($optionsSearch['with'])

+ 4
- 4
common/models/Product.php View File

// disponible par défaut // disponible par défaut
if ($this->available_on_points_sale) { if ($this->available_on_points_sale) {
foreach ($this->productPointSale as $productPointSale) { foreach ($this->productPointSale as $productPointSale) {
if ($pointSale->id == $productPointSale->id_point_sale
//&& $productPointSale->id_product == $this->id
if (isset($pointSale->id)
&& $productPointSale->id_point_sale
&& $pointSale->id == $productPointSale->id_point_sale
&& !$productPointSale->available) { && !$productPointSale->available) {
return false; return false;
} }
} // indisponible par défaut } // indisponible par défaut
else { else {
foreach ($this->productPointSale as $productPointSale) { foreach ($this->productPointSale as $productPointSale) {
if ($pointSale->id == $productPointSale->id_point_sale
//&& $productPointSale->id_product == $this->id
if (isset($pointSale->id) && $pointSale->id == $productPointSale->id_point_sale
&& $productPointSale->available) { && $productPointSale->available) {
return true; return true;
} }

+ 1
- 1
producer/controllers/CreditController.php View File



public function actionStripeVerification() public function actionStripeVerification()
{ {
$creditHistoryService = \Yii::$app->logic->getCreditHistoryContainer()->getService();
$creditHistoryService = $this->getLogic()->getCreditHistoryContainer()->getService();
$producer = $this->getProducer(); $producer = $this->getProducer();
$contactProducer = $producer->getMainContact(); $contactProducer = $producer->getMainContact();



+ 3
- 1
producer/controllers/ProducerBaseController.php View File



namespace producer\controllers; namespace producer\controllers;


class ProducerBaseController extends CommonController
use common\controllers\CommonController;

class ProducerBaseController extends CommonController
{ {


var $producer ; var $producer ;

Loading…
Cancel
Save