$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()) { if (is_array($customFields)) { foreach ($customFields as $id => $value) { $CustomFields = new \SP\CustomFields($id, $Account->getAccountId(), $value); $CustomFields->addCustomField(); } } SP\Response::printJSON(_('Cuenta creada'), 0); } SP\Response::printJSON(_('Error al crear la cuenta'), 0); break; case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT: 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) {