[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9231] property: invoice: ACL based on dime / update
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9231] property: invoice: ACL based on dime / update order and voucher / alter split |
Date: |
Sun, 29 Apr 2012 15:50:16 +0000 |
Revision: 9231
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9231
Author: sigurdne
Date: 2012-04-29 15:50:16 +0000 (Sun, 29 Apr 2012)
Log Message:
-----------
property: invoice: ACL based on dime / update order and voucher / alter split
Modified Paths:
--------------
trunk/property/inc/class.boinvoice.inc.php
trunk/property/inc/class.bolookup.inc.php
trunk/property/inc/class.menu.inc.php
trunk/property/inc/class.soXport.inc.php
trunk/property/inc/class.sogeneric.inc.php
trunk/property/inc/class.soinvoice.inc.php
trunk/property/inc/class.soworkorder.inc.php
trunk/property/inc/class.uiinvoice.inc.php
trunk/property/inc/class.uiinvoice2.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/config.tpl
trunk/property/templates/base/workorder.xsl
Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.boinvoice.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -368,7 +368,7 @@
function select_dimb_list($selected='')
{
- $dimbs=$this->so->select_dimb_list();
+ $dimbs=$this->so->select_dimb_list($selected);
return $this->bocommon->select_list($selected,$dimbs);
}
@@ -768,9 +768,9 @@
return $line;
}
- function check_role()
+ function check_role($dimb = 0)
{
- return $this->so->check_role();
+ return $this->so->check_role($dimb);
}
public function get_historical_accounting_periods()
Modified: trunk/property/inc/class.bolookup.inc.php
===================================================================
--- trunk/property/inc/class.bolookup.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.bolookup.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -326,10 +326,19 @@
}
function read_ecodimb()
{
+ $config =
CreateObject('phpgwapi.config','property');
+ $config->read();
+
+ $custom_criteria = array();
+ if(isset($config->config_data['invoice_acl']) &&
$config->config_data['invoice_acl'] == 'dimb')
+ {
+ $custom_criteria = array('dimb_role_user');
+ }
+
$ecodimb = CreateObject('property.sogeneric');
$ecodimb->get_location_info('dimb',false);
$values = $ecodimb->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
- 'allrows'=>$this->allrows));
+ 'allrows'=>$this->allrows, 'custom_criteria' =>
$custom_criteria));
$this->total_records = $ecodimb->total_records;
Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.menu.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -206,11 +206,24 @@
'text' =>
lang('Accounting dim b'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'dimb') )
),
+/*
'dimb_roles' => array
(
'text' => lang('dimb
roles'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'property', 'location' =>
'.invoice.dimb', 'global_cats' => 'true', 'menu_selection' =>
'admin::property::accounting::dimb_roles') )
),
+*/
+ 'dimb_role' => array
+ (
+ 'text' => lang('dimb
roles'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'dimb_role') )
+ ),
+ 'dimb_role_user' => array
+ (
+ 'text' => lang('dimb
role user'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'dimb_role_user') )
+ ),
+
'accounting_dimd' => array
(
'text' =>
lang('Accounting dim d'),
Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.soXport.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -195,7 +195,7 @@
{
$id = (int) $id;
$sql = "SELECT project_group FROM fm_workorder"
- . " $this->join fm_project ON
fm_workorder.project_id = fm_project.id WHERE fm_workorder.id={$id}";
+ . " {$this->join} fm_project ON
fm_workorder.project_id = fm_project.id WHERE fm_workorder.id={$id}";
$this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
return $this->db->f('project_group');
Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.sogeneric.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -53,11 +53,12 @@
function read($data, $filter = array())
{
- $start = isset($data['start']) &&
$data['start'] ? $data['start']:0;
- $query =
isset($data['query'])?$data['query']:'';
- $sort = isset($data['sort']) && $data['sort']
? $data['sort']:'DESC';
- $order =
isset($data['order'])?$data['order']:'';
- $allrows =
isset($data['allrows'])?$data['allrows']:'';
+ $start = isset($data['start'])
&& $data['start'] ? $data['start'] : 0;
+ $query = isset($data['query'])
? $data['query']:'';
+ $sort = isset($data['sort'])
&& $data['sort'] ? $data['sort'] : 'DESC';
+ $order = isset($data['order'])
? $data['order'] : '';
+ $allrows =
isset($data['allrows']) ? $data['allrows'] : '';
+ $custom_criteria =
isset($data['custom_criteria']) && $data['custom_criteria'] ?
$data['custom_criteria'] : array();
$values = array();
if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
@@ -65,6 +66,24 @@
return $values;
}
+
+ $_join_method = array();
+ $_filter_array = array();
+ if($custom_criteria)
+ {
+ foreach ($custom_criteria as $_custom_criteria)
+ {
+
if(isset($this->location_info['custom_criteria'][$_custom_criteria]['join']) &&
is_array($this->location_info['custom_criteria'][$_custom_criteria]['join']))
+ {
+ $_join_method =
array_merge($_join_method,
$this->location_info['custom_criteria'][$_custom_criteria]['join']);
+ }
+
if(isset($this->location_info['custom_criteria'][$_custom_criteria]['filter'])
&&
is_array($this->location_info['custom_criteria'][$_custom_criteria]['filter']))
+ {
+ $_filter_array =
array_merge($_filter_array,
$this->location_info['custom_criteria'][$_custom_criteria]['filter']);
+ }
+ }
+ }
+
/*
$valid_order = false;
@@ -93,7 +112,7 @@
}
}
*/
- $_filter_array = array();
+
$get_single = array();
foreach ( $this->location_info['fields'] as $field )
{
@@ -291,8 +310,10 @@
$querymethod .= $_query_end;
}
- $sql = "SELECT * FROM $table {$filtermethod}
{$querymethod}";
+ $join_method = $_join_method ? implode (' ',
$_join_method) : '';
+ $sql = "SELECT * FROM {$table} {$join_method}
{$filtermethod} {$querymethod}";
+
$this->_db->query('SELECT count(*) as cnt ' .
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
$this->_db->next_record();
$this->total_records = $this->_db->f('cnt');
@@ -462,6 +483,14 @@
'type' =>
'varchar'
)
),
+ 'custom_criteria' => array
+ (
+ 'dimb_role_user' =>
array
+ (
+ 'join'
=> array("{$this->_db->join} fm_ecodimb_role_user ON fm_ecodimb.id =
fm_ecodimb_role_user.ecodimb"),
+ 'filter'
=> array('fm_ecodimb_role_user.user_id = ' . (int) $this->account)
+ )
+ ),
'edit_msg' => lang('edit'),
'add_msg' => lang('add'),
'name' => lang('dimb'),
@@ -1065,6 +1094,29 @@
'menu_selection' =>
'admin::property::accounting::accounting_cats'
);
break;
+
+ case 'dimb_role':
+ $info = array
+ (
+ 'table'
=> 'fm_ecodimb_role',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'name',
+ 'descr' =>
lang('name'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg'
=> lang('edit role'),
+ 'add_msg'
=> lang('add role'),
+ 'name'
=> lang('dimb role'),
+ 'acl_app'
=> 'property',
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::unit'
+ );
+ break;
//-------- ID type varchar
case 'project_status':
$info = array
@@ -1444,6 +1496,81 @@
break;
//-------- ID type auto
+
+ case 'dimb_role_user':
+
+ $info = array
+ (
+ 'table'
=> 'fm_ecodimb_role_user',
+ 'id'
=> array('name' => 'id', 'type' => 'auto'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name'
=> 'ecodimb',
+ 'descr'
=> lang('dim b'),
+ 'type'
=> 'select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'dimb', 'selected' =>
'##ecodimb##')//b_account_category
+ )
+ ),
+ array
+ (
+ 'name'
=> 'role_id',
+ 'descr'
=> lang('role type'),
+ 'type'
=> 'select',
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'dimb_role', 'selected' => '##role_id##')
+ )
+ ),
+ array
+ (
+ 'name'
=> 'user_id',
+ 'descr'
=> lang('user'),
+ 'type'
=> 'select',
+ 'filter'
=> true,
+ 'get_single'
=> 'get_user',
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bocommon.get_user_list_right2',
+
'method_input' => array('selected' => '##user_id##', 'right' => 1,
'acl_location' => '.invoice')
+ )
+ ),
+ array
+ (
+ 'name' =>
'default_user',
+ 'descr' =>
lang('default'),
+ 'type' =>
'checkbox',
+ 'default' =>
'checked'
+ ),
+ ),
+ 'edit_msg'
=> lang('edit'),
+ 'add_msg'
=> lang('add'),
+ 'name'
=> lang('dimb role'),
+ 'acl_app'
=> 'property',
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::accounting::dimb_role',
+ 'default'
=> array
+ (
+ 'created_by'
=> array('add' => '$this->account'),
+ 'created_on'
=> array('add' => 'time()'),
+ ),
+ 'check_grant' =>
false
+ );
+ break;
+
case 'order_dim1':
$info = array
(
Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.soinvoice.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -867,10 +867,11 @@
$this->db->next_record();
switch ( $this->db->f('type') )
{
- case 'workorder':
-
$historylog_workorder->add($entry,$id,$status_code[$entry]);
-
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder set status=" .
"'$status_code[$entry]'" . "where id=$id");
- $receipt['message'][] =
array('msg'=>lang('Workorder %1 is %2',$id, $status_code[$entry]));
+ case 'workorder':
+
$historylog_workorder->add($entry,$id,$status_code[$entry]);
+
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder set status=" .
"'{$status_code[$entry]}'" . "where id=$id");
+ $receipt['message'][] =
array('msg'=>lang('Workorder %1 is %2',$id, $status_code[$entry]));
+ break;
}
}
}
@@ -1033,10 +1034,32 @@
return $this->db->f('merknad');
}
- function check_role()
+ function check_role($dimb = 0)
{
- if(!isset($this->role) || !$this->role)
+ if($this->role && !$dimb)
{
+ return $this->role;
+ }
+
+ if(isset($this->config->config_data['invoice_acl']) &&
$this->config->config_data['invoice_acl'] == 'dimb')
+ {
+ $dimb = (int) $dimb;
+ $filter_dimb = $dimb ? "AND ecodimb = {$dimb}"
: '';
+ $this->db->query("SELECT user_id FROM
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id = 1
{$filter_dimb} AND expired_on IS NULL");
+ $this->db->next_record();
+ $this->role['is_janitor'] =
!!$this->db->f('user_id');
+
+ $this->db->query("SELECT user_id FROM
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id = 2
{$filter_dimb} AND expired_on IS NULL");
+ $this->db->next_record();
+ $this->role['is_supervisor'] =
!!$this->db->f('user_id');
+
+ $this->db->query("SELECT user_id FROM
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id = 3
{$filter_dimb} AND expired_on IS NULL");
+ $this->db->next_record();
+ $this->role['is_budget_responsible'] =
!!$this->db->f('user_id');
+
+ }
+ else
+ {
$this->role = array(
'is_janitor'
=> $this->acl->check('.invoice', 32, 'property'),
'is_supervisor'
=> $this->acl->check('.invoice', 64, 'property'),
@@ -1198,17 +1221,47 @@
}
//----------
- function select_dimb_list()
+ function select_dimb_list($selected = 0)
{
- $this->db->query("SELECT * FROM fm_ecodimb order by id
asc ");
+ $selected = (int) $selected;
+ $include_selected = false;
+
+ if(isset($this->config->config_data['invoice_acl']) &&
$this->config->config_data['invoice_acl'] == 'dimb')
+ {
+ $sql = "SELECT fm_ecodimb.* FROM fm_ecodimb
{$this->db->join} fm_ecodimb_role_user ON fm_ecodimb.id =
fm_ecodimb_role_user.ecodimb"
+ . ' WHERE fm_ecodimb_role_user.user_id = ' .
(int) $this->account_id . ' ORDER BY descr ASC';
+ $include_selected = true;
+ }
+ else
+ {
+ $sql = "SELECT * FROM fm_ecodimb ORDER BY descr
ASC";
+ }
+
+ $selected_found = false;
+ $this->db->query($sql);
$dimb_list = array();
while ($this->db->next_record())
{
- $dimb_list[] = Array(
- 'id' => $this->db->f('id'),
- 'name' => $this->db->f('descr')
+ $id = $this->db->f('id');
+ if($id == $selected)
+ {
+ $selected_found = true;
+ }
+
+ $dimb_list[] = array
+ (
+ 'id' => $id,
+ 'name' =>
$this->db->f('descr',true)
);
}
+
+ if($include_selected && $selected && !$selected_found)
+ {
+ $this->db->query("SELECT descr FROM fm_ecodimb
WHERE id={$selected}");
+ $this->db->next_record();
+ array_unshift($dimb_list, array ('id' =>
$selected, 'name' => '**' . $this->db->f('descr',true) . '**' ) );
+ }
+
return $dimb_list;
}
@@ -1883,12 +1936,25 @@
$value_set_line['line_text'] =
$data['line_text'];
$value_set_line =
$this->db->validate_update($value_set_line);
- $this->db->query("UPDATE fm_ecobilag SET
$value_set_line WHERE id = " . (int)$data['line_id'],__LINE__,__FILE__);
+ $this->db->query("UPDATE fm_ecobilag SET
{$value_set_line} WHERE id = " . (int)$data['line_id'],__LINE__,__FILE__);
unset($value_set_line);
+ //update workorder
if($data['order_id'] && $data['b_account_id'])
{
- $this->db->query("UPDATE fm_workorder SET
account_id = '{$data['b_account_id']}' WHERE id='{$data['order_id']}'");
+ $this->db->query("SELECT type FROM fm_orders
WHERE id={$data['order_id']}",__LINE__,__FILE__);
+ $this->db->next_record();
+ switch ( $this->db->f('type') )
+ {
+ case 'workorder':
+ $value_set_line['account_id']
= $data['b_account_id'];
+ $value_set_line['category']
= $data['dim_e'];
+
+ $value_set_line =
$this->db->validate_update($value_set_line);
+ $this->db->query("UPDATE
fm_workorder SET {$value_set_line} WHERE id='{$data['order_id']}'");
+ unset($value_set_line);
+ break;
+ }
}
foreach($data['approved_amount'] as $line_id =>
$approved_amount)
@@ -1926,9 +1992,8 @@
$this->db->query("SELECT belop FROM
{$table} WHERE id={$id}",__LINE__,__FILE__);
$this->db->next_record();
$amount = $this->db->f('belop');
- $new_amount = $amount - $split_amount;
- if($new_amount < 0)
+ if(($amount - $split_amount) < 0)
{
phpgwapi_cache::message_set(lang('negative sum'), 'error');
continue;
@@ -1958,16 +2023,17 @@
$value_set= array
(
- 'belop' =>
$new_amount,
- 'godkjentbelop' => $new_amount,
+ 'belop' =>
$split_amount,
+ 'godkjentbelop' => $split_amount
);
$value_set =
$this->db->validate_update($value_set);
$this->db->query("UPDATE {$table} SET
$value_set WHERE id= {$id}" ,__LINE__,__FILE__);
$value_set= array
(
- 'belop' =>
$split_amount,
- 'godkjentbelop' =>
$split_amount,
+ 'belop' =>
$amount - $split_amount,
+ 'godkjentbelop' => $amount -
$split_amount,
+ 'splitt' => $id
);
$value_set =
$this->db->validate_update($value_set);
$this->db->query("UPDATE {$table} SET
$value_set WHERE id= {$new_id}" ,__LINE__,__FILE__);
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2012-04-29 08:58:55 UTC
(rev 9230)
+++ trunk/property/inc/class.soworkorder.inc.php 2012-04-29 15:50:16 UTC
(rev 9231)
@@ -1211,10 +1211,16 @@
$this->db->transaction_begin();
- $this->db->query("UPDATE fm_workorder SET $value_set
WHERE id= {$workorder['id']}" ,__LINE__,__FILE__);
+ $this->db->query("UPDATE fm_workorder SET {$value_set}
WHERE id= {$workorder['id']}" ,__LINE__,__FILE__);
- $this->db->query("UPDATE fm_ecobilag SET spbudact_code
= '{$workorder['b_account_id']}' WHERE pmwrkord_code = '{$workorder['id']}'"
,__LINE__,__FILE__);
+ $value_set_invoice = array();
+ $value_set_invoice['spbudact_code'] =
$workorder['b_account_id'];
+ $value_set_invoice['dime'] =
$workorder['category'];
+ $value_set_invoice =
$this->bocommon->validate_db_update($value_set_invoice);
+
+ $this->db->query("UPDATE fm_ecobilag SET
{$value_set_invoice} WHERE pmwrkord_code = '{$workorder['id']}'"
,__LINE__,__FILE__);
+
/* if($workorder['charge_tenant'])
{
$this->db->query("UPDATE fm_project set
charge_tenant = 1 WHERE id =" . $workorder['project_id']);
Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.uiinvoice.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -4041,7 +4041,7 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('forward' => $data));
}
- function get_approve_role()
+ function get_approve_role($dimb = 0)
{
$role_check = array
(
@@ -4050,7 +4050,7 @@
'is_budget_responsible' => lang('b -
responsible')
);
- $roles = $this->bo->check_role();
+ $roles = $this->bo->check_role($dimb);
$approve = array();
foreach ($roles as $role => $role_value)
Modified: trunk/property/inc/class.uiinvoice2.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice2.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/inc/class.uiinvoice2.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -134,7 +134,7 @@
if($values = phpgw::get_var('values'))
{
- $approve =
execMethod('property.uiinvoice.get_approve_role');
+ $approve =
execMethod('property.uiinvoice.get_approve_role', $values['dim_b']);
if(!$approve)
{
@@ -198,7 +198,16 @@
$userlist_default[] = array('id'=> '*' .
$GLOBALS['phpgw']->accounts->get($this->account_id)->lid, 'name'=>lang('mine
vouchers'));
$userlist_default[] = array('id'=>'','name'=>lang('no
user'));
- $voucher_list = array('id' => '', 'name' =>
lang('select'));
+ $voucher_list = array();
+ if($voucher_id)
+ {
+ $voucher_list =
$this->bo->get_vouchers(array('query' => $voucher_id ));
+ }
+
+ if(!$voucher_list)
+ {
+ $voucher_list = array('id' => '', 'name' =>
lang('select'));
+ }
foreach($userlist_default as $default)
{
@@ -217,8 +226,6 @@
$user = $GLOBALS['phpgw']->accounts->get(
$GLOBALS['phpgw_info']['user']['id'] );
-
-
$myColumnDefs = array();
$datavalues = array();
$myButtons = array();
@@ -226,7 +233,7 @@
$datavalues[] = array
(
'name' => "0",
- 'values' =>
json_encode(array()),
+ 'values' =>
$this->query(),//json_encode(array()),
'total_records' => 0,
'permission' => "''",
'is_paginator' => 1,
@@ -371,8 +378,7 @@
'voucher_list' =>
array('options' => $voucher_list),
),
'voucher_info'
=> $this->get_single_line($line_id),
- 'update_action'
=> self::link(array('menuaction' => 'property.uiinvoice2.update_voucher')),
- 'datatable_old'
=> array()//$datatable_old;
+ 'update_action'
=> self::link(array('menuaction' => 'property.uiinvoice2.update_voucher'))
);
//_debug_array($data);die();
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
@@ -507,12 +513,12 @@
$sign_orig = '';
$my_initials =
$GLOBALS['phpgw_info']['user']['account_lid'];
-
+
if(count($voucher))
{
//---------start forward
- $approve =
execMethod('property.uiinvoice.get_approve_role');
+ $approve =
execMethod('property.uiinvoice.get_approve_role', $voucher[0]['dim_b']);
$approved_list[] = array
(
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2012-04-29 08:58:55 UTC
(rev 9230)
+++ trunk/property/inc/class.uiworkorder.inc.php 2012-04-29 15:50:16 UTC
(rev 9231)
@@ -1622,8 +1622,13 @@
);
- $_formatter_voucher_link =
isset($config->config_data['invoicehandler']) &&
$config->config_data['invoicehandler'] == 2 ?
'YAHOO.widget.DataTable.formatLink_invoicehandler_2' :
'YAHOO.widget.DataTable.formatLink';
+ $_formatter_voucher_link =
isset($config->config_data['invoicehandler']) &&
$config->config_data['invoicehandler'] == 2 ?
'YAHOO.widget.DataTable.formatLink_invoicehandler_2' :
'YAHOO.widget.DataTable.formatLink';
+ if($_lean)
+ {
+ $_formatter_voucher_link = '""';
+ }
+
$myColumnDefs[2] = array
(
'name' => "2",
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2012-04-29 08:58:55 UTC (rev 9230)
+++ trunk/property/setup/setup.inc.php 2012-04-29 15:50:16 UTC (rev 9231)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.642';
+ $setup_info['property']['version'] = '0.9.17.643';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
@@ -142,6 +142,8 @@
'fm_ecobilagoverf',
'fm_ecobilag_category',
'fm_ecodimb',
+ 'fm_ecodimb_role',
+ 'fm_ecodimb_role_user',
'fm_ecodimd',
'fm_ecologg',
'fm_ecomva',
Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/setup/tables_current.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -1065,7 +1065,7 @@
'budsjettsigndato' => array('type' =>
'timestamp','nullable' => True),
'utbetalingsigndato' => array('type' =>
'timestamp','nullable' => True),
'merknad' => array('type' => 'text','nullable'
=> True),
- 'splitt' => array('type' => 'int','precision'
=> '2','nullable' => True),
+ 'splitt' => array('type' => 'int','precision'
=> '4','nullable' => True),
'kreditnota' => array('type' =>
'int','precision' => '2','nullable' => True),
'pre_transfer' => array('type' =>
'int','precision' => '2','nullable' => True),
'item_type' => array('type' =>
'int','precision' => '4','nullable' => True),
@@ -1121,7 +1121,7 @@
'overftid' => array('type' =>
'timestamp','nullable' => True),
'ordrebelop' => array('type' =>
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' =>
False),
'merknad' => array('type' => 'text','nullable'
=> True),
- 'splitt' => array('type' => 'int','precision'
=> '2','nullable' => True),
+ 'splitt' => array('type' => 'int','precision'
=> '4','nullable' => True),
'filnavn' => array('type' =>
'varchar','precision' => '255','nullable' => False),
'kreditnota' => array('type' =>
'int','precision' => '2','nullable' => True),
'item_type' => array('type' =>
'int','precision' => '4','nullable' => True),
@@ -1171,6 +1171,35 @@
'fk' => array(),
'uc' => array()
),
+ 'fm_ecodimd_role' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
+ 'name' => array('type' => 'varchar','precision'
=> '25','nullable' => False)
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array(),
+ 'uc' => array()
+ ),
+ 'fm_ecodimb_role_user' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto','precision' =>
'4','nullable' => False),
+ 'ecodimb' => array('type' => 'int','precision'
=> '2','nullable' => False),
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'role_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'default' => array('type' => 'int','precision'
=> '2','nullable' => true),
+ 'active_from' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ 'active_to' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ 'created_on' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'created_by' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'expired_on' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ 'expired_by' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array('fm_ecodimd_role' => array('role_id' =>
'id'),'fm_ecodimd' => array('ecodimd' => 'id'),'phpgw_accounts' =>
array('user_id'=>'account_id')),
+ 'uc' => array()
+ ),
'fm_ecodimd' => array(
'fd' => array(
'id' => array('type' => 'varchar','precision'
=> '5','nullable' => False),
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/setup/tables_update.inc.php 2012-04-29 15:50:16 UTC (rev
9231)
@@ -6244,3 +6244,83 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+ $test[] = '0.9.17.642';
+ function property_upgrade0_9_17_642()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_ecobilag','splitt',
array('type' => 'int','precision' => '4','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_ecobilagoverf','splitt',
array('type' => 'int','precision' => '4','nullable' => True));
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_ecodimb_role', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'name' => array('type' =>
'varchar','precision' => '25','nullable' => False)
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_ecodimb_role (id, name) VALUES (1, 'Bestiller')",__LINE__,__FILE__);
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_ecodimb_role (id, name) VALUES (2, 'Attestant')",__LINE__,__FILE__);
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_ecodimb_role (id, name) VALUES (3, 'Anviser')",__LINE__,__FILE__);
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_ecodimb_role_user', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'auto','precision' => '4','nullable' => False),
+ 'ecodimb' => array('type' =>
'int','precision' => '2','nullable' => False),
+ 'user_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'role_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'default_user' => array('type' =>
'int','precision' => '2','nullable' => true),
+ 'active_from' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ 'active_to' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ 'created_on' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'created_by' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'expired_on' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ 'expired_by' => array('type' => 'int',
'precision' => 4,'nullable' => True),
+ ),
+ 'pk' => array('id'),
+ 'ix' => array(),
+ 'fk' => array('fm_ecodimb_role' =>
array('role_id' => 'id'),'fm_ecodimb' => array('ecodimb' =>
'id'),'phpgw_accounts' => array('user_id'=>'account_id')),
+ 'uc' => array()
+ )
+ );
+
+ $sql = 'SELECT * FROM fm_responsibility_contact JOIN
phpgw_accounts ON fm_responsibility_contact.contact_id =
phpgw_accounts.person_id WHERE expired_on IS NULL AND ecodimb IS NOT NULL';
+ $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $roles[] = array
+ (
+ 'ecodimb' =>
$GLOBALS['phpgw_setup']->oProc->f('ecodimb'),
+ 'user_id' =>
$GLOBALS['phpgw_setup']->oProc->f('account_id'),
+ 'role_id' =>
$GLOBALS['phpgw_setup']->oProc->f('responsibility_id') == 2 ? 3 : 2,
+ 'default_user' =>
$GLOBALS['phpgw_setup']->oProc->f('responsibility_id') == 2 ? 1 : '',
+ 'active_from' =>
$GLOBALS['phpgw_setup']->oProc->f('active_from'),
+ 'active_to' =>
$GLOBALS['phpgw_setup']->oProc->f('active_to'),
+ 'created_on' =>
$GLOBALS['phpgw_setup']->oProc->f('created_on'),
+ 'created_by' =>
$GLOBALS['phpgw_setup']->oProc->f('created_by')
+ );
+ $i++;
+ }
+
+ foreach ($roles as $role)
+ {
+ $cols = implode(',', array_keys($role));
+ $values =
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($role));
+ $sql = "INSERT INTO fm_ecodimb_role_user ({$cols})
VALUES ({$values})";
+
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.643';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/templates/base/config.tpl 2012-04-29 15:50:16 UTC (rev
9231)
@@ -87,6 +87,15 @@
</select>
</td>
</tr>
+ <tr class="row_on">
+ <td>{lang_invoice_acl}:</td>
+ <td>
+ <select name="newsettings[invoice_acl]">
+ <option value="default"
{selected_invoice_acl_default}>ACL</option>
+ <option value="dimb"
{selected_invoice_acl_dimb}>DimB</option>
+ </select>
+ </td>
+ </tr>
<tr class="row_off">
<td>{lang_workorder_status_that_are_to_be_set_when_invoice_is_processed}:</td>
<td>
Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2012-04-29 08:58:55 UTC (rev
9230)
+++ trunk/property/templates/base/workorder.xsl 2012-04-29 15:50:16 UTC (rev
9231)
@@ -137,10 +137,17 @@
<xsl:value-of select="lang_project_id"/>
</td>
<td>
-
<xsl:variable name="project_link"><xsl:value-of
select="project_link"/>&id=<xsl:value-of
select="value_project_id"/></xsl:variable>
-
<a href="{$project_link}">
-
<xsl:value-of select="value_project_id"/>
-
</a>
+
<xsl:choose>
+
<xsl:when test="lean = 0">
+
<xsl:variable name="project_link"><xsl:value-of
select="project_link"/>&id=<xsl:value-of
select="value_project_id"/></xsl:variable>
+
<a href="{$project_link}">
+
<xsl:value-of select="value_project_id"/>
+
</a>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:value-of select="value_project_id"/>
+
</xsl:otherwise>
+
</xsl:choose>
<input type="hidden" name="values[project_id]"
value="{value_project_id}"/>
</td>
</tr>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9231] property: invoice: ACL based on dime / update order and voucher / alter split,
Sigurd Nes <=