fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6587] merge 6579:6586 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6587] merge 6579:6586 from trunk
Date: Fri, 12 Nov 2010 13:34:53 +0000

Revision: 6587
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6587
Author:   sigurdne
Date:     2010-11-12 13:34:53 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
merge 6579:6586 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
    branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
    branches/Version-1_0-branch/booking/setup/phpgw_no.lang
    branches/Version-1_0-branch/booking/templates/base/css/base.css
    branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-1_0-branch/property/inc/class.boresponsible.inc.php
    branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php
    branches/Version-1_0-branch/property/inc/class.solocation.inc.php
    branches/Version-1_0-branch/property/inc/class.sotenant_claim.inc.php
    branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
    branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php
    
branches/Version-1_0-branch/property/js/yahoo/location.responsiblility_role.js
    branches/Version-1_0-branch/rental/inc/class.soadjustment.inc.php
    branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiadjustment.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
    branches/Version-1_0-branch/rental/setup/phpgw_no.lang
    
branches/Version-1_0-branch/rental/templates/base/contracts_for_regulation_list.php

Added Paths:
-----------
    branches/Version-1_0-branch/booking/templates/base/images/info.png

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586

Modified: branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php 
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php 
2010-11-12 13:34:53 UTC (rev 6587)
@@ -384,8 +384,15 @@
                        array_set_default($application, 'resources', 
array(get_var('resource', int, 'GET')));
                        }
                        array_set_default($application, 'building_id', 
phpgw::get_var('building_id', 'GET'));
-                       array_set_default($application, 'building_name', 
phpgw::get_var('building_name', 'GET'));
+
+                       array_set_default($application, 'building_name', 
mb_detect_encoding(phpgw::get_var('building_name', 'GET')));
                        
+                       if (strstr($application['building_name'],"%")){
+                               $search = array('%C3%85', '%C3%A5', '%C3%98', 
'%C3%B8', '%C3%86', '%C3%A6');
+                               $replace = array ('Å','å','Ø','ø','Æ','æ');
+                               $application['building_name'] = 
str_replace($search, $replace, $application['building_name']);
+                       }
+                       
                        if(phpgw::get_var('from_', 'GET'))
                        {
                                $default_dates = array_map(array(self, 
'_combine_dates'), phpgw::get_var('from_', 'GET'), phpgw::get_var('to_', 
'GET'));

Modified: branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uievent.inc.php       
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/booking/inc/class.uievent.inc.php       
2010-11-12 13:34:53 UTC (rev 6587)
@@ -253,7 +253,7 @@
                public function add()
                {
                        $errors = array();
-                       $event = array('customer_internal' => 1); 
+                       $event = array('customer_internal' => 0); 
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
 
@@ -326,8 +326,11 @@
                                                }
                                        }  
                                }
+                               if ($_POST['cost'] != 0 and 
!$event['customer_organization_number'] and !$event['customer_ssn']) {
+                                       $errors['invoice_data'] = lang('There 
is set a cost, but no invoice data is filled inn');
+                               } 
 
-                               if(!$errors['event'] && !$errors['time'])
+                               if(!$errors['event'] && !$errors['time'] && 
!$errors['invoice_data'] && !$errors['resource_number'] && 
!$errors['organization_number'])
                                {
                                        if (!$_POST['application_id'])
                                        {
@@ -473,7 +476,11 @@
                                        $event['customer_organization_number'] 
= $_POST['customer_organization_number'];
                                }
 
-                               if(!$errors['event'] and 
!$errors['resource_number'] and !$errors['organization_number'])
+                               if ($_POST['cost'] != 0 and 
!$event['customer_organization_number'] and !$event['customer_ssn']) {
+                                       $errors['invoice_data'] = lang('There 
is set a cost, but no invoice data is filled inn');
+                               } 
+
+                               if(!$errors['event'] and 
!$errors['resource_number'] and !$errors['organization_number'] and 
!$errors['invoice_data'])
                                {
                                        if (phpgw::get_var('mail', 'POST'))
                                        {

Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2010-11-12 
13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2010-11-12 
13:34:53 UTC (rev 6587)
@@ -471,3 +471,4 @@
 Out season     booking no      Ut sesong
 Allocations colliding with existing allocations or bookings (%1)       booking 
no      Tildelinger ikke kan lages
 Allocations that can be created        booking no      Tildelinger som kan 
lages
+There is set a cost, but no invoice data is filled inn booking no      Det er 
satt en pris, men ingen fakturainformasjon er gitt 

Modified: branches/Version-1_0-branch/booking/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/css/base.css     
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/booking/templates/base/css/base.css     
2010-11-12 13:34:53 UTC (rev 6587)
@@ -93,11 +93,17 @@
     padding-bottom: 2em;
 }
 
-/* ie fix. autocomplete dropdown is displayed behind some elements if the 
z-index is not set */
 div.autocomplete {
-       z-index: 500;
        position: relative;
 }
+/* ie fix. autocomplete dropdown is displayed behind some elements if the 
z-index is not set */
+div.autocomplete input {
+       z-index: 500;
+}
+/* ie fix. autocomplete dropdown is displayed behind some elements if the 
z-index is not set */
+#building_container ul {
+       z-index: 1000;
+}
 
 dl.form dt.heading, dl.form-col dt.heading, dl.form-2col dt.heading, 
div.heading,
 dl.proplist dt.heading, dl.proplist-col dt.heading {
@@ -274,3 +280,10 @@
 .yui-skin-sam .yui-dt TABLE TD{
        border: none !important;
 }
+
+div.info:hover { 
+    background-image: url(../images/info.png);
+    background-repeat: no-repeat;
+    background-position: 100% 0%;
+}
+

Copied: branches/Version-1_0-branch/booking/templates/base/images/info.png 
(from rev 6586, trunk/booking/templates/base/images/info.png)
===================================================================
(Binary files differ)

Modified: branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bolocation.inc.php   
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/property/inc/class.bolocation.inc.php   
2010-11-12 13:34:53 UTC (rev 6587)
@@ -652,7 +652,7 @@
                                                                                
        'lookup_tenant'=>$data['lookup_tenant'],'lookup'=>$data['lookup'],
                                                                                
        'district_id'=>$this->district_id,'allrows'=>$data['allrows'],
                                                                                
        
'status'=>$this->status,'part_of_town_id'=>$this->part_of_town_id,'dry_run'=>$data['dry_run'],
-                                                                               
        'location_code' => $this->location_code));
+                                                                               
        'location_code' => $this->location_code, 'filter_role_on_contact' => 
$data['filter_role_on_contact'], 'role_id' => $data['role_id']));
 
                        $this->total_records = $this->so->total_records;
                        $this->uicols = $this->so->uicols;
@@ -664,7 +664,15 @@
                {
                        $soresponsible          = 
CreateObject('property.soresponsible');
                        $contacts = createObject('phpgwapi.contacts');
+                       
+                       if($data['user_id'] < 0 && $data['role_id'])
+                       {
+                               $account = 
$GLOBALS['phpgw']->accounts->get(abs($data['user_id']));
+                               $contact_id = $account->person_id;
 
+                               $data['filter_role_on_contact'] = $contact_id;
+                       }
+
                        $locations = $this->read($data);
                        foreach ($locations as & $location)
                        {

Modified: branches/Version-1_0-branch/property/inc/class.boresponsible.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boresponsible.inc.php        
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/property/inc/class.boresponsible.inc.php        
2010-11-12 13:34:53 UTC (rev 6587)
@@ -299,11 +299,13 @@
                        $dont_add = array();
                        if( isset($values['assign_orig']) && 
is_array($values['assign_orig']) )
                        {
-                               foreach( $values['assign_orig'] as $assign_orig 
=> $location_code )
+                               foreach( $values['assign_orig'] as $assign_orig 
)
                                {
                                        $assign_arr                     = 
explode('_', $assign_orig);
                                        $contact_id                     = 
$assign_arr[0];
                                        $responsible_item       = 
$assign_arr[1];
+                                       $location_code          = 
$assign_arr[2];
+
                                        $dont_add[]             = 
$location_code;                               
        
                                        if( !in_array($location_code, 
$values['assign']) )

Modified: branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php       
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php       
2010-11-12 13:34:53 UTC (rev 6587)
@@ -181,18 +181,21 @@
                {
                        $project_id     = isset($data['project_id']) && 
$data['project_id'] ? $data['project_id'] : phpgw::get_var('project_id');
 
-                       $claim = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                       $claims = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'user_id' => $this->user_id,'status' => $this->status,'cat_id' => 
$this->cat_id,
                                                                                
        'allrows'=>$this->allrows,'project_id' => $project_id, 'district_id' => 
$this->district_id,));
                        $this->total_records = $this->so->total_records;
 
-                       foreach ($claim as &$entry)
+                       foreach ($claims as &$entry)
                        {
                                $entry['entry_date']  = 
$GLOBALS['phpgw']->common->show_date($entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                $entry['status'] = lang($entry['status']);
                                $entry['user'] = 
$GLOBALS['phpgw']->accounts->get($entry['user_id'])->__toString();
+                               $location_info = 
execMethod('property.solocation.read_single',$entry['location_code']);
+                               $entry['loc1_name'] = 
$location_info['loc1_name'];
+                               $entry['loc_category'] = 
$location_info['category_name'];
                        }
-                       return $claim;
+                       return $claims;
                }
 
                function check_claim_project($project_id)

Modified: branches/Version-1_0-branch/property/inc/class.solocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2010-11-12 13:34:53 UTC (rev 6587)
@@ -246,24 +246,23 @@
 
                function read($data)
                {
-                       if(is_array($data))
-                       {
-                               $start                          = 
isset($data['start']) && $data['start'] ? $data['start'] : 0;
-                               $filter                         = 
isset($data['filter']) && $data['filter'] ? $data['filter'] : 0;
-                               $query                          = 
isset($data['query']) ? $data['query'] : '';
-                               $sort                           = 
isset($data['sort']) && $data['sort'] ? $data['sort'] : 'DESC';
-                               $order                          = 
isset($data['order']) ? $data['order'] : '';
-                               $cat_id                         = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']:'';
-                               $type_id                        = 
isset($data['type_id']) ? $data['type_id'] : '';
-                               $lookup_tenant          = 
isset($data['lookup_tenant']) ? $data['lookup_tenant'] : '';
-                               $district_id            = 
isset($data['district_id']) ? $data['district_id'] : '';
-                               $allrows                        = 
isset($data['allrows']) ? $data['allrows'] : '';
-                               $lookup                         = 
isset($data['lookup']) ? $data['lookup'] : '';
-                               $status                         = 
isset($data['status']) ? $data['status'] : '';
-                               $part_of_town_id        = 
isset($data['part_of_town_id']) ? $data['part_of_town_id'] : '';
-                               $dry_run                        = 
isset($data['dry_run']) ? $data['dry_run'] : '';
-                               $location_code          = 
isset($data['location_code']) ? $data['location_code'] : '';
-                       }
+                       $start                                  = 
isset($data['start']) && $data['start'] ? $data['start'] : 0;
+                       $filter                                 = 
isset($data['filter']) && $data['filter'] ? $data['filter'] : 0;
+                       $query                                  = 
isset($data['query']) ? $data['query'] : '';
+                       $sort                                   = 
isset($data['sort']) && $data['sort'] ? $data['sort'] : 'DESC';
+                       $order                                  = 
isset($data['order']) ? $data['order'] : '';
+                       $cat_id                                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']:'';
+                       $type_id                                = 
isset($data['type_id']) ? $data['type_id'] : '';
+                       $lookup_tenant                  = 
isset($data['lookup_tenant']) ? $data['lookup_tenant'] : '';
+                       $district_id                    = 
isset($data['district_id']) ? $data['district_id'] : '';
+                       $allrows                                = 
isset($data['allrows']) ? $data['allrows'] : '';
+                       $lookup                                 = 
isset($data['lookup']) ? $data['lookup'] : '';
+                       $status                                 = 
isset($data['status']) ? $data['status'] : '';
+                       $part_of_town_id                = 
isset($data['part_of_town_id']) ? $data['part_of_town_id'] : '';
+                       $dry_run                                = 
isset($data['dry_run']) ? $data['dry_run'] : '';
+                       $location_code                  = 
isset($data['location_code']) ? $data['location_code'] : '';
+                       $filter_role_on_contact = 
$data['filter_role_on_contact'] ? (int)$data['filter_role_on_contact'] : 0;
+                       $role_id                                = 
$data['role_id'] ? (int)$data['role_id'] : 0;
 
                        if (!$type_id)
                        {
@@ -287,7 +286,7 @@
                        }
 
 
-                       $sql = $this->socommon->fm_cache('sql_'. $type_id . '_' 
. $lookup_tenant . '_' . $lookup);
+                       $sql = $this->socommon->fm_cache('sql_'. $type_id . 
'_lt' . $lookup_tenant . '_l' . $lookup . '_f' . !!$filter_role_on_contact);
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");
 
 //                     $choice_table = 'phpgw_cust_choice';
@@ -512,11 +511,21 @@
                                $joinmethod .= " {$this->left_join} 
fm_location{$type_id}_category ON ( fm_location{$type_id}.category = 
fm_location{$type_id}_category.id))";
                                $paranthesis .='(';
 
+                               if($filter_role_on_contact)
+                               {
+                                       $joinmethod .= " {$this->join} 
fm_responsibility_contact ON ( fm_location{$type_id}.location_code = 
fm_responsibility_contact.location_code))";
+                                       $paranthesis .='(';
+                                       $joinmethod .= " {$this->join} 
fm_responsibility ON ( fm_responsibility_contact.responsibility_id = 
fm_responsibility.id))";
+                                       $paranthesis .='(';
+                                       $joinmethod .= " {$this->join} 
fm_responsibility_role ON ( fm_responsibility.id = 
fm_responsibility_role.responsibility_id))";
+                                       $paranthesis .='(';
+                               }
+
                                $from = " FROM {$paranthesis} 
fm_location{$type_id} ";
 
                                $sql = "SELECT $cols $from $joinmethod";
 
-                               $this->socommon->fm_cache('sql_'. $type_id . 
'_' . $lookup_tenant . '_' . $lookup ,$sql);
+                               $this->socommon->fm_cache('sql_'. $type_id . 
'_lt' . $lookup_tenant . '_l' . $lookup . '_f' . !!$filter_role_on_contact 
,$sql);
                                $this->socommon->fm_cache('uicols_'. $type_id  
. '_' . $lookup_tenant . '_' . $lookup,$uicols);
                                $this->socommon->fm_cache('cols_return_'. 
$type_id  . '_' . $lookup_tenant . '_' . $lookup,$cols_return);
 
@@ -693,10 +702,18 @@
 
                        if ($location_code)
                        {
-                               $filtermethod .= "  {$where} 
fm_location{$type_id}.location_code $this->like '{$location_code}%'";
+                               $filtermethod .= " {$where} 
fm_location{$type_id}.location_code $this->like '{$location_code}%'";
                                $where= 'AND';                  
                        }
 
+                       if($filter_role_on_contact && $role_id)
+                       {
+                               $time = time() +1;
+                               $filtermethod .= " {$where} active_from < 
{$time} AND (active_to > {$time} OR active_to = 0)"
+                               ." AND expired_on IS NULL AND 
fm_responsibility_role.id ={$role_id} AND contact_id = 
{$filter_role_on_contact}";
+                               $where= 'AND';                  
+                       }
+
                        $_querymethod = array();
                        $__querymethod = array();
                        $_joinmethod_datatype = array();
@@ -824,9 +841,9 @@
                        }
 
                        $sql .= "$filtermethod $querymethod";
-//_debug_array($sql);
+
                        $values = array();
-                       $this->db->query('SELECT count(*) AS cnt ' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+                       $this->db->query('SELECT count(*) AS cnt ' . 
substr($sql,strripos($sql,' from')),__LINE__,__FILE__);
                        $this->db->next_record();
                        $this->total_records = $this->db->f('cnt');
 
@@ -1079,7 +1096,9 @@
                        }
 
                        $cols = "fm_location{$type_id}.category as cat_id";
+                       $cols .= ",fm_location{$type_id}_category.descr as 
category_name";
                        $cols_return[]  = 'cat_id';
+                       $cols_return[]  = 'category_name';
 
                        for ($i=1;$i<($type_id);$i++)
                        {
@@ -1115,6 +1134,8 @@
                                $this->cols_return      =       
$this->socommon->fm_cache('cols_return_single_'. $type_id);
                        }
 
+                       $sql .= " {$this->join} fm_location{$type_id}_category 
ON (fm_location{$type_id}.category = fm_location{$type_id}_category.id)";
+
                        $sql .= " WHERE 
fm_location$type_id.location_code='$location_code' ";
 
                        $this->db->query($sql,__LINE__,__FILE__);

Modified: branches/Version-1_0-branch/property/inc/class.sotenant_claim.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sotenant_claim.inc.php       
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/property/inc/class.sotenant_claim.inc.php       
2010-11-12 13:34:53 UTC (rev 6587)
@@ -114,8 +114,8 @@
                                $querymethod = " $where ( first_name 
$this->like '%$query%' OR last_name $this->like '%$query%' OR project_id=" . 
(int)$query .')';
                        }
 
-                       $sql = "SELECT fm_tenant_claim.*, 
fm_tenant_claim_category.descr as category, fm_tenant.last_name, 
fm_tenant.first_name,district_id"
-                        . " FROM fm_tenant_claim "
+                       $sql = "SELECT fm_tenant_claim.*, 
fm_tenant_claim_category.descr as claim_category, fm_tenant.last_name, 
fm_tenant.first_name,district_id,"
+                        . " fm_project.address, fm_project.category, 
fm_project.location_code FROM fm_tenant_claim "
                         . " $this->join fm_tenant_claim_category on 
fm_tenant_claim.category=fm_tenant_claim_category.id"
                         . " $this->join fm_tenant on 
fm_tenant_claim.tenant_id=fm_tenant.id"
                         . " $this->join fm_project ON fm_project.id = 
fm_tenant_claim.project_id"
@@ -150,6 +150,10 @@
                                        'status'                => 
$this->db->f('status'),
                                        'user_id'               => 
$this->db->f('user_id'),
                                        'district_id'   => 
$this->db->f('district_id'),
+                                       'address'               => 
$this->db->f('address',true),
+                                       'category'              => 
$this->db->f('category'),
+                                       'location_code' => 
$this->db->f('location_code'),
+                                       'claim_category'=> 
$this->db->f('claim_category',true),
                                );
                        }
                        return $claims;

Modified: branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uilocation.inc.php   
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/property/inc/class.uilocation.inc.php   
2010-11-12 13:34:53 UTC (rev 6587)
@@ -869,6 +869,8 @@
 
 
 
+
+
                        }
 
                        $datatable['pagination']['records_total']       = 
$this->bo->total_records;
@@ -1034,6 +1036,7 @@
                        }
 
                        $values = phpgw::get_var('values');
+                       $values_assign = $_POST['values_assign'];
                        $role_id = phpgw::get_var('role_id', 'int');
                        $receipt = array();
                $_role = CreateObject('property.socategory');
@@ -1041,9 +1044,12 @@
 
                        $this->save_sessiondata();
 
-                       if($values && $this->acl_edit)
+                       $user_id = phpgw::get_var('user_id', 'int', 'request', 
$this->account);
+
+                       if($values_assign && $this->acl_edit)
                        {
-                               $user_id = phpgw::get_var('user_id', 'int', 
'request', $this->account);
+                               $values_assign = 
phpgw::clean_value(json_decode($values_assign,true));
+                               $user_id = abs($user_id);
                                $account = 
$GLOBALS['phpgw']->accounts->get($user_id);
                                $contact_id = $account->person_id;
                                if(!$role_id)
@@ -1055,7 +1061,8 @@
                                        $role = 
$_role->read_single($data=array('id' => $role_id));
                                        $values['contact_id']                   
= $contact_id;
                                        $values['responsibility_id']    = 
$role['responsibility_id'];
-
+                                       $values['assign']                       
        = $values_assign['assign'];
+                                       $values['assign_orig']                  
= $values_assign['assign_orig'];
                                        $boresponsible = 
CreateObject('property.boresponsible');
                                        $receipt = 
$boresponsible->update_role_assignment($values);
                                }
@@ -1165,6 +1172,7 @@
                                array_unshift 
($values_combo_box[4],$default_value);
 
                                $values_combo_box[5]  = 
$this->bocommon->get_user_list_right2('filter',PHPGW_ACL_READ,$this->user_id,".location.{$type_id}");
+                               array_unshift 
($values_combo_box[5],array('id'=> 
(-1*$GLOBALS['phpgw_info']['user']['account_id']),'name'=>lang('mine roles')));
                                $default_value = 
array('id'=>'','name'=>lang('no user'));
                                array_unshift 
($values_combo_box[5],$default_value);
 
@@ -1296,7 +1304,7 @@
 
                        $location_list = array();
 
-                       $location_list = 
$this->bo->get_responsible(array('role_id' =>$role_id, 
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
 =>$dry_run));
+                       $location_list = 
$this->bo->get_responsible(array('user_id' => $user_id, 'role_id' =>$role_id, 
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
 =>$dry_run));
 
                        $uicols = $this->bo->uicols;
 

Modified: branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php       
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php       
2010-11-12 13:34:53 UTC (rev 6587)
@@ -279,27 +279,39 @@
                        $uicols['name'][1]['name'] = 'district_id';
                        $uicols['name'][1]['value'] = 'district_id';
 
-                       $uicols['name'][2]['name'] = 'Project';
-                       $uicols['name'][2]['value'] = 'project_id';
+                       $uicols['name'][2]['name'] = 'location';
+                       $uicols['name'][2]['value'] = 'location_code';
 
-                       $uicols['name'][3]['name'] = 'name';
-                       $uicols['name'][3]['value'] = 'name';
+                       $uicols['name'][3]['name'] = 'loc1_name';
+                       $uicols['name'][3]['value'] = 'loc1_name';
 
-                       $uicols['name'][4]['name'] = 'time created';
-                       $uicols['name'][4]['value'] = 'entry_date';
+                       $uicols['name'][4]['name'] = 'address';
+                       $uicols['name'][4]['value'] = 'address';
 
-                       $uicols['name'][5]['name'] = 'user';
-                       $uicols['name'][5]['value'] = 'user';
+                       $uicols['name'][5]['name'] = 'category';
+                       $uicols['name'][5]['value'] = 'loc_category';
 
-                       $uicols['name'][6]['name'] = 'category';
-                       $uicols['name'][6]['value'] = 'category';
+                       $uicols['name'][6]['name'] = 'Project';
+                       $uicols['name'][6]['value'] = 'project_id';
 
-                       $uicols['name'][7]['name'] = 'Status';
-                       $uicols['name'][7]['value'] = 'status';
+                       $uicols['name'][7]['name'] = 'name';
+                       $uicols['name'][7]['value'] = 'name';
 
-                       $uicols['name'][8]['name'] = 'tenant_id';
-                       $uicols['name'][8]['value'] = 'tenant_id';
+                       $uicols['name'][8]['name'] = 'time created';
+                       $uicols['name'][8]['value'] = 'entry_date';
 
+                       $uicols['name'][9]['name'] = 'user';
+                       $uicols['name'][9]['value'] = 'user';
+
+                       $uicols['name'][10]['name'] = 'category';
+                       $uicols['name'][10]['value'] = 'claim_category';
+
+                       $uicols['name'][11]['name'] = 'Status';
+                       $uicols['name'][11]['value'] = 'status';
+
+                       $uicols['name'][12]['name'] = 'tenant_id';
+                       $uicols['name'][12]['value'] = 'tenant_id';
+
                        $count_uicols_name = count($uicols['name']);
 
                        $j = 0;

Modified: 
branches/Version-1_0-branch/property/js/yahoo/location.responsiblility_role.js
===================================================================
--- 
branches/Version-1_0-branch/property/js/yahoo/location.responsiblility_role.js  
    2010-11-12 13:29:50 UTC (rev 6586)
+++ 
branches/Version-1_0-branch/property/js/yahoo/location.responsiblility_role.js  
    2010-11-12 13:34:53 UTC (rev 6587)
@@ -2,7 +2,7 @@
 // Declaration of event.index vars
 //--------------------------------------------------------
        //define SelectButton
-    var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3, 
oMenuButton_4, oMenuButton_5;
+    var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3, 
oMenuButton_4;//, oMenuButton_5;
        var selectsButtons = [
     {order:0, var_URL:'type_id',               name:'btn_type_id',             
style:'typebutton',                     dependiente:[], reload:1},
     {order:1, var_URL:'cat_id',                        name:'btn_cat_id',      
        style:'categorybutton',         dependiente:[]},
@@ -22,28 +22,44 @@
        // define Text buttons
        var textImput = [
        {order:0, name:'query', id:'txt_query'}
-       ]
+       ];
 
        var toolTips =
        [
                {name:'status', title:'Status', 
description:'',ColumnDescription:'status'},
                {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
-       ]
+       ];
 
        var linktoolTips =
        [
                {name:'btn_data_search', title:'Data search', 
description:'Narrow the search dates'}
-       ]
+       ];
 
        var config_values =
-       {
-               date_search : 0 //if search has link "Data search"
-       }
+       [
+               {date_search : 0} //if search has link "Data search"
+       ];
 
        var tableYUI;
        
/********************************************************************************
        *
        */
+
+       this.onChangeSelect = function()
+       {
+               var myselect=document.getElementById("sel_user_id");
+               for (var i=0; i<myselect.options.length; i++)
+               {
+                       if (myselect.options[i].selected==true)
+                       {
+                               break;
+                       }
+               }
+               eval("path_values.user_id='"+myselect.options[i].value+"'");
+               execute_ds();
+       }
+
+
        this.myParticularRenderEvent = function()
        {
                delete_content_div("message",2); //find it in property.js
@@ -153,7 +169,7 @@
                if(oRecord.getData('responsible_item'))
                {
                        checked = "checked = 'checked'";
-                       hidden = "<input type=\"hidden\" class=\"orig_check\"  
name=\"values[assign_orig]["+oRecord.getData('responsible_contact_id')+"_"+oRecord.getData('responsible_item')+"]\"
 value=\""+oRecord.getData('location_code')+"\"/>";
+                       hidden = "<input type=\"hidden\" class=\"orig_check\"  
name=\"values[assign_orig][]\" 
value=\""+oRecord.getData('responsible_contact_id')+"_"+oRecord.getData('responsible_item')+"_"+oRecord.getData('location_code')+"\"/>";
                }
                        
                elCell.innerHTML = hidden + "<center><input type=\"checkbox\" 
"+checked+" class=\"mychecks\"  name=\"values[assign][]\" 
value=\""+oRecord.getData('location_code')+"\"/></center>";
@@ -185,18 +201,34 @@
                valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('mychecks');
                valuesForPHP_orig = 
YAHOO.util.Dom.getElementsByClassName('orig_check');
 
-               var myclone = null;
+               var values_return =
+               {
+                       assign:[],
+                       assign_orig:[]
+               };
+
                //add all control to form
                for(i=0;i<valuesForPHP.length;i++)
                {
-                       myclone = valuesForPHP[i].cloneNode(true);
-                       mydiv.appendChild(myclone);
+                       //values_return.assign[i] = valuesForPHP[i].value;
+                       if(valuesForPHP[i].checked)
+                       {
+                               
values_return.assign.push(valuesForPHP[i].value);
+                       }
                }
+
                for(i=0;i<valuesForPHP_orig.length;i++)
                {
-                       myclone = valuesForPHP_orig[i].cloneNode(true);
-                       mydiv.appendChild(myclone);
+                       //console.log(valuesForPHP_orig[i].name); // firebug
+                       values_return.assign_orig[i] = 
valuesForPHP_orig[i].value;
                }
+
+               var returnfield = document.createElement('input');
+               returnfield.setAttribute('name', 'values_assign');
+               returnfield.setAttribute('type', 'text');
+               returnfield.setAttribute('value', 
JSON.stringify(values_return));
+               mydiv.appendChild(returnfield);
+
                // find out the unique form
                formObject = document.body.getElementsByTagName('form');
                // modify the 'form' for send it as POST using asyncronize call

Modified: branches/Version-1_0-branch/rental/inc/class.soadjustment.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.soadjustment.inc.php   
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/rental/inc/class.soadjustment.inc.php   
2010-11-12 13:34:53 UTC (rev 6587)
@@ -140,11 +140,11 @@
                        $adjustment->get_new_price(),
                        $adjustment->get_percent(),
                        $adjustment->get_interval(),
-            $adjustment->get_adjustment_date(),
-            '\''.$adjustment->get_adjustment_type().'\'',
-            ($adjustment->is_manual() ? "true" : "false"),
-            ($adjustment->is_executed() ? "true" : "false"),
-            $adjustment->get_year()
+                       $adjustment->get_adjustment_date(),
+                       '\''.$adjustment->get_adjustment_type().'\'',
+                       ($adjustment->is_manual() ? "true" : "false"),
+                       ($adjustment->is_executed() ? "true" : "false"),
+                       $adjustment->get_year()
                );
 
                $query ="INSERT INTO rental_adjustment (" . join(',', $cols) . 
") VALUES (" . join(',', $values) . ")";
@@ -188,7 +188,6 @@
        
        public function run_adjustments()
        {
-               //TODO: 
                /* check if there are incomplete adjustments (for today)
                 * gather all adjustable contracts with 
                 *              interval = adjustment interval and this year = 
last adjusted + interval
@@ -199,12 +198,12 @@
                 * update adjustment -> set is_executed to true
                 * update price book elements according to type if interval=1
                 */
-               $current_date = strtotime('now'); //TODO: fix this
-               $prev_day = mktime(0,0,0,date('m'),date('d')-1,date('Y'));
+               
+               $prev_day = mktime(0,0,0,date('m'),date('d'),date('Y'));
                $next_day = mktime(0,0,0,date('m'),date('d')+1,date('Y'));
 
                //get incomplete adjustments for today
-               $adjustments_query = "SELECT * FROM rental_adjustment WHERE NOT 
is_executed AND (adjustment_date < {$next_day} AND adjustment_date > 
{$prev_day})";
+               $adjustments_query = "SELECT * FROM rental_adjustment WHERE NOT 
is_executed AND (adjustment_date < {$next_day} AND adjustment_date >= 
{$prev_day})";
                //var_dump($adjustments_query);
                $result = $this->db->query($adjustments_query);
                //var_dump("etter spr");
@@ -264,8 +263,8 @@
                        //gather all adjustable contracts
                        $adjustable_contracts = "SELECT id, adjustment_share, 
date_start, adjustment_year FROM rental_contract ";
                        $adjustable_contracts .= "WHERE location_id = 
'{$adjustment->get_responsibility_id()}' AND adjustable ";
-                       $adjustable_contracts .= "AND (";
-                       $adjustable_contracts .= "(adjustment_interval = 
{$adjustment->get_interval()} AND (adjustment_year + 
{$adjustment->get_interval()}) = {$adjustment->get_year()})";
+                       $adjustable_contracts .= "AND adjustment_interval = 
{$adjustment->get_interval()} ";
+                       $adjustable_contracts .= "AND (((adjustment_year + 
{$adjustment->get_interval()}) <= {$adjustment->get_year()})";
                        $adjustable_contracts .= " OR ";
                        $adjustable_contracts .= "(adjustment_year IS NULL OR 
adjustment_year = 0)";
                        $adjustable_contracts .= ")";
@@ -279,7 +278,10 @@
                                $adj_year = 
$this->unmarshal($this->db->f('adjustment_year', true), 'int');
                                $start_year = date('Y', $date_start);
 
-                               if(($adj_year != null && $adj_year > 0) || 
(($adj_year == null || $adj_year == 0) && ($start_year + 
$adjustment->get_interval() == $adjustment->get_year())))
+                               $contract = 
rental_socontract::get_instance()->get_single($contract_id);
+
+                               $firstJanAdjYear = 
mktime(0,0,0,1,1,$adjustment->get_year());
+                               if($contract->is_active($firstJanAdjYear) && 
(($adj_year != null && $adj_year > 0) || (($adj_year == null || $adj_year == 0) 
&& ($start_year + $adjustment->get_interval() <= $adjustment->get_year()))))
                                {
                                        //update adjustment_year on contract
                                        
rental_socontract::get_instance()->update_adjustment_year($contract_id, 
$adjustment->get_year());
@@ -374,5 +376,22 @@
                }
                return true;
        }
+       
+       public function newer_executed_regulation_exists($adjustment){
+               $columns = "id";
+               $table = "rental_adjustment";
+               $conditions = "is_executed='true'".
+                                       "AND adjustment_date > 
{$adjustment->get_adjustment_date()}".
+                                       "AND 
adjustment_interval={$adjustment->get_interval()}".
+                                       "AND 
responsibility_id={$adjustment->get_responsibility_id()}";
+               $sql = "Select $columns from $table where $conditions"; 
+               
+               $result = $this->db->query($sql);
+               
+               if($this->db->num_rows() > 0){
+                       return true;
+               }
+               return false;
+       }
 }
 ?>

Modified: branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.socontract.inc.php     
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/rental/inc/class.socontract.inc.php     
2010-11-12 13:34:53 UTC (rev 6587)
@@ -179,12 +179,19 @@
                        $adjustment_interval = 
$this->marshal($filters['adjustment_interval'],'int');
                        $adjustment_year = 
$this->marshal($filters['adjustment_year'],'int');
                        
-                       if($this->marshal($filters['adjustment_is_executed'])){
+                       if($filters['adjustment_is_executed']){
                                $filter_clauses[] = "contract.adjustment_year = 
{$adjustment_year}";
                        }
                        else{
-                               $filter_clauses[] = "contract.adjustment_year + 
{$adjustment_interval} = {$adjustment_year}";
+                               $filter_clauses[] = "contract.adjustment_year + 
{$adjustment_interval} <= {$adjustment_year}";
                        }
+                       
+                       $firstJanAdjYear = mktime(0,0,0,1,1,$adjustment_year);
+                       
+                       //make sure the contracts are active
+                       $filter_clauses[] = "(contract.date_end is null OR 
contract.date_end >= {$firstJanAdjYear})";
+                       $filter_clauses[] = "contract.date_start is not null 
AND contract.date_start <= {$firstJanAdjYear}";
+                       
                        $filter_clauses[] = "contract.adjustable IS true";
                        $filter_clauses[] = "contract.adjustment_interval = 
{$adjustment_interval}";
                        

Modified: branches/Version-1_0-branch/rental/inc/class.uiadjustment.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uiadjustment.inc.php   
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/rental/inc/class.uiadjustment.inc.php   
2010-11-12 13:34:53 UTC (rev 6587)
@@ -96,7 +96,7 @@
                {
                        default:
                                $value['ajax'][] = false;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 'rental.uiadjustment.view', 
'id' => $value['id'])));
+                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'rental.uiadjustment.show_affected_contracts', 'id' => $value['id'])));
                                $value['labels'][] = lang('show');
                                $value['ajax'][] = false;
                                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 'rental.uiadjustment.edit', 
'id' => $value['id'])));
@@ -107,9 +107,9 @@
                                $value['ajax'][] = false;
                                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'rental.uiadjustment.delete', 'id' => $value['id'])));
                                $value['labels'][] = lang('delete');
-                               $value['ajax'][] = false;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'rental.uiadjustment.show_affected_contracts', 'id' => $value['id'])));
-                               $value['labels'][] = 
lang('show_affected_contracts');
+                               //$value['ajax'][] = false;
+                               //$value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'rental.uiadjustment.show_affected_contracts', 'id' => $value['id'])));
+                               //$value['labels'][] = 
lang('show_affected_contracts');
                                
                        }
        }
@@ -271,9 +271,17 @@
        {
                $adjustment_id = (int)phpgw::get_var('id');
                $adjustment = 
rental_soadjustment::get_instance()->get_single($adjustment_id);
+
+               //if there exist another regulation that has been exectued 
after current regulation with the same filters, the affected list will be out 
of date.
+               $show_affected_list = true;
+               if($adjustment->is_executed()){
+                       
if(rental_soadjustment::get_instance()->newer_executed_regulation_exists($adjustment))$show_affected_list
 = false;
+               }
+
                $this->render('contracts_for_regulation_list.php', 
array('adjustment_id' => $adjustment_id, 
                                                                                
                                                        'adjustment' => 
$adjustment,
-                                                                               
                                                        'cancel_link' => 
self::link(array('menuaction' => 'rental.uiadjustment.index'))));
+                                                                               
                                                        'cancel_link' => 
self::link(array('menuaction' => 'rental.uiadjustment.index')),
+                                                                               
                                                        'show_affected_list' => 
$show_affected_list));
        }
        
        public function run_adjustments()

Modified: branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php 
2010-11-12 13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php 
2010-11-12 13:34:53 UTC (rev 6587)
@@ -995,9 +995,11 @@
                        }
                }
                
-               public function is_active()
+               public function is_active($date)
                {
-                       $ts = strtotime(date('Y-m-d')); // timestamp for today
+                       $ts = $date;
+                       if(!$ts)
+                               $ts = strtotime(date('Y-m-d')); // timestamp 
for today
                        
                        $date_start = 
$this->get_contract_date()->get_start_date();
                        $date_end = $this->get_contract_date()->get_end_date();

Modified: branches/Version-1_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2010-11-12 
13:29:50 UTC (rev 6586)
+++ branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2010-11-12 
13:34:53 UTC (rev 6587)
@@ -20,6 +20,7 @@
 adjustment_is_executed rental  no      Reguleringen er utført
 adjustment_is_not_executed     rental  no      Reguleringen er ikke utført
 adjustment_list        rental  no      Reguleringer
+adjustment_list_out_of_date    rental  no      Det er kjørt en nyere 
regulering for samme utvalg av kontrakter
 adjustment_share       rental  no      Reguleringsandel
 adjustment_type        rental  no      Reguleringstype
 adjustment_year        rental  no      Sist regulert

Modified: 
branches/Version-1_0-branch/rental/templates/base/contracts_for_regulation_list.php
===================================================================
--- 
branches/Version-1_0-branch/rental/templates/base/contracts_for_regulation_list.php
 2010-11-12 13:29:50 UTC (rev 6586)
+++ 
branches/Version-1_0-branch/rental/templates/base/contracts_for_regulation_list.php
 2010-11-12 13:34:53 UTC (rev 6587)
@@ -42,19 +42,26 @@
        </div>
        <div style="float: left; width: 100%;">
        <?php
-               $list_form = false; 
-               $list_id = 'contracts_for_adjustment';
-               $url_add_on = '&amp;type='.$list_id.'&amp;id='.$adjustment_id;
-               $editable = false;
-               $extra_cols = array(
-                       array("key" => "type", "label" => 
lang('responsibility'), "index" => 3),
-                       array("key" => "composite", "label" => 
lang('composite'), "sortable"=>'true', "index" => 4),
-                       array("key" => "party", "label" => lang('party'), 
"sortable"=>'true', "index" => 5),
-                       array("key" => "adjustment_interval", "label" => 
lang('adjustment_interval'), "sortable"=>false),
-                       array("key" => "adjustment_share", "label" => 
lang('adjustment_share'), "sortable"=>false),
-                       array("key" => "adjustment_year", "label" => 
lang('adjustment_year'), "sortable"=>false)
-               );
-               include('contract_list_partial.php'); 
+               if($show_affected_list){
+                       $list_form = false; 
+                       $list_id = 'contracts_for_adjustment';
+                       $url_add_on = 
'&amp;type='.$list_id.'&amp;id='.$adjustment_id;
+                       $editable = false;
+                       $extra_cols = array(
+                               array("key" => "type", "label" => 
lang('responsibility'), "index" => 3),
+                               array("key" => "composite", "label" => 
lang('composite'), "sortable"=>'true', "index" => 4),
+                               array("key" => "party", "label" => 
lang('party'), "sortable"=>'true', "index" => 5),
+                               array("key" => "adjustment_interval", "label" 
=> lang('adjustment_interval'), "sortable"=>false),
+                               array("key" => "adjustment_share", "label" => 
lang('adjustment_share'), "sortable"=>false),
+                               array("key" => "adjustment_year", "label" => 
lang('adjustment_year'), "sortable"=>false)
+                       );
+                       include('contract_list_partial.php');
+               }
+               else{
        ?>
+               <h3><?php echo lang("adjustment_list_out_of_date")?></h3>
+       <?php
+               }
+       ?>
        </div>
 </div>
\ No newline at end of file




reply via email to

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