[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r5113 - phpcompta/tags/rel650/include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r5113 - phpcompta/tags/rel650/include |
Date: |
Mon, 17 Sep 2012 21:07:26 +0200 (CEST) |
Author: danydb
Date: 2012-09-17 21:07:25 +0200 (Mon, 17 Sep 2012)
New Revision: 5113
Modified:
phpcompta/tags/rel650/include/ac_common.php
Log:
Default module otherwise try to find default menu if several results then
returns the first one
Modified: phpcompta/tags/rel650/include/ac_common.php
===================================================================
--- phpcompta/tags/rel650/include/ac_common.php 2012-09-17 18:57:00 UTC (rev
5112)
+++ phpcompta/tags/rel650/include/ac_common.php 2012-09-17 19:07:25 UTC (rev
5113)
@@ -853,25 +853,42 @@
p_type_display='M' and
user_name=$1 and pm_default=1", array($g_user->login));
+ /*
+ * Try to find the smallest order for module
+ */
if (empty($default_module))
{
$default_module = $cn->get_array("select me_code
- from profile_menu join profile_user using (p_id)
- where
- p_type_display='M' and user_name=$1 and
p_order=(select min(p_order) from profile_menu join profile_user using (p_id)
- where p_type_display='M' and user_name=$2) limit 1",
array($g_user->login, $g_user->login));
- /*
- * if nothing found, there is no profile for this user => exit
- */
+ from profile_menu join profile_user using (p_id)
+ where
+ p_type_display='M' and
+ user_name=$1 order by p_order limit 1", array($g_user->login));
+
+ // if no default try to find the default menu
if ( empty ($default_module))
{
$default_module = $cn->get_array("select me_code
- from profile_menu join profile_user using (p_id)
- where
- user_name=$1 and p_order=(select min(p_order) from
profile_menu join profile_user using (p_id)
- where user_name=$2) limit 1", array($g_user->login,
$g_user->login));
+ from profile_menu join profile_user using (p_id)
+ where
+ p_type_display='E' and
+ user_name=$1 and pm_default=1 ",
array($g_user->login));
+ /*
+ * Try to find a default menu by order
+ */
if (empty ($default_module))
{
+ $default_module = $cn->get_array("select me_code
+ from profile_menu join profile_user using (p_id)
+ where
+ user_name=$1 and p_order=(select min(p_order)
from profile_menu join profile_user using (p_id)
+ where user_name=$2) limit 1",
array($g_user->login, $g_user->login));
+ }
+
+ /*
+ * if nothing found, there is no profile for this user
=> exit
+ */
+ if (empty ($default_module))
+ {
echo_warning(_("Utilisateur n'a pas de
profile"));
exit();
}
@@ -881,7 +898,8 @@
if (count($default_module) > 1)
{
- echo_error(_("Plusieurs modules sont le module par défaut"),
__LINE__, __FILE__);
+ // return the first module found
+ return $default_module[0]['me_code'];
}
elseif (count($default_module) == 1)
{
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r5113 - phpcompta/tags/rel650/include,
phpcompta-dev <=