diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index e1ce804a270..90a6fcd04bf 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -383,13 +383,14 @@ else
document.formsoc.action.value="create";
document.formsoc.submit();
});
-
+
$("#copyaddressfromsoc").click(function() {
$(\'textarea[name="address"]\').text("'.addslashes($objsoc->address).'");
$(\'input[name="zipcode"]\').val("'.addslashes($objsoc->zip).'");
$(\'input[name="town"]\').val("'.addslashes($objsoc->town).'");
$(\'select[name="country_id"]\').val("'.addslashes($objsoc->country_id).'");
- });
+ $(\'select[name="state_id"]\').val("'.addslashes($objsoc->state_id).'");
+ });
})'."\n";
print ''."\n";
}
@@ -419,7 +420,7 @@ else
}
else {
print '
| '.$langs->trans("Company").' | ';
- print $form->select_company(GETPOST('socid','int'),'socid','',1);
+ print $form->select_company($socid,'socid','',1);
print ' |
';
}
}
@@ -434,20 +435,27 @@ else
// Address
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) $object->address = $objsoc->address; // Predefined with third party
print ''.$langs->trans("Address");
- if ($conf->use_javascript_ajax) print ' '.$langs->trans('CopyAddressFromSoc').'';
- print ' | | ';
+ print ' | ';
+
+ $rowspan=3;
+ if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++;
+
+ print '';
+ if ($conf->use_javascript_ajax && $socid) print ''.$langs->trans('CopyAddressFromSoc').'';
+ print ' | ';
+ print '
';
// Zip / Town
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) $object->zip = $objsoc->zip; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) $object->town = $objsoc->town; // Predefined with third party
- print '| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | ';
+ print ' |
| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | ';
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' ';
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
print ' |
';
// Country
if (dol_strlen(trim($object->fk_pays)) == 0) $object->fk_pays = $objsoc->country_id; // Predefined with third party
- print '| '.$langs->trans("Country").' | ';
+ print ' |
| '.$langs->trans("Country").' | ';
print $form->select_country((isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id),'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print ' |
';
@@ -455,13 +463,13 @@ else
// State
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
- print '| '.$langs->trans('State').' | ';
+ print ' |
| '.$langs->trans('State').' | ';
if ($object->country_id)
{
print $formcompany->select_state(isset($_POST["state_id"])?$_POST["state_id"]:$object->state_id,$object->country_code,'state_id');
}
else
- {
+ {
print $countrynotdefined;
}
print ' |
';
@@ -576,7 +584,7 @@ else
$object->country_code = $tmparray['code'];
$object->country = $tmparray['label'];
}
-
+
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
@@ -591,13 +599,14 @@ else
document.formsoc.action.value="edit";
document.formsoc.submit();
});
-
+
$("#copyaddressfromsoc").click(function() {
$(\'textarea[name="address"]\').text("'.addslashes($objsoc->address).'");
$(\'input[name="zipcode"]\').val("'.addslashes($objsoc->zip).'");
$(\'input[name="town"]\').val("'.addslashes($objsoc->town).'");
$(\'select[name="country_id"]\').val("'.addslashes($objsoc->country_id).'");
- });
+ $(\'select[name="state_id"]\').val("'.addslashes($objsoc->state_id).'");
+ });
})'."\n";
print ''."\n";
}
@@ -641,17 +650,23 @@ else
// Address
print ''.$langs->trans("Address");
- if ($conf->use_javascript_ajax) print ' '.$langs->trans('CopyAddressFromSoc').'';
- print ' | | ';
+ print ' | ';
+
+ $rowspan=3;
+ if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++;
+
+ print '';
+ if ($conf->use_javascript_ajax) print ''.$langs->trans('CopyAddressFromSoc').'';
+ print ' |
';
// Zip / Town
- print '| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | ';
+ print ' |
| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | ';
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' ';
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
print ' |
';
// Country
- print '| '.$langs->trans("Country").' | ';
+ print ' |
| '.$langs->trans("Country").' | ';
print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print ' |
';
@@ -659,7 +674,7 @@ else
// State
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
- print '| '.$langs->trans('State').' | ';
+ print ' |
| '.$langs->trans('State').' | ';
print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'state_id');
print ' |
';
}
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 9e555cc94bd..60276959b8e 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -77,7 +77,7 @@ Poste= Position
DefaultLang=Language by default
VATIsUsed=VAT is used
VATIsNotUsed=VAT is not used
-CopyAddressFromSoc=Copy address from company
+CopyAddressFromSoc=Fill address with thirdparty address
##### Local Taxes #####
LocalTax1IsUsedES= RE is used
LocalTax1IsNotUsedES= RE is not used
diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang
index 9ec54530163..60c5f8be6aa 100644
--- a/htdocs/langs/fr_FR/companies.lang
+++ b/htdocs/langs/fr_FR/companies.lang
@@ -79,7 +79,7 @@ Poste= Poste
DefaultLang=Langue par défaut
VATIsUsed=Assujetti à TVA
VATIsNotUsed=Non assujetti à TVA
-CopyAddressFromSoc=Copier l'adresse de la société
+CopyAddressFromSoc=Remplir adresse avec adresse du tiers
##### Local Taxes #####
LocalTax1IsUsedES= Assujetti à RE
LocalTax1IsNotUsedES= Non assujetti à RE