From 55bb500ba4b8d84dd138238ffa5272ef66aa83ea Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Tue, 18 Jan 2011 09:05:28 +0000
Subject: [PATCH] Fix: private status is lost if change country

---
 htdocs/societe/soc.php | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 93ec558b894..eedd848693f 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -610,9 +610,14 @@ else
 		{
 			print "\n".'<script type="text/javascript" language="javascript">';
 			print 'jQuery(document).ready(function () {
-                         id_te_private=8;
-                         id_ef15=1;
-                         jQuery(".individualline").hide();
+						id_te_private=8;
+                        id_ef15=1;
+                        is_private='.(GETPOST("private")?GETPOST("private"):0).';
+						if (is_private) {
+							jQuery(".individualline").show();
+						} else {
+							jQuery(".individualline").hide();
+						}
                          jQuery("#radiocompany").click(function() {
                                jQuery(".individualline").hide();
                                jQuery("#typent_id").val(0);
@@ -634,10 +639,10 @@ else
 
 			print "<br>\n";
 			print $langs->trans("ThirdPartyType").': &nbsp; ';
-			print '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.(! $_REQUEST["private"]?' checked="true"':'');
+			print '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.(! GETPOST("private")?' checked="true"':'');
 			print '> '.$langs->trans("Company/Fundation");
 			print ' &nbsp; &nbsp; ';
-			print '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.(! $_REQUEST["private"]?'':' checked="true"');
+			print '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.(! GETPOST("private")?'':' checked="true"');
 			print '> '.$langs->trans("Individual");
 			print ' ('.$langs->trans("ToCreateContactWithSameName").')';
 			print "<br>\n";
-- 
GitLab