[Vtigercrm-commits] [vtiger-commits] r10603 - in /vtigercrm/branches/5.0.3/modules/Accounts: Accounts.js AddressChange.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Apr 9 12:23:53 EDT 2007


Author: richie
Date: Mon Apr  9 10:23:47 2007
New Revision: 10603

Log:
* Fixed the issue with contact address update when we save account as non admin user, Fixed #3269

Modified:
    vtigercrm/branches/5.0.3/modules/Accounts/Accounts.js
    vtigercrm/branches/5.0.3/modules/Accounts/AddressChange.php

Modified: vtigercrm/branches/5.0.3/modules/Accounts/Accounts.js
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Accounts/Accounts.js (original)
+++ vtigercrm/branches/5.0.3/modules/Accounts/Accounts.js Mon Apr  9 10:23:47 2007
@@ -245,28 +245,40 @@
 //When changing the Account Address Information  it should also change the related contact address.
 function checkAddress(form,id)
 {
-		var bill_street = form.bill_street.value;
-                var ship_street = form.ship_street.value;
-                var bill_city   = form.bill_city.value;
-                var ship_city   = form.ship_city.value;
-                var bill_state  = form.bill_state.value;
-                var ship_state  = form.ship_state.value;
-                var bill_code   = form.bill_code.value;
-                var ship_code   = form.ship_code.value;
-                var bill_country= form.bill_country.value;
-                var ship_country= form.ship_country.value;
-                var bill_pobox  = form.bill_pobox.value;
-                var ship_pobox  = form.ship_pobox.value;
-		
-
-       var url = "bill_street="+bill_street+"&ship_street="+ship_street+"&bill_city="+bill_city+"&ship_city="+ship_city+"&bill_state="+bill_state+"&ship_state="+ship_state+"&bill_code="+bill_code+"&ship_code="+ship_code+"&bill_country="+bill_country+"&ship_country="+ship_country+"&bill_pobox="+bill_pobox+"&ship_pobox="+ship_pobox+"&record="+id;		
+		var url='';
+		if(typeof(form.bill_street) != 'undefined')
+     			url +="&bill_street="+form.bill_street.value;
+		if(typeof(form.ship_street) != 'undefined')
+     			url +="&ship_street="+form.ship_street.value;
+		if(typeof(form.bill_city) != 'undefined')
+    			url +="&bill_city="+form.bill_city.value;
+		if(typeof(form.ship_city) != 'undefined')
+     			url +="&ship_city="+form.ship_city.value;
+		if(typeof(form.bill_state) != 'undefined')
+     			url +="&bill_state="+form.bill_state.value;
+		if(typeof(form.ship_state) != 'undefined')
+     			url +="&ship_state="+form.ship_state.value;
+		if(typeof(form.bill_code) != 'undefined')
+    			url +="&bill_code="+ form.bill_code.value;
+		if(typeof(form.ship_code) != 'undefined')
+			url +="&ship_code="+ form.ship_code.value;
+		if(typeof(form.bill_country) != 'undefined')
+			url +="&bill_country="+form.bill_country.value;
+		if(typeof(form.ship_country) != 'undefined')
+			url +="&ship_country="+form.ship_country.value;
+		if(typeof(form.bill_pobox) != 'undefined')
+			url +="&bill_pobox="+ form.bill_pobox.value;
+		if(typeof(form.ship_pobox) != 'undefined')
+			url +="&ship_pobox="+ form.ship_pobox.value;
+
+      		url +="&record="+id;		
 	
 		$("status").style.display="inline";
                         new Ajax.Request(
                               'index.php',
                                 {queue: {position: 'end', scope: 'command'},
                                         method: 'post',
-                                        postBody:"module=Accounts&action=AccountsAjax&ajax=true&file=AddressChange&"+url,
+                                        postBody:"module=Accounts&action=AccountsAjax&ajax=true&file=AddressChange"+url,
                                         onComplete: function(response) {
 						if(response.responseText  == 'address_change')
                                         	{

Modified: vtigercrm/branches/5.0.3/modules/Accounts/AddressChange.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Accounts/AddressChange.php (original)
+++ vtigercrm/branches/5.0.3/modules/Accounts/AddressChange.php Mon Apr  9 10:23:47 2007
@@ -23,7 +23,18 @@
 $result = $adb->query($sql);
 $value = $adb->fetch_row($result);
 
-if(($_REQUEST['bill_city'] != $value['billingcity'])  ||  $_REQUEST['bill_street'] != $value['billingstreet']  ||  $_REQUEST['bill_country']!=$value['billingcountry']  ||  $_REQUEST['bill_code']!=$value['billingcode']  ||  $_REQUEST['bill_pobox']!=$value['billingpobox']   ||  $_REQUEST['bill_state']!=$value['billingstate']   ||  $_REQUEST['ship_country']!=$value['country']  ||  $_REQUEST['ship_city']!=$value['city']  ||  $_REQUEST['ship_state']!=$value['state']  ||  $_REQUEST['ship_code']!=$value['code']   ||  $_REQUEST['ship_street']!=$value['street']   ||  $_REQUEST['ship_pobox']!=$value['pobox'] )
+if(($_REQUEST['bill_city'] != $value['billingcity'] && isset($_REQUEST['bill_city']))  ||
+ ($_REQUEST['bill_street'] != $value['billingstreet'] && isset($_REQUEST['bill_street'])) ||
+ ($_REQUEST['bill_country']!=$value['billingcountry'] && isset($_REQUEST['bill_country']))|| 
+ ($_REQUEST['bill_code']!=$value['billingcode'] && isset($_REQUEST['bill_code']))||
+ ($_REQUEST['bill_pobox']!=$value['billingpobox'] && isset($_REQUEST['bill_pobox'])) || 
+ ($_REQUEST['bill_state']!=$value['billingstate'] && isset($_REQUEST['bill_state']))||
+ ($_REQUEST['ship_country']!=$value['country'] && isset($_REQUEST['ship_country']))|| 
+ ($_REQUEST['ship_city']!=$value['city'] && isset($_REQUEST['ship_city']))||
+ ($_REQUEST['ship_state']!=$value['state'] && isset($_REQUEST['ship_state']))||
+ ($_REQUEST['ship_code']!=$value['code'] && isset($_REQUEST['ship_code']))||
+ ($_REQUEST['ship_street']!=$value['street'] && isset($_REQUEST['ship_street']))|| 
+ ($_REQUEST['ship_pobox']!=$value['pobox'] && isset($_REQUEST['ship_pobox'])))
 {
 	$sql1="select contactid from vtiger_contactdetails where accountid=".$record;
 	$result1 = $adb->query($sql1);





More information about the vtigercrm-commits mailing list