ソースを参照

Anthély : rappatriement clients depuis le compte Anthéli #793

refactoring
Guillaume Bourgeois 1年前
コミット
2300a426e3
1個のファイルの変更14行の追加2行の削除
  1. +14
    -2
      backend/controllers/ProducerAdminController.php

+ 14
- 2
backend/controllers/ProducerAdminController.php ファイルの表示

@@ -130,7 +130,7 @@ class ProducerAdminController extends BackendController
}
}

public function actionUserTransfer($fromProducerId, $toProducerId)
public function actionUserTransfer($fromProducerId, $toProducerId, $withOrders = 1)
{
$fromProducerId = (int) $fromProducerId;
$toProducerId = (int) $toProducerId;
@@ -138,7 +138,19 @@ class ProducerAdminController extends BackendController
$usersArray = User::findBy(['id_producer' => $fromProducerId])->all();

foreach($usersArray as $user) {
Producer::addUser($user['user_id'], $toProducerId);
$idUser = $user['user_id'];

$countOrders = 0;
if($withOrders) {
$countOrders = Order::searchCount([
'id_user' => $idUser,
], ['conditions' => 'date_delete IS NULL']);
}

if(($withOrders && $countOrders) || !$withOrders) {
Producer::addUser($idUser, $toProducerId);
}

$count ++;
}


読み込み中…
キャンセル
保存