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: Mon, 20 Feb 2006 14:02:45 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/02/20 14:02:45

Modified files:
        inc            : class.bor_agreement.inc.php 
                         class.sor_agreement.inc.php 
                         class.uir_agreement.inc.php 
        setup          : tables_current.inc.php tables_update.inc.php 
        templates/base : r_agreement.xsl 
        templates/default: r_agreement.xsl 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bor_agreement.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sor_agreement.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uir_agreement.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_current.inc.php.diff?tr1=1.45&tr2=1.46&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_update.inc.php.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/r_agreement.xsl.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/default/r_agreement.xsl.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: property/inc/class.bor_agreement.inc.php
diff -u property/inc/class.bor_agreement.inc.php:1.6 
property/inc/class.bor_agreement.inc.php:1.7
--- property/inc/class.bor_agreement.inc.php:1.6        Sat Feb 18 11:25:46 2006
+++ property/inc/class.bor_agreement.inc.php    Mon Feb 20 14:02:45 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.6 2006/02/18 11:25:46 
sigurdne Exp $
+       * @version $Id: class.bor_agreement.inc.php,v 1.7 2006/02/20 14:02:45 
sigurdne Exp $
        */
 
        /**
@@ -550,6 +550,16 @@
                function save_item($values,$values_attribute='')
                {
 
+                       if($values['start_date'])
+                       {
+                               $values['start_date']   = 
$this->bocommon->date_to_timestamp($values['start_date']);
+                       }
+                       
+                       if($values['start_date'])
+                       {
+                               $values['end_date']     = 
$this->bocommon->date_to_timestamp($values['end_date']);
+                       }
+
                        while (is_array($values['location']) && list(,$value) = 
each($values['location']))
                        {
                                if($value)
@@ -791,11 +801,21 @@
 
                function save_common($values)
                {
-                       if ($values['id'])
+                       if($values['start_date'])
                        {
-                               if ($values['id'] != 0)
+                               $values['start_date']   = 
$this->bocommon->date_to_timestamp($values['start_date']);
+                       }
+                       
+                       if($values['start_date'])
+                       {
+                               $values['end_date']     = 
$this->bocommon->date_to_timestamp($values['end_date']);
+                       }
+
+                       if ($values['c_id'])
+                       {
+                               if ($values['c_id'] != 0)
                                {
-                                       
$receipt=$this->so->edit_common($values);
+                                       
$receipt=$this->so->add_common_history($values);
                                }
                        }
                        else
@@ -804,6 +824,10 @@
                        }
                        return $receipt;
                }
+               function delete_common_h($r_agreement_id,$c_id,$id)
+               {
+                       $this->so->delete_common_h($r_agreement_id,$c_id,$id);
+               }
 
 
        }
Index: property/inc/class.sor_agreement.inc.php
diff -u property/inc/class.sor_agreement.inc.php:1.9 
property/inc/class.sor_agreement.inc.php:1.10
--- property/inc/class.sor_agreement.inc.php:1.9        Sun Feb 19 16:40:42 2006
+++ property/inc/class.sor_agreement.inc.php    Mon Feb 20 14:02:45 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.9 2006/02/19 16:40:42 
sigurdne Exp $
+       * @version $Id: class.sor_agreement.inc.php,v 1.10 2006/02/20 14:02:45 
sigurdne Exp $
        */
 
        /**
@@ -1626,7 +1626,7 @@
 
                function request_next_id()
                {
-                       $this->db->query("SELECT max(id) as id FROM 
fm_r_agreement");
+                       $this->db->query("SELECT max(id) as id FROM 
fm_r_agreement",__LINE__,__FILE__);
                        $this->db->next_record();
                        $next_id= $this->db->f('id')+1;
                        return $next_id;
@@ -1640,41 +1640,55 @@
                        $vals[] = $values['b_account'];
                        $cols[] = 'remark';
                        $vals[] = $this->db->db_addslashes($values['remark']);
-//                     $cols[] = 'rental_type_id';
-//                     $vals[] = $values['rental_type_id'];
-                       
 
                        $cols   = "," . implode(",", $cols);
                        $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
 
                        $this->db->transaction_begin();
-                       $id = 
$this->bocommon->next_id($table,array('agreement_id'=>$values['r_agreement_id']));
+                       $c_id = 
$this->bocommon->next_id($table,array('agreement_id'=>$values['r_agreement_id']));
 
                        $this->db->query("INSERT INTO $table 
(id,agreement_id,entry_date,user_id $cols) "
-                               . "VALUES ($id," . $values['r_agreement_id'] 
."," . time()
-                               . "," . $this->account . " $vals)");
+                               . "VALUES ($c_id," . $values['r_agreement_id'] 
."," . time()
+                               . "," . $this->account . " 
$vals)",__LINE__,__FILE__);
 
-                       $this->db->query("SELECT start_date, end_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'],__LINE__,__FILE__);
                        $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
+                       if ($values['start_date'])
+                       {
+                               $start_date = $values['start_date'];
+                               if ($start_date < $this->db->f('start_date'))
+                               {
+                                       $start_date     = 
$this->db->f('start_date');
+                               }
+                       }
+                       else
                        {
-                               $start_date = time();
+                               $start_date     = $this->db->f('start_date');
                        }
 
-                       if($end_date > mktime(0, 0, 0, 12, 32, date(Y))) // 
next year
+                       if ($values['end_date'])
                        {
-                               $end_date = mktime(0, 0, 0, 12, 31, date(Y)); 
// last day of this year
+                               $end_date = $values['end_date'];
                        }
+                       else
+                       {
+
+                               $end_date = $this->db->f('end_date');
+_debug_array($end_date);
+                               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,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']) .")");
+                               . "VALUES (" . $values['r_agreement_id'] . "," 
. $c_id .",1,1," . $this->floatval($values['budget_cost']) . "," . $start_date 
. "," . $end_date
+                               . "," . $this->account . "," . 
$this->floatval($values['override_fraction']) .")",__LINE__,__FILE__);
 
                        $receipt['r_agreement_id']= $values['r_agreement_id'];
-                       $receipt['id']= $id;
+                       $receipt['c_id']= $c_id;
 
                        $receipt['message'][] = array('msg'=>lang('r_agreement 
%1 has been saved',$receipt['r_agreement_id']));
 
@@ -1682,15 +1696,67 @@
                        return $receipt;
                }
 
+               function add_common_history($values)
+               {
+                       $table = 'fm_r_agreement_c_history';
+
+                       $this->db->transaction_begin();
+                       $id = 
$this->bocommon->next_id($table,array('agreement_id'=>$values['r_agreement_id'],'c_id'
 =>$values['c_id']));
 
-               function read_common($id)
+                       $this->db->query("SELECT from_date, to_date FROM $table 
WHERE agreement_id=" . $values['r_agreement_id'] . " AND c_id=" . 
$values['c_id'] . " AND id =" .($id-1),__LINE__,__FILE__);
+                       $this->db->next_record();
+                       if ($values['start_date'])
+                       {
+                               $start_date = $values['start_date'];
+                               if($start_date < $this->db->f('to_date')) 
+                               {
+                                       $start_date = $this->db->f('to_date') + 
(3600 * 24);
+                               }
+                       }
+                       else
+                       {
+                               $start_date     = $this->db->f('to_date') + 
(3600 * 24);
+                       }
+
+                       if ($values['end_date'])
+                       {
+                               $end_date = $values['end_date'];
+                       }
+                       else
+                       {
+                               $end_date       = $this->db->f('to_date');
+                               
+                               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,to_date,user_id,override_fraction)
 "
+                               . "VALUES (" . $values['r_agreement_id'] . "," 
. $values['c_id'] . "," . $id .",1," . $this->floatval($values['budget_cost']) 
. "," . $start_date . "," . $end_date
+                               . "," . $this->account . "," . 
$this->floatval($values['override_fraction']) .")",__LINE__,__FILE__);
+
+                       
+                       $this->db->query("UPDATE fm_r_agreement_c_history set 
current_record = NULL WHERE agreement_id =" . $values['r_agreement_id'] . 'AND 
c_id=' . $values['c_id'] . 'AND id=' . ($id-1),__LINE__,__FILE__);
+                       $receipt['r_agreement_id']= $values['r_agreement_id'];
+                       $receipt['c_id']= $values['c_id'];
+
+                       $receipt['message'][] = array('msg'=>lang('r_agreement 
%1 has been saved',$receipt['r_agreement_id']));
+
+                       $this->db->transaction_commit();
+                       return $receipt;
+               }
+
+
+               function read_common($agreement_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";
+                       . " WHERE  fm_r_agreement_common.agreement_id = 
$agreement_id AND current_record = 1 ORDER BY fm_r_agreement_c_history.c_id 
ASC";
                
                        $this->db->query($sql,__LINE__,__FILE__);
 
@@ -1700,8 +1766,8 @@
                        {
                                $common[] = array
                                (
-                                       'agreement_id'  => $id,
-                                       'common_id'     => $this->db->f('c_id'),
+                                       'agreement_id'  => $agreement_id,
+                                       'c_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'),
@@ -1720,19 +1786,19 @@
                function read_single_common($data)
                {
                        $r_agreement_id =$data['r_agreement_id'];
-                       $id =$data['common_id'];
+                       $id =$data['c_id'];
 
-                       $this->db->query("SELECT * FROM fm_r_agreement_common 
WHERE agreement_id=$r_agreement_id AND id=$id");
+                       $this->db->query("SELECT * FROM fm_r_agreement_common 
WHERE agreement_id=$r_agreement_id AND id=$id",__LINE__,__FILE__);
 
                        if($this->db->next_record())
                        {
                                $common = array
                                (
                                        'agreement_id'  => $r_agreement_id,
-                                       'id'                    => $id,
+                                       'c_id'          => $id,
                                        'b_account_id'  => 
$this->db->f('b_account'),
                                        'remark'        => 
stripslashes($this->db->f('remark')),
-                                       'override_fraction'             => 
$this->db->f('override_fraction')
+                                       'override_fraction'     => 
$this->db->f('override_fraction')
                                );
                        }
                        return $common;
@@ -1743,7 +1809,7 @@
                        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);
+                               $c_id   = 
(isset($data['c_id'])?$data['c_id']:0);
                        }
                        
                        $table = 'fm_r_agreement_common';
@@ -1753,7 +1819,7 @@
                        . " 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 = 
$r_agreement_id AND c_id=$common_id ORDER BY fm_r_agreement_c_history.c_id ASC";
+                       . " WHERE  fm_r_agreement_common.agreement_id = 
$r_agreement_id AND c_id=$c_id ORDER BY fm_r_agreement_c_history.c_id ASC";
                
                        $this->db->query($sql,__LINE__,__FILE__);
 
@@ -1764,7 +1830,7 @@
                                $common[] = array
                                (
                                        'agreement_id'  => $id,
-                                       'common_id'     => $this->db->f('c_id'),
+                                       'c_id'          => $this->db->f('c_id'),
                                        'id'            => $this->db->f('id'),
                                        'b_account_id'  => 
$this->db->f('b_account'),
                                        'from_date'     => 
$this->db->f('from_date'),
@@ -1779,5 +1845,13 @@
                        return $common;
                }
 
+               function delete_common_h($r_agreement_id,$c_id,$id)
+               {
+                       $this->db->transaction_begin();
+                       $this->db->query("DELETE FROM fm_r_agreement_c_history 
WHERE agreement_id=$r_agreement_id AND c_id=$c_id AND 
id=$id",__LINE__,__FILE__);
+                       $this->db->transaction_commit();
+               }
+
+
        }
 ?>
Index: property/inc/class.uir_agreement.inc.php
diff -u property/inc/class.uir_agreement.inc.php:1.10 
property/inc/class.uir_agreement.inc.php:1.11
--- property/inc/class.uir_agreement.inc.php:1.10       Sun Feb 19 16:40:42 2006
+++ property/inc/class.uir_agreement.inc.php    Mon Feb 20 14:02:45 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.10 2006/02/19 16:40:42 
sigurdne Exp $
+       * @version $Id: class.uir_agreement.inc.php,v 1.11 2006/02/20 14:02:45 
sigurdne Exp $
        */
 
        /**
@@ -39,7 +39,8 @@
                        'view_item'             => True,
                        'view_file'             => True,
                        'excel'                 => True,
-                       'edit_common'           => True
+                       'edit_common'           => True,
+                       'delete_common_h'       => True
                );
 
                function uir_agreement()
@@ -716,8 +717,6 @@
 
                                $values_common = $this->bo->read_common($id);
 
-
-
                                if (isSet($values_common) AND 
is_array($values_common))
                                {
                                        foreach($values_common as $common_entry)
@@ -725,19 +724,19 @@
 
                                                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']);
+                                                       $link_edit = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common&r_agreement_id='
 . $common_entry['agreement_id'] . '&c_id=' . $common_entry['c_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']);
+                                                       $link_delete = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.delete_common&r_agreement_id='
 . $common_entry['agreement_id'] . '&c_id=' . $common_entry['c_id']);
                                                        $text_delete            
=lang('delete');
                                                }
 
                                                $content_common[] = array
                                                (
                                                        'agreement_id'          
                => $common_entry['agreement_id'],
-                                                       'common_id'             
                        => $common_entry['common_id'],
+                                                       'c_id'                  
                => $common_entry['c_id'],
                                                        'b_account_id'          
                => $common_entry['b_account_id'],
                                                        'from_date'             
                        => $common_entry['from_date'],
                                                        'to_date'               
                        => $common_entry['to_date'],
@@ -746,7 +745,7 @@
                                                        '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_view'             
                        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.view&agreement_id='
 . $common_entry['agreement_id'] . '&c_id=' . $common_entry['c_id']),
                                                        'link_edit'             
                        => $link_edit,
                                                        'link_delete'           
                => $link_delete,
                                                        'lang_view_statustext'  
        => lang('view the p_of_town'),
@@ -1073,6 +1072,9 @@
                                if ($values['save'] || $values['apply']):
                                {
                                        $values['tenant_id']            = 
get_var('tenant_id',array('POST'));
+                                       $values['start_date']           = 
get_var('start_date',array('POST'));
+                                       $values['end_date']             = 
get_var('end_date',array('POST'));
+
                                        if(!$receipt['error'])
                                        {
                                                $values['r_agreement_id']       
= $r_agreement_id;
@@ -1131,6 +1133,7 @@
                        }
 
                        $r_agreement = 
$this->bo->read_single(array('r_agreement_id'=>$r_agreement_id));
+                       $default_next_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$this->bocommon->date_to_timestamp($r_agreement['start_date']));
                        $values = 
$this->bo->read_single_item(array('r_agreement_id'=>$r_agreement_id,'id'=>$id));
 
 
@@ -1189,6 +1192,11 @@
                        if($id)
                        {
                                $list = 
$this->bo->read_prizing(array('r_agreement_id'=>$r_agreement_id,'item_id'=>$id));
+                               $lookup_type='view';
+                       }
+                       else
+                       {
+                               $lookup_type='form';                    
                        }
 
                        $uicols         = $this->bo->uicols;
@@ -1217,8 +1225,6 @@
                        );
 
 
-                       $lookup_type='form';
-
                        $max_location_level = 
$this->bocommon->get_max_location_level();
 //_debug_array($values);
                        $location_data=$bolocation->initiate_ui_location(array(
@@ -1296,6 +1302,13 @@
                                'lang_rental_type_statustext'   => lang('Select 
rental type'),
                                'lang_select_rental_type'               => 
lang('Select rental type'),
                                'lang_rental_type'                              
=> lang('Rental type'),
+                               'lang_start_date_statustext'                    
=> lang('Choose the start date for the next period'),
+                               'lang_end_date_statustext'                      
=> lang('Choose the end date for the next period'),
+                               'lang_start_date'                               
=> lang('start date'),
+                               'value_start_date'                              
=> $default_next_date,
+                               'lang_end_date'                         => 
lang('end date'),
+//                             'value_end_date'                                
=> $r_agreement['start_date'],
+
                        );
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('rental agreement') . ': ' . ($values['id']?lang('edit item') . ' ' . 
$r_agreement['name']:lang('add item') . ' ' . $r_agreement['name']);
@@ -1918,12 +1931,12 @@
                function edit_common()
                {
                        $r_agreement_id = 
get_var('r_agreement_id',array('POST','GET'));
-                       $id     = get_var('id',array('POST','GET'));
+                       $c_id   = get_var('c_id',array('POST','GET'));
                        $values         = get_var('values',array('POST'));
 /*                     $delete_last    = get_var('delete_last',array('GET'));
                        if($delete_last)
                        {
-                               
$this->bo->delete_last_index($r_agreement_id,$id);
+                               
$this->bo->delete_last_index($r_agreement_id,$c_id);
                        }
 
 */
@@ -1939,10 +1952,13 @@
                                        if(!$receipt['error'])
                                        {
                                                $values['r_agreement_id']       
= $r_agreement_id;
-                                               $values['id']   = $id;
+                                               $values['c_id'] = $c_id;
+                                               $values['start_date']           
= get_var('start_date',array('POST'));
+                                               $values['end_date']             
        = get_var('end_date',array('POST'));
+
                                                $receipt = 
$this->bo->save_common($values);
                                                $r_agreement_id = 
$receipt['r_agreement_id'];
-                                               $id                     = 
$receipt['id'];
+                                               $c_id                   = 
$receipt['c_id'];
                                                if ($values['save'])
                                                {
                                                        
$GLOBALS['phpgw']->session->appsession('session_data','r_agreement_receipt',$receipt);
@@ -1978,10 +1994,13 @@
 
                        $r_agreement = 
$this->bo->read_single(array('r_agreement_id'=>$r_agreement_id));
 
-                       if($id)
+                       $default_next_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$this->bocommon->date_to_timestamp($r_agreement['start_date']));
+                       
+                       if($c_id)
                        {
-                               $values = 
$this->bo->read_single_common(array('r_agreement_id'=>$r_agreement_id,'common_id'=>$id));
-                               $values_common = 
$this->bo->read_common_history(array('r_agreement_id'=>$r_agreement_id,'common_id'=>$id));
+                               $values = 
$this->bo->read_single_common(array('r_agreement_id'=>$r_agreement_id,'c_id'=>$c_id));
+                               $values_common = 
$this->bo->read_common_history(array('r_agreement_id'=>$r_agreement_id,'c_id'=>$c_id));
+
 
 
                                if (isSet($values_common) AND 
is_array($values_common))
@@ -1991,35 +2010,34 @@
 
                                                if($this->acl_edit)
                                                {
-                                                       $link_edit = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common_h&r_agreement_id='
 . $common_entry['agreement_id'] . '&common_id=' . $common_entry['common_id'] . 
'&id=' . $common_entry['id']);
+                                                       $link_edit = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common_h&r_agreement_id='
 . $r_agreement_id . '&c_id=' . $common_entry['c_id'] . '&id=' . 
$common_entry['id']);
                                                        $text_edit              
        = lang('edit');
                                                }
                                                if($this->acl_delete)
                                                {
-                                                       $link_delete = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.delete_common_h&r_agreement_id='
 . $common_entry['agreement_id'] . '&common_id=' . $common_entry['common_id'] . 
'&id=' . $common_entry['id']);
+                                                       $link_delete = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.delete_common_h&r_agreement_id='
 . $r_agreement_id . '&c_id=' . $common_entry['c_id'] . '&id=' . 
$common_entry['id']);
                                                        $text_delete            
=lang('delete');
                                                }
 
                                                $content_common[] = array
                                                (
-                                               //      'agreement_id'          
                => $common_entry['agreement_id'],
                                                        'id'                    
                => $common_entry['id'],
                                                        'b_account_id'          
                => $common_entry['b_account_id'],
-                                                       'from_date'             
                        => $common_entry['from_date'],
-                                                       'to_date'               
                        => $common_entry['to_date'],
+                                                       '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'],
+                                                       '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_common_h&agreement_id='
 . $common_entry['agreement_id'] . '&common_id=' . $common_entry['common_id'] . 
'&id=' . $common_entry['id']),
-                                                       'link_edit'             
                        => $link_edit,
+                                                       'remark'                
                => $common_entry['remark'],
+                                                       'link_view'             
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.view_common_h&agreement_id='
 . $r_agreement_id . '&c_id=' . $common_entry['c_id'] . '&id=' . 
$common_entry['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,
+                                                       '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
                                                );
                                                
@@ -2027,6 +2045,7 @@
                                                unset($link_delete);
                                                unset($text_edit);
                                                unset($text_delete);
+                                               $default_next_date = 
$common_entry['to_date'];
                                        }
                                }
 
@@ -2051,13 +2070,14 @@
 
                                $lookup_type='view';
 
+                               $default_next_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$this->bocommon->date_to_timestamp($default_next_date)
 + 3600*24);
                        }
 
                        $link_data = array
                        (
                                'menuaction'            => 
$this->currentapp.'.uir_agreement.edit_common',
                                'r_agreement_id'        => $r_agreement_id,
-                               'id'                            => $id,
+                               'c_id'                          => $c_id,
                        );
 
 
@@ -2094,44 +2114,17 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       $table_add[] = array
-                       (
-                               'lang_add'                              => 
lang('add detail'),
-                               'lang_add_standardtext' => lang('add a common 
budget account'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common&r_agreement_id='
 . $r_agreement_id)
-                       );
-
-
-                       $table_update[] = array
-                       (
-                               'jsDateFormat'                  => 
$jsDateFormat,
-                               'date_img'                      => 
$cal_info['img'],
-                               'lang_datetitle'                => lang('Select 
date'),
-                               'calendar_setup'                => 
"Calendar.setup({inputField  : 'date',ifFormat  : '" . $jsDateFormat . 
"',button : 'date-trigger'});",
-
-                               'lang_new_index'                => lang('New 
index'),
-                               'lang_new_index_statustext'     => lang('Enter 
a new index'),
-                               'lang_date_statustext'          => lang('Select 
the date for the update'),
-                               'lang_update'                   => 
lang('Update'),
-                               'lang_update_statustext'        => lang('update 
selected investments')
-                       );
-
-
-                       $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'],
                                                'type'                          
=>$lookup_type));
 
-
                        $data = array
                        (
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'edit_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_id'                                       
        => lang('ID'),
-                               'value_id'                                      
        => $values['id'],
+                               'value_id'                                      
        => $values['c_id'],
                                'value_r_agreement_id'                  => 
$r_agreement_id,
                                'lang_category'                                 
=> lang('category'),
                                'lang_save'                                     
        => lang('save'),
@@ -2150,7 +2143,7 @@
                                'dateformat'                                    
=> $dateformat,
 
                                'jsDateFormat'                                  
=> $jsDateFormat,
-                               'date_img'                                      
        => $cal_info['img'],
+                               'date_img'                                      
=> $cal_info['img'],
                                'lang_datetitle'                                
=> lang('Select date'),
                                'calendar_setup_start'                  => 
"Calendar.setup({inputField  : 'start_date',ifFormat  : '" . $jsDateFormat . 
"',button : 'start_date-trigger'});",
                                'calendar_setup_end'                    => 
"Calendar.setup({inputField  : 'end_date',ifFormat  : '" . $jsDateFormat . 
"',button : 'end_date-trigger'});",
@@ -2158,20 +2151,11 @@
                                'lang_agreement'                                
=> lang('Agreement'),
                                'agreement_name'                                
=> $r_agreement['name'],
 
-                               'table_add'                                     
        => $table_add,
-                               'acl_manage'                                    
=> $this->acl_manage,
-                               'table_update'                                  
=> $table_update,
-                               'update_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common&r_agreement_id='
 . $r_agreement_id . '&id=' . $id),
-                               'lang_select_all'                               
=> lang('Select All'),
-                               'img_check'                                     
        => 
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
-                               'check_source'                                  
=> './'.$this->currentapp.'/inc/check.js',
 
-                               'lang_budget_cost'                              
                => lang('budget cost'),
+                               'lang_budget_cost'                      => 
lang('budget cost'),
                                'lang_cost_statustext'                  => 
lang('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,
                                'lang_remark'                                   
=> lang('Remark'),
                                'lang_override_fraction'                => 
lang('Override fraction'),
@@ -2180,14 +2164,66 @@
                                'value_remark'          => $values['remark'],
                                'values_common_history'                         
        => $content_common,
                                'table_header_common_history'                   
=> $table_header_common,
+                               'lang_start_date_statustext'                    
=> lang('Choose the start date for the next period'),
+                               'lang_end_date_statustext'                      
=> lang('Choose the end date for the next period'),
+                               'lang_start_date'                               
=> lang('start date'),
+                               'value_start_date'                              
=> $default_next_date,
+                               'lang_end_date'                         => 
lang('end date'),
+
+
 
                                
                        );
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('rental agreement') . ': ' . ($values['id']?lang('edit common cost') . ' ' 
. $r_agreement['name']:lang('add common cost') . ' ' . $r_agreement['name']);
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('rental agreement') . ': ' . ($values['c_id']?lang('edit common cost') . ' 
' . $r_agreement['name']:lang('add common cost') . ' ' . $r_agreement['name']);
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_common' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
+
+               function delete_common_h()
+               {
+                       $r_agreement_id = 
get_var('r_agreement_id',array('POST','GET'));
+                       $c_id           = get_var('c_id',array('POST','GET'));
+                       $id             = get_var('id',array('POST','GET'));
+
+                       $delete         = get_var('delete',array('POST'));
+                       $confirm        = get_var('confirm',array('POST'));
+
+                       $link_data = array
+                       (
+                               'menuaction' => 
$this->currentapp.'.uir_agreement.edit_common',
+                               'r_agreement_id'        => $r_agreement_id,
+                               'c_id'                  => $c_id
+                       );
+
+//_debug_array($link_data);
+                       if (get_var('confirm',array('POST')))
+                       {
+                               
$this->bo->delete_common_h($r_agreement_id,$c_id,$id);
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+                       $data = array
+                       (
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.delete_common_h&r_agreement_id='
 . $r_agreement_id. '&c_id=' . $c_id . '&id=' . $id),
+                               'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
+                               'lang_yes'                              => 
lang('yes'),
+                               'lang_yes_statustext'   => lang('Delete the 
entry'),
+                               'lang_no_statustext'    => lang('Back to the 
list'),
+                               'lang_no'                               => 
lang('no')
+                       );
+
+                       $appname                                                
= lang('rental agreement');
+                       $function_msg                                   = 
lang('delete') . ' ' . lang('common history element');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+
+               }
+               
        }
 ?>
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.45 
property/setup/tables_current.inc.php:1.46
--- property/setup/tables_current.inc.php:1.45  Fri Feb 17 14:48:14 2006
+++ property/setup/tables_current.inc.php       Mon Feb 20 14:02:45 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.45 2006/02/17 14:48:14 
sigurdne Exp $
+       * @version $Id: tables_current.inc.php,v 1.46 2006/02/20 14:02:45 
sigurdne Exp $
        */
 
        $phpgw_baseline = array(
@@ -2103,7 +2103,9 @@
                                'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
                                'index_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
-                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True)
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'from_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'to_date' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
                        ),
                        'pk' => array('agreement_id','item_id','id'),
                        'fk' => array(),
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.28 
property/setup/tables_update.inc.php:1.29
--- property/setup/tables_update.inc.php:1.28   Fri Feb 17 14:48:14 2006
+++ property/setup/tables_update.inc.php        Mon Feb 20 14:02:45 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.28 2006/02/17 14:48:14 
sigurdne Exp $
+       * @version $Id: tables_update.inc.php,v 1.29 2006/02/20 14:02:45 
sigurdne Exp $
        */
 
        /**
@@ -955,7 +955,9 @@
                                        'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
                                        'index_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                        'user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                                       'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True)
+                                       'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'from_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'to_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                ),
                                'pk' => array('agreement_id','item_id','id'),
                                'fk' => array(),
Index: property/templates/base/r_agreement.xsl
diff -u property/templates/base/r_agreement.xsl:1.10 
property/templates/base/r_agreement.xsl:1.11
--- property/templates/base/r_agreement.xsl:1.10        Sun Feb 19 16:40:42 2006
+++ property/templates/base/r_agreement.xsl     Mon Feb 20 14:02:45 2006
@@ -795,7 +795,7 @@
                                </xsl:attribute>
 
                                <td align="left">
-                                       <xsl:value-of select="common_id"/>
+                                       <xsl:value-of select="c_id"/>
                                </td>
                                <td align="left">
                                        <xsl:value-of select="b_account_id"/>
@@ -882,9 +882,14 @@
                                                        <xsl:value-of 
select="value_id"/>
                                                </td>
                                        </tr>
+                                       <xsl:call-template 
name="location_view"/>
                                </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:call-template 
name="location_form"/>
+                               </xsl:otherwise>
+
                        </xsl:choose>
-                       <xsl:call-template name="location_form"/>
+
                        <xsl:call-template name="tenant_form"/>
                        <tr>
                                <td valign="top">
@@ -913,6 +918,43 @@
                                </td>
                        </tr>
 
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_start_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="start_date" 
name="start_date" size="10" value="{value_start_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_start_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_start"/>
+                                       </script>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_end_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="end_date" 
name="end_date" size="10" value="{value_end_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_end_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_end"/>
+                                       </script>
+                               </td>
+                       </tr>
+
                        <xsl:choose>
                                <xsl:when test="attributes_values != ''">
                                        <tr>
@@ -1796,25 +1838,26 @@
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:call-template 
name="b_account_form"/>
-                                       <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:otherwise>
                        </xsl:choose>
 
                        <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>
+
+                       <tr>
+                               <td valign="top">
                                        <xsl:value-of 
select="lang_override_fraction"/>
                                </td>
                                <td>
@@ -1828,6 +1871,44 @@
                                </td>
                        </tr>
 
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_start_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="start_date" 
name="start_date" size="10" value="{value_start_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_start_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_start"/>
+                                       </script>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_end_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="end_date" 
name="end_date" size="10" value="{value_end_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_end_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_end"/>
+                                       </script>
+                               </td>
+                       </tr>
+
+
                        <xsl:choose>
                                <xsl:when test="value_id=''">
 
@@ -1889,35 +1970,12 @@
                        </tr>
                </table>
                </form>
-               
                <xsl:choose>
                        <xsl:when test="values_common_history != ''">
-               
-                               <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[common_id]" value="{value_id}" ></input>
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
-
-                       <xsl:apply-templates 
select="table_header_common_history"/>
-                       <xsl:apply-templates select="values_common_history"/>
-
-                                       </table>
-                                       <table width="70%" cellpadding="2" 
cellspacing="2" align="center">
-                                       <xsl:choose>
-                                               <xsl:when 
test="table_update!=''">
-                                                       <xsl:apply-templates 
select="table_update"/>
-                                               </xsl:when>
-                                       </xsl:choose>
-                                               <tr>
-                                                       <td></td><td></td>
-                                                       <td class="small_text" 
align="left">
-                                                               <a 
href="{delete_action}" 
onMouseover="window.status='{lang_delete_last_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="lang_delete_last"/></a>
-                                                       </td>
-                                               </tr>
-
-                                       </table>
-                               </form>
+                               <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                       <xsl:apply-templates 
select="table_header_common_history"/>
+                                       <xsl:apply-templates 
select="values_common_history"/>
+                               </table>        
                        </xsl:when>
                </xsl:choose>
                </div>
Index: property/templates/default/r_agreement.xsl
diff -u property/templates/default/r_agreement.xsl:1.4 
property/templates/default/r_agreement.xsl:1.5
--- property/templates/default/r_agreement.xsl:1.4      Tue Feb 14 14:45:50 2006
+++ property/templates/default/r_agreement.xsl  Mon Feb 20 14:02:45 2006
@@ -19,6 +19,9 @@
                        <xsl:when test="edit_attrib">
                                <xsl:apply-templates select="edit_attrib"/>
                        </xsl:when>
+                       <xsl:when test="edit_common">
+                               <xsl:apply-templates select="edit_common"/>
+                       </xsl:when>
                        <xsl:otherwise>
                                <xsl:apply-templates select="list"/>
                        </xsl:otherwise>
@@ -366,7 +369,7 @@
                <table cellpadding="2" cellspacing="2" align="center">
                        <tr><td>
                <form ENCTYPE="multipart/form-data" method="post" name="form" 
action="{$edit_url}">
-               <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
+               <table cellpadding="2" cellspacing="2" width="79%" align="left">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -696,7 +699,13 @@
                </xsl:choose>                                           
                </td>
                </tr>
+
+
                <tr>
+                       <xsl:attribute name="class">
+                               <xsl:text>row_on</xsl:text>
+                       </xsl:attribute>
+                       
                        <td class="th_text" align="left" colspan="5">
                        <HR/>
                                <xsl:value-of select="lang_service"/>
@@ -705,16 +714,126 @@
                        <xsl:apply-templates select="table_add_service"/>
 
                <tr>
-                       <td class="th_text" align="left" colspan="5">
+                       <xsl:attribute name="class">
+                               <xsl:text>row_on</xsl:text>
+                       </xsl:attribute>
+
+                       <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="c_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">
@@ -763,9 +882,14 @@
                                                        <xsl:value-of 
select="value_id"/>
                                                </td>
                                        </tr>
+                                       <xsl:call-template 
name="location_view"/>
                                </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:call-template 
name="location_form"/>
+                               </xsl:otherwise>
+
                        </xsl:choose>
-                       <xsl:call-template name="location_form"/>
+
                        <xsl:call-template name="tenant_form"/>
                        <tr>
                                <td valign="top">
@@ -794,6 +918,43 @@
                                </td>
                        </tr>
 
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_start_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="start_date" 
name="start_date" size="10" value="{value_start_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_start_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_start"/>
+                                       </script>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_end_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="end_date" 
name="end_date" size="10" value="{value_end_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_end_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_end"/>
+                                       </script>
+                               </td>
+                       </tr>
+
                        <xsl:choose>
                                <xsl:when test="attributes_values != ''">
                                        <tr>
@@ -804,6 +965,9 @@
                                </xsl:when>
                        </xsl:choose>
                        <tr height="50">
+                       <td colspan = '2'>
+                       <table>
+                       <tr>
                                <td valign="bottom">
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
                                        <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
@@ -835,6 +999,9 @@
                                        </input>
                                </td>
                        </tr>
+                       </table>
+                       </td>
+                       </tr>
                </table>
                </form>
                
@@ -1618,6 +1785,295 @@
                </div>
        </xsl:template>
 
+
+<!-- add common / edit common -->
+
+       <xsl:template match="edit_common">
+               <xsl:variable name="dateformat_source"><xsl:value-of 
select="dateformat_source"/></xsl:variable>
+               <SCRIPT LANGUAGE="JavaScript" 
SRC="{$dateformat_source}"></SCRIPT>
+
+               <script language="JavaScript">
+                       self.name="first_Window";
+                       <xsl:value-of select="lookup_functions"/>
+               </script>
+               <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
+               <div align="left">
+               <form name="form" method="post" action="{$edit_url}">
+               <table cellpadding="2" cellspacing="2" width="100%" 
align="center">
+                       <xsl:choose>
+                               <xsl:when test="msgbox_data != ''">
+                                       <tr>
+                                               <td align="left" colspan="3">
+                                                       <xsl:call-template 
name="msgbox"/>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+                       <xsl:choose>
+                               <xsl:when test="value_r_agreement_id!=''">
+                                       <tr >
+                                               <td align="left">
+                                                       <xsl:value-of 
select="lang_agreement"/>
+                                               </td>
+                                               <td align="left">
+                                                       <xsl:value-of 
select="value_r_agreement_id"/>
+                                                       <xsl:text> [</xsl:text>
+                                                       <xsl:value-of 
select="agreement_name"/>
+                                                       <xsl:text>] </xsl:text>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+                       <xsl:choose>
+                               <xsl:when test="value_id!=''">
+                                       <tr >
+                                               <td align="left">
+                                                       <xsl:value-of 
select="lang_id"/>
+                                               </td>
+                                               <td align="left">
+                                                       <xsl:value-of 
select="value_id"/>
+                                               </td>
+                                       </tr>
+                                       <xsl:call-template 
name="b_account_view"/>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:call-template 
name="b_account_form"/>
+                               </xsl:otherwise>
+                       </xsl:choose>
+
+                       <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>
+
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_override_fraction"/>
+                               </td>
+                               <td>
+                                       <input type="text" 
name="values[override_fraction]" value="{value_override_fraction}" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_override_fraction_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_start_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="start_date" 
name="start_date" size="10" value="{value_start_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_start_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_start"/>
+                                       </script>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_end_date"/>
+                               </td>
+                               <td>
+                                       <input type="text" id="end_date" 
name="end_date" size="10" value="{value_end_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_end_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <script type="text/javascript">
+                                       document.writeln('<img 
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;"/>');
+                                       <xsl:value-of 
select="calendar_setup_end"/>
+                                       </script>
+                               </td>
+                       </tr>
+
+
+                       <xsl:choose>
+                               <xsl:when test="value_id=''">
+
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_remark"/>
+                                       </td>
+                                       <td>
+                                               <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
+                                                       <xsl:attribute 
name="onMouseover">
+                                                               
<xsl:text>window.status='</xsl:text>
+                                                                       
<xsl:value-of select="lang_remark_statustext"/>
+                                                               <xsl:text>'; 
return true;</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="value_remark"/>           
+                                               </textarea>
+                                       </td>
+                               </tr>
+                               </xsl:when>
+                       </xsl:choose>
+
+                       <tr height="50">
+                       <td colspan = '2'>
+                       <table>
+                       <tr>
+                               <td valign="bottom">
+                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_save_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                               <td valign="bottom">
+                                       <xsl:variable 
name="lang_apply"><xsl:value-of select="lang_apply"/></xsl:variable>
+                                       <input type="submit" 
name="values[apply]" value="{$lang_apply}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_apply_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                               <td align="right" valign="bottom">
+                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+                                       <input type="submit" 
name="values[cancel]" value="{$lang_cancel}" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_cancel_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+                       </table>
+                       </td>
+                       </tr>
+               </table>
+               </form>
+               <xsl:choose>
+                       <xsl:when test="values_common_history != ''">
+                               <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                       <xsl:apply-templates 
select="table_header_common_history"/>
+                                       <xsl:apply-templates 
select="values_common_history"/>
+                               </table>        
+                       </xsl:when>
+               </xsl:choose>
+               </div>
+       </xsl:template>
+
+
+       <xsl:template match="table_header_common_history">              
+                       <tr class="th">
+                               <td width="10%" align="right">
+                                       <xsl:value-of select="lang_id"/>
+                               </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_history">
+               <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="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>
+
+
+
 <!-- datatype_list --> 
 
        <xsl:template match="datatype_list">




reply via email to

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