[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6553] Property: Responsibility roles
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6553] Property: Responsibility roles |
Date: |
Tue, 09 Nov 2010 07:41:49 +0000 |
Revision: 6553
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6553
Author: sigurdne
Date: 2010-11-09 07:41:48 +0000 (Tue, 09 Nov 2010)
Log Message:
-----------
Property: Responsibility roles
Modified Paths:
--------------
trunk/property/inc/class.bolocation.inc.php
trunk/property/inc/class.boresponsible.inc.php
trunk/property/inc/class.solocation.inc.php
trunk/property/inc/class.uilocation.inc.php
trunk/property/js/yahoo/location.responsiblility_role.js
Modified: trunk/property/inc/class.bolocation.inc.php
===================================================================
--- trunk/property/inc/class.bolocation.inc.php 2010-11-08 14:21:48 UTC (rev
6552)
+++ trunk/property/inc/class.bolocation.inc.php 2010-11-09 07:41:48 UTC (rev
6553)
@@ -645,9 +645,9 @@
}
}
- function read($data='')
+ function read($data = array())
{
- $location = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+ $locations = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' => $this->cat_id,'type_id' =>
$data['type_id'],
'lookup_tenant'=>$data['lookup_tenant'],'lookup'=>$data['lookup'],
'district_id'=>$this->district_id,'allrows'=>$data['allrows'],
@@ -657,9 +657,19 @@
$this->total_records = $this->so->total_records;
$this->uicols = $this->so->uicols;
- return $location;
+ return $locations;
}
+ function get_responsible($data = array())
+ {
+ $locations = $this->read($data);
+ foreach ($locations as & $location)
+ {
+
+ }
+ return $locations;
+ }
+
function read_single($data='',$extra=array())
{
if(is_array($data))
Modified: trunk/property/inc/class.boresponsible.inc.php
===================================================================
--- trunk/property/inc/class.boresponsible.inc.php 2010-11-08 14:21:48 UTC
(rev 6552)
+++ trunk/property/inc/class.boresponsible.inc.php 2010-11-09 07:41:48 UTC
(rev 6553)
@@ -287,6 +287,31 @@
* @return array $receip with result on the
action(failed/success)
*/
+ public function update_role_assignment($values)
+ {
+ foreach ($values['assign'] as $location_code)
+ {
+ $data = array
+ (
+ 'location' =>
explode('-', $location_code),
+ 'active_from' => time(),
+ 'responsibility_id' =>
$values['responsibility_id'],
+ 'contact_id' =>
$values['contact_id'],
+ 'ecodimb' => '',
+ 'remark' =>
'from role assignment'
+ );
+
+ $this->so->add_contact($data);
+ }
+ }
+ /**
+ * Save responsibility contact
+ *
+ * @param array $values values to be stored/edited and
referencing ID if editing
+ *
+ * @return array $receip with result on the
action(failed/success)
+ */
+
public function save_contact($values)
{
phpgw::import_class('phpgwapi.datetime');
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2010-11-08 14:21:48 UTC (rev
6552)
+++ trunk/property/inc/class.solocation.inc.php 2010-11-09 07:41:48 UTC (rev
6553)
@@ -265,6 +265,10 @@
$location_code =
isset($data['location_code']) ? $data['location_code'] : '';
}
+ if($order == 'undefined')
+ {
+ $order = '';
+ }
if (!$type_id)
{
return;
Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2010-11-08 14:21:48 UTC (rev
6552)
+++ trunk/property/inc/class.uilocation.inc.php 2010-11-09 07:41:48 UTC (rev
6553)
@@ -864,6 +864,7 @@
{
$datatable['pagination']['records_returned']=
count($location_list);
+
}
$datatable['pagination']['records_total'] =
$this->bo->total_records;
@@ -1038,13 +1039,39 @@
$values = phpgw::get_var('values');
$receipt = array();
+ $_role = CreateObject('property.socategory');
+ $_role->get_location_info('responsibility_role','');
+
if($values && $this->acl_edit)
{
-_debug_array($values);
- $receipt = $this->bo->update_roles($values);
+ $user_id = phpgw::get_var('user_id', 'int');
+ $role_id = phpgw::get_var('role_id', 'int');
+ $account =
$GLOBALS['phpgw']->accounts->get($user_id);
+ $contact_id = $account->person_id;
+
+ if(!$contact_id)
+ {
+ $receipt['message'][] = array('msg'=>
lang('missing contact'));
+ }
+ else if(!$role_id)
+ {
+ $receipt['message'][] = 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'];
+
+ $boresponsible =
CreateObject('property.boresponsible');
+ $receipt =
$boresponsible->update_role_assignment($values);
+ foreach($values['assign'] as $_assign
=> $_location_code)
+ {
+ $receipt['message'][] =
array('msg'=>"{$_assign} => {$_location_code}");
+ }
+ }
}
-
$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']:'');
@@ -1072,7 +1099,10 @@
'lookup_name' => $lookup_name,
'cat_id' =>
$this->cat_id,
'status' =>
$this->status,
- 'location_code' =>
$this->location_code
+ 'location_code' =>
$this->location_code,
+ // 'sort'
=> $this->sort,
+ // 'order'
=> $this->order
+
));
$datatable['config']['allow_allrows'] = true;
@@ -1088,6 +1118,8 @@
."cat_id:'{$this->cat_id}',"
."status:'{$this->status}',"
."location_code:'{$this->location_code}',"
+ //
."sort:'{$this->sort}',"
+ //
."order:'{$this->order}',"
."block_query:'{$block_query}'";
@@ -1124,10 +1156,7 @@
'order' => 'name'
);
- $_role = CreateObject('property.socategory');
-
-
$_role->get_location_info('responsibility_role','');
-
+
$roles = $_role->read($_role_criteria);
foreach ($roles as $role)
{
@@ -1154,7 +1183,9 @@
'cat_id' => $this->cat_id,
'district_id' => $this->district_id,
'query'
=> $this->query,
-
'filter' => $this->filter
+
'filter' => $this->filter,
+ 'sort'
=> $this->sort,
+ 'order'
=> $this->order
)
),
'fields' => array(
@@ -1192,8 +1223,8 @@
'tab_index' => 4
),
array( //boton
contact
-
'id' => 'btn_contact_id',
-
'name' => 'contact_id',
+
'id' => 'btn_user_id',
+
'name' => 'user_id',
'value' => lang('user'),
'type' => 'button',
'style' => 'filter',
@@ -1267,7 +1298,7 @@
$location_list = array();
- $location_list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
+ $location_list =
$this->bo->get_responsible(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
$uicols = $this->bo->uicols;
Modified: trunk/property/js/yahoo/location.responsiblility_role.js
===================================================================
--- trunk/property/js/yahoo/location.responsiblility_role.js 2010-11-08
14:21:48 UTC (rev 6552)
+++ trunk/property/js/yahoo/location.responsiblility_role.js 2010-11-09
07:41:48 UTC (rev 6553)
@@ -8,7 +8,7 @@
{order:1, var_URL:'cat_id', name:'btn_cat_id',
style:'categorybutton', dependiente:[]},
{order:2, var_URL:'district_id', name:'btn_district_id',
style:'districtbutton', dependiente:[3,5]},
{order:3,
var_URL:'part_of_town_id',name:'btn_part_of_town_id',style:'partOFTownbutton',dependiente:[]},
- {order:4, var_URL:'contact_id', name:'btn_contact_id',
style:'userIdbutton', dependiente:[]},
+ {order:4, var_URL:'user_id', name:'btn_user_id',
style:'userIdbutton', dependiente:[]},
{order:5, var_URL:'role_id', name:'btn_role_id',
style:'roleIdbutton', dependiente:[]}
];
@@ -141,6 +141,7 @@
}
else if(flag_particular_setting=='update')
{
+/*
myColumnDefs = [];
for(var k=0 ; k<values_ds.headers.name.length; k++)
{
@@ -162,6 +163,7 @@
myColumnDefs.push(obj_temp);
}
init_datatable();
+*/
}
}
@@ -180,13 +182,13 @@
var hidden = '';
if(!oRecord.getData('exception'))
{
- if(oRecord.getData('receipt_date'))
+ if(oRecord.getData('responsibility_id'))
{
checked = "checked = 'checked'";
- hidden = "<input type=\"hidden\"
class=\"orig_check\"
name=\"values[events_orig]["+oRecord.getData('id')+"_"+oRecord.getData('schedule_time')+"]\"
value=\""+oRecord.getData('id')+"\"/>";
+ hidden = "<input type=\"hidden\"
class=\"orig_check\"
name=\"values[assign_orig]["+oRecord.getData('responsibility_id')+"_"+oRecord.getData('location_code')+"]\"
value=\""+oRecord.getData('location_code')+"\"/>";
}
- elCell.innerHTML = hidden + "<center><input
type=\"checkbox\" "+checked+" class=\"mychecks\"
name=\"values[events]["+oRecord.getData('id')+"_"+oRecord.getData('schedule_time')+"]\"
value=\""+oRecord.getData('id')+"\"/></center>";
+ elCell.innerHTML = hidden + "<center><input
type=\"checkbox\" "+checked+" class=\"mychecks\" name=\"values[assign][]\"
value=\""+oRecord.getData('location_code')+"\"/></center>";
}
}
@@ -246,7 +248,7 @@
{
//Create ROW
newTR = document.createElement('tr');
- td_empty(11);
+ td_empty(myColumnDefs.length -1);
//RowChecked
CreateRowChecked("mychecks");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6553] Property: Responsibility roles,
Sigurd Nes <=