diff --git a/CHANGELOG b/CHANGELOG index 23aad2bb..682476e7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +=== ** v1.0.1 ** === + +* [BUG] Corregido mensaje al eliminar cuentas/usuarios/grupos/perfiles. +* [BUG] Corregido fallo al obtener el perfil de usuario tras finalizar la sesión. +* [MOD] Dar el foco a los "inputs" tras cargar el contenido. +* [MOD] Revisión de traducción. + === ** v1.0 ** === * [NUEVO] Se muestran los grupos secundarios en el menú contextual de los resultados de búsqueda. @@ -126,6 +133,13 @@ --- +=== ** v1.0.1 ** === + +* [BUG] Fix message text on deleting accounts/users/groups/profiles. +* [BUG] Fix error on retrieving profile data while closing session. +* [MOD] Give focus to "inputs" after loading content. +* [MOD] Update translations. + === ** v1.0 ** === * [NEW] Secondary groups are shown on search results context menu. diff --git a/ajax/ajax_accountsave.php b/ajax/ajax_accountsave.php index 55ed56a0..2d34d268 100644 --- a/ajax/ajax_accountsave.php +++ b/ajax/ajax_accountsave.php @@ -105,7 +105,7 @@ if ($frmSaveType == 1) { SP_Common::printXML(_('Las claves no coinciden')); } } else { - $SP_Common::printXML(_('No es una acción válida')); + $SP_Common::printXML(_('Acción Inválida')); } if ($frmSaveType == 1 || $frmSaveType == 4) { @@ -228,5 +228,5 @@ switch ($frmSaveType) { SP_Common::printXML(_('Error al actualizar la clave')); break; default: - SP_Common::printXML(_('No es una acción válida')); + SP_Common::printXML(_('Acción Inválida')); } \ No newline at end of file diff --git a/ajax/ajax_backup.php b/ajax/ajax_backup.php index 20aba89e..b6698419 100644 --- a/ajax/ajax_backup.php +++ b/ajax/ajax_backup.php @@ -38,8 +38,6 @@ if (!$sk || !SP_Common::checkSessionKey($sk)) { SP_Common::printXML(_('CONSULTA INVÁLIDA')); } -SP_Users::checkUserAccess("backup") || die ('
'._('No tiene permisos para acceder a esta página').''._('No tiene permisos para acceder a esta página').'' . _('Gestión de Perfiles') . '' : ''; echo ''; - $tplvars['active'] = 0; + $tplvars['active'] = 0; if (SP_Users::checkUserAccess("users")) { $arrUsersTableProp = array( @@ -191,13 +191,14 @@ switch ($action) { } echo '
'; - + echo ''; break; @@ -255,13 +256,16 @@ switch ($action) { echo ''; - echo ''; + '; break; case "eventlog": SP_Users::checkUserAccess($action) || SP_Html::showCommonError('unavailable'); diff --git a/ajax/ajax_migrate.php b/ajax/ajax_migrate.php index 8773cfaf..49d32e1f 100644 --- a/ajax/ajax_migrate.php +++ b/ajax/ajax_migrate.php @@ -1 +1 @@ -. * */ define('APP_ROOT', '..'); include_once (APP_ROOT . "/inc/init.php"); SP_Util::checkReferer('POST'); if (!SP_Init::isLoggedIn()) { SP_Common::printXML(_('La sesión no se ha iniciado o ha caducado'), 10); } if (SP_Config::getValue('demoenabled', 0)) { SP_Common::printXML(_('Opción inválida')); } $sk = SP_Common::parseParams('p', 'sk', FALSE); if (!$sk || !SP_Common::checkSessionKey($sk)) { SP_Common::printXML(_('CONSULTA INVÁLIDA')); } $frmDBUser = SP_Common::parseParams('p', 'dbuser'); $frmDBPass = SP_Common::parseParams('p', 'dbpass'); $frmDBName = SP_Common::parseParams('p', 'dbname'); $frmDBHost = SP_Common::parseParams('p', 'dbhost'); $frmMigrateEnabled = SP_Common::parseParams('p', 'chkmigrate', 0, FALSE, 1); if (!$frmMigrateEnabled) { SP_Common::printXML(_('Confirmar la importación de cuentas')); } if (!$frmDBUser) { SP_Common::printXML(_('Es necesario un usuario de conexión')); } if (!$frmDBPass) { SP_Common::printXML(_('Es necesaria una clave de conexión')); } if (!$frmDBName) { SP_Common::printXML(_('Es necesario el nombre de la BBDD')); } if (!$frmDBHost) { SP_Common::printXML(_('Es necesario un nombre de host')); } $options['dbhost'] = $frmDBHost; $options['dbname'] = $frmDBName; $options['dbuser'] = $frmDBUser; $options['dbpass'] = $frmDBPass; $res = SP_Migrate::migrate($options); if (is_array($res['error'])) { foreach ($res['error'] as $error) { $errors [] = $error['description']; $errors [] = $error['hint']; error_log($error['hint']); } $out = implode('
', $errors); SP_Common::printXML($out); } else if (is_array($res['ok'])) { $out = implode('
', $res['ok']); SP_Common::printXML($out, 0); } \ No newline at end of file +. * */ define('APP_ROOT', '..'); include_once (APP_ROOT . "/inc/init.php"); SP_Util::checkReferer('POST'); if (!SP_Init::isLoggedIn()) { SP_Common::printXML(_('La sesión no se ha iniciado o ha caducado'), 10); } if (SP_Config::getValue('demoenabled', 0)) { SP_Common::printXML(_('Acción Inválida').'(DEMO)'); } $sk = SP_Common::parseParams('p', 'sk', FALSE); if (!$sk || !SP_Common::checkSessionKey($sk)) { SP_Common::printXML(_('CONSULTA INVÁLIDA')); } $frmDBUser = SP_Common::parseParams('p', 'dbuser'); $frmDBPass = SP_Common::parseParams('p', 'dbpass'); $frmDBName = SP_Common::parseParams('p', 'dbname'); $frmDBHost = SP_Common::parseParams('p', 'dbhost'); $frmMigrateEnabled = SP_Common::parseParams('p', 'chkmigrate', 0, FALSE, 1); if (!$frmMigrateEnabled) { SP_Common::printXML(_('Confirmar la importación de cuentas')); } if (!$frmDBUser) { SP_Common::printXML(_('Es necesario un usuario de conexión')); } if (!$frmDBPass) { SP_Common::printXML(_('Es necesaria una clave de conexión')); } if (!$frmDBName) { SP_Common::printXML(_('Es necesario el nombre de la BBDD')); } if (!$frmDBHost) { SP_Common::printXML(_('Es necesario un nombre de host')); } $options['dbhost'] = $frmDBHost; $options['dbname'] = $frmDBName; $options['dbuser'] = $frmDBUser; $options['dbpass'] = $frmDBPass; $res = SP_Migrate::migrate($options); if (is_array($res['error'])) { foreach ($res['error'] as $error) { $errors [] = $error['description']; $errors [] = $error['hint']; error_log($error['hint']); } $out = implode('
', $errors); SP_Common::printXML($out); } else if (is_array($res['ok'])) { $out = implode('
', $res['ok']); SP_Common::printXML($out, 0); } \ No newline at end of file diff --git a/ajax/ajax_search.php b/ajax/ajax_search.php index 198fcb4a..58abcafd 100644 --- a/ajax/ajax_search.php +++ b/ajax/ajax_search.php @@ -184,7 +184,12 @@ foreach ( $resQuery as $account ){ echo'
  • '; $groupsName = _('Grupos').':

    *'.$account->usergroup_name.'
    '; - $groupsName .= implode('
    ', SP_Account::getAccountGroupsName($account->account_id)); + + $secondaryGroups = SP_Account::getAccountGroupsName($account->account_id); + + if ( $secondaryGroups ){ + $groupsName .= implode('
    ', $secondaryGroups); + } echo ''; diff --git a/ajax/ajax_usersMgmt.php b/ajax/ajax_usersMgmt.php index 2a5f1b65..546d7057 100644 --- a/ajax/ajax_usersMgmt.php +++ b/ajax/ajax_usersMgmt.php @@ -32,7 +32,6 @@ if (!SP_Init::isLoggedIn()) { SP_Util::logout(); } - if ( SP_Common::parseParams('p', 'id', FALSE, TRUE) && SP_Common::parseParams('p', 'type', FALSE, TRUE) ) { $tplvars['itemid'] = SP_Common::parseParams('p', 'id', 0); $itemType = $tplvars['itemtype'] = SP_Common::parseParams('p', 'type', 0); diff --git a/ajax/ajax_usersSave.php b/ajax/ajax_usersSave.php index 97edc3f1..48a16464 100644 --- a/ajax/ajax_usersSave.php +++ b/ajax/ajax_usersSave.php @@ -44,12 +44,6 @@ $frmSaveType = SP_Common::parseParams('p', 'type', 0); $frmAction = SP_Common::parseParams('p', 'action', 0); $frmItemId = SP_Common::parseParams('p', 'id', 0); -if ($frmAction == 3) { - SP_Users::checkUserAccess("acceditpass", $frmItemId) || die('
    getUserLoginById($frmItemId); + + if ( SP_Config::getValue('demoenabled', 0) && $userLogin == 'demo'){ + SP_Common::printXML(_('Acción Inválida').'(DEMO)'); + } + if (!$frmUsrPass || !$frmUsrPassV) { SP_Common::printXML(_('La clave no puede estar en blanco'), 2); } @@ -158,7 +158,7 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { if ($objUser->manageUser("updatepass")) { $message['action'] = _('Modificar Clave Usuario'); - $message['text'][] = _('Nombre') . ': ' . $frmUsrName . ' (' . $frmUsrLogin . ')'; + $message['text'][] = _('Login') . ': ' . $userLogin; SP_Common::wrLogInfo($message); SP_Common::sendEmail($message); @@ -168,8 +168,14 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { SP_Common::printXML(_('Error al modificar la clave')); // Eliminar usuario - } elseif ($frmAction == 4 && !SP_Config::getValue('demoenabled', 0)) { + } elseif ($frmAction == 4) { + $userLogin = $objUser->getUserLoginById($frmItemId); + + if ( SP_Config::getValue('demoenabled', 0) && $userLogin == 'demo' ){ + SP_Common::printXML(_('Acción Inválida').'(DEMO)'); + } + $objUser->userId = $frmItemId; if ($frmItemId == $_SESSION["uid"]) { @@ -178,7 +184,7 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { if ($objUser->manageUser("delete")) { $message['action'] = _('Eliminar Usuario'); - $message['text'][] = _('Login') . ': ' . $frmUsrName . ' (' . $frmUsrLogin . ')'; + $message['text'][] = _('Login') . ': ' . $userLogin; SP_Common::wrLogInfo($message); SP_Common::sendEmail($message); @@ -189,11 +195,11 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { SP_Common::printXML(_('Error al eliminar el usuario')); } - SP_Common::printXML(_('No es una acción válida')); + SP_Common::printXML(_('Acción Inválida')); } elseif ($frmSaveType == 3 || $frmSaveType == 4) { // Variables POST del formulario - $frmGrpName = ( isset($_POST["name"]) ) ? SP_Html::sanitize($_POST["name"]) : ""; - $frmGrpDesc = ( isset($_POST["description"]) ) ? SP_Html::sanitize($_POST["description"]) : ""; + $frmGrpName = SP_Common::parseParams('p', 'name'); + $frmGrpDesc = SP_Common::parseParams('p', 'description'); // Nuevo grupo o editar if ($frmAction == 1 OR $frmAction == 2) { @@ -235,7 +241,7 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { SP_Common::printXML(_('Error al actualizar el grupo')); } - // Eliminar grupo + // Eliminar grupo } elseif ($frmAction == 4) { $objUser->groupId = $frmItemId; @@ -244,9 +250,11 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { if (is_string($resGroupUse)) { SP_Common::printXML(_('No es posible eliminar:Grupo en uso por') . ' ' . $resGroupUse); } else { + $groupName = $objUser->getGroupNameById($frmItemId); + if ($objUser->manageGroup("delete")) { $message['action'] = _('Eliminar Grupo'); - $message['text'][] = _('Nombre') . ': ' . $frmGrpName; + $message['text'][] = _('Nombre') . ': ' . $groupName; SP_Common::wrLogInfo($message); SP_Common::sendEmail($message); @@ -258,12 +266,12 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { } } - SP_Common::printXML(_('No es una acción válida')); + SP_Common::printXML(_('Acción Inválida')); } elseif ($frmSaveType == 5 || $frmSaveType == 6) { $profileProp = array(); // Variables POST del formulario - $frmProfileName = ( isset($_POST["profile_name"]) ) ? SP_Html::sanitize($_POST["profile_name"]) : ""; + $frmProfileName = SP_Common::parseParams('p', 'profile_name'); $objUser->profileId = $frmItemId; // Profile properties Array @@ -322,16 +330,18 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { SP_Common::printXML(_('Error al actualizar el perfil')); } - // Eliminar perfil + // Eliminar perfil } elseif ($frmAction == 4) { $resProfileUse = $objUser->checkProfileInUse(); if (is_string($resProfileUse)) { SP_Common::printXML(_('No es posible eliminar: Perfil en uso por') . ' ' . $resProfileUse); } else { + $profileName = $objUser->getProfileNameById($frmItemId); + if ($objUser->manageProfiles("delete")) { $message['action'] = _('Eliminar Perfil'); - $message['text'][] = _('Nombre') . ': ' . $frmProfileName; + $message['text'][] = _('Nombre') . ': ' . $profileName; SP_Common::wrLogInfo($message); SP_Common::sendEmail($message); @@ -343,5 +353,5 @@ if ($frmSaveType == 1 || $frmSaveType == 2) { } } - SP_Common::printXML(_('No es una acción válida')); + SP_Common::printXML(_('Acción Inválida')); } \ No newline at end of file diff --git a/ajax/ajax_usrpass.php b/ajax/ajax_usrpass.php index 7fc9ebb5..ef475bd3 100644 --- a/ajax/ajax_usrpass.php +++ b/ajax/ajax_usrpass.php @@ -42,7 +42,6 @@ $strError = '
    '._('No tiene permisos para re SP_Users::checkUserAccess("acceditpass",$userId) || die ($strError); -$isDemoMode = SP_Config::getValue('demoenabled', 0); ?>
    @@ -66,11 +65,7 @@ $isDemoMode = SP_Config::getValue('demoenabled', 0); - - - - - + @@ -88,5 +83,4 @@ $isDemoMode = SP_Config::getValue('demoenabled', 0);
  • - - \ No newline at end of file + \ No newline at end of file diff --git a/inc/account.class.php b/inc/account.class.php index 6f2d2609..3fec687e 100644 --- a/inc/account.class.php +++ b/inc/account.class.php @@ -459,7 +459,7 @@ class SP_Account { $message['action'] = _('Eliminar Cuenta'); $message['text'][] = _('Cliente').": ".$this->cacheParams['customer_name']; - $message['text'][] = _('Cuenta').": $this->accountName ($this->accountId)"; + $message['text'][] = _('Cuenta').": ".$this->cacheParams['account_name']." ($this->accountId)"; $query = "DELETE FROM accounts " . "WHERE account_id = ".(int)$this->accountId." LIMIT 1"; @@ -725,7 +725,6 @@ class SP_Account { * @return array con los nombres de los grupos ordenados */ public static function getAccountGroupsName ($accountId){ - $query = "SELECT usergroup_name FROM accGroups " . "JOIN usrGroups ON accgroup_groupId = usergroup_id " . "WHERE accgroup_accountId = ".(int)$accountId; @@ -736,6 +735,10 @@ class SP_Account { return FALSE; } + if (!is_array($queryRes)) { + return FALSE; + } + foreach ( $queryRes as $groups ){ $groupsName[] = $groups->usergroup_name; } diff --git a/inc/config.class.php b/inc/config.class.php index 33ecc35f..01f1c089 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -208,7 +208,7 @@ class SP_Config{ if ( ! is_dir($bakDstDir) ){ if ( ! @mkdir($bakDstDir, 0550) ){ - $arrOut['error'] = ''._('No es posible crear el directorio de backups').' ('.$bakDstDir.')'; + $arrOut['error'] = _('No es posible crear el directorio de backups').' ('.$bakDstDir.')'; $message['action'] = _('Copia BBDD'); $message['text'][] = _('No es posible crear el directorio de backups'); @@ -220,7 +220,7 @@ class SP_Config{ } if ( ! is_writable($bakDstDir) ){ - $arrOut['error'] = ''._('Compruebe los permisos del directorio de backups').''; + $arrOut['error'] = _('Compruebe los permisos del directorio de backups'); $error = 1; } diff --git a/inc/locales/en_US/LC_MESSAGES/messages.mo b/inc/locales/en_US/LC_MESSAGES/messages.mo index fbab3ce1..a96f804b 100644 Binary files a/inc/locales/en_US/LC_MESSAGES/messages.mo and b/inc/locales/en_US/LC_MESSAGES/messages.mo differ diff --git a/inc/tpl/accounts.php b/inc/tpl/accounts.php index e25e019c..dd975d3c 100644 --- a/inc/tpl/accounts.php +++ b/inc/tpl/accounts.php @@ -428,5 +428,6 @@ $skey = SP_Common::getSessionKey(TRUE); $("#selGroups").chosen({ placeholder_text_multiple: "", }); + $('input:text:visible:first').focus(); \ No newline at end of file diff --git a/inc/tpl/editpass.php b/inc/tpl/editpass.php index 444e319a..e2a7e209 100644 --- a/inc/tpl/editpass.php +++ b/inc/tpl/editpass.php @@ -83,4 +83,5 @@ if (!$account->checkAccountAccess("acceditpass") || !SP_Users::checkUserAccess(" - \ No newline at end of file + + \ No newline at end of file diff --git a/inc/tpl/profiles.php b/inc/tpl/profiles.php index 29116cb1..ae2626c3 100644 --- a/inc/tpl/profiles.php +++ b/inc/tpl/profiles.php @@ -117,10 +117,10 @@ $activeTab = $data['active']; diff --git a/inc/tpl/search.php b/inc/tpl/search.php index 02f258d7..e222c54a 100644 --- a/inc/tpl/search.php +++ b/inc/tpl/search.php @@ -83,6 +83,7 @@ $categoriesSelProp = array("name" => "category", $("#rpp").spinner({step: 5, max: 50, min: 5, numberFormat: "n", stop: function(event, ui) { accSearch(0); }}); + $('input:text:visible:first').focus();
    \ No newline at end of file diff --git a/inc/users.class.php b/inc/users.class.php index 2ab02ad1..8c99c924 100644 --- a/inc/users.class.php +++ b/inc/users.class.php @@ -512,8 +512,9 @@ class SP_Users { // Número de usuarios con el grupo $query = "SELECT user_id FROM usrData WHERE user_groupId = " . (int) $this->groupId; - if (DB::doQuery($query, __FUNCTION__) === FALSE) + if (DB::doQuery($query, __FUNCTION__) === FALSE){ return FALSE; + } $numRows = count(DB::$last_result); $txt = _('Usuarios') . " (" . $numRows . ")"; @@ -985,6 +986,57 @@ class SP_Users { return (int) $queryRes[0]->user_id; } + + /** + * @brief Obtener el login de usuario a partir del Id + * @return string con el login del usuario + */ + public static function getUserLoginById($id) { + $query = "SELECT user_login FROM usrData + WHERE user_id = " . (int)$id . " LIMIT 1"; + + $queryRes = DB::getResults($query, __FUNCTION__); + + if ($queryRes === FALSE || !is_array($queryRes)) { + return FALSE; + } + + return $queryRes[0]->user_login; + } + + /** + * @brief Obtener el nombre de un grupo por a partir del Id + * @return string con el nombre del grupo + */ + public static function getGroupNameById($id) { + $query = "SELECT usergroup_name FROM usrGroups + WHERE usergroup_id = " . (int)$id . " LIMIT 1"; + + $queryRes = DB::getResults($query, __FUNCTION__); + + if ($queryRes === FALSE || !is_array($queryRes)) { + return FALSE; + } + + return $queryRes[0]->usergroup_name; + } + + /** + * @brief Obtener el nombre de un perfil por a partir del Id + * @return string con el nombre del perfil + */ + public static function getProfileNameById($id) { + $query = "SELECT userprofile_name FROM usrProfiles + WHERE userprofile_id = " . (int)$id . " LIMIT 1"; + + $queryRes = DB::getResults($query, __FUNCTION__); + + if ($queryRes === FALSE || !is_array($queryRes)) { + return FALSE; + } + + return $queryRes[0]->userprofile_name; + } /** * @brief Autentifica al usuario con LDAP @@ -1252,6 +1304,12 @@ class SP_Users { * @return object con los permisos del perfil del usuario */ public static function getUserProfile() { + $userId = SP_Common::parseParams('s', 'uid', 0); + + if ( ! $userId ){ + return FALSE; + } + $query = "SELECT user_profileId, userProfile_pView, userProfile_pViewPass, @@ -1273,7 +1331,7 @@ class SP_Users { userProfile_pEventlog FROM usrData JOIN usrProfiles ON userProfile_Id = user_profileId - WHERE user_id = " . $_SESSION['uid'] . " LIMIT 1"; + WHERE user_id = " . $userId . " LIMIT 1"; $queryRes = DB::getResults($query, __FUNCTION__); diff --git a/inc/util.class.php b/inc/util.class.php index 56a3ff23..83947053 100644 --- a/inc/util.class.php +++ b/inc/util.class.php @@ -169,7 +169,8 @@ class SP_Util { * @return array con el número de versión */ public static function getVersion() { - return array(1, 00, 01); + //return array(1, 00, 01); + return array(1, 00, 'rc3'); } /** diff --git a/js/functions.js b/js/functions.js index 6e1af90c..ee7105f0 100644 --- a/js/functions.js +++ b/js/functions.js @@ -33,7 +33,8 @@ jQuery.extend(jQuery.fancybox.defaults, { autoHeight: 'true', minHeight: 50, padding: 0, - helpers: {overlay : { css : { 'background' : 'rgba(0, 0, 0, 0.1)'}}} + helpers: {overlay : { css : { 'background' : 'rgba(0, 0, 0, 0.1)'}}}, + afterShow: function(){$('#fancyContainer input:visible:first').focus();} }); $(document).ready(function(){ @@ -577,7 +578,7 @@ function usersMgmt(frmId, isDel, id, type, sk){ var active = frmId; alertify.confirm(atext, function (e) { - if ( e) { + if (e) { usersAjax(data, url); doAction('usersmenu','',active) }