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']) |
// 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; | ||||
} | } |
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(); | ||||
namespace producer\controllers; | namespace producer\controllers; | ||||
class ProducerBaseController extends CommonController | |||||
use common\controllers\CommonController; | |||||
class ProducerBaseController extends CommonController | |||||
{ | { | ||||
var $producer ; | var $producer ; |