[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9654] property: add department as entity
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9654] property: add department as entity |
Date: |
Sun, 24 Jun 2012 16:29:58 +0000 |
Revision: 9654
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9654
Author: sigurdne
Date: 2012-06-24 16:29:58 +0000 (Sun, 24 Jun 2012)
Log Message:
-----------
property: add department as entity
Modified Paths:
--------------
trunk/property/inc/class.bobudget.inc.php
trunk/property/inc/class.menu.inc.php
trunk/property/inc/class.sobudget.inc.php
trunk/property/inc/class.sogeneric.inc.php
trunk/property/inc/class.uibudget.inc.php
trunk/property/setup/phpgw_no.lang
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
Modified: trunk/property/inc/class.bobudget.inc.php
===================================================================
--- trunk/property/inc/class.bobudget.inc.php 2012-06-22 13:38:11 UTC (rev
9653)
+++ trunk/property/inc/class.bobudget.inc.php 2012-06-24 16:29:58 UTC (rev
9654)
@@ -80,6 +80,7 @@
$filter =
phpgw::get_var('filter', 'int');
$cat_id =
phpgw::get_var('cat_id', 'int');
$dimb_id =
phpgw::get_var('dimb_id', 'int');
+ $department =
phpgw::get_var('department', 'int');
$allrows =
phpgw::get_var('allrows', 'bool');
$district_id =
phpgw::get_var('district_id', 'int');
$year =
phpgw::get_var('year', 'int');
@@ -95,6 +96,8 @@
$this->order = isset($order) &&
$order ? $order : '';
$this->cat_id = isset($cat_id) &&
$cat_id ? $cat_id : '';
$this->dimb_id = isset($dimb_id) &&
$dimb_id ? $dimb_id :
$GLOBALS['phpgw_info']['user']['preferences']['property']['dimb'];
+ $this->department =
isset($department) && $department ? $department :
$GLOBALS['phpgw_info']['user']['preferences']['property']['department'];
+
$this->part_of_town_id = isset($part_of_town_id) &&
$part_of_town_id ? $part_of_town_id : '';
$this->district_id = isset($district_id)
&& $district_id ? $district_id : '';
$this->grouping = isset($grouping) &&
$grouping ? $grouping : '';
@@ -143,7 +146,7 @@
$budget = $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,
'district_id' => $this->district_id,'year' =>
$this->year,'grouping' => $this->grouping,'revision' => $this->revision,
- 'cat_id' => $this->cat_id, 'dimb_id' =>
$this->dimb_id));
+ 'cat_id' => $this->cat_id, 'dimb_id' =>
$this->dimb_id, 'department' => $this->department));
$this->total_records =
$this->so->total_records;
$this->sum_budget_cost =
$this->so->sum_budget_cost;
@@ -180,7 +183,7 @@
'sort' => strtoupper($this->sort), 'order' =>
$this->order, 'filter' => $this->filter,
'cat_id' => $this->cat_id,
'allrows'=>$this->allrows, 'district_id' => $this->district_id,
'year' => $this->year, 'grouping' =>
$this->grouping, 'revision' => $this->revision,
- 'details' => $this->details,'dimb_id' =>
$this->dimb_id));
+ 'details' => $this->details,'dimb_id' =>
$this->dimb_id, 'department' => $this->department));
$this->total_records =
$this->so->total_records;
$this->sum_budget_cost =
$this->so->sum_budget_cost;
Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php 2012-06-22 13:38:11 UTC (rev
9653)
+++ trunk/property/inc/class.menu.inc.php 2012-06-24 16:29:58 UTC (rev
9654)
@@ -201,6 +201,11 @@
'text' => lang('budget
account'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'budget_account') )
),
+ 'department' => array
+ (
+ 'text' =>
lang('department'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'department') )
+ ),
'accounting_dimb' => array
(
'text' =>
lang('Accounting dim b'),
Modified: trunk/property/inc/class.sobudget.inc.php
===================================================================
--- trunk/property/inc/class.sobudget.inc.php 2012-06-22 13:38:11 UTC (rev
9653)
+++ trunk/property/inc/class.sobudget.inc.php 2012-06-24 16:29:58 UTC (rev
9654)
@@ -532,6 +532,7 @@
$cat_id = isset($data['cat_id']) ?
$data['cat_id'] : '';
$details = isset($data['details']) ?
$data['details'] : '';
$dimb_id = isset($data['dimb_id']) &&
$data['dimb_id'] ? (int)$data['dimb_id'] : 0;
+ $department = isset($data['department'])
&& $data['department'] ? (int)$data['department'] : 0;
if(!$year)
{
@@ -550,9 +551,15 @@
$where = 'WHERE';
+ $cat_ids = array();
if ($cat_id > 0)
{
- $filtermethod .= " $where fm_project.category =
" . (int)$cat_id;
+ $cat_ids = $this->get_sub_cats($cat_id);
+ }
+
+ if($cat_ids)
+ {
+ $filtermethod .= " $where fm_project.category
IN (". implode(',', $cat_ids) . ')';
$where = 'AND';
}
@@ -568,6 +575,23 @@
$where = 'AND';
}
+ $_department_dimb = array();
+ if ($department > 0)
+ {
+ $_department_dimb[] = -1;//block in case no one
found
+ $this->db->query("SELECT id FROM fm_ecodimb
WHERE department = $department ",__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $_department_dimb[] =
$this->db->f('id');
+ }
+ }
+
+ if($_department_dimb)
+ {
+ $filtermethod .= " $where fm_workorder.ecodimb
IN (" . implode(',', $_department_dimb) . ')';
+ $where = 'AND';
+ }
+
if ($grouping > 0)
{
$filtermethod .= " $where
fm_b_account.category='$grouping' ";
@@ -630,9 +654,9 @@
$where = 'AND';
- if ($cat_id > 0)
+ if($cat_ids)
{
- $filtermethod .= " $where fm_tts_tickets.cat_id
= " . (int)$cat_id;
+ $filtermethod .= " $where fm_tts_tickets.cat_id
IN (". implode(',', $cat_ids) . ')';
$where = 'AND';
}
@@ -648,6 +672,12 @@
$where = 'AND';
}
+ if($_department_dimb)
+ {
+ $filtermethod .= " $where
fm_tts_tickets.ecodimb IN (" . implode(',', $_department_dimb) . ')';
+ $where = 'AND';
+ }
+
if ($grouping > 0)
{
$filtermethod .= " $where
fm_b_account.category='$grouping' ";
@@ -728,6 +758,12 @@
*/
}
+ if($cat_ids)
+ {
+ $filtermethod .= " $where fm_budget.category IN
(". implode(',', $cat_ids) . ')';
+ $where = 'AND';
+ }
+
if ($district_id > 0)
{
$filtermethod .= " $where
district_id='$district_id' ";
@@ -740,6 +776,13 @@
$where = 'AND';
}
+ if($_department_dimb)
+ {
+ $filtermethod .= " $where ecodimb IN (" .
implode(',', $_department_dimb) . ')';
+ $where = 'AND';
+ }
+
+
if( $details )
{
$sql = "SELECT budget_cost,b_account_id as
b_account_field,district_id,ecodimb FROM fm_budget"
@@ -770,9 +813,9 @@
$filtermethod = '';
$where = 'AND';
- if ($cat_id > 0)
+ if($cat_ids)
{
- $filtermethod .= " $where fm_project.category =
" . (int)$cat_id;
+ $filtermethod .= " $where fm_workorder.category
IN (". implode(',', $cat_ids) . ')';
$where = 'AND';
}
@@ -794,6 +837,13 @@
$where = 'AND';
}
+ if($_department_dimb)
+ {
+ $filtermethod .= " $where dimb IN (" .
implode(',', $_department_dimb) . ')';
+ $where = 'AND';
+ }
+
+
$start_periode = date('Ym',mktime(2,0,0,1,1,$year));
$end_periode = date('Ym',mktime(2,0,0,12,31,$year));
@@ -861,9 +911,9 @@
$filtermethod = " fm_s_agreement_budget.year = $year";
$where = 'AND';
- if ($cat_id > 0)
+ if($cat_ids)
{
- $filtermethod .= " $where
fm_s_agreement.category = " . (int)$cat_id;
+ $filtermethod .= " $where
fm_s_agreement.category IN (". implode(',', $cat_ids) . ')';
$where = 'AND';
}
@@ -879,6 +929,12 @@
$where = 'AND';
}
+ if($_department_dimb)
+ {
+ $filtermethod .= " $where
fm_s_agreement_budget.ecodimb IN (" . implode(',', $_department_dimb) . ')';
+ $where = 'AND';
+ }
+
$sql = "SELECT sum(budget) as budget,
count(fm_s_agreement.id) as hits, fm_b_account.{$b_account_field} as
{$b_account_field}, fm_s_agreement_budget.ecodimb"
. " FROM fm_s_agreement"
. " {$this->join} fm_s_agreement_budget ON
fm_s_agreement.id = fm_s_agreement_budget.agreement_id"
@@ -937,9 +993,9 @@
$filtermethod = '';
$where = 'WHERE';
- if ($cat_id > 0)
+ if($cat_ids)
{
- $filtermethod .= " $where
fm_s_agreement.category = " . (int)$cat_id;
+ $filtermethod .= " $where
fm_s_agreement.category IN (". implode(',', $cat_ids) . ')';
$where = 'AND';
}
@@ -955,8 +1011,12 @@
$where = 'AND';
}
+ if($_department_dimb)
+ {
+ $filtermethod .= " $where
fm_s_agreement_budget.ecodimb IN (" . implode(',', $_department_dimb) . ')';
+ $where = 'AND';
+ }
-
$sql = "SELECT fm_b_account.{$b_account_field} as
{$b_account_field}, sum(fm_ecobilag.godkjentbelop) as
actual_cost,fm_s_agreement_budget.ecodimb"
. " FROM fm_ecobilag"
. " {$this->join} fm_b_account ON
fm_ecobilag.spbudact_code =fm_b_account.id"
Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php 2012-06-22 13:38:11 UTC (rev
9653)
+++ trunk/property/inc/class.sogeneric.inc.php 2012-06-24 16:29:58 UTC (rev
9654)
@@ -481,6 +481,21 @@
'name' =>
'descr',
'descr' =>
lang('descr'),
'type' =>
'varchar'
+ ),
+ array
+ (
+ 'name'
=> 'department',
+ 'descr'
=> lang('department'),
+ 'type'
=> 'select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'department', 'selected' =>
'##department##')
+ )
)
),
'custom_criteria' => array
@@ -1495,6 +1510,57 @@
);
break;
+ case 'department':
+
+ $info = array
+ (
+ 'table'
=> 'fm_department',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'name',
+ 'descr' =>
lang('name'),
+ 'type' =>
'varchar',
+ 'nullable'
=> false,
+ 'size'
=> 60,
+ 'sortable'
=> true
+ ),
+ array
+ (
+ 'name'
=> 'parent_id',
+ 'descr'
=> lang('parent'),
+ 'type'
=> 'select',
+ 'sortable'
=> true,
+ 'nullable'
=> true,
+ 'filter'
=> false,
+ 'role'
=> 'parent',
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'department', 'role' => 'parent', 'selected'
=> '##parent_id##')
+ )
+ )
+ ),
+ 'edit_msg'
=> lang('edit'),
+ 'add_msg'
=> lang('add'),
+ 'name'
=> lang('department'),
+ 'acl_app'
=> 'property',
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::accounting::department',
+ 'default'
=> array
+ (
+ 'created_by'
=> array('add' => '$this->account'),
+ 'created_on'
=> array('add' => 'time()'),
+ 'modified_by'
=> array('edit' => '$this->account'),
+ 'modified_on'
=> array('edit' => 'time()'),
+ ),
+ 'check_grant' =>
false
+ );
+ break;
+
//-------- ID type auto
case 'dimb_role_user':
Modified: trunk/property/inc/class.uibudget.inc.php
===================================================================
--- trunk/property/inc/class.uibudget.inc.php 2012-06-22 13:38:11 UTC (rev
9653)
+++ trunk/property/inc/class.uibudget.inc.php 2012-06-24 16:29:58 UTC (rev
9654)
@@ -1047,13 +1047,16 @@
$default_value = array
('id'=>'','name'=>lang('no grouping'));
array_unshift
($values_combo_box[3],$default_value);
- $values_combo_box[4] =
$this->bocommon->select_category_list(array('type'=>'dimb'));
- foreach($values_combo_box[4] as & $_dimb)
+ $values_combo_box[4] =
$this->bocommon->select_category_list(array('type'=>'department'));
+ array_unshift ($values_combo_box[4], array
('id'=>'','name'=>lang('department')));
+
+ $values_combo_box[5] =
$this->bocommon->select_category_list(array('type'=>'dimb'));
+ foreach($values_combo_box[5] as & $_dimb)
{
$_dimb['name'] =
"{$_dimb['id']}-{$_dimb['name']}";
}
$default_value = array
('id'=>'','name'=>lang('no dimb'));
- array_unshift
($values_combo_box[4],$default_value);
+ array_unshift
($values_combo_box[5],$default_value);
$datatable['actions']['form'] = array
(
@@ -1141,12 +1144,24 @@
array
( //boton
USER
//
'id' => 'btn_user_id',
+ 'id' =>
'sel_department',
+ 'name'
=> 'department',
+ 'value'
=> lang('department'),
+ 'type'
=> 'select',
+ 'style'
=> 'filter',
+
'values' => $values_combo_box[4],
+
'onchange'=> 'onChangeSelect("department");',
+
'tab_index' => 5
+ ),
+ array
+ ( //boton
USER
+ //
'id' => 'btn_user_id',
'id' =>
'sel_dimb_id',
'name'
=> 'dimb_id',
'value'
=> lang('dimb'),
'type'
=> 'select',
'style'
=> 'filter',
-
'values' => $values_combo_box[4],
+
'values' => $values_combo_box[5],
'onchange'=> 'onChangeSelect("dimb_id");',
'tab_index' => 5
),
@@ -1538,7 +1553,7 @@
'lang_year'
=> lang('year'),
'lang_year_statustext'
=> lang('Budget year'),
- 'year'
=>
$this->bocommon->select_list($values['year'],$this->bo->get_year_list()),
+ 'year'
=>
$this->bocommon->select_list($values['year']?$values['year']:date('Y'),$this->bo->get_year_list()),
'lang_district'
=> lang('District'),
'lang_no_district'
=> lang('no district'),
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2012-06-22 13:38:11 UTC (rev 9653)
+++ trunk/property/setup/phpgw_no.lang 2012-06-24 16:29:58 UTC (rev 9654)
@@ -502,6 +502,7 @@
delete workorder property no slett bestilling
delivered property no Levert
delivery address property no Leveringsadresse
+department property no Avdeling
deposit claim property no Krav mot depositum
deposition property no Avsetning
description property no Beskrivelse
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2012-06-22 13:38:11 UTC (rev 9653)
+++ trunk/property/setup/setup.inc.php 2012-06-24 16:29:58 UTC (rev 9654)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.647';
+ $setup_info['property']['version'] = '0.9.17.648';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
@@ -133,6 +133,7 @@
'fm_tts_tickets',
'fm_tts_history',
'fm_tts_views',
+ 'fm_department',
'fm_ecoart',
'fm_ecoavvik',
'fm_ecobilag_process_code',
Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-06-22 13:38:11 UTC (rev
9653)
+++ trunk/property/setup/tables_current.inc.php 2012-06-24 16:29:58 UTC (rev
9654)
@@ -968,6 +968,21 @@
'fk' => array(),
'uc' => array()
),
+ 'fm_department' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
+ 'parent_id' => array('type' =>
'int','precision' => '4','nullable' => true),
+ 'name' => array('type' => 'varchar','precision'
=> '60','nullable' => False),
+ 'created_on' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'created_by' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'modified_by' => array('type' =>
'int','precision' => 4,'nullable' => true),
+ 'modified_on' => array('type' =>
'int','precision' => 4,'nullable' => true)
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array(),
+ 'uc' => array()
+ ),
'fm_ecoart' => array(
'fd' => array(
'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
@@ -1165,11 +1180,12 @@
'fm_ecodimb' => array(
'fd' => array(
'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
- 'descr' => array('type' =>
'varchar','precision' => '25','nullable' => False)
+ 'descr' => array('type' =>
'varchar','precision' => '50','nullable' => False),
+ 'department' => array('type' =>
'int','precision' => '4','nullable' => False),
),
'pk' => array('id'),
'ix' => array(),
- 'fk' => array(),
+ 'fk' => array('fm_department' => array('department' =>
'id')),
'uc' => array()
),
'fm_ecodimb_role' => array(
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2012-06-22 13:38:11 UTC (rev
9653)
+++ trunk/property/setup/tables_update.inc.php 2012-06-24 16:29:58 UTC (rev
9654)
@@ -6351,7 +6351,7 @@
}
/**
- * Update property version from 0.9.17.643 to 0.9.17.644
+ * Update property version from 0.9.17.644 to 0.9.17.645
* Add view on fm_ecobilag
*/
$test[] = '0.9.17.644';
@@ -6394,7 +6394,7 @@
}
/**
- * Update property version from 0.9.17.643 to 0.9.17.644
+ * Update property version from 0.9.17.645 to 0.9.17.646
* Add optional inheritance of location from project to order
*/
$test[] = '0.9.17.645';
@@ -6421,8 +6421,8 @@
}
/**
- * Update property version from 0.9.17.643 to 0.9.17.644
- * Add update values
+ * Update property version from 0.9.17.646 to 0.9.17.647
+ * Update values
*/
$test[] = '0.9.17.646';
function property_upgrade0_9_17_646()
@@ -6463,3 +6463,54 @@
}
}
+ /**
+ * Update property version from 0.9.17.647 to 0.9.17.648
+ * Update values
+ */
+ $test[] = '0.9.17.647';
+ function property_upgrade0_9_17_647()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_department', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'parent_id' => array('type' =>
'int','precision' => '4','nullable' => true),
+ 'name' => array('type' =>
'varchar','precision' => '60','nullable' => False),
+ 'created_on' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'created_by' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'modified_by' => array('type' =>
'int','precision' => 4,'nullable' => true),
+ 'modified_on' => array('type' =>
'int','precision' => 4,'nullable' => true)
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_department (id, name, created_on, created_by) VALUES (1, 'Department'," .
time() . ",6 ) ",__LINE__,__FILE__);
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecodimb','department',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => true
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_ecodimb SET
department = 1",__LINE__,__FILE__);
+
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_ecodimb','department',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => false
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.648';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9654] property: add department as entity,
Sigurd Nes <=