Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2011-12-15 23:42:09 +01:00
commit 0c32afe40b

View File

@ -121,7 +121,7 @@ if (empty($reshook))
$object->address = $_POST["adresse"]; $object->address = $_POST["adresse"];
$object->zip = $_POST["zipcode"]; $object->zip = $_POST["zipcode"];
$object->town = $_POST["town"]; $object->town = $_POST["town"];
$object->country_id = $_POST["pays_id"]; $object->country_id = $_POST["country_id"];
$object->state_id = $_POST["departement_id"]; $object->state_id = $_POST["departement_id"];
$object->tel = $_POST["tel"]; $object->tel = $_POST["tel"];
$object->fax = $_POST["fax"]; $object->fax = $_POST["fax"];
@ -233,11 +233,11 @@ if (empty($reshook))
$contact->firstname = $object->prenom; $contact->firstname = $object->prenom;
$contact->address = $object->address; $contact->address = $object->address;
$contact->zip = $object->zip; $contact->zip = $object->zip;
$contact->cp=$object->cp; $contact->cp = $object->cp; // TODO obsolete
$contact->town = $object->town; $contact->town = $object->town;
$contact->ville=$object->ville; $contact->ville = $object->ville; // TODO obsolete
$contact->fk_departement = $object->state_id; $contact->fk_departement = $object->state_id;
$contact->fk_pays=$object->pays_id; $contact->fk_pays = $object->country_id;
$contact->socid = $object->id; // fk_soc $contact->socid = $object->id; // fk_soc
$contact->status = 1; $contact->status = 1;
$contact->email = $object->email; $contact->email = $object->email;
@ -520,7 +520,7 @@ else
$object->name = $_POST["nom"]; $object->name = $_POST["nom"];
$object->prenom = $_POST["prenom"]; $object->prenom = $_POST["prenom"];
$object->particulier = $_REQUEST["private"]; $object->particulier = GETPOST('private', 'int');
$object->prefix_comm = $_POST["prefix_comm"]; $object->prefix_comm = $_POST["prefix_comm"];
$object->client = $_POST["client"]?$_POST["client"]:$object->client; $object->client = $_POST["client"]?$_POST["client"]:$object->client;
$object->code_client = $_POST["code_client"]; $object->code_client = $_POST["code_client"];
@ -590,11 +590,11 @@ else
} }
// We set country_id, country_code and country for the selected country // We set country_id, country_code and country for the selected country
$object->country_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->country_id; $object->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->country_id; $object->pays_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
if ($object->pays_id) if ($object->country_id)
{ {
$tmparray=getCountry($object->pays_id,'all',$db,$langs,0); $tmparray=getCountry($object->country_id,'all',$db,$langs,0);
$object->pays_code=$tmparray['code']; $object->pays_code=$tmparray['code'];
$object->pays=$tmparray['label']; $object->pays=$tmparray['label'];
$object->country_code=$tmparray['code']; $object->country_code=$tmparray['code'];
@ -608,30 +608,30 @@ else
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () { print '$(document).ready(function () {
id_te_private=8; id_te_private=8;
id_ef15=1; id_ef15=1;
is_private='.(GETPOST("private")?GETPOST("private"):0).'; is_private='.(GETPOST("private")?GETPOST("private"):0).';
if (is_private) { if (is_private) {
jQuery(".individualline").show(); $(".individualline").show();
} else { } else {
jQuery(".individualline").hide(); $(".individualline").hide();
} }
jQuery("#radiocompany").click(function() { $("#radiocompany").click(function() {
jQuery(".individualline").hide(); $(".individualline").hide();
jQuery("#typent_id").val(0); $("#typent_id").val(0);
jQuery("#effectif_id").val(0); $("#effectif_id").val(0);
jQuery("#TypeName").html(document.formsoc.ThirdPartyName.value); $("#TypeName").html(document.formsoc.ThirdPartyName.value);
document.formsoc.private.value=0; document.formsoc.private.value=0;
}); });
jQuery("#radioprivate").click(function() { $("#radioprivate").click(function() {
jQuery(".individualline").show(); $(".individualline").show();
jQuery("#typent_id").val(id_te_private); $("#typent_id").val(id_te_private);
jQuery("#effectif_id").val(id_ef15); $("#effectif_id").val(id_ef15);
jQuery("#TypeName").html(document.formsoc.LastName.value); $("#TypeName").html(document.formsoc.LastName.value);
document.formsoc.private.value=1; document.formsoc.private.value=1;
}); });
jQuery("#selectpays_id").change(function() { $("#selectcountry_id").change(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.submit(); document.formsoc.submit();
}); });
@ -768,14 +768,14 @@ else
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>'; print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectpays_id','departement_id'),6); print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>'; print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectpays_id','departement_id')); print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id'));
print '</td></tr>'; print '</td></tr>';
// Country // Country
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($object->country_id,'pays_id'); $form->select_pays($object->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
@ -884,7 +884,7 @@ else
// Legal Form // Legal Form
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td>'; print '<tr><td>'.$langs->trans('JuridicalStatus').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($object->pays_id) if ($object->country_id)
{ {
$formcompany->select_forme_juridique($object->forme_juridique_code,$object->pays_code); $formcompany->select_forme_juridique($object->forme_juridique_code,$object->pays_code);
} }
@ -1027,7 +1027,7 @@ else
$object->address = $_POST["adresse"]; $object->address = $_POST["adresse"];
$object->zip = $_POST["zipcode"]; $object->zip = $_POST["zipcode"];
$object->town = $_POST["town"]; $object->town = $_POST["town"];
$object->country_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; $object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->pays_id;
$object->state_id = $_POST["departement_id"]; $object->state_id = $_POST["departement_id"];
$object->tel = $_POST["tel"]; $object->tel = $_POST["tel"];
$object->fax = $_POST["fax"]; $object->fax = $_POST["fax"];
@ -1052,10 +1052,11 @@ else
$object->localtax1_assuj = $_POST["localtax1assuj_value"]; $object->localtax1_assuj = $_POST["localtax1assuj_value"];
$object->localtax2_assuj = $_POST["localtax2assuj_value"]; $object->localtax2_assuj = $_POST["localtax2assuj_value"];
// We set pays_id, and pays_code label of the chosen country // We set country_id, and pays_code label of the chosen country
if ($object->pays_id) // TODO move to DAO class
if ($object->country_id)
{ {
$sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$object->pays_id; $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$object->country_id;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@ -1065,8 +1066,8 @@ else
{ {
dol_print_error($db); dol_print_error($db);
} }
$object->pays_code=$obj->code; $object->country_code = $obj->code;
$object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; $object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
} }
} }
@ -1075,8 +1076,8 @@ else
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () { print '$(document).ready(function () {
jQuery("#selectpays_id").change(function() { $("#selectcountry_id").change(function() {
document.formsoc.action.value="edit"; document.formsoc.action.value="edit";
document.formsoc.submit(); document.formsoc.submit();
}); });
@ -1212,14 +1213,14 @@ else
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>'; print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->cp,'zipcode',array('town','selectpays_id','departement_id'),6); print $formcompany->select_ziptown($object->cp,'zipcode',array('town','selectcountry_id','departement_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>'; print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->ville,'town',array('zipcode','selectpays_id','departement_id')); print $formcompany->select_ziptown($object->ville,'town',array('zipcode','selectcountry_id','departement_id'));
print '</td></tr>'; print '</td></tr>';
// Country // Country
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($object->pays_id,'pays_id'); $form->select_pays($object->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
@ -1227,7 +1228,7 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE)) if (empty($conf->global->SOCIETE_DISABLE_STATE))
{ {
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
$formcompany->select_departement($object->state_id,$object->pays_code); $formcompany->select_departement($object->state_id,$object->country_code);
print '</td></tr>'; print '</td></tr>';
} }
@ -1241,40 +1242,40 @@ else
print '<tr>'; print '<tr>';
// IdProf1 (SIREN for France) // IdProf1 (SIREN for France)
$idprof=$langs->transcountry('ProfId1',$object->pays_code); $idprof=$langs->transcountry('ProfId1',$object->country_code);
if ($idprof!='-') if ($idprof!='-')
{ {
print '<td>'.$idprof.'</td><td>'; print '<td>'.$idprof.'</td><td>';
print $formcompany->get_input_id_prof(1,'idprof1',$object->siren,$object->pays_code); print $formcompany->get_input_id_prof(1,'idprof1',$object->siren,$object->country_code);
print '</td>'; print '</td>';
} }
else print '<td>&nbsp;</td><td>&nbsp;</td>'; else print '<td>&nbsp;</td><td>&nbsp;</td>';
// IdProf2 (SIRET for France) // IdProf2 (SIRET for France)
$idprof=$langs->transcountry('ProfId2',$object->pays_code); $idprof=$langs->transcountry('ProfId2',$object->country_code);
if ($idprof!='-') if ($idprof!='-')
{ {
print '<td>'.$idprof.'</td><td>'; print '<td>'.$idprof.'</td><td>';
print $formcompany->get_input_id_prof(2,'idprof2',$object->siret,$object->pays_code); print $formcompany->get_input_id_prof(2,'idprof2',$object->siret,$object->country_code);
print '</td>'; print '</td>';
} }
else print '<td>&nbsp;</td><td>&nbsp;</td>'; else print '<td>&nbsp;</td><td>&nbsp;</td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
// IdProf3 (APE for France) // IdProf3 (APE for France)
$idprof=$langs->transcountry('ProfId3',$object->pays_code); $idprof=$langs->transcountry('ProfId3',$object->country_code);
if ($idprof!='-') if ($idprof!='-')
{ {
print '<td>'.$idprof.'</td><td>'; print '<td>'.$idprof.'</td><td>';
print $formcompany->get_input_id_prof(3,'idprof3',$object->ape,$object->pays_code); print $formcompany->get_input_id_prof(3,'idprof3',$object->ape,$object->country_code);
print '</td>'; print '</td>';
} }
else print '<td>&nbsp;</td><td>&nbsp;</td>'; else print '<td>&nbsp;</td><td>&nbsp;</td>';
// IdProf4 (NU for France) // IdProf4 (NU for France)
$idprof=$langs->transcountry('ProfId4',$object->pays_code); $idprof=$langs->transcountry('ProfId4',$object->country_code);
if ($idprof!='-') if ($idprof!='-')
{ {
print '<td>'.$idprof.'</td><td>'; print '<td>'.$idprof.'</td><td>';
print $formcompany->get_input_id_prof(4,'idprof4',$object->idprof4,$object->pays_code); print $formcompany->get_input_id_prof(4,'idprof4',$object->idprof4,$object->country_code);
print '</td>'; print '</td>';
} }
else print '<td>&nbsp;</td><td>&nbsp;</td>'; else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -1317,7 +1318,7 @@ else
// Local Taxes // Local Taxes
// TODO add specific function by country // TODO add specific function by country
if($mysoc->pays_code=='ES') if($mysoc->country_code=='ES')
{ {
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{ {