function plugin_accounts_MassiveActionsProcess($data) { $account_item = new PluginAccountsAccount_Item(); $res = array('ok' => 0, 'ko' => 0, 'noright' => 0); switch ($data['action']) { case "plugin_accounts_add_item": foreach ($data["item"] as $key => $val) { if ($val == 1) { $input = array('plugin_accounts_accounts_id' => $data['plugin_accounts_accounts_id'], 'items_id' => $key, 'itemtype' => $data['itemtype']); if ($account_item->can(-1, 'w', $input)) { if ($account_item->add($input)) { $res['ok']++; } else { $res['ko']++; } } else { $res['noright']++; } } } break; } return $res; }