fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12285] change responsiblility_role


From: Nelson Guerra
Subject: [Fmsystem-commits] [12285] change responsiblility_role
Date: Mon, 10 Nov 2014 23:14:57 +0000

Revision: 12285
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12285
Author:   nelson224
Date:     2014-11-10 23:14:56 +0000 (Mon, 10 Nov 2014)
Log Message:
-----------
change responsiblility_role

Modified Paths:
--------------
    branches/dev-syncromind/property/inc/class.uilocation.inc.php

Modified: branches/dev-syncromind/property/inc/class.uilocation.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uilocation.inc.php       
2014-11-10 23:12:45 UTC (rev 12284)
+++ branches/dev-syncromind/property/inc/class.uilocation.inc.php       
2014-11-10 23:14:56 UTC (rev 12285)
@@ -39,6 +39,7 @@
        class property_uilocation extends phpgwapi_uicommon_jquery
        {
                protected $appname = 'property';
+               private $receipt = array();
                var $grants;
                var $cat_id;
                var $start;
@@ -54,6 +55,7 @@
                var $public_functions = array
                        (
                                'query'                             => true,
+                               'responsiblility_role_save' => true,
                                'get_part_of_town'      => true,
                                'download'                      => true,
                                'index'                                 => true,
@@ -194,6 +196,8 @@
                        $type_id        = $this->type_id;
                        $lookup         = $this->lookup;
                        $lookup_tenant  = phpgw::get_var('lookup_tenant', 
'bool');
+                       $user_id = phpgw::get_var('user_id', 'int', 'request', 
$this->account);
+                       $role_id = phpgw::get_var('role_id', 'int');
                        
                        $search = phpgw::get_var('search');
                        $order = phpgw::get_var('order');
@@ -217,7 +221,9 @@
                                'status' => phpgw::get_var('status'),
                                'part_of_town_id' => 
phpgw::get_var('part_of_town_id', 'int'),
                                'location_code' => 
phpgw::get_var('location_code'),
-                               'filter'                => 
phpgw::get_var('filter', 'int')
+                               'filter'                => 
phpgw::get_var('filter', 'int'),
+                               'user_id' => $user_id,
+                               'role_id' => $role_id
                        );
 
                        $values = $this->bo->get_responsible($params);
@@ -230,7 +236,49 @@
                        return $this->jquery_results($result_data);
                }
                
+
+               public function responsiblility_role_save()
+               {
+                       $values = phpgw::get_var('values');
+                       //$values_assign = $_POST['values_assign'];
+                       $assign_orig = phpgw::get_var('assign_orig');
+                       $assign = phpgw::get_var('assign');
+
+                       $role_id = phpgw::get_var('role_id', 'int');
+                       //$receipt = array();
+                       $_role = CreateObject('property.sogeneric');
+                       $_role->get_location_info('responsibility_role','');
+
+                       //$this->save_sessiondata();
+
+                       $user_id = phpgw::get_var('user_id', 'int', 'request', 
$this->account);
+
+                       if($assign && $this->acl_edit)
+                       {
+                               //$values_assign = 
phpgw::clean_value(json_decode(stripslashes($values_assign),true)); 
//json_decode has issues with magic_quotes_gpc
+                               $user_id = abs($user_id);
+                               $account = 
$GLOBALS['phpgw']->accounts->get($user_id);
+                               $contact_id = $account->person_id;
+                               if(!$role_id)
+                               {
+                                       $result = array('msg'=> lang('missing 
role'));
+                               }
+                               else
+                               {
+                                       $role = 
$_role->read_single($data=array('id' => $role_id));
+                                       $values['contact_id']                   
= $contact_id;
+                                       $values['responsibility_id']    = 
$role['responsibility_id'];
+                                       $values['assign']                       
        = $assign;
+                                       $values['assign_orig']                  
= $assign_orig;
+                                       $boresponsible = 
CreateObject('property.boresponsible');
+                                       $result = 
$boresponsible->update_role_assignment($values);
+                               }
+                       }
+                       
+                       return $result;
+               }
                
+               
                function save_sessiondata()
                {
                        $data = array
@@ -966,6 +1014,8 @@
 
                function responsiblility_role()
                {
+                       $user_id = phpgw::get_var('user_id', 'int', 'request', 
$this->account);
+                       $role_id = phpgw::get_var('role_id', 'int');
                        $type_id = phpgw::get_var('type_id', 'int');
 
                        if(!$type_id)
@@ -988,39 +1038,6 @@
                                return;
                        }
 
-                       $values = phpgw::get_var('values');
-                       $values_assign = $_POST['values_assign'];
-                       $role_id = phpgw::get_var('role_id', 'int');
-                       $receipt = array();
-                       $_role = CreateObject('property.sogeneric');
-                       $_role->get_location_info('responsibility_role','');
-
-                       $this->save_sessiondata();
-
-                       $user_id = phpgw::get_var('user_id', 'int', 'request', 
$this->account);
-
-                       if($values_assign && $this->acl_edit)
-                       {
-                               $values_assign = 
phpgw::clean_value(json_decode(stripslashes($values_assign),true)); 
//json_decode has issues with magic_quotes_gpc
-                               $user_id = abs($user_id);
-                               $account = 
$GLOBALS['phpgw']->accounts->get($user_id);
-                               $contact_id = $account->person_id;
-                               if(!$role_id)
-                               {
-                                       $receipt['error'][] = array('msg'=> 
lang('missing role'));
-                               }
-                               else
-                               {
-                                       $role = 
$_role->read_single($data=array('id' => $role_id));
-                                       $values['contact_id']                   
= $contact_id;
-                                       $values['responsibility_id']    = 
$role['responsibility_id'];
-                                       $values['assign']                       
        = $values_assign['assign'];
-                                       $values['assign_orig']                  
= $values_assign['assign_orig'];
-                                       $boresponsible = 
CreateObject('property.boresponsible');
-                                       $receipt = 
$boresponsible->update_role_assignment($values);
-                               }
-                       }
-
                        $second_display = phpgw::get_var('second_display', 
'bool');
                        $default_district       = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
 
@@ -1078,7 +1095,6 @@
                                array_unshift 
($data['form']['toolbar']['item'], $filter);
                        }
        
-                       
                        $uicols['name'][]               = 'responsible_contact';
                        $uicols['descr'][]              = lang('responsible');
                        $uicols['sortable'][]   = false;
@@ -1153,7 +1169,7 @@
                                                'text'                  => 
lang('save'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
-                                                       'menuaction'    => 
'property.uilocation.responsiblility_role',
+                                                       'menuaction'    => 
'property.uilocation.responsiblility_role_save',
                                                        'type_id'               
        => $type_id,
                                                        'cat_id'                
=> $this->cat_id,
                                                        'district_id'       => 
$this->district_id,
@@ -1161,9 +1177,10 @@
                                                        'second_display'    => 
1,
                                                        'status'            => 
$this->status,
                                                        'location_code'     => 
$this->location_code,
-                                                       'entity_id'             
        => $this->entity_id
+                                                       'entity_id'             
        => $this->entity_id,
+                                                       'phpgw_return_as' => 
'json'
                                                )),
-                                               'target'                => 
'ajax'
+                                               'target'                => 
'custom'
                                        );
                        }
                        




reply via email to

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