Pārlūkot izejas kodu

Merge branch 'dev'

master
Guillaume Bourgeois pirms 5 gadiem
vecāks
revīzija
16138b6cad
2 mainītis faili ar 17 papildinājumiem un 5 dzēšanām
  1. +7
    -1
      common/models/User.php
  2. +10
    -4
      producer/controllers/OrderController.php

+ 7
- 1
common/models/User.php Parādīt failu

@@ -590,7 +590,13 @@ class User extends ActiveRecordCommon implements IdentityInterface
*/
public function getFavoritePointSale()
{
$arrayUserPointSale = UserPointSale::find()->where(['id_user' => $this->id])->all() ;
$arrayUserPointSale = UserPointSale::find()
->innerJoinWith('pointSale')
->where([
'user_point_sale.id_user' => $this->id,
'point_sale.id_producer' => Producer::getId()
])
->all() ;
if(count($arrayUserPointSale) == 1) {
$pointSale = PointSale::findOne(['id' => $arrayUserPointSale[0]->id_point_sale]) ;

+ 10
- 4
producer/controllers/OrderController.php Parādīt failu

@@ -571,12 +571,18 @@ class OrderController extends ProducerBaseController
$favoritePointSale = User::getCurrent()->getFavoritePointSale() ;
if($favoritePointSale) {
foreach($pointsSaleArray as $key => $pointSale) {
if($pointSale['id'] == $favoritePointSale->id) {
unset($pointsSaleArray[$key]) ;
array_unshift($pointsSaleArray, $pointSale) ;
for( $i = 0; $i < count($pointsSaleArray) ; $i++) {
if($pointsSaleArray[$i]['id'] == $favoritePointSale->id) {
$theFavoritePointSale = $pointsSaleArray[$i] ;
unset($pointsSaleArray[$i]) ;
}
}

if(isset($theFavoritePointSale)) {
$pointsSaleArray = array_reverse($pointsSaleArray, false) ;
$pointsSaleArray[] = $theFavoritePointSale ;
$pointsSaleArray = array_reverse($pointsSaleArray, false) ;
}
}
$json['points_sale'] = $pointsSaleArray ;

Notiek ielāde…
Atcelt
Saglabāt