fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9348] property: dimb acl


From: Sigurd Nes
Subject: [Fmsystem-commits] [9348] property: dimb acl
Date: Wed, 09 May 2012 20:53:51 +0000

Revision: 9348
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9348
Author:   sigurdne
Date:     2012-05-09 20:53:51 +0000 (Wed, 09 May 2012)
Log Message:
-----------
property: dimb acl

Modified Paths:
--------------
    trunk/property/inc/class.soinvoice.inc.php

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2012-05-09 20:29:22 UTC (rev 
9347)
+++ trunk/property/inc/class.soinvoice.inc.php  2012-05-09 20:53:51 UTC (rev 
9348)
@@ -1045,15 +1045,15 @@
                        {
                                $dimb = (int) $dimb;
                                $filter_dimb = $dimb ? "AND ecodimb = {$dimb}" 
: '';
-                               $this->db->query("SELECT user_id FROM 
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id = 1 
{$filter_dimb} AND expired_on IS NULL AND active_from < " . time(). ' AND 
(active_to > ' . time() . ' OR active_to = 0)');
+                               $this->db->query("SELECT user_id FROM 
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id IN (1, 2, 
3) {$filter_dimb} AND expired_on IS NULL AND active_from < " . time(). ' AND 
(active_to > ' . time() . ' OR active_to = 0)');
                                $this->db->next_record();
                                $this->role['is_janitor'] = 
!!$this->db->f('user_id');
 
-                               $this->db->query("SELECT user_id FROM 
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id = 2 
{$filter_dimb} AND expired_on IS NULL AND active_from < " . time(). ' AND 
(active_to > ' . time() . ' OR active_to = 0)');
+                               $this->db->query("SELECT user_id FROM 
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id IN (2, 3) 
{$filter_dimb} AND expired_on IS NULL AND active_from < " . time(). ' AND 
(active_to > ' . time() . ' OR active_to = 0)');
                                $this->db->next_record();
                                $this->role['is_supervisor'] = 
!!$this->db->f('user_id');
 
-                               $this->db->query("SELECT user_id FROM 
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id = 3 
{$filter_dimb} AND expired_on IS NULL AND active_from < " . time(). ' AND 
(active_to > ' . time() . ' OR active_to = 0)');
+                               $this->db->query("SELECT user_id FROM 
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id IN (3) 
{$filter_dimb} AND expired_on IS NULL AND active_from < " . time(). ' AND 
(active_to > ' . time() . ' OR active_to = 0)');
                                $this->db->next_record();
                                $this->role['is_budget_responsible'] = 
!!$this->db->f('user_id');
                                
@@ -1074,9 +1074,25 @@
                {
                        $filter_dimb = $dimb ? "AND ecodimb = {$dimb}" : '';
                        $role_id = (int) $role_id;
+                       switch ($role_id)
+                       {
+                               case 1:
+                                       $role_filter = "role_id IN (1, 2, 3)";
+                                       break;
+                               case 2:
+                                       $role_filter = "role_id IN (2, 3)";
+                                       break;
+                               case 3:
+                                       $role_filter = "role_id IN (3)";
+                                       break;
+                               default:
+                                       $role_filter = "role_id = {$role_id}";
+                       }
+                       
+
                        $sql = "SELECT DISTINCT account_lid,account_lastname, 
account_firstname FROM fm_ecodimb_role_user"
                        . " {$this->db->join} phpgw_accounts ON 
fm_ecodimb_role_user.user_id = phpgw_accounts.account_id"
-                       . " WHERE role_id = {$role_id} {$filter_dimb} AND 
expired_on IS NULL"
+                       . " WHERE {$role_filter} {$filter_dimb} AND expired_on 
IS NULL"
                        . ' AND active_from < ' . time()
                        . ' AND (active_to > ' . time() . ' OR active_to = 0)'
                        . " ORDER BY account_lastname ASC, account_firstname 
ASC";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]