fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9249] property: invoice: more on ACL based on dime


From: Sigurd Nes
Subject: [Fmsystem-commits] [9249] property: invoice: more on ACL based on dime
Date: Tue, 01 May 2012 09:54:47 +0000

Revision: 9249
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9249
Author:   sigurdne
Date:     2012-05-01 09:54:46 +0000 (Tue, 01 May 2012)
Log Message:
-----------
property: invoice: more on ACL based on dime

Modified Paths:
--------------
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.uiinvoice.inc.php
    trunk/property/inc/class.uiinvoice2.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/setup/phpgw_no.lang

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2012-04-30 09:41:41 UTC (rev 
9248)
+++ trunk/property/inc/class.boinvoice.inc.php  2012-05-01 09:54:46 UTC (rev 
9249)
@@ -820,4 +820,33 @@
                {
                        return $this->so->update_voucher2($data);
                }
+
+               function get_approve_role($dimb = 0)
+               {
+                       $role_check = array
+                       (
+                               'is_janitor'                            => 
lang('janitor'),
+                               'is_supervisor'                         => 
lang('supervisor'),
+                               'is_budget_responsible'         => lang('b - 
responsible')
+                       );
+
+                       $roles  = $this->check_role($dimb);
+
+                       $approve = array();
+                       foreach ($roles as $role => $role_value)
+                       {
+                               if ($role_value && isset($role_check[$role]))
+                               {
+                                       $approve[] = array
+                                       (
+                                               'id'            => $role,
+                                               'name'          => 
$role_check[$role],
+                                               'selected'      => 0
+                                       );
+                               }
+                       }
+                       return $approve;
+               }
+
+
        }

Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php  2012-04-30 09:41:41 UTC (rev 
9248)
+++ trunk/property/inc/class.uiinvoice.inc.php  2012-05-01 09:54:46 UTC (rev 
9249)
@@ -1760,7 +1760,7 @@
 
                        if( phpgw::get_var('phpgw_return_as') == 'json' && 
is_array($values) && isset($values))
                        {
-                               if($this->get_approve_role())
+                               if($this->bo->get_approve_role())
                                {
                                        $receipt = 
$this->bo->update_invoice_sub($values);
                                }
@@ -2299,7 +2299,7 @@
                                'is_budget_responsible'         => lang('b - 
responsible')
                        );
 
-                       $approve = $this->get_approve_role();
+                       $approve = $this->bo->get_approve_role();
 
                        $values = phpgw::get_var('values');
 
@@ -3897,7 +3897,7 @@
                                'is_budget_responsible'         => lang('b - 
responsible')
                        );
 
-                       $approve = $this->get_approve_role();
+                       $approve = $this->bo->get_approve_role();
 
                        $values = phpgw::get_var('values');
 
@@ -4041,30 +4041,4 @@
                        $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('forward' => $data));
                }
 
-               function get_approve_role($dimb = 0)
-               {
-                       $role_check = array
-                       (
-                               'is_janitor'                            => 
lang('janitor'),
-                               'is_supervisor'                         => 
lang('supervisor'),
-                               'is_budget_responsible'         => lang('b - 
responsible')
-                       );
-
-                       $roles  = $this->bo->check_role($dimb);
-
-                       $approve = array();
-                       foreach ($roles as $role => $role_value)
-                       {
-                               if ($role_value && isset($role_check[$role]))
-                               {
-                                       $approve[] = array
-                                       (
-                                               'id'            => $role,
-                                               'name'          => 
$role_check[$role],
-                                               'selected'      => 0
-                                       );
-                               }
-                       }
-                       return $approve;
-               }
        }

Modified: trunk/property/inc/class.uiinvoice2.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice2.inc.php 2012-04-30 09:41:41 UTC (rev 
9248)
+++ trunk/property/inc/class.uiinvoice2.inc.php 2012-05-01 09:54:46 UTC (rev 
9249)
@@ -132,7 +132,7 @@
 
                        if($values = phpgw::get_var('values'))
                        {
-                               $approve = 
execMethod('property.uiinvoice.get_approve_role',  $values['dim_b']);
+                               $approve = 
execMethod('property.boinvoice.get_approve_role',  $values['dim_b']);
 
                                if(!$approve)
                                {
@@ -539,7 +539,7 @@
                                        $budget_responsible_list        = 
$this->bocommon->get_user_list_right(128,isset($voucher[0]['budget_responsible'])?$voucher[0]['budget_responsible']:'','.invoice');
                                }
 
-                               $approve = 
execMethod('property.uiinvoice.get_approve_role', $voucher[0]['dim_b']);
+                               $approve = 
execMethod('property.boinvoice.get_approve_role', $voucher[0]['dim_b']);
  
                                $approved_list[] = array
                                (

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2012-04-30 09:41:41 UTC (rev 
9248)
+++ trunk/property/inc/class.uiproject.inc.php  2012-05-01 09:54:46 UTC (rev 
9249)
@@ -1108,6 +1108,21 @@
 
                                        $save=true;
 
+                                       
if(isset($config->config_data['invoice_acl']) && 
$config->config_data['invoice_acl'] == 'dimb')
+                                       {
+                                               if(!isset($values['ecodimb']) 
|| !$values['ecodimb'])
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please select dimb!'));
+                                                       $error_id=true;
+                                               }
+
+                                               
if(!execMethod('property.boinvoice.get_approve_role', $values['ecodimb']))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('you are not approved for this dimb: %1', 
$values['ecodimb'] ));
+                                                       $error_id=true;
+                                               }
+                                       }
+       
                                        if(!isset($values['location']))
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('Please select a location !'));

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2012-04-30 09:41:41 UTC (rev 
9248)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2012-05-01 09:54:46 UTC (rev 
9249)
@@ -1223,6 +1223,7 @@
                        {
                                $values_hour = $common_data['content'];
                        }
+
                        $project        = 
$this->boproject->read_single($common_data['workorder']['project_id'],array(),true);
 
                        $bolocation     = CreateObject('property.bolocation');
@@ -1442,6 +1443,15 @@
 
                        if($to_email || $print || 
($workorder['mail_recipients'][0] && $_POST['send_order']))
                        {
+                               
if(isset($this->config->config_data['invoice_acl']) && 
$this->config->config_data['invoice_acl'] == 'dimb')
+                               {
+                                       
if(!execMethod('property.boinvoice.get_approve_role', $project['ecodimb'] ? 
$project['ecodimb'] : $workorder['ecodimb']))
+                                       {
+                                               phpgwapi_cache::message_set( 
lang('you are not approved for this dimb: %1', $project['ecodimb'] ? 
$project['ecodimb'] : $workorder['ecodimb'] ), 'error' );
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiwo_hour.view', 'workorder_id'=> $workorder_id, 'from' => 
phpgw::get_var('from')));
+                                       }
+                               }
+
                                $_to = isset($workorder['mail_recipients'][0]) 
&& $workorder['mail_recipients'][0] ? implode(';', 
$workorder['mail_recipients']) : $to_email;
                                $email_data['use_yui_table'] = false;
 
@@ -1868,6 +1878,15 @@
                        $common_data            = 
$this->common_data($workorder_id);
                        $project                        = 
$this->boproject->read_single($common_data['workorder']['project_id'],array(),true);
 
+                       if(isset($this->config->config_data['invoice_acl']) && 
$this->config->config_data['invoice_acl'] == 'dimb')
+                       {
+                               
if(!execMethod('property.boinvoice.get_approve_role', $project['ecodimb'] ? 
$project['ecodimb'] : $common_data['workorder']['ecodimb']))
+                               {
+                                       phpgwapi_cache::message_set( lang('you 
are not approved for this dimb: %1', $project['ecodimb'] ? $project['ecodimb'] 
: $common_data['workorder']['ecodimb'] ), 'error' );
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiwo_hour.view', 'workorder_id'=> $workorder_id, 'from' => 
phpgw::get_var('from')));
+                               }
+                       }
+
                        $content = 
$this->_get_order_details($common_data['content'],   $show_cost);
 
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2012-04-30 09:41:41 UTC 
(rev 9248)
+++ trunk/property/inc/class.uiworkorder.inc.php        2012-05-01 09:54:46 UTC 
(rev 9249)
@@ -954,6 +954,14 @@
                                }
                        }
 
+                       if($project_id && !isset($values['project_id']))
+                       {
+                               $values['project_id']=$project_id;
+                       }
+
+                       $project        = 
(isset($values['project_id'])?$boproject->read_single_mini($values['project_id']):'');
+
+
                        if (isset($values['save']))
                        {
                                if($GLOBALS['phpgw']->session->is_repost())
@@ -961,6 +969,15 @@
                                        
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
                                }
 
+                               if(isset($config->config_data['invoice_acl']) 
&& $config->config_data['invoice_acl'] == 'dimb')
+                               {
+                                       
if(!execMethod('property.boinvoice.get_approve_role', $project['ecodimb'] ? 
$project['ecodimb'] : $values['ecodimb']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('you are not approved for this dimb: %1', 
$project['ecodimb'] ? $project['ecodimb'] : $values['ecodimb'] ));
+                                               $error_id=true;
+                                       }
+                               }
+
                                $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
                                if(isset($insert_record_entity) && 
is_array($insert_record_entity))
                                {
@@ -1235,13 +1252,7 @@
 
                        }
 
-                       if($project_id && !isset($values['project_id']))
-                       {
-                               $values['project_id']=$project_id;
-                       }
 
-                       $project        = 
(isset($values['project_id'])?$boproject->read_single_mini($values['project_id']):'');
-
                        if(!isset($receipt['error']))
                        {
                                if($id)

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2012-04-30 09:41:41 UTC (rev 9248)
+++ trunk/property/setup/phpgw_no.lang  2012-05-01 09:54:46 UTC (rev 9249)
@@ -522,6 +522,7 @@
 dimb role user property        no      Bruker/Rolle/Kostnadssted
 no authorities demands property        no      Ingen myndighetskrav
 no dimb        property        no      K Ikke valgt
+Please select dimb!    property        no      Angi kostnadssted
 dim d  property        no      Dim D
 dime   property        no      Kategori
 directory created      property        no      katalog er opprettet
@@ -1900,6 +1901,7 @@
 year   property        no      År
 yearly property        no      Årlig
 you are not approved for this task     property        no      Du mangler 
rettigheter for denne oppgaven
+you are not approved for this dimb: %1 property        no      Du mangler 
rettigheter for dette kostnadsstedet: %1
 you have entered an invalid end date ! property        no      Du har angitt 
en ugyldig slutt dato
 you have entered an invalid start date !       property        no      Du har 
angitt en ugyldig start dato
 you have no edit right for this project        property        no      Du har 
ikke editeringsrettigheter for dette prosjektet




reply via email to

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