phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


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

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

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

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bor_agreement.inc.php.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sor_agreement.inc.php.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uir_agreement.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/setup.inc.php.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_current.inc.php.diff?tr1=1.43&tr2=1.44&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_update.inc.php.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/r_agreement.xsl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: property/inc/class.bor_agreement.inc.php
diff -u property/inc/class.bor_agreement.inc.php:1.3 
property/inc/class.bor_agreement.inc.php:1.4
--- property/inc/class.bor_agreement.inc.php:1.3        Tue Feb 14 14:45:50 2006
+++ property/inc/class.bor_agreement.inc.php    Thu Feb 16 14:48: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.3 2006/02/14 14:45:50 
sigurdne Exp $
+       * @version $Id: class.bor_agreement.inc.php,v 1.4 2006/02/16 14:48:45 
sigurdne Exp $
        */
 
        /**
@@ -752,5 +752,34 @@
 
                        return $rental_type[$selected];
                }
+               function read_single_common($data)
+               {
+                       $values = $this->so->read_single_common($data);
+
+                       return $values;
+               }
+               function read_common_list($data)
+               {
+
+                       return ;
+               }
+
+               function save_common($values)
+               {
+                       if ($values['id'])
+                       {
+                               if ($values['id'] != 0)
+                               {
+                                       
$receipt=$this->so->edit_common($values);
+                               }
+                       }
+                       else
+                       {
+                               $receipt = $this->so->add_common($values);
+                       }
+                       return $receipt;
+               }
+
+
        }
 ?>
Index: property/inc/class.sor_agreement.inc.php
diff -u property/inc/class.sor_agreement.inc.php:1.4 
property/inc/class.sor_agreement.inc.php:1.5
--- property/inc/class.sor_agreement.inc.php:1.4        Tue Feb 14 14:45:50 2006
+++ property/inc/class.sor_agreement.inc.php    Thu Feb 16 14:48: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.4 2006/02/14 14:45:50 
sigurdne Exp $
+       * @version $Id: class.sor_agreement.inc.php,v 1.5 2006/02/16 14:48:45 
sigurdne Exp $
        */
 
        /**
@@ -1631,5 +1631,71 @@
                        $next_id= $this->db->f('id')+1;
                        return $next_id;
                }
+
+               function add_common($values)
+               {
+                       $table = 'fm_r_agreement_common';
+
+                       $cols[] = 'b_account';
+                       $vals[] = $values['b_account'];
+                       $cols[] = 'remark';
+                       $vals[] = $this->db->db_addslashes($values['remark']);
+//                     $cols[] = 'rental_type_id';
+//                     $vals[] = $values['rental_type_id'];
+                       
+                       $cols[] = 'override_fraction';
+                       $vals[] = $this->floatval($values['override_fraction']);
+
+                       $cols   = "," . implode(",", $cols);
+                       $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
+
+                       $this->db->transaction_begin();
+                       $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)");
+
+                       $this->db->query("SELECT start_date FROM fm_r_agreement 
WHERE id=" . $values['r_agreement_id']);
+                       $this->db->next_record();
+                       $start_date     = $this->db->f('start_date');
+
+
+                       $this->db->query("INSERT INTO fm_r_agreement_c_history 
(agreement_id,c_id,id,current_record,budget_cost,from_date,entry_date,user_id) "
+                               . "VALUES (" . $values['r_agreement_id'] . "," 
. $id .",1,1," . $this->floatval($values['budget_cost']) . "," . 
(int)$start_date . "," . time()
+                               . "," . $this->account . ")");
+
+                       $receipt['r_agreement_id']= $values['r_agreement_id'];
+                       $receipt['id']= $id;
+
+                       $receipt['message'][] = array('msg'=>lang('r_agreement 
%1 has been saved',$receipt['r_agreement_id']));
+
+                       $this->db->transaction_commit();
+                       return $receipt;
+               }
+
+
+               function read_single_common($data)
+               {
+                       $r_agreement_id =$data['r_agreement_id'];
+                       $id =$data['common_id'];
+
+                       $this->db->query("SELECT * FROM fm_r_agreement_common 
WHERE agreement_id=$r_agreement_id AND id=$id");
+
+                       if($this->db->next_record())
+                       {
+                               $common = array
+                               (
+                                       'agreement_id'  => $r_agreement_id,
+                                       'id'                    => $id,
+                                       'b_account_id'  => 
$this->db->f('b_account'),
+                                       'input_text'    => 
stripslashes($this->db->f('input_text')),
+                                       'statustext'    => 
stripslashes($this->db->f('statustext')),
+                                       'datatype'              => 
$this->db->f('datatype')
+                               );
+                       }
+                       return $common;
+               }       
+               
        }
 ?>
Index: property/inc/class.uir_agreement.inc.php
diff -u property/inc/class.uir_agreement.inc.php:1.5 
property/inc/class.uir_agreement.inc.php:1.6
--- property/inc/class.uir_agreement.inc.php:1.5        Wed Feb 15 19:39:22 2006
+++ property/inc/class.uir_agreement.inc.php    Thu Feb 16 14:48: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.5 2006/02/15 19:39:22 
sigurdne Exp $
+       * @version $Id: class.uir_agreement.inc.php,v 1.6 2006/02/16 14:48:45 
sigurdne Exp $
        */
 
        /**
@@ -1104,7 +1104,7 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> True,link_data => array()));
+       //              $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> True,link_data => array()));
 
                        $table_add[] = array
                        (
@@ -1848,94 +1848,35 @@
                        $r_agreement_id = 
get_var('r_agreement_id',array('POST','GET'));
                        $id     = get_var('id',array('POST','GET'));
                        $values         = get_var('values',array('POST'));
-                       $delete_last    = get_var('delete_last',array('GET'));
+/*                     $delete_last    = get_var('delete_last',array('GET'));
                        if($delete_last)
                        {
                                
$this->bo->delete_last_index($r_agreement_id,$id);
                        }
 
+*/
 
-                       $bolocation                     = 
CreateObject($this->currentapp.'.bolocation');
-
-                       $values_attribute  = 
get_var('values_attribute',array('POST'));
-
-                       $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
-                       $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
-                       $insert_record_r_agreement1 = 
$GLOBALS['phpgw']->session->appsession('insert_record_r_agreement1',$this->currentapp);
-
-//_debug_array($insert_record_r_agreement1);
-
-                       for ($j=0;$j<count($insert_record_entity);$j++)
-                       {
-                               
$insert_record['extra'][$insert_record_entity[$j]]      = 
$insert_record_entity[$j];
-                       }
-
-                       for ($j=0;$j<count($insert_record_r_agreement1);$j++)
-                       {
-                               
$insert_record['extra'][$insert_record_r_agreement1[$j]]        = 
$insert_record_r_agreement1[$j];
-                       }
-
-
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('r_agreement','attributes_form'));
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('r_agreement'));
 
                        if (is_array($values))
                        {
-
-                               for ($i=0; 
$i<count($insert_record['location']); $i++)
-                               {
-                                       
if($_POST[$insert_record['location'][$i]])
-                                       {
-                                               
$values['location'][$insert_record['location'][$i]]= 
$_POST[$insert_record['location'][$i]];
-                                       }
-                               }
-
-                               while (is_array($insert_record['extra']) && 
list($key,$column) = each($insert_record['extra']))
-                               {
-                                       if($_POST[$key])
-                                       {
-                                               $values['extra'][$column]       
= $_POST[$key];
-                                       }
-                               }
-
-                               $values['street_name']          = 
$_POST['street_name'];
-                               $values['street_number']        = 
$_POST['street_number'];
-                               $values['location_name']        = $_POST['loc' 
. (count($values['location'])).'_name']; // if not address - get the parent 
name as address
-
 //_debug_array($values);
                                if ($values['save'] || $values['apply']):
                                {
-                                       $values['tenant_id']            = 
get_var('tenant_id',array('POST'));
+                                       $values['b_account']            = 
get_var('b_account_id',array('POST'));
                                        if(!$receipt['error'])
                                        {
                                                $values['r_agreement_id']       
= $r_agreement_id;
                                                $values['id']   = $id;
-                                               $receipt = 
$this->bo->save_item($values,$values_attribute);
+                                               $receipt = 
$this->bo->save_common($values);
                                                $r_agreement_id = 
$receipt['r_agreement_id'];
                                                $id                     = 
$receipt['id'];
-                                               $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
                                                if ($values['save'])
                                                {
                                                        
$GLOBALS['phpgw']->session->appsession('session_data','r_agreement_receipt',$receipt);
                                                        
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit&id='
 . $r_agreement_id);
                                                }
                                        }
-                                       else
-                                       {
-                                               if($values['location'])
-                                               {
-                                                       
$location_code=implode("-", $values['location']);
-                                                       
$values['location_data'] = 
$bolocation->read_single($location_code,$values['extra']);
-                                               }
-                                               if($values['extra']['p_num'])
-                                               {
-                                                       
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-                                                       
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-                                                       
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-                                                       
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
-                                               }
-                                       }
                                }
                                elseif($values['update']):
                                {
@@ -1964,15 +1905,24 @@
                        }
 
                        $r_agreement = 
$this->bo->read_single(array('r_agreement_id'=>$r_agreement_id));
-                       $values = 
$this->bo->read_single_item(array('r_agreement_id'=>$r_agreement_id,'id'=>$id));
+
+                       if($id)
+                       {
+                               $values = 
$this->bo->read_single_common(array('r_agreement_id'=>$r_agreement_id,'common_id'=>$id));
+                               $list = 
$this->bo->read_common_list(array('r_agreement_id'=>$r_agreement_id,'common_id'=>$id));
+                       }
+
+                       $uicols         = $this->bo->uicols;
+                       $list           = 
$this->list_content($list,$uicols,$edit_common=True);
+                       $content        = $list['content'];
+                       $table_header=$list['table_header'];
 
 
                        $link_data = array
                        (
-                               'menuaction'            => 
$this->currentapp.'.uir_agreement.edit_item',
+                               'menuaction'            => 
$this->currentapp.'.uir_agreement.edit_common',
                                'r_agreement_id'        => $r_agreement_id,
                                'id'                            => $id,
-                               'role'                          => $this->role
                        );
 
 
@@ -2009,32 +1959,14 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> True,link_data => array()));
-
                        $table_add[] = array
                        (
                                'lang_add'                              => 
lang('add detail'),
-                               'lang_add_standardtext' => lang('add an item to 
the details'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_item&r_agreement_id='
 . $r_agreement_id)
+                               '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)
                        );
 
 
-                       if($id)
-                       {
-                               $list = 
$this->bo->read_prizing(array('r_agreement_id'=>$r_agreement_id,'item_id'=>$id));
-                       }
-
-                       $uicols         = $this->bo->uicols;
-                       $list           = 
$this->list_content($list,$uicols,$edit_item=True);
-                       $content        = $list['content'];
-                       $table_header=$list['table_header'];
-
-                       for ($i=0; $i<count($list['content'][0]['row']); $i++)
-                       {
-                               $set_column[]=True;
-                       }
-//_debug_array($list);
-
                        $table_update[] = array
                        (
                                'jsDateFormat'                  => 
$jsDateFormat,
@@ -2054,22 +1986,11 @@
 
                        $max_location_level = 
$this->bocommon->get_max_location_level();
 //_debug_array($values);
-                       $location_data=$bolocation->initiate_ui_location(array(
-                                               'values'                => 
$values['location_data'],
-                                               'type_id'               => 
$max_location_level, // calculated from location_types
-                                               'no_link'               => 
$max_location_level+1, // disable lookup links for location type less than 
type_id
-                                               'tenant'                => 
False,
-                                               'lookup_type'   => $lookup_type,
-                                               'lookup_entity' => False, // 
$this->bocommon->get_lookup_entity('r_agreement'),
-                                               'entity_data'   => 
False,//$values['p']
-                                               ));
 
-                       
$tenant_data=$this->bocommon->initiate_ui_tenant_lookup(array(
-                                               'tenant_id'     => 
$values['tenant_id'],
-                                               'last_name'     => 
$values['last_name'],
-                                               'first_name'    => 
$values['first_name'],
-                                               'role'          => 'tenant')
-                                               );
+                       
$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']));
+
 
                        $data = array
                        (
@@ -2091,9 +2012,6 @@
                                'onKeyUp'                                       
        => $onKeyUp,
                                'onBlur'                                        
        => $onBlur,
                                'dateformat_source'                             
=> './'.$this->currentapp.'/inc/dateformat.js',
-                               'lang_attributes'                               
=> lang('Attributes'),
-                               'attributes_header'                             
=> $attributes_header,
-                               'attributes_values'                             
=> $values['attributes'],
                                'lookup_functions'                              
=> $values['lookup_functions'],
                                'dateformat'                                    
=> $dateformat,
 
@@ -2111,27 +2029,29 @@
                                'table_header'                                  
=> $table_header,
                                'acl_manage'                                    
=> $this->acl_manage,
                                'table_update'                                  
=> $table_update,
-                               'update_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_item&r_agreement_id='
 . $r_agreement_id . '&id=' . $id),
+                               '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',
-                               'location_data'                                 
=> $location_data,
 
-                               'lang_cost'                                     
        => lang('cost'),
-                               'lang_cost_statustext'                  => 
lang('cost'),
-                               'value_cost'                                    
=> $values['cost'],
-                               'set_column'                                    
=> $set_column,
+                               '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_item&delete_last=1&r_agreement_id='
 . $r_agreement_id . '&id=' . $id),
-                               'tenant_data'                                   
=> $tenant_data,
+                               'delete_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common&delete_last=1&r_agreement_id='
 . $r_agreement_id . '&id=' . $id),
+                               'b_account_data'                                
=> $b_account_data,
                                'rental_type_list'                              
=> $this->bo->get_rental_type_list($values['rental_type_id']),
                                'lang_rental_type_statustext'   => lang('Select 
rental type'),
                                'lang_select_rental_type'               => 
lang('Select rental type'),
                                'lang_rental_type'                              
=> lang('Rental type'),
+                               'lang_remark'                                   
=> lang('Remark'),
+                               'lang_override_fraction'                => 
lang('Override fraction'),
+                               'lang_override_fraction_statustext'=> 
lang('Override fraction of common costs'),
+                               
                        );
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('rental agreement') . ': ' . ($values['id']?lang('edit item') . ' ' . 
$r_agreement['name']:lang('add item') . ' ' . $r_agreement['name']);
+                       $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']->xslttpl->set_var('phpgw',array('edit_common' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
Index: property/setup/setup.inc.php
diff -u property/setup/setup.inc.php:1.28 property/setup/setup.inc.php:1.29
--- property/setup/setup.inc.php:1.28   Sun Feb 12 18:12:02 2006
+++ property/setup/setup.inc.php        Thu Feb 16 14:48: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: setup.inc.php,v 1.28 2006/02/12 18:12:02 sigurdne Exp $
+       * @version $Id: setup.inc.php,v 1.29 2006/02/16 14:48:45 sigurdne Exp $
        */
 
        $setup_info['property']['name']      = 'property';
@@ -194,6 +194,8 @@
                'fm_r_agreement_choice',
                'fm_r_agreement_detail',
                'fm_r_agreement_pricing',
+               'fm_r_agreement_common',
+               'fm_r_agreement_c_history'
        );
 
        /* The hooks this app includes, needed for hooks registration */
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.43 
property/setup/tables_current.inc.php:1.44
--- property/setup/tables_current.inc.php:1.43  Tue Feb 14 14:45:50 2006
+++ property/setup/tables_current.inc.php       Thu Feb 16 14:48: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.43 2006/02/14 14:45:50 
sigurdne Exp $
+       * @version $Id: tables_current.inc.php,v 1.44 2006/02/16 14:48:45 
sigurdne Exp $
        */
 
        $phpgw_baseline = array(
@@ -2109,5 +2109,40 @@
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
+               ),
+               'fm_r_agreement_common' => array(
+                       'fd' => array(
+                               'agreement_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'b_account' => array('type' => 'varchar', 
'precision' => 30,'nullable' => True),
+                               'remark' => array('type' => 'text','nullable' 
=> True),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True)
+                               'override_fraction' => array('type' => 
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
+                       ),
+                       'pk' => array('agreement_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_r_agreement_c_history' => array(
+                       'fd' => array(
+                               'agreement_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'c_id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'from_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'to_date' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'current_record' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'budget_cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
+                               'actual_cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
+                       ),
+                       'pk' => array('agreement_id','c_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
                )
+
        );
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.26 
property/setup/tables_update.inc.php:1.27
--- property/setup/tables_update.inc.php:1.26   Tue Feb 14 14:45:50 2006
+++ property/setup/tables_update.inc.php        Thu Feb 16 14:48: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.26 2006/02/14 14:45:50 
sigurdne Exp $
+       * @version $Id: tables_update.inc.php,v 1.27 2006/02/16 14:48:45 
sigurdne Exp $
        */
 
        /**
@@ -964,6 +964,47 @@
                        )
                );
 
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_r_agreement_common', array(
+                               'fd' => array(
+                                       'agreement_id' => array('type' => 
'int', 'precision' => 4,'nullable' => False,'default' => '0'),
+                                       'id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                                       'b_account' => array('type' => 
'varchar', 'precision' => 30,'nullable' => True),
+                                       'remark' => array('type' => 
'text','nullable' => True),
+                                       'user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'override_fraction' => array('type' => 
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
+                               ),
+                               'pk' => array('agreement_id','id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+       
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_r_agreement_c_history', array(
+                               'fd' => array(
+                                       'agreement_id' => array('type' => 
'int', 'precision' => 4,'nullable' => False,'default' => '0'),
+                                       'c_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                                       'id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                                       'from_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'to_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'current_record' => array('type' => 
'int', 'precision' => 2,'nullable' => True),
+                                       'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'budget_cost' => array('type' => 
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
+                                       'actual_cost' => array('type' => 
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
+                               ),
+                               'pk' => array('agreement_id','c_id','id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+
                $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_acl_location (id, descr) VALUES ('.r_agreement', 'Rental agreement')");
 
                $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.513';
Index: property/templates/base/r_agreement.xsl
diff -u property/templates/base/r_agreement.xsl:1.5 
property/templates/base/r_agreement.xsl:1.6
--- property/templates/base/r_agreement.xsl:1.5 Wed Feb 15 19:39:23 2006
+++ property/templates/base/r_agreement.xsl     Thu Feb 16 14:48: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>
@@ -814,6 +817,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;">
@@ -845,6 +851,9 @@
                                        </input>
                                </td>
                        </tr>
+                       </table>
+                       </td>
+                       </tr>
                </table>
                </form>
                
@@ -1628,6 +1637,189 @@
                </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:when>
+                       </xsl:choose>
+                       <xsl:call-template name="b_account_form"/>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_rental_type"/>
+                               </td>
+                               <td valign="top">
+                                       <xsl:variable 
name="lang_rental_type_statustext"><xsl:value-of 
select="lang_rental_type_statustext"/></xsl:variable>
+                                       <select name="values[rental_type_id]" 
class="forms" onMouseover="window.status='{$lang_rental_type_statustext}'; 
return true;" onMouseout="window.status='';return true;">
+                                               <option value=""><xsl:value-of 
select="lang_select_rental_type"/></option>
+                                               <xsl:apply-templates 
select="rental_type_list"/>
+                                       </select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_budget_cost"/>
+                               </td>
+                               <td>
+                                       <input type="text" 
name="values[budget_cost]" value="{value_budget_cost}" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_budget_cost_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+                       <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_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>
+
+                       <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 != ''">
+               
+                               <xsl:variable 
name="update_action"><xsl:value-of select="update_action"/></xsl:variable>
+                               <form method="post" name="form2" 
action="{$update_action}">
+                                       <input type="hidden" 
name="values[agreement_id]" value="{value_r_agreement_id}" ></input>
+                                       <input type="hidden" 
name="values[item_id]" value="{value_id}" ></input>
+                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                               <xsl:call-template 
name="table_header"/>
+                                               <xsl:call-template 
name="values2"/>
+                                       </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>
+                       </xsl:when>
+               </xsl:choose>
+               </div>
+       </xsl:template>
+
+
+
 <!-- datatype_list --> 
 
        <xsl:template match="datatype_list">




reply via email to

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