[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property inc/class.sor_agreement.inc.php inc/cl...
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] property inc/class.sor_agreement.inc.php inc/cl... |
Date: |
Fri, 17 Feb 2006 14:48:14 +0000 |
CVSROOT: /sources/phpgroupware
Module name: property
Branch:
Changes by: Sigurd Nes <address@hidden> 06/02/17 14:48:14
Modified files:
inc : class.sor_agreement.inc.php
class.uir_agreement.inc.php
setup : tables_current.inc.php tables_update.inc.php
templates/base : r_agreement.xsl
Log message:
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sor_agreement.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uir_agreement.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_current.inc.php.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_update.inc.php.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/r_agreement.xsl.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
Patches:
Index: property/inc/class.sor_agreement.inc.php
diff -u property/inc/class.sor_agreement.inc.php:1.6
property/inc/class.sor_agreement.inc.php:1.7
--- property/inc/class.sor_agreement.inc.php:1.6 Thu Feb 16 22:00:30 2006
+++ property/inc/class.sor_agreement.inc.php Fri Feb 17 14:48:14 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage agreement
- * @version $Id: class.sor_agreement.inc.php,v 1.6 2006/02/16 22:00:30
sigurdne Exp $
+ * @version $Id: class.sor_agreement.inc.php,v 1.7 2006/02/17 14:48:14
sigurdne Exp $
*/
/**
@@ -1643,8 +1643,6 @@
// $cols[] = 'rental_type_id';
// $vals[] = $values['rental_type_id'];
- $cols[] = 'override_fraction';
- $vals[] = $this->floatval($values['override_fraction']);
$cols = "," . implode(",", $cols);
$vals = "," .
$this->bocommon->validate_db_insert($vals);
@@ -1656,14 +1654,24 @@
. "VALUES ($id," . $values['r_agreement_id']
."," . time()
. "," . $this->account . " $vals)");
- $this->db->query("SELECT start_date FROM fm_r_agreement
WHERE id=" . $values['r_agreement_id']);
+ $this->db->query("SELECT start_date, end_date FROM
fm_r_agreement WHERE id=" . $values['r_agreement_id']);
$this->db->next_record();
$start_date = $this->db->f('start_date');
+ $end_date = $this->db->f('end_date');
+
+ if($start_date < (time() + (3600 * 24))) // older than
the day before
+ {
+ $start_date = time();
+ }
+ if($end_date > mktime(0, 0, 0, 12, 32, date(Y))) //
next year
+ {
+ $end_date = mktime(0, 0, 0, 12, 31, date(Y));
// last day of this year
+ }
- $this->db->query("INSERT INTO fm_r_agreement_c_history
(agreement_id,c_id,id,current_record,budget_cost,from_date,entry_date,user_id) "
- . "VALUES (" . $values['r_agreement_id'] . ","
. $id .",1,1," . $this->floatval($values['budget_cost']) . "," .
(int)$start_date . "," . time()
- . "," . $this->account . ")");
+ $this->db->query("INSERT INTO fm_r_agreement_c_history
(agreement_id,c_id,id,current_record,budget_cost,from_date,to_date,user_id,override_fraction)
"
+ . "VALUES (" . $values['r_agreement_id'] . ","
. $id .",1,1," . $this->floatval($values['budget_cost']) . "," . $start_date .
"," . $end_date
+ . "," . $this->account . "," .
$this->floatval($values['override_fraction']) .")");
$receipt['r_agreement_id']= $values['r_agreement_id'];
$receipt['id']= $id;
@@ -1704,7 +1712,7 @@
);
}
-_debug_array($common);
+//_debug_array($common);
return $common;
}
@@ -1740,7 +1748,8 @@
$table = 'fm_r_agreement_common';
- $cols = "b_account,budget_cost,
actual_cost,fm_r_agreement_c_history.id,from_date,to_date,fm_r_agreement_c_history.c_id";
+ $cols = "b_account,budget_cost,
actual_cost,fm_r_agreement_c_history.id,from_date,to_date,fm_r_agreement_c_history.c_id,"
+ . "fraction,override_fraction";
$cols_return[] = 'id';
$uicols['input_type'][] = 'text';
@@ -1766,6 +1775,18 @@
$uicols['descr'][] = lang('actual cost');
$uicols['statustext'][] = lang('actual cost');
+ $cols_return[] = 'fraction';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'fraction';
+ $uicols['descr'][] = lang('fraction');
+ $uicols['statustext'][] = lang('fraction');
+
+ $cols_return[] = 'override_fraction';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'override_fraction';
+ $uicols['descr'][] = lang('override
fraction');
+ $uicols['statustext'][] = lang('override
fraction');
+
$cols_return[] = 'from_date';
$uicols['input_type'][] = 'text';
$uicols['name'][] = 'from_date';
Index: property/inc/class.uir_agreement.inc.php
diff -u property/inc/class.uir_agreement.inc.php:1.7
property/inc/class.uir_agreement.inc.php:1.8
--- property/inc/class.uir_agreement.inc.php:1.7 Thu Feb 16 22:00:30 2006
+++ property/inc/class.uir_agreement.inc.php Fri Feb 17 14:48:14 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage agreement
- * @version $Id: class.uir_agreement.inc.php,v 1.7 2006/02/16 22:00:30
sigurdne Exp $
+ * @version $Id: class.uir_agreement.inc.php,v 1.8 2006/02/17 14:48:14
sigurdne Exp $
*/
/**
@@ -716,6 +716,72 @@
$values_common = $this->bo->read_common($id);
+
+
+ if (isSet($values_common) AND
is_array($values_common))
+ {
+ foreach($values_common as $common_entry)
+ {
+
+ if($this->acl_edit)
+ {
+ $link_edit =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common&r_agreement_id='
. $common_entry['agreement_id'] . '&id=' . $common_entry['common_id']);
+ $text_edit
= lang('edit');
+ }
+ if($this->acl_delete)
+ {
+ $link_delete =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.delete_common&r_agreement_id='
. $common_entry['agreement_id'] . '&id=' . $common_entry['common_id']);
+ $text_delete
=lang('delete');
+ }
+
+ $content_common[] = array
+ (
+ 'agreement_id'
=> $common_entry['agreement_id'],
+ 'common_id'
=> $common_entry['common_id'],
+ 'b_account_id'
=> $common_entry['b_account_id'],
+ 'from_date'
=> $common_entry['from_date'],
+ 'to_date'
=> $common_entry['to_date'],
+ 'budget_cost'
=> $common_entry['budget_cost'],
+ 'actual_cost'
=> $common_entry['actual_cost'],
+ 'fraction'
=> $common_entry['fraction'],
+ 'override_fraction'
=> $common_entry['override_fraction'],
+ 'remark'
=> $common_entry['remark'],
+ 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.view&agreement_id='
. $common_entry['agreement_id']),
+ 'link_edit'
=> $link_edit,
+ 'link_delete'
=> $link_delete,
+ 'lang_view_statustext'
=> lang('view the p_of_town'),
+ 'lang_edit_statustext'
=> lang('edit the p_of_town'),
+
'lang_delete_statustext' => lang('delete the p_of_town'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> $text_edit,
+ 'text_delete'
=> $text_delete
+ );
+
+ unset($link_edit);
+ unset($link_delete);
+ unset($text_edit);
+ unset($text_delete);
+ }
+ }
+
+
+ $table_header_common = array
+ (
+ 'lang_id'
=> lang('ID'),
+ 'lang_b_account' =>
lang('Budget account'),
+ 'lang_from_date' =>
lang('from date'),
+ 'lang_to_date' =>
lang('to date'),
+ 'lang_budget_cost' =>
lang('budget cost'),
+ 'lang_actual_cost' =>
lang('actual cost'),
+ 'lang_fraction' =>
lang('fraction'),
+ 'lang_override_fraction' =>
lang('override fraction'),
+ 'lang_view'
=> lang('view'),
+ 'lang_edit'
=> lang('edit'),
+ 'lang_delete' =>
lang('delete')
+ );
+
+
+
}
$link_data = array
@@ -924,7 +990,10 @@
'set_column'
=> $set_column,
'lang_space'
=> lang('space'),
'lang_service'
=> lang('service'),
- 'lang_common_costs'
=> lang('common costs'),
+ 'lang_common_costs'
=> lang('common costs'),
+ 'values_common'
=> $content_common,
+ 'table_header_common' =>
$table_header_common,
+
);
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('rental agreement') . ': ' . ($id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
@@ -1913,6 +1982,8 @@
{
$values =
$this->bo->read_single_common(array('r_agreement_id'=>$r_agreement_id,'common_id'=>$id));
$list =
$this->bo->read_common_history(array('r_agreement_id'=>$r_agreement_id,'common_id'=>$id));
+ $lookup_type='view';
+
}
@@ -1985,14 +2056,13 @@
);
- $lookup_type='form';
-
$max_location_level =
$this->bocommon->get_max_location_level();
//_debug_array($values);
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
'b_account_id' =>
$values['b_account_id'],
- 'b_account_name' =>
$values['b_account_name']));
+ 'b_account_name' =>
$values['b_account_name'],
+ 'type'
=>$lookup_type));
$data = array
@@ -2057,6 +2127,5 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_common' => $data));
// $GLOBALS['phpgw']->xslttpl->pp();
}
-
}
?>
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.44
property/setup/tables_current.inc.php:1.45
--- property/setup/tables_current.inc.php:1.44 Thu Feb 16 14:48:45 2006
+++ property/setup/tables_current.inc.php Fri Feb 17 14:48:14 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage setup
- * @version $Id: tables_current.inc.php,v 1.44 2006/02/16 14:48:45
sigurdne Exp $
+ * @version $Id: tables_current.inc.php,v 1.45 2006/02/17 14:48:14
sigurdne Exp $
*/
$phpgw_baseline = array(
@@ -2118,7 +2118,6 @@
'remark' => array('type' => 'text','nullable'
=> True),
'user_id' => array('type' => 'int', 'precision'
=> 4,'nullable' => True),
'entry_date' => array('type' => 'int',
'precision' => 4,'nullable' => True)
- 'override_fraction' => array('type' =>
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
),
'pk' => array('agreement_id','id'),
'fk' => array(),
@@ -2138,6 +2137,8 @@
'entry_date' => array('type' => 'int',
'precision' => 4,'nullable' => True),
'budget_cost' => array('type' => 'decimal',
'precision' => 20, 'scale' => 2,'nullable' => True),
'actual_cost' => array('type' => 'decimal',
'precision' => 20, 'scale' => 2,'nullable' => True),
+ 'fraction' => array('type' => 'decimal',
'precision' => 20, 'scale' => 2,'nullable' => True),
+ 'override_fraction' => array('type' =>
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
),
'pk' => array('agreement_id','c_id','id'),
'fk' => array(),
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.27
property/setup/tables_update.inc.php:1.28
--- property/setup/tables_update.inc.php:1.27 Thu Feb 16 14:48:45 2006
+++ property/setup/tables_update.inc.php Fri Feb 17 14:48:14 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage setup
- * @version $Id: tables_update.inc.php,v 1.27 2006/02/16 14:48:45
sigurdne Exp $
+ * @version $Id: tables_update.inc.php,v 1.28 2006/02/17 14:48:14
sigurdne Exp $
*/
/**
@@ -974,7 +974,6 @@
'remark' => array('type' =>
'text','nullable' => True),
'user_id' => array('type' => 'int',
'precision' => 4,'nullable' => True),
'entry_date' => array('type' => 'int',
'precision' => 4,'nullable' => True),
- 'override_fraction' => array('type' =>
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
),
'pk' => array('agreement_id','id'),
'fk' => array(),
@@ -996,6 +995,8 @@
'entry_date' => array('type' => 'int',
'precision' => 4,'nullable' => True),
'budget_cost' => array('type' =>
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
'actual_cost' => array('type' =>
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
+ 'fraction' => array('type' =>
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
+ 'override_fraction' => array('type' =>
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
),
'pk' => array('agreement_id','c_id','id'),
'fk' => array(),
Index: property/templates/base/r_agreement.xsl
diff -u property/templates/base/r_agreement.xsl:1.7
property/templates/base/r_agreement.xsl:1.8
--- property/templates/base/r_agreement.xsl:1.7 Thu Feb 16 22:00:30 2006
+++ property/templates/base/r_agreement.xsl Fri Feb 17 14:48:14 2006
@@ -718,16 +718,122 @@
<xsl:text>row_on</xsl:text>
</xsl:attribute>
- <td class="th_text" align="left" colspan="5">
+ <td class="th_text" align="left" colspan="10">
<HR/>
<xsl:value-of select="lang_common_costs"/>
</td>
+ </tr>
+ <tr>
+ <td>
+ <table>
+ <xsl:apply-templates select="table_header_common"/>
+ <xsl:apply-templates select="values_common"/>
<xsl:apply-templates select="table_add_common"/>
+ </table>
+ </td>
</tr>
</table>
</div>
</xsl:template>
+
+ <xsl:template match="table_header_common">
+ <tr class="th">
+ <td width="10%" align="right">
+ <xsl:value-of select="lang_id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="lang_b_account"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="lang_from_date"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="lang_to_date"/>
+ </td>
+ <td align="left">
+ <xsl:value-of
select="lang_budget_cost"/>
+ </td>
+ <td align="left">
+ <xsl:value-of
select="lang_actual_cost"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="lang_fraction"/>
+ </td>
+ <td align="left">
+ <xsl:value-of
select="lang_override_fraction"/>
+ </td>
+ <td width="5%" align="center">
+ <xsl:value-of select="lang_view"/>
+ </td>
+ <td width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_common">
+ <xsl:variable name="lang_view_statustext"><xsl:value-of
select="lang_view_statustext"/></xsl:variable>
+ <xsl:variable name="lang_edit_statustext"><xsl:value-of
select="lang_edit_statustext"/></xsl:variable>
+ <xsl:variable name="lang_delete_statustext"><xsl:value-of
select="lang_delete_statustext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="left">
+ <xsl:value-of select="common_id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="b_account_id"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="from_date"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="to_date"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="budget_cost"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="actual_cost"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="fraction"/>
+ </td>
+ <td align="left">
+ <xsl:value-of
select="override_fraction"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_view"><xsl:value-of select="link_view"/></xsl:variable>
+ <a href="{$link_view}"
onMouseover="window.status='{$lang_view_statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_view"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
<!-- add item / edit item -->
<xsl:template match="edit_item">
@@ -1686,11 +1792,10 @@
<xsl:value-of
select="value_id"/>
</td>
</tr>
+ <xsl:call-template
name="b_account_view"/>
</xsl:when>
- </xsl:choose>
- <xsl:call-template name="b_account_form"/>
- <xsl:choose>
- <xsl:when test="value_id=''">
+ <xsl:otherwise>
+ <xsl:call-template
name="b_account_form"/>
<tr>
<td valign="top">
<xsl:value-of
select="lang_budget_cost"/>
@@ -1705,8 +1810,6 @@
</input>
</td>
</tr>
- </xsl:when>
- </xsl:choose>
<tr>
<td valign="top">
@@ -1738,6 +1841,8 @@
</textarea>
</td>
</tr>
+ </xsl:otherwise>
+ </xsl:choose>
<tr height="50">
<td colspan = '2'>