|
|
|
|
|
|
|
|
->from('user'); |
|
|
->from('user'); |
|
|
|
|
|
|
|
|
$active = (isset($params['inactive']) && $params['inactive']) ? 0 : 1; |
|
|
$active = (isset($params['inactive']) && $params['inactive']) ? 0 : 1; |
|
|
$query->innerJoin('user_producer', 'user.id = user_producer.id_user AND user_producer.active = ' . $active . ' AND user_producer.newsletter = 1 AND user_producer.id_producer = :id_producer', [':id_producer' => $params['id_producer']]); |
|
|
|
|
|
|
|
|
$filterNewsletter = (isset($params['newsletter']) && $params['newsletter']) ? 'AND user_producer.newsletter = 1' : ''; |
|
|
|
|
|
$query->innerJoin('user_producer', 'user.id = user_producer.id_user AND user_producer.active = ' . $active . ' '.$filterNewsletter.' AND user_producer.id_producer = :id_producer', [':id_producer' => $params['id_producer']]); |
|
|
|
|
|
|
|
|
if (isset($params['id_point_sale']) && $params['id_point_sale']) { |
|
|
if (isset($params['id_point_sale']) && $params['id_point_sale']) { |
|
|
$point_sale = PointSale::findOne(['id' => $params['id_point_sale']]); |
|
|
$point_sale = PointSale::findOne(['id' => $params['id_point_sale']]); |