예제 #1
0
}
$Account = new SP\Account();
switch ($actionId) {
    case \SP\Controller\ActionsInterface::ACTION_ACC_NEW:
    case \SP\Controller\ActionsInterface::ACTION_ACC_COPY:
        SP\Customer::$customerName = $newCustomer;
        // Comprobar si se ha introducido un nuevo cliente
        if ($customerId === 0 && $newCustomer) {
            try {
                SP\Customer::addCustomer();
                $customerId = SP\Customer::$customerLastId;
            } catch (\SP\SPException $e) {
                SP\Response::printJSON($e->getMessage());
            }
        }
        $Account->setAccountName($accountName);
        $Account->setAccountCategoryId($categoryId);
        $Account->setAccountCustomerId($customerId);
        $Account->setAccountLogin($accountLogin);
        $Account->setAccountUrl($accountUrl);
        $Account->setAccountPass($accountEncPass['data']);
        $Account->setAccountIV($accountEncPass['iv']);
        $Account->setAccountNotes($accountNotes);
        $Account->setAccountUserId($currentUserId);
        $Account->setAccountUserGroupId($accountMainGroupId);
        $Account->setAccountUsersId($accountOtherUsers);
        $Account->setAccountUserGroupsId($accountOtherGroups);
        $Account->setAccountOtherUserEdit($accountUserEditEnabled);
        $Account->setAccountOtherGroupEdit($accountGroupEditEnabled);
        // Crear cuenta
        if ($Account->createAccount()) {