phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property inc/class.uir_agreement.inc.php templa...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property inc/class.uir_agreement.inc.php templa...
Date: Wed, 15 Feb 2006 19:39:23 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/02/15 19:39:23

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

Log message:
        no message

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

Patches:
Index: property/inc/class.uir_agreement.inc.php
diff -u property/inc/class.uir_agreement.inc.php:1.4 
property/inc/class.uir_agreement.inc.php:1.5
--- property/inc/class.uir_agreement.inc.php:1.4        Tue Feb 14 14:45:50 2006
+++ property/inc/class.uir_agreement.inc.php    Wed Feb 15 19:39:22 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.4 2006/02/14 14:45:50 
sigurdne Exp $
+       * @version $Id: class.uir_agreement.inc.php,v 1.5 2006/02/15 19:39:22 
sigurdne Exp $
        */
 
        /**
@@ -38,7 +38,8 @@
                        'edit_item'             => True,
                        'view_item'             => True,
                        'view_file'             => True,
-                       'excel'                 => True
+                       'excel'                 => True,
+                       'edit_common'           => True
                );
 
                function uir_agreement()
@@ -798,7 +799,7 @@
                        (
                                'lang_add'                              => 
lang('add common'),
                                '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='
 . $id)
+                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit_common&r_agreement_id='
 . $id)
                        );
 
 
@@ -1841,5 +1842,300 @@
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
+               
+               function edit_common()
+               {
+                       $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'));
+                       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'));
+
+                       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'));
+                                       if(!$receipt['error'])
+                                       {
+                                               $values['r_agreement_id']       
= $r_agreement_id;
+                                               $values['id']   = $id;
+                                               $receipt = 
$this->bo->save_item($values,$values_attribute);
+                                               $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']):
+                               {
+                                       $values['date']         = 
get_var('date',array('POST'));
+
+                                       if(!$values['date'])
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+                                       }
+                                       if(!$values['new_index'])
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
+                                       }
+
+                                       if(!$receipt['error'])
+                                       {
+                                               $receipt = 
$this->bo->update($values);
+                                       }
+
+                               }
+                               elseif (!$values['save'] && !$values['apply'] 
&& !$values['update']):
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uir_agreement.edit&id='
 . $r_agreement_id);
+                               }
+                               endif;
+                       }
+
+                       $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));
+
+
+                       $link_data = array
+                       (
+                               'menuaction'            => 
$this->currentapp.'.uir_agreement.edit_item',
+                               'r_agreement_id'        => $r_agreement_id,
+                               'id'                            => $id,
+                               'role'                          => $this->role
+                       );
+
+
+                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       $sep = '/';
+                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
+                       $dlarr[strpos($dateformat,'m')] = 'MM';
+                       $dlarr[strpos($dateformat,'d')] = 'DD';
+                       ksort($dlarr);
+
+                       $dateformat= (implode($sep,$dlarr));
+
+                       switch(substr($dateformat,0,1))
+                       {
+                               case 'M':
+                                       $dateformat_validate= 
"javascript:vDateType='1'";
+                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
+                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
+                                       break;
+                               case 'y':
+                                       
$dateformat_validate="javascript:vDateType='2'";
+                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
+                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
+                                       break;
+                               case 'D':
+                                       
$dateformat_validate="javascript:vDateType='3'";
+                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
+                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
+                                       break;
+                       }
+
+                       $cal_info       = $this->bocommon->jscalendar();
+                       $jsDateFormat=$cal_info['jsDateFormat'];
+
+                       $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)
+                       );
+
+
+                       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,
+                               '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')
+                       );
+
+
+                       $lookup_type='form';
+
+                       $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')
+                                               );
+
+                       $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_r_agreement_id'                  => 
$r_agreement_id,
+                               'lang_category'                                 
=> lang('category'),
+                               'lang_save'                                     
        => lang('save'),
+                               'lang_cancel'                                   
=> lang('cancel'),
+                               'lang_apply'                                    
=> lang('apply'),
+                               'lang_apply_statustext'                 => 
lang('Apply the values'),
+                               'lang_cancel_statustext'                => 
lang('Leave the rental agreement untouched and return back to the list'),
+                               'lang_save_statustext'                  => 
lang('Save the r_agreement and return back to the list'),
+
+                               'lang_dateformat'                               
=> lang(strtolower($dateformat)),
+                               'dateformat_validate'                   => 
$dateformat_validate,
+                               '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,
+
+                               'jsDateFormat'                                  
=> $jsDateFormat,
+                               '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'});",
+
+                               'lang_agreement'                                
=> lang('Agreement'),
+                               'agreement_name'                                
=> $r_agreement['name'],
+
+                               'table_add'                                     
        => $table_add,
+                               'values'                                        
        => $content,
+                               '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),
+                               '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_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,
+                               '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'),
+                       );
+
+                       $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']->xslttpl->set_var('phpgw',array('edit_common' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
        }
 ?>
Index: property/templates/base/r_agreement.xsl
diff -u property/templates/base/r_agreement.xsl:1.4 
property/templates/base/r_agreement.xsl:1.5
--- property/templates/base/r_agreement.xsl:1.4 Tue Feb 14 14:45:50 2006
+++ property/templates/base/r_agreement.xsl     Wed Feb 15 19:39:23 2006
@@ -366,7 +366,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 +696,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,6 +711,10 @@
                        <xsl:apply-templates select="table_add_service"/>
 
                <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_common_costs"/>




reply via email to

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