phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property inc/class.sor_agreement.inc.php inc/cl...
Date: Mon, 13 Feb 2006 20:44:31 +0000

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

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

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sor_agreement.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uir_agreement.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_current.inc.php.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_update.inc.php.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/r_agreement.xsl.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/tenant_form.xsl.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/default/r_agreement.xsl.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/default/tenant_form.xsl.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: property/inc/class.sor_agreement.inc.php
diff -u property/inc/class.sor_agreement.inc.php:1.2 
property/inc/class.sor_agreement.inc.php:1.3
--- property/inc/class.sor_agreement.inc.php:1.2        Mon Feb 13 14:40:56 2006
+++ property/inc/class.sor_agreement.inc.php    Mon Feb 13 20:44:30 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage agreement
-       * @version $Id: class.sor_agreement.inc.php,v 1.2 2006/02/13 14:40:56 
sigurdne Exp $
+       * @version $Id: class.sor_agreement.inc.php,v 1.3 2006/02/13 20:44:30 
sigurdne Exp $
        */
 
        /**
@@ -626,15 +626,16 @@
 
                                if($this->db->next_record())
                                {
-                                       $item['agreement_id']   = 
(int)$this->db->f('agreement_id');
-                                       $item['id']                             
= (int)$this->db->f('id');
+                                       $item['agreement_id']           = 
(int)$this->db->f('agreement_id');
+                                       $item['id']                     = 
(int)$this->db->f('id');
                                        $item['entry_date']             = 
$this->db->f('entry_date');
-                                       $item['location_code']  = 
$this->db->f('location_code');
+                                       $item['location_code']          = 
$this->db->f('location_code');
                                        $item['p_num']                  = 
$this->db->f('p_num');
-                                       $item['p_entity_id']    = 
$this->db->f('p_entity_id');
+                                       $item['p_entity_id']            = 
$this->db->f('p_entity_id');
                                        $item['p_cat_id']               = 
$this->db->f('p_cat_id');
                                        $item['cost']                   = 
$this->db->f('cost');
-
+                                       $item['tenant_id']              = 
$this->db->f('tenant_id');
+                                       
                                        for 
($i=0;$i<count($item['attributes']);$i++)
                                        {
                                                
$item['attributes'][$i]['value']        = 
$this->db->f($item['attributes'][$i]['name']);
@@ -724,7 +725,9 @@
 
                        $cols[] = 'location_code';
                        $vals[] = $values['location_code'];
-
+                       $cols[] = 'tenant_id';
+                       $vals[] = $values['tenant_id'];
+                       
 /*                     while (is_array($values['location']) && 
list($input_name,$value) = each($values['location']))
                        {
                                if($value)
@@ -888,7 +891,8 @@
                        $value_set['location_code']     = 
$values['location_code'];
                        $value_set['cost']      = $values['cost'];
                        $value_set['address']   = $address;
-
+                       $value_set['tenant_id'] = $values['tenant_id'];
+                       
                        if($value_set)
                        {
                                $value_set      = ',' . 
$this->bocommon->validate_db_update($value_set);
@@ -1275,7 +1279,8 @@
                                                'user_id' => array('type' => 
'int', 'precision' => 4,'nullable' => True),
                                                'entry_date' => array('type' => 
'int', 'precision' => 4,'nullable' => True),
                                                'test' => array('type' => 
'text','nullable' => True),
-                                               'cost' => array('type' => 
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True)
+                                               'cost' => array('type' => 
'decimal', 'precision' => 20, 'scale' => 2,'nullable' => True),
+                                               'tenant_id' => array('type' => 
'int', 'precision' => 4,'nullable' => True)
                                                );
                                        break;
                                default:
@@ -1523,38 +1528,57 @@
                }
                function delete_attrib($attrib_id)
                {
-                       $table = 'fm_r_agreement';
+
+                       if($this->role=='detail')
+                       {
+                               $filtermethod= ' AND attrib_detail=2';
+                               $filtermethod2= ' WHERE attrib_detail=2';
+                               $table = 'fm_r_agreement_detail';
+                       }
+                       else
+                       {
+                               $filtermethod= ' AND attrib_detail=1';
+                               $filtermethod2= ' WHERE attrib_detail=1';
+                               $table = 'fm_r_agreement';
+                       }
+
+                       $table_def = $this->get_table_def($table);
+                       
                        $attribute_table = 'fm_r_agreement_attribute';
                        $this->init_process();
+                       $this->oProc->m_odb->transaction_begin();
+                       $this->db->transaction_begin();
 
-                       $sql = "SELECT * FROM $attribute_table WHERE 
id=$attrib_id";
+                       $sql = "SELECT * FROM $attribute_table WHERE 
id=$attrib_id $filtermethod";
 
                        $this->db->query($sql);
                        $this->db->next_record();
                        $ColumnName             = $this->db->f('column_name');
 
-                       if($this->oProc->DropColumn($table,'', $ColumnName))
+                       if($this->oProc->DropColumn($table,$table_def[$table], 
$ColumnName))
                        {
-                               $sql = "SELECT attrib_sort FROM 
$attribute_table where id=$attrib_id";
+                               $sql = "SELECT attrib_sort FROM 
$attribute_table where id=$attrib_id $filtermethod";
                                $this->db->query($sql);
                                $this->db->next_record();
                                $attrib_sort    = $this->db->f('attrib_sort');
-                               $sql2 = "SELECT max(attrib_sort) as max_sort 
FROM $attribute_table";
+                               $sql2 = "SELECT max(attrib_sort) as max_sort 
FROM $attribute_table $filtermethod2";
                                $this->db->query($sql2);
                                $this->db->next_record();
                                $max_sort       = $this->db->f('max_sort');
                                if($max_sort>$attrib_sort)
                                {
-                                       $sql = "UPDATE $attribute_table set 
attrib_sort=attrib_sort-1 WHERE attrib_sort > $attrib_sort";
+                                       $sql = "UPDATE $attribute_table set 
attrib_sort=attrib_sort-1 WHERE attrib_sort > $attrib_sort $filtermethod";
                                        $this->db->query($sql);
                                }
 
-                               $this->db->query("DELETE FROM $attribute_table 
WHERE id=$attrib_id");
+                               $this->db->query("DELETE FROM $attribute_table 
WHERE id=$attrib_id $filtermethod");
                        }
                        else
                        {
                                $receipt['error'][] = array('msg'       => 
lang('Attribute has NOT been deleted'));
                        }
+                       $this->db->transaction_commit();
+                       $this->oProc->m_odb->transaction_commit();
 
                        return $receipt;
                }
Index: property/inc/class.uir_agreement.inc.php
diff -u property/inc/class.uir_agreement.inc.php:1.2 
property/inc/class.uir_agreement.inc.php:1.3
--- property/inc/class.uir_agreement.inc.php:1.2        Mon Feb 13 14:40:56 2006
+++ property/inc/class.uir_agreement.inc.php    Mon Feb 13 20:44:30 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage agreement
-       * @version $Id: class.uir_agreement.inc.php,v 1.2 2006/02/13 14:40:56 
sigurdne Exp $
+       * @version $Id: class.uir_agreement.inc.php,v 1.3 2006/02/13 20:44:30 
sigurdne Exp $
        */
 
        /**
@@ -959,7 +959,7 @@
 //_debug_array($values);
                                if ($values['save'] || $values['apply']):
                                {
-
+                                       $values['tenant_id']            = 
get_var('tenant_id',array('POST'));
                                        if(!$receipt['error'])
                                        {
                                                $values['r_agreement_id']       
= $r_agreement_id;
@@ -1091,15 +1091,15 @@
 
                        $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'});",
+                               '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'                => 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'                   => 
lang('Update'),
                                'lang_update_statustext'        => lang('update 
selected investments')
                        );
 
@@ -1117,6 +1117,12 @@
                                                'entity_data'   => $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')
+                                               );
 
                        $data = array
                        (
@@ -1171,7 +1177,7 @@
                                '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,
                        );
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('rental agreement') . ': ' . ($values['id']?lang('edit item') . ' ' . 
$r_agreement['name']:lang('add item') . ' ' . $r_agreement['name']);
@@ -1229,6 +1235,14 @@
                                                'entity_data'   => $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',
+                                               'type'          => 'view')
+                                               );
+
                        $data = array
                        (
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -1256,6 +1270,7 @@
                                'lang_cost_statustext'                  => 
lang('cost'),
                                'value_cost'                                    
=> $values['cost'],
                                'set_column'                                    
=> $set_column,
+                               'tenant_data'                                   
=> $tenant_data,
                        );
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('rental agreement') . ': ' . lang('view item') . ' ' . 
$r_agreement['name'];
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.41 
property/setup/tables_current.inc.php:1.42
--- property/setup/tables_current.inc.php:1.41  Mon Feb 13 14:40:56 2006
+++ property/setup/tables_current.inc.php       Mon Feb 13 20:44:30 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.41 2006/02/13 14:40:56 
sigurdne Exp $
+       * @version $Id: tables_current.inc.php,v 1.42 2006/02/13 20:44:30 
sigurdne Exp $
        */
 
        $phpgw_baseline = array(
@@ -2083,7 +2083,8 @@
                                'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
                                'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'test' => array('type' => 'text','nullable' => 
True),
-                               'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True)
+                               'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
+                               'tenant_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                        ),
                        'pk' => array('agreement_id','id'),
                        'fk' => array(),
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.24 
property/setup/tables_update.inc.php:1.25
--- property/setup/tables_update.inc.php:1.24   Mon Feb 13 14:40:56 2006
+++ property/setup/tables_update.inc.php        Mon Feb 13 20:44:30 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.24 2006/02/13 14:40:56 
sigurdne Exp $
+       * @version $Id: tables_update.inc.php,v 1.25 2006/02/13 20:44:30 
sigurdne Exp $
        */
 
        /**
@@ -933,7 +933,8 @@
                                        'user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                        'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                        'test' => array('type' => 
'text','nullable' => True),
-                                       'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True)
+                                       'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
+                                       'tenant_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True)
                                ),
                                'pk' => array('agreement_id','id'),
                                'fk' => array(),
Index: property/templates/base/r_agreement.xsl
diff -u property/templates/base/r_agreement.xsl:1.2 
property/templates/base/r_agreement.xsl:1.3
--- property/templates/base/r_agreement.xsl:1.2 Mon Feb 13 14:40:56 2006
+++ property/templates/base/r_agreement.xsl     Mon Feb 13 20:44:30 2006
@@ -572,7 +572,7 @@
                <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="79%" 
align="center">
+               <table cellpadding="2" cellspacing="2" width="100%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -610,7 +610,7 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:call-template name="location_form"/>
-
+                       <xsl:call-template name="tenant_form"/>
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_cost"/>
@@ -991,7 +991,7 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:call-template name="location_view"/>
-
+                       <xsl:call-template name="tenant_view"/>
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_cost"/>
Index: property/templates/base/tenant_form.xsl
diff -u property/templates/base/tenant_form.xsl:1.1 
property/templates/base/tenant_form.xsl:1.2
--- property/templates/base/tenant_form.xsl:1.1 Mon Feb 13 14:40:56 2006
+++ property/templates/base/tenant_form.xsl     Mon Feb 13 20:44:30 2006
@@ -1,4 +1,4 @@
-<!-- $Id: tenant_form.xsl,v 1.1 2006/02/13 14:40:56 sigurdne Exp $ -->
+<!-- $Id: tenant_form.xsl,v 1.2 2006/02/13 20:44:30 sigurdne Exp $ -->
 
        <xsl:template name="tenant_form">
                <xsl:apply-templates select="tenant_data"/>
@@ -17,7 +17,7 @@
                                <td valign="top">
                                        <a href="javascript:tenant_lookup()" 
onMouseover="window.status='{lang_select_tenant_help}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="lang_tenant"/></a>
                                </td>
-                               <td>
+                               <td colspan = '3'>
                                        <input size="9" type="text" 
name="tenant_id" value="{value_tenant_id}" >
                                        <xsl:attribute name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>
Index: property/templates/default/r_agreement.xsl
diff -u property/templates/default/r_agreement.xsl:1.2 
property/templates/default/r_agreement.xsl:1.3
--- property/templates/default/r_agreement.xsl:1.2      Mon Feb 13 14:40:56 2006
+++ property/templates/default/r_agreement.xsl  Mon Feb 13 20:44:30 2006
@@ -572,7 +572,7 @@
                <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="79%" 
align="center">
+               <table cellpadding="2" cellspacing="2" width="100%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -610,7 +610,7 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:call-template name="location_form"/>
-
+                       <xsl:call-template name="tenant_form"/>
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_cost"/>
@@ -991,7 +991,7 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:call-template name="location_view"/>
-
+                       <xsl:call-template name="tenant_view"/>
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_cost"/>
Index: property/templates/default/tenant_form.xsl
diff -u property/templates/default/tenant_form.xsl:1.1 
property/templates/default/tenant_form.xsl:1.2
--- property/templates/default/tenant_form.xsl:1.1      Mon Feb 13 14:40:56 2006
+++ property/templates/default/tenant_form.xsl  Mon Feb 13 20:44:30 2006
@@ -1,4 +1,4 @@
-<!-- $Id: tenant_form.xsl,v 1.1 2006/02/13 14:40:56 sigurdne Exp $ -->
+<!-- $Id: tenant_form.xsl,v 1.2 2006/02/13 20:44:30 sigurdne Exp $ -->
 
        <xsl:template name="tenant_form">
                <xsl:apply-templates select="tenant_data"/>
@@ -17,7 +17,7 @@
                                <td valign="top">
                                        <a href="javascript:tenant_lookup()" 
onMouseover="window.status='{lang_select_tenant_help}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="lang_tenant"/></a>
                                </td>
-                               <td>
+                               <td colspan = '3'>
                                        <input size="9" type="text" 
name="tenant_id" value="{value_tenant_id}" >
                                        <xsl:attribute name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>




reply via email to

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