fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13766] edit hook home


From: Sigurd Nes
Subject: [Fmsystem-commits] [13766] edit hook home
Date: Mon, 24 Aug 2015 13:06:48 +0000

Revision: 13766
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13766
Author:   sigurdne
Date:     2015-08-24 13:06:48 +0000 (Mon, 24 Aug 2015)
Log Message:
-----------
edit hook home

Modified Paths:
--------------
    trunk/property/inc/class.hook_helper.inc.php
    trunk/property/inc/class.soproject.inc.php

Modified: trunk/property/inc/class.hook_helper.inc.php
===================================================================
--- trunk/property/inc/class.hook_helper.inc.php        2015-08-24 12:01:11 UTC 
(rev 13765)
+++ trunk/property/inc/class.hook_helper.inc.php        2015-08-24 13:06:48 UTC 
(rev 13766)
@@ -92,7 +92,7 @@
                public function home_backend()
                {
                        $this->home_workorder_overdue_tender();
-                       $this->home_workorder_overdue_end_date();
+                       $this->home_project_overdue_end_date();
                        $this->home_tenant_claims();
                        $this->home_ticket();
                        $this->home_project();
@@ -202,7 +202,7 @@
                 *
                 * @return void
                 */
-               public function home_workorder_overdue_end_date()
+               public function home_project_overdue_end_date()
                {
                        $accound_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $save_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
@@ -215,14 +215,13 @@
                        if ( 
isset($prefs['property']['mainscreen_show_project_overdue'])
                        && 
$prefs['property']['mainscreen_show_project_overdue'] == 'yes')
                        {
-                               $soworkorder = 
CreateObject('property.soworkorder');
+                               $soproject = CreateObject('property.soproject');
 
-                               $values = $soworkorder->read(array(
+                               $values = $soproject->read(array(
                                        'filter'                        => 
$accound_id,
-                                       'inspection_on_completion'      => 
time(),
+                                       'overdue'                       => 
time(),
                                ));
-
-                               $total_records = $soworkorder->total_records;
+                               $total_records = $soproject->total_records;
                                $portalbox = CreateObject('phpgwapi.listbox', 
array
                                (
                                        'title'         => lang('end date 
delay') . " ({$total_records})",
@@ -248,11 +247,11 @@
                                }
                                foreach ($values as $entry)
                                {
-                                       $entry['tender_delay']  = 
ceil(phpgwapi_datetime::get_working_days($entry['tender_deadline'], time()));
+                                       $entry['delay'] = 
ceil(phpgwapi_datetime::get_working_days($entry['end_date'], time()));
                                        $portalbox->data[] = array
                                        (
-                                               'text' => "Forsinkelse: 
{$entry['tender_delay']} dager :: bestilling nr:{$entry['workorder_id']} :: 
{$entry['location_code']} :: {$entry['address']}",
-                                               'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiworkorder.edit', 'id' => $entry['workorder_id'], 'tab' => 'budget'))
+                                               'text' => "Forsinkelse: 
{$entry['delay']} dager :: prosjekt nr:{$entry['project_id']} :: 
{$entry['location_code']} :: {$entry['address']}",
+                                               'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiproject.edit', 'id' => $entry['project_id'], 'tab' => 'budget'))
                                        );
                                }
                                echo "\n".'<!-- BEGIN ticket info -->'."\n<div 
class='property_tickets' style='padding-left: 
10px;'>".$portalbox->draw()."</div>\n".'<!-- END ticket info -->'."\n";

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2015-08-24 12:01:11 UTC (rev 
13765)
+++ trunk/property/inc/class.soproject.inc.php  2015-08-24 13:06:48 UTC (rev 
13766)
@@ -116,6 +116,7 @@
                        $status_id               = isset($data['status_id']) && 
$data['status_id'] ? $data['status_id'] : 'open';
                        $start_date              = isset($data['start_date']) 
&& $data['start_date'] ? (int) $data['start_date'] : 0;
                        $end_date                = isset($data['end_date']) && 
$data['end_date'] ? (int) $data['end_date'] : 0;
+                       $overdue                 = isset($data['overdue']) && 
$data['overdue'] ? (int) $data['overdue'] : 0;
                        $allrows                 = isset($data['allrows']) ? 
$data['allrows'] : '';
                        $wo_hour_cat_id  = isset($data['wo_hour_cat_id']) ? 
$data['wo_hour_cat_id'] : '';
                        $district_id     = isset($data['district_id']) ? 
$data['district_id'] : '';
@@ -492,7 +493,10 @@
                                        {
                                                $_status_filter[] = 
$this->db->f('id');
                                        }
-                                       $filtermethod .= " $where 
fm_project.status IN ('" . implode("','", $_status_filter) . "')";
+                                       if($_status_filter)
+                                       {
+                                               $filtermethod .= " $where 
fm_project.status IN ('" . implode("','", $_status_filter) . "')";
+                                       }
                                }
                                else
                                {
@@ -553,6 +557,25 @@
                                $where = 'AND';
                        }
 
+                       if($overdue)
+                       {
+                               $end_date = $overdue + 3600 * 16 + 
phpgwapi_datetime::user_timezone();
+                               $filtermethod .= " $where fm_project.end_date 
<= $end_date AND fm_project.start_date <= $end_date ";
+                               $_status_filter = array();
+                               $this->db->query("SELECT * FROM 
fm_project_status WHERE closed IS NULL");
+                               while($this->db->next_record())
+                               {
+                                       $_status_filter[] = $this->db->f('id');
+                               }
+                               if($_status_filter)
+                               {
+                                       $filtermethod .= " AND 
fm_project.status IN ('" . implode("','", $_status_filter) . "')";
+                               }
+
+                               $where = 'AND';
+                               
+                       }
+
                        if($filter_year && $filter_year != 'all')
                        {
                                $filter_year = (int) $filter_year;




reply via email to

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