fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16967] property: delivery address on orders


From: sigurdne
Subject: [Fmsystem-commits] [16967] property: delivery address on orders
Date: Thu, 10 Aug 2017 14:33:50 -0400 (EDT)

Revision: 16967
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16967
Author:   sigurdne
Date:     2017-08-10 14:33:49 -0400 (Thu, 10 Aug 2017)
Log Message:
-----------
property: delivery address on orders

Modified Paths:
--------------
    trunk/property/inc/class.bolocation.inc.php
    trunk/property/inc/class.solocation.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/js/portico/project.edit.js
    trunk/property/js/portico/workorder.edit.js
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.bolocation.inc.php
===================================================================
--- trunk/property/inc/class.bolocation.inc.php 2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/inc/class.bolocation.inc.php 2017-08-10 18:33:49 UTC (rev 
16967)
@@ -1172,4 +1172,10 @@
                        return array('ResultSet' => array('Result' => $values));
 
                }
+
+               function get_delivery_address($loc1 = '')
+               {
+                       return $this->so->get_delivery_address($loc1);
+               }
+
        }
\ No newline at end of file

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/inc/class.solocation.inc.php 2017-08-10 18:33:49 UTC (rev 
16967)
@@ -2162,4 +2162,40 @@
                        return $values;
                }
 
+               function get_delivery_address($loc1 = '')
+               {
+                       $loc1 = $this->db->db_addslashes($loc1);
+                       $sql = "SELECT delivery_address FROM fm_location1 WHERE 
loc1 = '$loc1'";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $delivery_address = $this->db->f('delivery_address', 
true);
+
+                       if($delivery_address)
+                       {
+                               return $delivery_address;
+                       }
+
+                       $sql = "SELECT fm_part_of_town.delivery_address FROM 
fm_location1"
+                               . " {$this->join} fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.id)"
+                               . "WHERE loc1 = '$loc1'";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $delivery_address = $this->db->f('delivery_address', 
true);
+
+                       if($delivery_address)
+                       {
+                               return $delivery_address;
+                       }
+
+                       $sql = "SELECT fm_district.delivery_address FROM 
fm_location1 "
+                               . " {$this->join} fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.id)"
+                               . " {$this->join} fm_district ON 
(fm_part_of_town.district_id = fm_district.id)"                        
+                               . " WHERE loc1 = '$loc1'";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $delivery_address = $this->db->f('delivery_address', 
true);
+
+                       return $delivery_address;
+
+               }
        }
\ No newline at end of file

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/inc/class.soproject.inc.php  2017-08-10 18:33:49 UTC (rev 
16967)
@@ -889,8 +889,7 @@
                        $project = array();
                        if ($this->db->next_record())
                        {
-                               $project = array
-                                       (
+                               $project = array(
                                        'id' => $project_id,
                                        'project_id' => 
$this->db->f('id'),//consider this one
                                        'project_type_id' => 
$this->db->f('project_type_id'),
@@ -924,7 +923,8 @@
                                        'b_account_id' => 
$this->db->f('b_account_id'),
                                        'contact_id' => 
$this->db->f('contact_id'),
                                        'inherit_location' => 
$this->db->f('inherit_location'),
-                                       'periodization_id' => 
$this->db->f('periodization_id')
+                                       'periodization_id' => 
$this->db->f('periodization_id'),
+                                       'delivery_address' => 
$this->db->f('delivery_address', true),
                                );
 
                                if (isset($values['attributes']) && 
is_array($values['attributes']))
@@ -1044,7 +1044,7 @@
                        {
                                $query_order_id = (int) $query;
                                $query = $this->db->db_addslashes($query);
-                               
+
                                $filtermethod .= " AND (fm_workorder.id = 
'{$query_order_id}' OR fm_vendor.org_name {$this->like} '%$query%')";
                        }
 
@@ -1068,7 +1068,7 @@
                                . " {$this->join} fm_workorder_budget ON 
fm_workorder.id = fm_workorder_budget.order_id"
                                . " {$this->left_join} fm_vendor ON 
fm_vendor.id = fm_workorder.vendor_id"
                                . " WHERE project_id={$project_id} 
{$filter_year}{$filtermethod}", __LINE__, __FILE__);
-                               
+
                        $this->db->next_record();
                        $this->total_records = (int)$this->db->f('cnt');
 
@@ -1158,7 +1158,7 @@
                                else
                                {
                                        $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['combined_cost'];
-                                       $entry['diff'] = $_diff_start - 
$entry['obligation'] - $entry['actual_cost'];                           
+                                       $entry['diff'] = $_diff_start - 
$entry['obligation'] - $entry['actual_cost'];
                                }
                        }
 
@@ -1285,12 +1285,13 @@
                                $project['contact_id'],
                                $project['inherit_location'],
                                $project['budget_periodization'],
+                               $project['delivery_address'],
                        );
 
                        $values = $this->db->validate_insert($values);
 
                        $this->db->query("INSERT INTO fm_project 
(id,project_type_id,external_project_id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
-                               . 
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,b_account_id,contact_id,inherit_location,periodization_id
 $cols) "
+                               . 
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,b_account_id,contact_id,inherit_location,periodization_id,delivery_address
 $cols) "
                                . "VALUES ($values $vals )", __LINE__, 
__FILE__);
 
                        /**
@@ -1472,6 +1473,7 @@
                                'b_account_id' => $project['b_account_id'],
                                'contact_id' => $project['contact_id'],
                                'inherit_location' => 
$project['inherit_location'],
+                               'delivery_address' => 
$project['delivery_address'],
                        );
 
                        if (isset($project['budget_periodization']) && 
$project['budget_periodization'])

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2017-08-10 14:56:54 UTC 
(rev 16966)
+++ trunk/property/inc/class.soworkorder.inc.php        2017-08-10 18:33:49 UTC 
(rev 16967)
@@ -1009,7 +1009,8 @@
                                        'order_dim1' => 
$this->db->f('order_dim1'),
                                        'order_sent' => 
$this->db->f('order_sent'),
                                        'order_received' => 
$this->db->f('order_received'),
-                                       'order_received_amount' => 
$this->db->f('order_received_amount')
+                                       'order_received_amount' => 
$this->db->f('order_received_amount'),
+                                       'delivery_address' => 
$this->db->f('delivery_address', true),
                                        );
 
                                $sql = "SELECT periodization_id,"
@@ -1318,7 +1319,8 @@
                                $workorder['service_id'],
                                $workorder['building_part'],
                                $workorder['order_dim1'],
-                               isset($workorder['vendor_email']) && 
is_array($workorder['vendor_email']) ? implode(',', $workorder['vendor_email']) 
: ''
+                               isset($workorder['vendor_email']) && 
is_array($workorder['vendor_email']) ? implode(',', $workorder['vendor_email']) 
: '',
+                               $workorder['delivery_address']
                        );
 
                        $values = $this->db->validate_insert($values);
@@ -1327,7 +1329,7 @@
                                . 
"tender_received,inspection_on_completion,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,continuous,fictive_periodization,"
-                               . "contract_id, tax_code, unspsc_code, 
service_id,building_part, order_dim1, mail_recipients  $cols) "
+                               . "contract_id, tax_code, unspsc_code, 
service_id,building_part, order_dim1, mail_recipients, delivery_address $cols) "
                                . "VALUES ( {$values} {$vals})", __LINE__, 
__FILE__);
 
                        $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES ({$id},'workorder')");
@@ -1488,6 +1490,7 @@
                                'building_part' => $workorder['building_part'],
                                'order_dim1' => $workorder['order_dim1'],
                                'mail_recipients' => 
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ? 
implode(',', $workorder['vendor_email']) : '',
+                               'delivery_address'      => 
$this->db->db_addslashes($workorder['delivery_address'])
                        );
 
                        
if(isset($config->config_data['enable_order_service_id']) && 
$config->config_data['enable_order_service_id'])

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/inc/class.uilocation.inc.php 2017-08-10 18:33:49 UTC (rev 
16967)
@@ -68,7 +68,8 @@
                        'summary' => true,
                        'columns' => true,
                        'update_location' => true,
-                       'responsiblility_role' => true
+                       'responsiblility_role' => true,
+                       'get_delivery_address'  => true
                );
 
                function __construct()
@@ -2898,4 +2899,16 @@
                        //print_r($data); die;
                        self::render_template_xsl('datatable_jquery', $data);
                }
+
+               function get_delivery_address()
+               {
+                       $loc1 = phpgw::get_var('loc1');
+
+                       $delivery_address = 
$this->bo->get_delivery_address($loc1);
+                       
+                       return array(
+                               'delivery_address' => $delivery_address
+                       );
+
+               }
        }
\ No newline at end of file

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2017-08-10 18:33:49 UTC (rev 
16967)
@@ -2002,8 +2002,13 @@
                        $location_code = 
isset($common_data['workorder']['location_code']) && 
$common_data['workorder']['location_code'] ? 
$common_data['workorder']['location_code'] : $project['location_code'];
 
                        $delivery_address = lang('delivery address') . ':';
-                       if 
(isset($this->config->config_data['delivery_address']) && 
$this->config->config_data['delivery_address'])
+
+                       if($common_data['workorder']['delivery_address'])
                        {
+                               $delivery_address .= 
"\n{$common_data['workorder']['delivery_address']}";
+                       }
+                       else if 
(isset($this->config->config_data['delivery_address']) && 
$this->config->config_data['delivery_address'])
+                       {
                                $delivery_address .= 
"\n{$this->config->config_data['delivery_address']}";
                        }
                        else

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2017-08-10 14:56:54 UTC 
(rev 16966)
+++ trunk/property/inc/class.uiworkorder.inc.php        2017-08-10 18:33:49 UTC 
(rev 16967)
@@ -2657,7 +2657,8 @@
                                'order_dim1_list' => $order_dim1_list,
                                'value_order_sent'      => 
!!$values['order_sent'],
                                'value_order_received'  => 
$values['order_received'] ? 
$GLOBALS['phpgw']->common->show_date($values['order_received']) : '[ DD/MM/YYYY 
- H:i ]',
-                               'value_order_received_amount' => (int) 
$values['order_received_amount']
+                               'value_order_received_amount' => (int) 
$values['order_received_amount'],
+                               'value_delivery_address'        => 
$values['delivery_address'] ? $values['delivery_address'] : 
$project['delivery_address']
                        );
 
                        $appname = lang('Workorder');

Modified: trunk/property/js/portico/project.edit.js
===================================================================
--- trunk/property/js/portico/project.edit.js   2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/js/portico/project.edit.js   2017-08-10 18:33:49 UTC (rev 
16967)
@@ -399,6 +399,27 @@
 
 on_loc1_updated = function ()
 {
+       if(     $("#delivery_address").val() )
+       {
+               return;
+       }
+
        var loc1 = $("#loc1").val();
 
+       var oArgs = {menuaction: 'property.uilocation.get_delivery_address', 
loc1: loc1};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               url: requestUrl,
+               success: function (data)
+               {
+                       if (data != null)
+                       {
+                               
$("#delivery_address").val(data.delivery_address);
+
+                       }
+               }
+       });
 };

Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/js/portico/workorder.edit.js 2017-08-10 18:33:49 UTC (rev 
16967)
@@ -659,3 +659,30 @@
                }
        });
 }
+
+on_loc1_updated = function ()
+{
+       if(     $("#delivery_address").val() )
+       {
+               return;
+       }
+
+       var loc1 = $("#loc1").val();
+
+       var oArgs = {menuaction: 'property.uilocation.get_delivery_address', 
loc1: loc1};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               url: requestUrl,
+               success: function (data)
+               {
+                       if (data != null)
+                       {
+                               
$("#delivery_address").val(data.delivery_address);
+
+                       }
+               }
+       });
+};

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2017-08-10 14:56:54 UTC (rev 
16966)
+++ trunk/property/templates/base/workorder.xsl 2017-08-10 18:33:49 UTC (rev 
16967)
@@ -311,6 +311,18 @@
                                                </xsl:when>
                                        </xsl:choose>
                                        <div class="pure-control-group">
+                                               <label for="delivery_address">
+                                                       <xsl:value-of 
select="php:function('lang', 'delivery address')"/>
+                                               </label>
+                                               <textarea  
class="pure-input-1-2" rows="6" id="delivery_address" 
name="values[delivery_address]">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'delivery address')"/>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="value_delivery_address"/>
+                                               </textarea>
+                                       </div>
+
+                                       <div class="pure-control-group">
                                                <label for="name">
                                                        <xsl:value-of 
select="lang_coordinator"/>
                                                </label>




reply via email to

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