phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property inc/class.bor_agreement.inc.php inc/cl...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property inc/class.bor_agreement.inc.php inc/cl...
Date: Thu, 16 Feb 2006 22:00:30 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/02/16 22:00:30

Modified files:
        inc            : class.bor_agreement.inc.php 
                         class.sor_agreement.inc.php 
                         class.uir_agreement.inc.php 
        templates/base : r_agreement.xsl 

Log message:
        no message

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bor_agreement.inc.php.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sor_agreement.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uir_agreement.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/r_agreement.xsl.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: property/inc/class.bor_agreement.inc.php
diff -u property/inc/class.bor_agreement.inc.php:1.4 
property/inc/class.bor_agreement.inc.php:1.5
--- property/inc/class.bor_agreement.inc.php:1.4        Thu Feb 16 14:48:45 2006
+++ property/inc/class.bor_agreement.inc.php    Thu Feb 16 22:00:30 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.bor_agreement.inc.php,v 1.4 2006/02/16 14:48:45 
sigurdne Exp $
+       * @version $Id: class.bor_agreement.inc.php,v 1.5 2006/02/16 22:00:30 
sigurdne Exp $
        */
 
        /**
@@ -752,16 +752,46 @@
 
                        return $rental_type[$selected];
                }
+
+               function read_common($id)
+               {
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $values = $this->so->read_common($id);
+
+                       $this->total_records = $this->so->total_records;
+
+                       for ($i=0; $i<count($values); $i++)
+                       {
+                               $values[$i]['from_date']  = 
$GLOBALS['phpgw']->common->show_date($values[$i]['from_date'],$dateformat);
+                               $values[$i]['to_date']  = 
$GLOBALS['phpgw']->common->show_date($values[$i]['to_date'],$dateformat);
+                       }
+
+
+                       return $values;
+               }
+
                function read_single_common($data)
                {
                        $values = $this->so->read_single_common($data);
 
                        return $values;
                }
-               function read_common_list($data)
+               function read_common_history($data)
                {
+                       $values = $this->so->read_common_history($data);
+
+                       $this->total_records = $this->so->total_records;
+
+                       $this->uicols   = $this->so->uicols;
 
-                       return ;
+                       for ($i=0; $i<count($values); $i++)
+                       {
+                               $values[$i]['from_date']  = 
$GLOBALS['phpgw']->common->show_date($values[$i]['from_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $values[$i]['to_date']  = 
$GLOBALS['phpgw']->common->show_date($values[$i]['to_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       }
+
+
+                       return $values;
                }
 
                function save_common($values)
Index: property/inc/class.sor_agreement.inc.php
diff -u property/inc/class.sor_agreement.inc.php:1.5 
property/inc/class.sor_agreement.inc.php:1.6
--- property/inc/class.sor_agreement.inc.php:1.5        Thu Feb 16 14:48:45 2006
+++ property/inc/class.sor_agreement.inc.php    Thu Feb 16 22:00:30 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.5 2006/02/16 14:48:45 
sigurdne Exp $
+       * @version $Id: class.sor_agreement.inc.php,v 1.6 2006/02/16 22:00:30 
sigurdne Exp $
        */
 
        /**
@@ -1675,6 +1675,40 @@
                }
 
 
+               function read_common($id)
+               {
+                       $sql ="SELECT b_account,budget_cost, 
actual_cost,fm_r_agreement_c_history.id,from_date,"
+                       . " 
to_date,fm_r_agreement_c_history.c_id,override_fraction,remark "
+                       . " FROM fm_r_agreement_common $this->join  
fm_r_agreement_c_history "
+                       . " ON ( fm_r_agreement_common.agreement_id 
=fm_r_agreement_c_history.agreement_id "
+                       . " AND fm_r_agreement_common.id 
=fm_r_agreement_c_history.c_id)"
+                       . " WHERE  fm_r_agreement_common.agreement_id = $id AND 
current_record = 1 ORDER BY fm_r_agreement_c_history.c_id ASC";
+               
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $this->total_records = $this->db->num_rows();
+
+                       while ($this->db->next_record())
+                       {
+                               $common[] = array
+                               (
+                                       'agreement_id'  => $id,
+                                       'common_id'     => $this->db->f('c_id'),
+                                       'b_account_id'  => 
$this->db->f('b_account'),
+                                       'from_date'     => 
$this->db->f('from_date'),
+                                       'to_date'       => 
$this->db->f('to_date'),
+                                       'budget_cost'   => 
$this->db->f('budget_cost'),
+                                       'actual_cost'   => 
$this->db->f('actual_cost'),
+                                       'override_fraction'     => 
$this->db->f('override_fraction'),
+                                       'remark'        => 
stripslashes($this->db->f('remark')),
+                               );
+                       }
+
+_debug_array($common);
+                       return $common;
+               }
+
+
                function read_single_common($data)
                {
                        $r_agreement_id =$data['r_agreement_id'];
@@ -1689,13 +1723,119 @@
                                        'agreement_id'  => $r_agreement_id,
                                        'id'                    => $id,
                                        'b_account_id'  => 
$this->db->f('b_account'),
-                                       'input_text'    => 
stripslashes($this->db->f('input_text')),
-                                       'statustext'    => 
stripslashes($this->db->f('statustext')),
-                                       'datatype'              => 
$this->db->f('datatype')
+                                       'remark'        => 
stripslashes($this->db->f('remark')),
+                                       'override_fraction'             => 
$this->db->f('override_fraction')
                                );
                        }
                        return $common;
                }       
+
+               function read_common_history($data)
+               {
+                       if(is_array($data))
+                       {
+                               $r_agreement_id = 
(isset($data['r_agreement_id'])?$data['r_agreement_id']:0);
+                               $common_id      = 
(isset($data['common_id'])?$data['common_id']:0);
+                       }
+
+                       $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_return[]                  = 'id';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]               = 'id';
+                       $uicols['descr'][]              = lang('ID');
+                       $uicols['statustext'][]         = lang('ID');
+
+                       $cols_return[]                  = 'b_account';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]               = 'b_account';
+                       $uicols['descr'][]              = lang('budget 
account');
+                       $uicols['statustext'][]         = lang('Budget 
account');
+
+                       $cols_return[]                  = 'budget_cost';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]               = 'budget_cost';
+                       $uicols['descr'][]              = lang('budget cost');
+                       $uicols['statustext'][]         = lang('budget cost');
+
+                       $cols_return[]                  = 'actual_cost';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]               = 'actual_cost';
+                       $uicols['descr'][]              = lang('actual cost');
+                       $uicols['statustext'][]         = lang('actual cost');
+
+                       $cols_return[]                  = 'from_date';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]               = 'from_date';
+                       $uicols['descr'][]              = lang('From date');
+                       $uicols['statustext'][]         = lang('From date');
+
+                       $cols_return[]                  = 'to_date';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]               = 'to_date';
+                       $uicols['descr'][]              = lang('To date');
+                       $uicols['statustext'][]         = lang('To date');
+
+                       $cols_return[]                  = 'index_date';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]               = 'index_date';
+                       $uicols['descr'][]              = lang('date');
+                       $uicols['statustext'][]         = lang('date');
+
+
+                       $paranthesis .='(';
+                       $joinmethod .= " $this->join  fm_r_agreement_c_history 
ON ( $table.agreement_id =fm_r_agreement_c_history.agreement_id AND $table.id 
=fm_r_agreement_c_history.c_id))";
+
+
+                       $from .= " FROM $paranthesis $table ";
+
+                       $sql = "SELECT $cols $from $joinmethod";
+
+
+                       $this->uicols   = $uicols;
+
+                       $ordermethod = " order by $table.id ASC";
+
+                       $where= 'WHERE';
+
+
+                       if ($r_agreement_id)
+                       {
+                               $filtermethod .= " $where 
$table.agreement_id=$r_agreement_id AND c_id=$common_id";
+                               $where= 'AND';
+                       }
+
+
+                       $sql .= " $filtermethod";
+//echo $sql;
+
+                       $this->db2->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db2->num_rows();
+                       if(!$allrows)
+                       {
+                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+
+                       $j=0;
+                       $n=count($cols_return);
+                       while ($this->db->next_record())
+                       {
+                               for ($i=0;$i<$n;$i++)
+                               {
+                                       $common_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
+                                       $common_list[$j]['agreement_id'] = 
$r_agreement_id;
+                               }
+                               $j++;
+                       }
+                       return $common_list;
+               }
+
                
        }
 ?>
Index: property/inc/class.uir_agreement.inc.php
diff -u property/inc/class.uir_agreement.inc.php:1.6 
property/inc/class.uir_agreement.inc.php:1.7
--- property/inc/class.uir_agreement.inc.php:1.6        Thu Feb 16 14:48:45 2006
+++ property/inc/class.uir_agreement.inc.php    Thu Feb 16 22:00:30 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.6 2006/02/16 14:48:45 
sigurdne Exp $
+       * @version $Id: class.uir_agreement.inc.php,v 1.7 2006/02/16 22:00:30 
sigurdne Exp $
        */
 
        /**
@@ -713,6 +713,9 @@
                                        );
                                }
 
+
+                               $values_common = $this->bo->read_common($id);
+
                        }
 
                        $link_data = array
@@ -1909,15 +1912,15 @@
                        if($id)
                        {
                                $values = 
$this->bo->read_single_common(array('r_agreement_id'=>$r_agreement_id,'common_id'=>$id));
-                               $list = 
$this->bo->read_common_list(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));
                        }
 
+
                        $uicols         = $this->bo->uicols;
                        $list           = 
$this->list_content($list,$uicols,$edit_common=True);
                        $content        = $list['content'];
                        $table_header=$list['table_header'];
 
-
                        $link_data = array
                        (
                                'menuaction'            => 
$this->currentapp.'.uir_agreement.edit_common',
@@ -2036,18 +2039,16 @@
 
                                'lang_budget_cost'                              
                => lang('budget cost'),
                                'lang_cost_statustext'                  => 
lang('budget cost'),
-                               'value_budget_cost'                             
        => $values['budget_cost'],
+                               'value_budget_cost'                             
=> $values['budget_cost'],
                                'lang_delete_last'                              
=> lang('delete last index'),
                                'lang_delete_last_statustext'   => lang('delete 
the last index'),
                                'delete_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common&delete_last=1&r_agreement_id='
 . $r_agreement_id . '&id=' . $id),
                                'b_account_data'                                
=> $b_account_data,
-                               'rental_type_list'                              
=> $this->bo->get_rental_type_list($values['rental_type_id']),
-                               'lang_rental_type_statustext'   => lang('Select 
rental type'),
-                               'lang_select_rental_type'               => 
lang('Select rental type'),
-                               'lang_rental_type'                              
=> lang('Rental type'),
                                'lang_remark'                                   
=> lang('Remark'),
                                'lang_override_fraction'                => 
lang('Override fraction'),
                                'lang_override_fraction_statustext'=> 
lang('Override fraction of common costs'),
+                               'value_override_fraction'               => 
$values['override_fraction'],
+                               'value_remark'          => $values['remark']
                                
                        );
 
Index: property/templates/base/r_agreement.xsl
diff -u property/templates/base/r_agreement.xsl:1.6 
property/templates/base/r_agreement.xsl:1.7
--- property/templates/base/r_agreement.xsl:1.6 Thu Feb 16 14:48:45 2006
+++ property/templates/base/r_agreement.xsl     Thu Feb 16 22:00:30 2006
@@ -1689,32 +1689,25 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:call-template name="b_account_form"/>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="lang_rental_type"/>
-                               </td>
-                               <td valign="top">
-                                       <xsl:variable 
name="lang_rental_type_statustext"><xsl:value-of 
select="lang_rental_type_statustext"/></xsl:variable>
-                                       <select name="values[rental_type_id]" 
class="forms" onMouseover="window.status='{$lang_rental_type_statustext}'; 
return true;" onMouseout="window.status='';return true;">
-                                               <option value=""><xsl:value-of 
select="lang_select_rental_type"/></option>
-                                               <xsl:apply-templates 
select="rental_type_list"/>
-                                       </select>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="lang_budget_cost"/>
-                               </td>
-                               <td>
-                                       <input type="text" 
name="values[budget_cost]" value="{value_budget_cost}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_budget_cost_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
+                       <xsl:choose>
+                               <xsl:when test="value_id=''">
+                                       <tr>
+                                               <td valign="top">
+                                                       <xsl:value-of 
select="lang_budget_cost"/>
+                                               </td>
+                                               <td>
+                                                       <input type="text" 
name="values[budget_cost]" value="{value_budget_cost}" 
onMouseout="window.status='';return true;">
+                                                               <xsl:attribute 
name="onMouseover">
+                                                                       
<xsl:text>window.status='</xsl:text>
+                                                                               
<xsl:value-of select="lang_budget_cost_statustext"/>
+                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+
                        <tr>
                                <td valign="top">
                                        <xsl:value-of 
select="lang_override_fraction"/>
@@ -1793,7 +1786,7 @@
                                <xsl:variable 
name="update_action"><xsl:value-of select="update_action"/></xsl:variable>
                                <form method="post" name="form2" 
action="{$update_action}">
                                        <input type="hidden" 
name="values[agreement_id]" value="{value_r_agreement_id}" ></input>
-                                       <input type="hidden" 
name="values[item_id]" value="{value_id}" ></input>
+                                       <input type="hidden" 
name="values[common_id]" value="{value_id}" ></input>
                                        <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
                                                <xsl:call-template 
name="table_header"/>
                                                <xsl:call-template 
name="values2"/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]