[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7497] property: more on download and filter on statu
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7497] property: more on download and filter on status for service agreements |
Date: |
Fri, 12 Aug 2011 08:48:53 +0000 |
Revision: 7497
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7497
Author: sigurdne
Date: 2011-08-12 08:48:52 +0000 (Fri, 12 Aug 2011)
Log Message:
-----------
property: more on download and filter on status for service agreements
Modified Paths:
--------------
trunk/property/inc/class.bos_agreement.inc.php
trunk/property/inc/class.sos_agreement.inc.php
trunk/property/inc/class.uis_agreement.inc.php
Modified: trunk/property/inc/class.bos_agreement.inc.php
===================================================================
--- trunk/property/inc/class.bos_agreement.inc.php 2011-08-11 13:14:30 UTC
(rev 7496)
+++ trunk/property/inc/class.bos_agreement.inc.php 2011-08-12 08:48:52 UTC
(rev 7497)
@@ -82,21 +82,24 @@
$allrows =
phpgw::get_var('allrows', 'bool');
$role =
phpgw::get_var('role');
$member_id =
phpgw::get_var('member_id', 'int');
+ $status_id = phpgw::get_var('status_id', 'int');
$this->p_num = phpgw::get_var('p_num');
$this->role = $role;
$this->so->role = $role;
- $this->start = $start ? $start : 0;
- $this->query = isset($query) ? $query :
$this->query;
- $this->sort = isset($sort) && $sort
? $sort : '';
- $this->order = isset($order) && $order ?
$order : '';
- $this->filter = isset($filter) && $filter ?
$filter : '';
- $this->cat_id = isset($cat_id) && $cat_id ?
$cat_id : '';
- $this->member_id = isset($member_id) &&
$member_id ? $member_id : '';
- $this->vendor_id = isset($vendor_id) &&
$vendor_id ? $vendor_id : '';
- $this->allrows = isset($allrows) && $allrows ?
$allrows : '';
+ $this->status_id =
isset($_REQUEST['status_id']) ? $status_id : $this->status_id;
+ $this->start =
isset($_REQUEST['start']) ? $start : $this->start;
+ $this->order =
isset($_REQUEST['order']) ? $order : $this->order;
+ $this->sort =
isset($_REQUEST['sort']) ? $sort : $this->sort;
+ $this->query =
isset($_REQUEST['query']) ? $query : $this->query;
+ $this->vendor_id =
isset($_REQUEST['vendor_id']) ? $vendor_id : $this->vendor_id;
+ $this->member_id =
isset($_REQUEST['member_id']) ? $member_id : $this->member_id;
+ $this->cat_id =
isset($_REQUEST['cat_id']) ? $cat_id : $this->cat_id;
+
+ $this->filter = $filter ? $filter :
'';
+ $this->allrows = $allrows ? $allrows :
'';
}
function save_sessiondata($data)
@@ -121,7 +124,7 @@
$this->cat_id = isset($data['cat_id']) ?
$data['cat_id'] : '';
$this->vendor_id= isset($data['vendor_id']) ?
$data['vendor_id'] : '';
$this->member_id= isset($data['member_id']) ?
$data['member_id'] : '';
- $this->allrows = isset($data['allrows']) ?
$data['allrows'] : '';
+ $this->status_id= $data['status_id'];
}
function check_perms($has, $needed)
@@ -150,30 +153,51 @@
//FIXME
function select_status_list($format='',$selected='')
{
- return array();
+ $status_list = array();
+ $attrib_data = $this->custom->find('property',
'.s_agreement', 0, '', 'ASC', 'attrib_sort', true, true);
+ foreach ( $attrib_data as $attrib )
+ {
+ if($attrib['datatype'] == 'LB' &&
$attrib['column_name'] == 'status')
+ {
+ foreach($attrib['choice'] as $choice)
+ {
+ $status_list[] = array
+ (
+ 'id' =>
$choice['id'],
+ 'name' =>
htmlspecialchars($choice['value'], ENT_QUOTES, 'UTF-8'),
+ );
+ }
+ }
+ }
+ return $status_list;
}
function read()
{
- $s_agreement = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+ $s_agreements = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'member_id'=>$this->member_id,
- 'vendor_id'=>$this->vendor_id, 'p_num' =>
$this->p_num));
+ 'vendor_id'=>$this->vendor_id, 'p_num' =>
$this->p_num, 'status_id'=>$this->status_id));
$this->total_records = $this->so->total_records;
$this->uicols = $this->so->uicols;
- for ($i=0; $i<count($s_agreement); $i++)
+ foreach ($s_agreements as &$s_agreement)
{
- if($s_agreement[$i]['start_date'])
+ if($s_agreement['start_date'])
{
- $s_agreement[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement[$i]['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $s_agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
}
- if($s_agreement[$i]['end_date'])
+ if($s_agreement['termination_date'])
{
- $s_agreement[$i]['end_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement[$i]['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $s_agreement['termination_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['termination_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
}
+
+ if($s_agreement['end_date'])
+ {
+ $s_agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
}
- return $s_agreement;
+ return $s_agreements;
}
function read_details($id)
Modified: trunk/property/inc/class.sos_agreement.inc.php
===================================================================
--- trunk/property/inc/class.sos_agreement.inc.php 2011-08-11 13:14:30 UTC
(rev 7496)
+++ trunk/property/inc/class.sos_agreement.inc.php 2011-08-12 08:48:52 UTC
(rev 7497)
@@ -82,6 +82,7 @@
$s_agreement_id =
isset($data['s_agreement_id'])?$data['s_agreement_id']:'';
$detail =
isset($data['detail'])?$data['detail']:'';
$p_num = isset($data['p_num'])
? $data['p_num'] : '';
+ $status_id =
isset($data['status_id']) && $data['status_id'] ? (int)$data['status_id']:0;
}
$choice_table = 'phpgw_cust_choice';
@@ -133,6 +134,13 @@
$uicols['descr'][] =
lang('start');
$uicols['statustext'][] = lang('start
date');
+ $cols_return[] =
'termination_date';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] =
'termination_date';
+ $uicols['descr'][] =
lang('termination date');
+ $uicols['statustext'][] =
lang('termination date');
+ // $uicols['datatype'][] = 'D';
+
$cols_return[] =
'end_date';
$uicols['input_type'][] = 'text';
$uicols['name'][] =
'end_date';
@@ -274,23 +282,27 @@
return;
}
- //_debug_array($cols_return_extra);
if ($order)
{
- if ($order=='id')
+ switch ($order)
{
- $ordermethod = " order by
$entity_table.$order $sort";
+ case 'id':
+ case 'status':
+ $ordermethod = " ORDER BY
{$entity_table}.{$order} {$sort}";
+ break;
+ case 'category':
+ $ordermethod = " ORDER BY
{$category_table}.descr {$sort}";
+ break;
+ default:
+ $ordermethod = " ORDER BY
{$order} {$sort}";
}
- else
- {
- $ordermethod = " order by $order $sort";
- }
}
else
{
- $ordermethod = " order by $entity_table.id
DESC";
+ $ordermethod = " ORDER BY {$entity_table}.id
DESC";
}
+
$filtermethod = '';
$where= 'WHERE';
@@ -340,13 +352,13 @@
$where= 'AND';
}
-/* if ($status)
+ if (!$detail && $status_id)
{
- $filtermethod .= " $where
$entity_table.status='$status' ";
+ $filtermethod .= " $where
$entity_table.status='$status_id' ";
$where= 'AND';
}
- */
+
$querymethod = '';
if($query)
{
@@ -405,6 +417,7 @@
$contacts =
CreateObject('phpgwapi.contacts');
+ $s_agreement_list = array();
while ($this->db->next_record())
{
for ($i=0;$i<$n;$i++)
Modified: trunk/property/inc/class.uis_agreement.inc.php
===================================================================
--- trunk/property/inc/class.uis_agreement.inc.php 2011-08-11 13:14:30 UTC
(rev 7496)
+++ trunk/property/inc/class.uis_agreement.inc.php 2011-08-12 08:48:52 UTC
(rev 7497)
@@ -179,6 +179,7 @@
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt','');
$datatable = array();
+ $this->save_sessiondata();
if( phpgw::get_var('phpgw_return_as') != 'json' )
{
@@ -516,17 +517,18 @@
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
$datatable['headers']['header'][$i]['visible'] = true;
$datatable['headers']['header'][$i]['sortable'] = false;
- if($uicols['name'][$i]=='id' ||
$uicols['name'][$i]=='name' || $uicols['name'][$i]=='org_name' ||
$uicols['name'][$i]=='category' || $uicols['name'][$i]=='start_date' ||
$uicols['name'][$i]=='end_date' || $uicols['name'][$i]=='status')
+ if($uicols['name'][$i]=='id' ||
$uicols['name'][$i]=='name' || $uicols['name'][$i]=='org_name' ||
$uicols['name'][$i]=='category' || $uicols['name'][$i]=='start_date' ||
$uicols['name'][$i]=='end_date' || $uicols['name'][$i]=='status' ||
$uicols['name'][$i]=='termination_date')
{
$datatable['headers']['header'][$i]['sortable'] = true;
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
}
-
+/*
if($uicols['name'][$i]=='category')
{
$datatable['headers']['header'][$i]['sortable'] = true;
$datatable['headers']['header'][$i]['sort_field'] = 'org_name';
}
+*/
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7497] property: more on download and filter on status for service agreements,
Sigurd Nes <=