Bladeren bron

Refactoring CreditHistory #881

refactoring
Guillaume Bourgeois 1 jaar geleden
bovenliggende
commit
70ef63c454
4 gewijzigde bestanden met toevoegingen van 11 en 8 verwijderingen
  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 Bestand weergeven

@@ -40,11 +40,12 @@ namespace common\models ;

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

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

+ 4
- 4
common/models/Product.php Bestand weergeven

@@ -245,8 +245,9 @@ class Product extends ActiveRecordCommon
// disponible par défaut
if ($this->available_on_points_sale) {
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) {
return false;
}
@@ -256,8 +257,7 @@ class Product extends ActiveRecordCommon
} // indisponible par défaut
else {
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) {
return true;
}

+ 1
- 1
producer/controllers/CreditController.php Bestand weergeven

@@ -193,7 +193,7 @@ class CreditController extends ProducerBaseController

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


+ 3
- 1
producer/controllers/ProducerBaseController.php Bestand weergeven

@@ -38,7 +38,9 @@ termes.

namespace producer\controllers;

class ProducerBaseController extends CommonController
use common\controllers\CommonController;

class ProducerBaseController extends CommonController
{

var $producer ;

Laden…
Annuleren
Opslaan