fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10696] property: invoice::when to close orders, bulk


From: Sigurd Nes
Subject: [Fmsystem-commits] [10696] property: invoice::when to close orders, bulkupdate:: transfer budget to new year
Date: Sun, 20 Jan 2013 18:52:57 +0000

Revision: 10696
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10696
Author:   sigurdne
Date:     2013-01-20 18:52:55 +0000 (Sun, 20 Jan 2013)
Log Message:
-----------
property: invoice::when to close orders, bulkupdate::transfer budget to new year

Modified Paths:
--------------
    trunk/property/inc/class.boproject.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiinvoice.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/js/portico/ajax_invoice.js
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/project.xsl
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php  2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/inc/class.boproject.inc.php  2013-01-20 18:52:55 UTC (rev 
10696)
@@ -884,9 +884,9 @@
                        $this->so->delete($project_id);
                }
 
-               function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb)
+               function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget)
                {
-                       return $this->so->bulk_update_status($start_date, 
$end_date, $status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb);
+                       return $this->so->bulk_update_status($start_date, 
$end_date, $status_filter, $status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget);
                }
 
                public function get_user_list($selected = 0)

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/inc/class.soinvoice.inc.php  2013-01-20 18:52:55 UTC (rev 
10696)
@@ -1426,7 +1426,7 @@
                        }                       
 
                        $sql = "SELECT {$table}.*,fm_workorder_status.descr as 
status, fm_workorder.charge_tenant,org_name,"
-                               . "fm_workorder.claim_issued, 
fm_workorder_status.closed FROM {$table}"
+                               . " fm_workorder.claim_issued, 
fm_workorder.continuous, fm_workorder_status.closed FROM {$table}"
                                . " {$this->left_join} fm_workorder ON 
fm_workorder.id = {$table}.pmwrkord_code"
                                . " {$this->left_join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
                                . " {$this->left_join} fm_project ON 
fm_workorder.project_id = fm_project.id"
@@ -1482,6 +1482,7 @@
                                                'period'                        
        => $this->db->f('periode'),
                                                'periodization'                 
=> $this->db->f('periodization'),
                                                'periodization_start'   => 
$this->db->f('periodization_start'),
+                                               'continuous'                    
=> $this->db->f('continuous'),
                                        );
                        }
 

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/inc/class.soproject.inc.php  2013-01-20 18:52:55 UTC (rev 
10696)
@@ -82,7 +82,7 @@
                        while ($this->db->next_record())
                        {
                                $branch[] = array
-                                       ( 
+                                       (
                                                'id' => $this->db->f('id'),
                                                'name'  => 
$this->db->f('descr',true)
                                        );
@@ -97,7 +97,7 @@
                        while ($this->db->next_record())
                        {
                                $location[] = array
-                                       ( 
+                                       (
                                                'id' => $this->db->f('id'),
                                                'name'  => 
$this->db->f('descr',true)
                                        );
@@ -478,7 +478,7 @@
                                        {
                                                $_status_filter[] = 
$this->db->f('id');
                                        }
-                                       $filtermethod .= " $where 
fm_project.status IN ('" . implode("','", $_status_filter) . "')"; 
+                                       $filtermethod .= " $where 
fm_project.status IN ('" . implode("','", $_status_filter) . "')";
                                }
                                else
                                {
@@ -710,7 +710,7 @@
 
 */
 
-                                       $get_spesific = false; 
+                                       $get_spesific = false;
                                        if ($filter_year && $filter_year != 
'all')
                                        {
                                                $this->db->query("SELECT 
sum(fm_project_budget.budget) AS budget"
@@ -718,7 +718,7 @@
                                                $this->db->next_record();
                                                $project['budget'] =  
$this->db->f('budget');
 
-                                               $get_spesific = true; 
+                                               $get_spesific = true;
                                                $_year_arr = array();
                                                for ($i=1;$i<14;$i++)
                                                {
@@ -1177,7 +1177,7 @@
 
                        if($project['budget'])
                        {
-                               $this->update_budget($id, 
$project['budget_year'], $project['budget_periodization'], 
$project['budget'],$project['budget_periodization_all']);
+                               $this->update_budget($id, 
$project['budget_year'], $project['budget_periodization'], 
$project['budget'],$project['budget_periodization_all'],'update', 
$project['budget_periodization_activate']);
                        }
 
                        if($project['extra']['contact_phone'] && 
$project['extra']['tenant_id'])
@@ -1461,7 +1461,7 @@
 
                                if($project['budget'])
                                {
-                                       $this->update_budget($project['id'], 
$project['budget_year'], $project['budget_periodization'], 
$project['budget'],$project['budget_periodization_all']);
+                                       $this->update_budget($project['id'], 
$project['budget_year'], $project['budget_periodization'], 
$project['budget'],$project['budget_periodization_all'], 'update', 
$project['budget_periodization_activate']);
                                }
 
                                $this->db->query("SELECT sum(budget) AS 
sum_budget FROM fm_project_budget WHERE active = 1 AND project_id = " . 
(int)$project['id'],__LINE__,__FILE__);
@@ -1653,7 +1653,7 @@
                                        unset($action_params);
                                }
 
-                               $workorder_closed_status = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : 'closed'; 
+                               $workorder_closed_status = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : 'closed';
 
                                if($old_status != $project['status'])
                                {
@@ -1867,7 +1867,7 @@
                }
 
 
-               function update_budget($project_id, $year, $periodization_id, 
$budget, $budget_periodization_all = false, $action = 'update')
+               function update_budget($project_id, $year, $periodization_id, 
$budget, $budget_periodization_all = false, $action = 'update', $activate = 0)
                {
                        $project_id = (int) $project_id;
                        $year = $year ? (int) $year : date('Y');
@@ -1901,7 +1901,7 @@
                                                                else
                                                                {
                                                                        
$partial_budget = $budget;
-                                                                       
$partial_budget = $partial_budget > 0 ? $partial_budget : 0; 
+                                                                       
$partial_budget = $partial_budget > 0 ? $partial_budget : 0;
                                                                        $budget 
= 0;
                                                                }
                                                        }
@@ -1918,7 +1918,7 @@
                                                                else
                                                                {
                                                                        
$partial_budget = $budget;
-                                                                       
$partial_budget = $partial_budget < 0 ? $partial_budget : 0; 
+                                                                       
$partial_budget = $partial_budget < 0 ? $partial_budget : 0;
                                                                        $budget 
= 0;
                                                                }
                                                        }
@@ -1937,12 +1937,12 @@
 
                                        $acc_partial += $budget;
 
-                                       $this->_update_budget($project_id, 
$year, $month, $budget, $action);                                    
+                                       $this->_update_budget($project_id, 
$year, $month, $budget, $action);
                                }
-                               
+
                                if(!$hit)
                                {
-                                       throw new 
Exception('property_soproject::update_buffer_budget() - found no active budget 
to transfer from');                            
+                                       throw new 
Exception('property_soproject::update_buffer_budget() - found no active budget 
to transfer from');
                                }
 
                                return $acc_partial;
@@ -2021,7 +2021,7 @@
                                }
                                $partial_budget = $partial_budget * (1 + 
$percentage_to_move);
 
-                               $this->_update_budget($project_id, $year, 
$outline['month'], $partial_budget, $action);
+                               $this->_update_budget($project_id, $year, 
$outline['month'], $partial_budget, $action, $activate);
                        }
 
                        $sql = "SELECT sum(budget) as sum_budget FROM 
fm_project_budget WHERE active = 1 AND project_id = {$project_id}";
@@ -2034,13 +2034,13 @@
                }
 
 
-               private function _update_budget($project_id, $year, $month, 
$budget, $action = 'update')
+               private function _update_budget($project_id, $year, $month, 
$budget, $action = 'update', $active = 0)
                {
                        $month = (int) $month;
                        $budget = (int) $budget;
                        $now = time();
-
-                       $sql = "SELECT budget FROM fm_project_budget WHERE 
project_id = {$project_id} AND year = {$year} AND month = {$month}";
+                       $active = (int) $active;
+                       $sql = "SELECT budget,active FROM fm_project_budget 
WHERE project_id = {$project_id} AND year = {$year} AND month = {$month}";
 //_debug_array($sql);
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
@@ -2052,14 +2052,16 @@
                                }
                                else if ($action == 'update')
                                {
-                                       $new_budget = $budget;                  
        
+                                       $new_budget = $budget;
+//                                     $active = (int)$this->db->f('active');
                                }
                                else if ($action == 'subtract')
                                {
                                        $new_budget = $old_budget - $budget;
+//                                     $active = (int)$this->db->f('active');
                                }
 
-                               $sql = "UPDATE fm_project_budget SET budget = 
{$new_budget}, modified_date = {$now} WHERE project_id = {$project_id} AND year 
= {$year} AND month = {$month}";                          
+                               $sql = "UPDATE fm_project_budget SET budget = 
{$new_budget}, modified_date = {$now} WHERE project_id = {$project_id} AND year 
= {$year} AND month = {$month}";
 //_debug_array($sql);
                                $this->db->query($sql,__LINE__,__FILE__);
                        }
@@ -2074,9 +2076,11 @@
                                        'user_id'                       => 
$this->account,
                                        'entry_date'            => $now,
                                        'modified_date'         => $now,
-//                                     'active'                        => 1
+                                       'active'                        => 
$active // only for new entries
                                );
 
+//_debug_array($value_set);die();
+
                                $cols = implode(',', array_keys($value_set));
                                $values = 
$this->db->validate_insert(array_values($value_set));
                                $this->db->query("INSERT INTO fm_project_budget 
({$cols}) VALUES ({$values})",__LINE__,__FILE__);
@@ -2570,8 +2574,16 @@
                }
 
 
-               function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, $user_id = 0,$ids,$paid = false, 
$closed_orders = false, $ecodimb = 0)
+               function bulk_update_status($start_date, $end_date, 
$status_filter, $status_new, $execute, $type, $user_id = 0,$ids,$paid = false, 
$closed_orders = false, $ecodimb = 0, $transfer_budget=0)
                {
+
+                       if($transfer_budget)
+                       {
+                               echo "<H1> Overføre budsjett for valgte 
prosjekt/bestillinger til år {$transfer_budget} </H1>";
+                               _debug_array($ids);
+                               die();
+                       }
+
                        $start_date = $start_date ? 
phpgwapi_datetime::date_to_timestamp($start_date) : time();
                        $start_date -= 3600*24;
                        $end_date = $end_date ? 
phpgwapi_datetime::date_to_timestamp($end_date) : time();
@@ -2593,7 +2605,7 @@
                        {
                                if($status_filter == 'open')
                                {
-                                       $filter .= " AND 
fm_{$type}_status.closed IS NULL"; 
+                                       $filter .= " AND 
fm_{$type}_status.closed IS NULL";
 
                                }
                                else
@@ -2602,9 +2614,14 @@
                                }
                        }
 
+                       $sql_budget = "SELECT DISTINCT year, active FROM 
fm_{$type}_budget WHERE ";
+
                        switch($type)
                        {
                                case 'project':
+
+                                       $sql_budget .= 'project_id = %d ORDER 
BY year';
+
                                        if($closed_orders)
                                        {
                                                $filter .=  " AND 
fm_open_workorder_view.project_id IS NULL";
@@ -2614,22 +2631,26 @@
                                        $status_table = 'fm_project_status';
                                        $title_field = 'fm_project.name as 
title';
                                        $this->_update_status_project($execute, 
$status_new, $ids);
-                                       $sql = "SELECT DISTINCT {$table}.id, 
$status_table.descr as status ,{$title_field},{$table}.start_date, 
count(project_id) as num_open FROM {$table}"
+                                       $sql = "SELECT DISTINCT {$table}.id, 
$status_table.descr as status 
,{$title_field},{$table}.start_date,{$table}.project_type_id, count(project_id) 
as num_open FROM {$table}"
                                        . " {$this->join} {$status_table} ON  
{$table}.status = {$status_table}.id "
                                        . " {$this->left_join} 
fm_open_workorder_view ON {$table}.id = fm_open_workorder_view.project_id "
-                                       . " WHERE ({$table}.start_date > 
{$start_date} AND {$table}.start_date < {$end_date} {$filter})"
-                                       . " GROUP BY {$table}.id, 
$status_table.descr ,{$table}.name, {$table}.start_date"
+                                       . " WHERE ({$table}.start_date > 
{$start_date} AND {$table}.start_date < {$end_date} OR {$table}.start_date IS 
NULL)  {$filter}"
+                                       . " GROUP BY {$table}.id, 
$status_table.descr ,{$table}.name, {$table}.start_date,project_type_id"
                                        . " ORDER BY {$table}.id DESC";
 
                                        break;
                                case 'workorder':
 
+                                       $sql_budget .= 'order_id = %d ORDER BY 
year';
+
                                        $table = 'fm_workorder';
                                        $status_table = 'fm_workorder_status';
                                        $title_field = 'fm_workorder.title';
                                        $actual_cost = ',actual_cost';
 
                                        $join_method = "{$this->join} 
{$status_table} ON  {$table}.status = {$status_table}.id";
+                                       $join_method .= " {$this->join} 
fm_project ON  {$table}.project_id = fm_project.id";
+
                                        if($paid)
                                        {
                                                $join_method .=  " 
{$this->join} fm_orders_actual_cost_view ON fm_workorder.id = 
fm_orders_actual_cost_view.order_id";
@@ -2637,15 +2658,22 @@
                                        }
 
                                        
$this->_update_status_workorder($execute, $status_new, $ids);
-                                       $sql = "SELECT {$table}.id, project_id, 
$status_table.descr as status ,{$title_field},start_date {$actual_cost} FROM 
{$table}"
-                                       . " {$join_method}"
-                                       . " WHERE ({$table}.start_date > 
{$start_date} AND {$table}.start_date < {$end_date} {$filter}) OR start_date is 
NULL"
+                                       $sql = "SELECT {$table}.id, project_id, 
$status_table.descr as status ,{$title_field},{$table}.start_date 
{$actual_cost},project_type_id"
+                                       . " FROM {$table} {$join_method}"
+                                       . " WHERE ({$table}.start_date > 
{$start_date} AND {$table}.start_date < {$end_date} {$filter}) OR 
{$table}.start_date is NULL"
                                        . " ORDER BY {$table}.id DESC";
                                        break;
                                default:
                                        return array();
                        }
 
+                       $project_types = array
+                       (
+                               1       => lang('operation'),
+                               2       => lang('investment'),
+                               3       => lang('buffer')
+                       );
+
                        $this->db->query($sql,__LINE__,__FILE__);
                        $values = array();
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -2654,19 +2682,32 @@
                        {
                                $values[] = array
                                (
-                                       'id'                    => 
$this->db->f('id'),
-                                       'project_id'    => 
$this->db->f('project_id'),
-                                       'title'                 => 
htmlspecialchars_decode($this->db->f('title',true)),
-                                       'status'                => 
$this->db->f('status',true),
-                                       'actual_cost'   => 
(float)$this->db->f('actual_cost'),
-                                       'start_date'    => 
$GLOBALS['phpgw']->common->show_date($this->db->f('start_date'),$dateformat),
-                                       'num_open'              => 
(int)$this->db->f('num_open'),
+                                       'id'                            => 
$this->db->f('id'),
+                                       'project_id'            => 
$this->db->f('project_id'),
+                                       'title'                         => 
htmlspecialchars_decode($this->db->f('title',true)),
+                                       'status'                        => 
$this->db->f('status',true),
+                                       'actual_cost'           => 
(float)$this->db->f('actual_cost'),
+                                       'start_date'            => 
$GLOBALS['phpgw']->common->show_date($this->db->f('start_date'),$dateformat),
+                                       'num_open'                      => 
(int)$this->db->f('num_open'),
+                                       'project_type'          => 
$project_types[$this->db->f('project_type_id')],
                                );
                        }
 
-                       return $values;
+                       foreach($values as &$entry)
+                       {
+                               $sql = sprintf($sql_budget,$entry['id']);
+                               $this->db->query($sql,__LINE__,__FILE__);
 
+                               $budget = array();
 
+                               while ($this->db->next_record())
+                               {
+                                       $budget[] = $this->db->f('year') . '[' 
. $this->db->f('active') . ']';
+                               }
+                               $entry['budget'] = implode(';', $budget);
+                       }
+
+                       return $values;
                }
 
                protected function _update_status_project($execute, 
$status_new, $ids)
@@ -2677,7 +2718,7 @@
                        }
                        $historylog     = 
CreateObject('property.historylog','project');
 
-                       $workorder_closed_status = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : false; 
+                       $workorder_closed_status = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : false;
 
                        $this->db->transaction_begin();
                        foreach ($ids as $id)

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2013-01-18 13:21:04 UTC 
(rev 10695)
+++ trunk/property/inc/class.soworkorder.inc.php        2013-01-20 18:52:55 UTC 
(rev 10696)
@@ -766,14 +766,14 @@
                                }
 
 
-                               $sql_cost = "SELECT fm_workorder.id as 
order_id,closed, actual_cost, pending_cost,fm_location1.mva,"
+                               $sql_cost = "SELECT fm_workorder.id as 
order_id,closed, sum(fm_orders_paid_or_pending_view.amount) as actual_cost, 
fm_location1.mva,"
                                . " sum(fm_workorder_budget.budget) AS budget, 
sum(fm_workorder_budget.combined_cost) AS combined_cost"
-                               . " FROM fm_workorder {$this->left_join} 
fm_orders_pending_cost_view ON fm_workorder.id = 
fm_orders_pending_cost_view.order_id"
+                               . " FROM fm_workorder {$this->left_join} 
fm_orders_paid_or_pending_view ON fm_workorder.id = 
fm_orders_paid_or_pending_view.order_id"
                                . " {$this->join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
                                . " {$this->join} fm_workorder_budget ON 
(fm_workorder.id = fm_workorder_budget.order_id)"
                                . " {$_join_district}"
                                . ' WHERE fm_workorder.id IN (' . implode(',', 
$_order_list ) .')'
-                               . " GROUP BY fm_workorder.id,closed, 
actual_cost, pending_cost, fm_location1.mva";
+                               . " GROUP BY fm_workorder.id,closed, 
fm_location1.mva";
 
                                unset($_order_list);
                                $this->db->query($sql_cost,__LINE__,__FILE__);
@@ -781,7 +781,7 @@
                                {
                                        
$_actual_cost_arr[$this->db->f('order_id')] = array
                                        (
-                                               'actual_cost'   => 
$this->db->f('actual_cost') + (float)$this->db->f('pending_cost'),
+                                               'actual_cost'   => 
$this->db->f('actual_cost'),
                                                'budget'                => 
$this->db->f('budget'),
                                                'combined_cost' => 
$this->db->f('combined_cost'),
                                                'closed'                => 
!!$this->db->f('closed'),
@@ -921,7 +921,8 @@
                                        'billable_hours'                => 
$this->db->f('billable_hours'),
                                        'approved'                              
=> $this->db->f('approved'),
                                        'mail_recipients'               => 
explode(',', trim($this->db->f('mail_recipients'),',')),
-                                       'actual_cost'                   => 
$this->db->f('actual_cost')
+                                       'actual_cost'                   => 
$this->db->f('actual_cost'),
+                                       'continuous'                    => 
$this->db->f('continuous')
                                );
 
                                $sql = "SELECT periodization_id,"
@@ -1209,14 +1210,16 @@
                                        $workorder['billable_hours'],
                                        $workorder['contract_sum'],
                                        $workorder['approved'],
+                                       $workorder['continuous'],
                                        isset($workorder['vendor_email']) && 
is_array($workorder['vendor_email']) ? implode(',', $workorder['vendor_email']) 
: ''
                                );
 
                        $values = $this->db->validate_insert($values);
 
                        $this->db->query("INSERT INTO fm_workorder 
(id,num,project_id,title,access,entry_date,start_date,end_date,status,"
-                               . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,user_id,ecodimb,category,billable_hours,contract_sum,approved,mail_recipients
  $cols) "
-                               . "VALUES ( $values $vals)",__LINE__,__FILE__);
+                               . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,"
+                               . 
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,mail_recipients
  $cols) "
+                               . "VALUES ( {$values} 
{$vals})",__LINE__,__FILE__);
 
                        $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES ({$id},'workorder')");
 
@@ -1356,6 +1359,7 @@
                                'billable_hours'        => 
$workorder['billable_hours'],
 //                             'contract_sum'          => 
$workorder['contract_sum'],
                                'approved'                      => 
$workorder['approved'],
+                               'continuous'            => 
$workorder['continuous'],
                                'mail_recipients'       => 
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ? 
implode(',', $workorder['vendor_email']) : '',
                        );
 

Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php  2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/inc/class.uiinvoice.inc.php  2013-01-20 18:52:55 UTC (rev 
10696)
@@ -1869,6 +1869,10 @@
                                                        {
                                                                $_checked = 
'checked="checked"';
                                                        }
+                                                       else 
if(!$invoices['continuous'])
+                                                       {
+                                                               $_checked = 
'checked="checked"';
+                                                       }
 
                                                        
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_orig][{$j}]' id='values[close_order_orig][{$j}]' 
class='myValuesForPHP ' type='hidden' value='{$invoices['closed']}'/>";
                                                        
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_tmp][{$j}]' id='values[close_order_tmp][{$j}]' 
class='close_order_tmp transfer_idClass' type='checkbox' value='true' 
{$_checked}/>";

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/inc/class.uiproject.inc.php  2013-01-20 18:52:55 UTC (rev 
10696)
@@ -2244,6 +2244,7 @@
                        $id_to_update   = phpgw::get_var('id_to_update');
                        $paid                   = phpgw::get_var('paid', 
'bool', 'POST');
                        $closed_orders  = phpgw::get_var('closed_orders', 
'bool', 'POST');
+                       $transfer_budget= phpgw::get_var('transfer_budget', 
'integer');
                        
                        if(isset($_POST['user_id']))
                        {
@@ -2274,7 +2275,7 @@
 
                        if(($execute || $get_list) && $type)
                        {
-                               $list = 
$this->bo->bulk_update_status($start_date, $end_date, $status_filter, 
$status_new, $execute, $type, $user_id,$ids,$paid,$closed_orders,$ecodimb);
+                               $list = 
$this->bo->bulk_update_status($start_date, $end_date, $status_filter, 
$status_new, $execute, $type, 
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget);
                        }
 
                        $total_records  = count($list);
@@ -2300,6 +2301,8 @@
                                                                                
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'num_open','label'=>lang('open'),'sortable'=>true,'resizeable'=>true 
,'formatter'=>'FormatterRight'),
+                                                                               
                                array('key' => 
'project_type','label'=>lang('project 
type'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 'select','label'=> 
lang('select'), 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)
                                                                                
                                ))
                                        );
@@ -2314,6 +2317,8 @@
                                                                                
                                array('key' => 
'start_date','label'=>lang('date'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'project_type','label'=>lang('project 
type'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 
'actual_cost','label'=>lang('actual cost'),'sortable'=>true,'resizeable'=>true 
,'formatter'=>'FormatterRight'),
                                                                                
                                array('key' => 'select','label'=> 
lang('select'), 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)
                                                                                
                                ))
@@ -2375,8 +2380,24 @@
                                $entry['selected'] = $entry['id'] == $type ? 1 
: 0;
                        }
 
+
+
+                       $year   = date('Y');
+                       $limit  = $year + 2;
+
+                       while ($year < $limit)
+                       {
+                               $year_list[] = array
+                               (
+                                       'id'    =>  $year,
+                                       'name'  =>  $year
+                               );
+                               $year++;
+                       }
+
                        $data = array
                        (
+                               'year_list'                             => 
array('options' => $year_list),
                                'property_js'                   => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
                                'datatable'                             => 
$datavalues,
                                'myColumnDefs'                  => 
$myColumnDefs,

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2013-01-18 13:21:04 UTC 
(rev 10695)
+++ trunk/property/inc/class.uiworkorder.inc.php        2013-01-20 18:52:55 UTC 
(rev 10696)
@@ -991,6 +991,7 @@
                                                
if(!$approve_role['is_supervisor'] && ! $approve_role['is_budget_responsible'])
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('you do not have permission to approve 
this order') );
+                                                       $values['approved'] = 
false;
                                                        $error_id=true;
                                                }
                                        }
@@ -2063,6 +2064,7 @@
                                'lang_key_deliver_statustext'                   
=> lang('Select where to deliver the key'),
 
                                'value_approved'                                
                => isset($values['approved']) ? $values['approved'] : '',
+                               'value_continuous'                              
                => isset($values['continuous']) ? $values['continuous'] : '',
                                'need_approval'                                 
                => $need_approval,
                                'lang_ask_approval'                             
                => lang('Ask for approval'),
                                'lang_ask_approval_statustext'                  
=> lang('Check this to send a mail to your supervisor for approval'),

Modified: trunk/property/js/portico/ajax_invoice.js
===================================================================
--- trunk/property/js/portico/ajax_invoice.js   2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/js/portico/ajax_invoice.js   2013-01-20 18:52:55 UTC (rev 
10696)
@@ -343,6 +343,15 @@
                                {
                                        checked_close_order = "checked = 
\"checked\"";
                                }
+                               else if(voucher[0].project_type_id == 1 && 
voucher[0].periodization_id) // operation projekts
+                               {
+                                       checked_close_order = "checked = 
\"checked\"";
+                               }
+                               else if(!voucher[0].continuous)
+                               {
+                                       checked_close_order = "checked = 
\"checked\"";
+                               }
+                               
                                var htmlString_close_order = "<input 
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close 
order\"" + checked_close_order + "></input>" + close_order_status;
                                $("#close_order").html( htmlString_close_order 
);
                                $("#close_order_orig").val( voucher[0].closed );

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2013-01-18 13:21:04 UTC (rev 10695)
+++ trunk/property/setup/phpgw_no.lang  2013-01-20 18:52:55 UTC (rev 10696)
@@ -369,6 +369,7 @@
 consume value  property        no      Beløp historisk forbruk
 consume history        property        no      Historisk forbruk
 continue       property        no      Fortsett
+continuous     property        no      Løpende
 line   property        no      Linje
 sheet  property        no      Ark
 choose file    property        no      Velg Fil
@@ -1942,6 +1943,7 @@
 you have entered an invalid end date ! property        no      Du har angitt 
en ugyldig slutt dato
 you have entered an invalid start date !       property        no      Du har 
angitt en ugyldig start dato
 you have no edit right for this project        property        no      Du har 
ikke editeringsrettigheter for dette prosjektet
+you do not have permission to approve this order       property        no      
Du har ikke rettighteter for a godkjenne bestillingen
 you have to select a budget responsible for this invoice in order to add the 
invoice   property        no      Du må velge en anviser for å kunne legge til 
en faktura
 you have to select a budget responsible for this invoice in order to make the 
import   property        no      Du må velge en anviser for å importere
 you have to select the conversion for this import      property        no      
Du må velge importformat

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2013-01-18 13:21:04 UTC (rev 10695)
+++ trunk/property/setup/setup.inc.php  2013-01-20 18:52:55 UTC (rev 10696)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.662';
+       $setup_info['property']['version']              = '0.9.17.663';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/setup/tables_current.inc.php 2013-01-20 18:52:55 UTC (rev 
10696)
@@ -529,7 +529,8 @@
                                'billable_hours' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
                                'contract_sum' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'approved'      => array('type' => 
'int','precision' => 2, 'nullable' => True),
-                               'mail_recipients' => array('type' => 
'varchar','precision' => 255, 'nullable' => True)
+                               'mail_recipients' => array('type' => 
'varchar','precision' => 255, 'nullable' => True),
+                               'continuous'    => array('type' => 
'int','precision' => 2, 'nullable' => True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/setup/tables_update.inc.php  2013-01-20 18:52:55 UTC (rev 
10696)
@@ -7252,3 +7252,29 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.662 to 0.9.17.663
+       * Add continuous-flag to workorder
+       */
+       $test[] = '0.9.17.662';
+       function property_upgrade0_9_17_662()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','continuous',array(
+                       'type'          => 'int',
+                       'precision'     => 2,
+                       'nullable'      => True
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.663';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/templates/base/project.xsl   2013-01-20 18:52:55 UTC (rev 
10696)
@@ -447,9 +447,18 @@
                                                                                
                        <input type="checkbox" 
name="values[budget_periodization_all]" value="True">
                                                                                
                                <xsl:attribute name="title">
                                                                                
                                        <xsl:value-of 
select="php:function('lang', 'all')"/>
+                                                                               
                                        <xsl:text> </xsl:text>
+                                                                               
                                        <xsl:value-of 
select="php:function('lang', 'periods')"/>
                                                                                
                                </xsl:attribute>
                                                                                
                        </input>
                                                                                
                </td>
+                                                                               
                <td>
+                                                                               
                        <input type="checkbox" 
name="values[budget_periodization_activate]" value="1">
+                                                                               
                                <xsl:attribute name="title">
+                                                                               
                                        <xsl:value-of 
select="php:function('lang', 'activate')"/>
+                                                                               
                                </xsl:attribute>
+                                                                               
                        </input>
+                                                                               
                </td>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
                                                                                
</tr>
@@ -979,6 +988,22 @@
                                                        </select>
                                                </td>
                                        </tr>
+                                       <tr>
+                                               <td>
+                                                       <xsl:value-of 
select="php:function('lang', 'transfer budget')"/>
+                                               </td>
+                                               <td>
+                                                       <select 
name="transfer_budget">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'transfer budget')"/>
+                                                               </xsl:attribute>
+                                                               <option 
value="0">
+                                                                       
<xsl:value-of select="php:function('lang', 'select year')"/>
+                                                               </option>
+                                                               
<xsl:apply-templates select="year_list/options"/>
+                                                       </select>
+                                               </td>
+                                       </tr>
                                        <xsl:choose>
                                                <xsl:when test="check_paid = 1">
                                                        <tr>

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2013-01-18 13:21:04 UTC (rev 
10695)
+++ trunk/property/templates/base/workorder.xsl 2013-01-20 18:52:55 UTC (rev 
10696)
@@ -510,14 +510,6 @@
                                                                                
                </input>
                                                                                
        </td>
                                                                                
</tr>
-                                                                               
<tr>
-                                                                               
        <td valign="top">
-                                                                               
                <xsl:value-of select="php:function('lang', 'selected mail 
addresses')"/>
-                                                                               
        </td>
-                                                                               
        <td>
-                                                                               
                <xsl:value-of select="mail_recipients"/>
-                                                                               
        </td>
-                                                                               
</tr>
                                                                        </tr>
                                                                </xsl:when>
                                                                <xsl:otherwise>
@@ -559,6 +551,32 @@
                                                                        
<xsl:call-template name="cat_sub_select"/>
                                                                </td>
                                                        </tr>
+                                                       
+                                                       <tr>
+                                                               <xsl:variable 
name="lang_continuous">
+                                                                       
<xsl:value-of select="php:function('lang', 'continuous')"/>
+                                                               </xsl:variable>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="$lang_continuous"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="checkbox" name="values[continuous]" value="1">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="$lang_continuous"/>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:if test="value_continuous = '1'">
+                                                                               
        <xsl:attribute name="checked">
+                                                                               
                <xsl:text>checked</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
</xsl:if>
+                                                                               
<xsl:if test="mode != 'edit'">
+                                                                               
        <xsl:attribute name="disabled">
+                                                                               
                <xsl:text>disabled</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
</xsl:if>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
 
                                                        <tr>
                                                                <td 
valign="top">




reply via email to

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