Test Failed
Push — master ( 8158be...5430bc )
by Alexey
05:17
created

WalletDiff::groupAction()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 4
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Data manager delete action
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2016 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Money;
13
14
class WalletDiff extends \Ui\DataManager\Action {
15
    public static $name = 'Списать/пополнить';
16
    public static $groupAction = true;
17
18
    public static function groupAction($dataManager, $ids, $actionParams, $adInfo) {
19
        if (empty($adInfo['amount'])) {
20
            throw new \Exception('Необходимо указать сумму');
21
        }
22
        $wallets = Wallet::getList(['where' => ['id', $ids, 'IN']]);
23
        foreach ($wallets as $wallet) {
24
            $wallet->diff($adInfo['amount'], $adInfo['comment']);
25
        }
26
    }
27
28
}
29