Esempio n. 1
0
        } elseif (SP\Profile::checkProfileExist($Profile->getId(), $Profile->getName())) {
            SP\Response::printJSON(_('Nombre de perfil duplicado'), 2);
        }
        if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_NEW) {
            if ($Profile->profileAdd()) {
                SP\Response::printJSON(_('Perfil creado'), 0, $doActionOnClose);
            }
            SP\Response::printJSON(_('Error al crear el perfil'));
        } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_EDIT) {
            if ($Profile->profileUpdate()) {
                SP\Response::printJSON(_('Perfil actualizado'), 0, $doActionOnClose);
            }
            SP\Response::printJSON(_('Error al actualizar el perfil'));
        }
    } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_DELETE) {
        $resProfileUse = SP\Profile::checkProfileInUse($Profile->getId());
        if ($resProfileUse['users'] > 0) {
            $uses[] = _('Usuarios') . " (" . $resProfileUse['users'] . ")";
            SP\Response::printJSON(_('No es posible eliminar') . ';;' . _('Perfil en uso por:') . ';;' . implode(';;', $uses));
        } else {
            if ($Profile->profileDelete()) {
                SP\Response::printJSON(_('Perfil eliminado'), 0, $doActionOnClose);
            }
            SP\Response::printJSON(_('Error al eliminar el perfil'));
        }
    }
} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE) {
    // Variables POST del formulario
    $frmCustomerName = SP\Request::analyze('name');
    $frmCustomerDesc = SP\Request::analyze('description');
    if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT) {