Uniformize field country_id, country_code, country
This commit is contained in:
parent
46bf593921
commit
c2348ef600
@ -96,8 +96,8 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
||||
$soc->code_client='CU'.time()."$s";
|
||||
$soc->code_fournisseur='SU'.time()."$s";
|
||||
$soc->tva_assuj=1;
|
||||
$soc->pays_id=1;
|
||||
$soc->pays_code='FR';
|
||||
$soc->country_id=1;
|
||||
$soc->country_code='FR';
|
||||
// Un client sur 3 a une remise de 5%
|
||||
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_client=5;
|
||||
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_client."\n";
|
||||
|
||||
@ -411,7 +411,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", adresse=" .($this->adresse?"'".$this->db->escape($this->adresse)."'":"null");
|
||||
$sql.= ", cp=" .($this->cp?"'".$this->db->escape($this->cp)."'":"null");
|
||||
$sql.= ", ville=" .($this->ville?"'".$this->db->escape($this->ville)."'":"null");
|
||||
$sql.= ", pays=" .($this->pays_id>0?"'".$this->pays_id."'":"null");
|
||||
$sql.= ", pays=" .($this->country_id>0?"'".$this->country_id."'":"null");
|
||||
$sql.= ", fk_departement=".($this->fk_departement>0?"'".$this->fk_departement."'":"null");
|
||||
$sql.= ", email='".$this->email."'";
|
||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||
@ -547,7 +547,7 @@ class Adherent extends CommonObject
|
||||
$lthirdparty->tel=$this->phone;
|
||||
$lthirdparty->state_id=$this->state_id;
|
||||
$lthirdparty->country_id=$this->country_id;
|
||||
$lthirdparty->pays_id=$this->pays_id;
|
||||
$lthirdparty->pays_id=$this->country_id;
|
||||
//$lthirdparty->phone_mobile=$this->phone_mobile;
|
||||
|
||||
$result=$lthirdparty->update($this->fk_soc,$user,0,1,1,'update'); // Use sync to 0 to avoid cyclic updates
|
||||
@ -963,7 +963,7 @@ class Adherent extends CommonObject
|
||||
$sql.= " d.datevalid as datev,";
|
||||
$sql.= " d.pays,";
|
||||
$sql.= " d.fk_departement,";
|
||||
$sql.= " p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib,";
|
||||
$sql.= " p.rowid as country_id, p.code as country_code, p.libelle as country,";
|
||||
$sql.= " dep.nom as departement, dep.code_departement as departement_code,";
|
||||
$sql.= " t.libelle as type, t.cotisation as cotisation,";
|
||||
$sql.= " u.rowid as user_id, u.login as user_login";
|
||||
@ -1004,20 +1004,20 @@ class Adherent extends CommonObject
|
||||
$this->town = $obj->town;
|
||||
|
||||
$this->state_id = $obj->fk_departement;
|
||||
$this->state_id = $obj->fk_departement?$obj->departement_code:'';
|
||||
$this->state_id = $obj->fk_departement?$obj->departement:'';
|
||||
$this->state_code = $obj->fk_departement?$obj->departement_code:'';
|
||||
$this->state = $obj->fk_departement?$obj->departement:'';
|
||||
$this->fk_departement = $obj->fk_departement; // TODO deprecated
|
||||
$this->departement_code = $obj->fk_departement?$obj->departement_code:''; // TODO deprecated
|
||||
$this->departement = $obj->fk_departement?$obj->departement:''; // TODO deprecated
|
||||
|
||||
$this->country_id = $obj->pays_id;
|
||||
$this->country_code = $obj->pays_code;
|
||||
$this->pays_id = $obj->pays_id; // TODO deprecated
|
||||
$this->pays_code = $obj->pays_code; // TODO deprecated
|
||||
if ($langs->trans("Country".$obj->pays_code) != "Country".$obj->pays_code) $this->pays = $langs->trans("Country".$obj->pays_code);
|
||||
elseif ($obj->pays_lib) $this->pays=$obj->pays_lib;
|
||||
else $this->pays=$obj->pays;
|
||||
$this->country = $this->pays;
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_code;
|
||||
$this->pays_id = $obj->country_id; // TODO deprecated
|
||||
$this->pays_code = $obj->country_code; // TODO deprecated
|
||||
if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) $this->country = $langs->trans("Country".$obj->country_code);
|
||||
elseif ($obj->country) $this->country=$obj->country;
|
||||
else $this->country=$obj->country;
|
||||
$this->pays = $this->country;
|
||||
|
||||
$this->phone = $obj->phone;
|
||||
$this->phone_perso = $obj->phone_perso;
|
||||
@ -1966,15 +1966,12 @@ class Adherent extends CommonObject
|
||||
$this->login='dolibspec';
|
||||
$this->pass='dolibspec';
|
||||
$this->societe = 'Societe ABC';
|
||||
$this->adresse = '61 jump street';
|
||||
$this->address = '61 jump street';
|
||||
$this->cp = '75000';
|
||||
$this->zip = '75000';
|
||||
$this->ville = 'Paris';
|
||||
$this->town = 'Paris';
|
||||
$this->pays_id = 1;
|
||||
$this->pays_code = 'FR';
|
||||
$this->pays = 'France';
|
||||
$this->country_id = 1;
|
||||
$this->country_code = 'FR';
|
||||
$this->country = 'France';
|
||||
$this->morphy = 1;
|
||||
$this->email = 'specimen@specimen.com';
|
||||
$this->phone = '0999999999';
|
||||
@ -2046,7 +2043,7 @@ class Adherent extends CommonObject
|
||||
if ($this->adresse && $conf->global->LDAP_MEMBER_FIELD_ADDRESS) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->adresse;
|
||||
if ($this->cp && $conf->global->LDAP_MEMBER_FIELD_ZIP) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->cp;
|
||||
if ($this->ville && $conf->global->LDAP_MEMBER_FIELD_TOWN) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->ville;
|
||||
if ($this->pays_code && $conf->global->LDAP_MEMBER_FIELD_COUNTRY) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->pays_code;
|
||||
if ($this->country_code && $conf->global->LDAP_MEMBER_FIELD_COUNTRY) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
||||
if ($this->email && $conf->global->LDAP_MEMBER_FIELD_MAIL) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
|
||||
if ($this->phone && $conf->global->LDAP_MEMBER_FIELD_PHONE) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
||||
if ($this->phone_perso && $conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||
|
||||
@ -236,9 +236,9 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe
|
||||
$object->ville = trim($_POST["town"]); // deprecated
|
||||
$object->town = trim($_POST["town"]);
|
||||
$object->state_id = $_POST["departement_id"];
|
||||
$object->country_id = $_POST["pays_id"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
$object->fk_departement = $_POST["departement_id"]; // deprecated
|
||||
$object->pays_id = $_POST["pays_id"]; // deprecated
|
||||
$object->pays_id = $_POST["country_id"]; // deprecated
|
||||
|
||||
$object->phone = trim($_POST["phone"]);
|
||||
$object->phone_perso = trim($_POST["phone_perso"]);
|
||||
@ -361,8 +361,8 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
|
||||
$address=$_POST["address"];
|
||||
$zip=$_POST["zipcode"];
|
||||
$town=$_POST["town"];
|
||||
$departement_id=$_POST["departement_id"];
|
||||
$pays_id=$_POST["pays_id"];
|
||||
$state_id=$_POST["departement_id"];
|
||||
$country_id=$_POST["country_id"];
|
||||
|
||||
$phone=$_POST["phone"];
|
||||
$phone_perso=$_POST["phone_perso"];
|
||||
@ -389,8 +389,10 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
|
||||
$object->zip = $zip;
|
||||
$object->ville = $town; // deprecated
|
||||
$object->town = $town;
|
||||
$object->fk_departement = $departement_id;
|
||||
$object->pays_id = $pays_id;
|
||||
$object->fk_departement = $state_id;
|
||||
$object->state_id = $state_id;
|
||||
$object->pays_id = $country_id;
|
||||
$object->country_id = $country_id;
|
||||
$object->phone = $phone;
|
||||
$object->phone_perso = $phone_perso;
|
||||
$object->phone_mobile= $phone_mobile;
|
||||
@ -621,25 +623,15 @@ if ($action == 'create')
|
||||
/* ************************************************************************** */
|
||||
$object->fk_departement = $_POST["departement_id"];
|
||||
|
||||
// We set pays_id, pays_code and label for the selected country
|
||||
$object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||
if ($object->pays_id)
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$object->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
if ($object->country_id)
|
||||
{
|
||||
$sql = "SELECT rowid, code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " WHERE rowid = ".$object->pays_id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$object->pays_id=$obj->rowid;
|
||||
$object->pays_code=$obj->code;
|
||||
$object->pays=$obj->libelle;
|
||||
$tmparray=getCountry($object->country_id,'all');
|
||||
$object->pays_code=$tmparray['code'];
|
||||
$object->pays=$tmparray['code'];
|
||||
$object->country_code=$tmparray['code'];
|
||||
$object->country=$tmparray['label'];
|
||||
}
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
@ -653,7 +645,7 @@ if ($action == 'create')
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectpays_id").change(function() {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
@ -723,15 +715,15 @@ if ($action == 'create')
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectpays_id','departement_id'),6);
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6);
|
||||
print ' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectpays_id','departement_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
$object->pays_id=$object->pays_id?$object->pays_id:$mysoc->pays_id;
|
||||
$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id;
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
|
||||
$form->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$object->pays_id,'pays_id');
|
||||
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 '</td></tr>';
|
||||
|
||||
@ -739,9 +731,9 @@ if ($action == 'create')
|
||||
if (empty($conf->global->MEMBER_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($object->pays_id)
|
||||
if ($object->country_id)
|
||||
{
|
||||
$formcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$object->fk_departement,$object->pays_code);
|
||||
print $formcompany->select_state(isset($_POST["departement_id"])?$_POST["departement_id"]:$object->fk_departement,$object->country_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -826,10 +818,10 @@ if ($action == 'edit')
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($object->typeid);
|
||||
|
||||
// We set pays_id, and pays_code label of the chosen country
|
||||
if (isset($_POST["pays"]) || $object->pays_id)
|
||||
// We set country_id, and country_code, country of the chosen country
|
||||
if (isset($_POST["pays"]) || $object->country_id)
|
||||
{
|
||||
$sql = "SELECT rowid, code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["pays"])?$_POST["pays"]:$object->pays_id);
|
||||
$sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["pays"])?$_POST["pays"]:$object->country_id);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -841,7 +833,10 @@ if ($action == 'edit')
|
||||
}
|
||||
$object->pays_id=$obj->rowid;
|
||||
$object->pays_code=$obj->code;
|
||||
$object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
$object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label;
|
||||
$object->country_id=$obj->rowid;
|
||||
$object->country_code=$obj->code;
|
||||
$object->country=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label;
|
||||
}
|
||||
|
||||
$head = member_prepare_head($object);
|
||||
@ -856,7 +851,7 @@ if ($action == 'edit')
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectpays").change(function() {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
@ -948,15 +943,15 @@ if ($action == 'edit')
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectpays_id','departement_id'),6);
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6);
|
||||
print ' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectpays_id','departement_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
//$object->pays_id=$object->pays_id?$object->pays_id:$mysoc->pays_id; // In edit mode we don't force to company country if not defined
|
||||
//$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
|
||||
$form->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$object->pays_id,'pays_id');
|
||||
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 '</td></tr>';
|
||||
|
||||
@ -964,7 +959,7 @@ if ($action == 'edit')
|
||||
if (empty($conf->global->MEMBER_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
$formcompany->select_departement($object->fk_departement,$object->pays_code);
|
||||
print $formcompany->select_state($object->fk_departement,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1273,22 +1268,22 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">';
|
||||
$img=picto_from_langcode($object->pays_code);
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
if ($img) print $img.' ';
|
||||
print getCountry($object->pays_code);
|
||||
print getCountry($object->country_code);
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td class="valeur">'.$object->departement.'</td>';
|
||||
|
||||
// Tel pro.
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.dol_print_phone($object->phone,$object->pays_code,0,$object->fk_soc,1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.dol_print_phone($object->phone,$object->country_code,0,$object->fk_soc,1).'</td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.dol_print_phone($object->phone_perso,$object->pays_code,0,$object->fk_soc,1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.dol_print_phone($object->phone_perso,$object->country_code,0,$object->fk_soc,1).'</td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($object->phone_mobile,$object->pays_code,0,$object->fk_soc,1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($object->phone_mobile,$object->country_code,0,$object->fk_soc,1).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($object->email,0,$object->fk_soc,1).'</td></tr>';
|
||||
|
||||
@ -685,10 +685,10 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Tel").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->pays_code) . '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Tel").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->pays_code) . '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '</td></tr>';
|
||||
|
||||
@ -136,7 +136,7 @@ print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
//Profid1 of Transmitter
|
||||
print '<tr class="pair"><td>'.$langs->trans("NumeroNationalEmetter").' - '.$langs->transcountry('ProfId1',$mysoc->pays_code).'</td>';
|
||||
print '<tr class="pair"><td>'.$langs->trans("NumeroNationalEmetter").' - '.$langs->transcountry('ProfId1',$mysoc->country_code).'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="hidden" name="nom1" value="PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR">';
|
||||
print '<input type="text" name="value1" value="'.$conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR.'" size="9" ></td>';
|
||||
|
||||
@ -128,7 +128,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE t.fk_pays = p.rowid";
|
||||
$sql.= " AND t.active = 1";
|
||||
$sql.= " AND p.code = '".$mysoc->pays_code."'";
|
||||
$sql.= " AND p.code = '".$mysoc->country_code."'";
|
||||
//print $request;
|
||||
|
||||
$res = $db->query($sql);
|
||||
|
||||
@ -236,15 +236,15 @@ if ($socid)
|
||||
if ($soc->pays)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($soc->pays_code);
|
||||
$img=picto_from_langcode($soc->country_code);
|
||||
print ($img?$img.' ':'');
|
||||
print $soc->pays;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans('EMail').'</td><td>';
|
||||
|
||||
@ -56,7 +56,10 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
|
||||
$address->address = $_POST["address"];
|
||||
$address->cp = $_POST["zipcode"];
|
||||
$address->ville = $_POST["town"];
|
||||
$address->pays_id = $_POST["pays_id"];
|
||||
$address->zip = $_POST["zipcode"];
|
||||
$address->town = $_POST["town"];
|
||||
$address->pays_id = $_POST["country_id"];
|
||||
$address->country_id= $_POST["country_id"];
|
||||
$address->tel = $_POST["tel"];
|
||||
$address->fax = $_POST["fax"];
|
||||
$address->note = $_POST["note"];
|
||||
@ -194,24 +197,14 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
}
|
||||
|
||||
// On positionne pays_id, pays_code et libelle du pays choisi
|
||||
$address->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||
if ($address->pays_id)
|
||||
$address->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
if ($address->country_id)
|
||||
{
|
||||
$sql = "SELECT code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " WHERE rowid = ".$address->pays_id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$address->pays_code = $obj->code;
|
||||
$address->pays = $obj->libelle;
|
||||
$tmparray=getCountry($address->country_id,'all');
|
||||
$address->pays_code = $tmparray['code'];
|
||||
$address->pays = $tmparray['label'];
|
||||
$address->country_code = $tmparray['code'];
|
||||
$address->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
print_titre($langs->trans("AddAddress"));
|
||||
@ -267,16 +260,16 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
|
||||
// Zip
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
|
||||
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectpays_id'),6);
|
||||
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectcountry_id'),6);
|
||||
print '</td></tr>';
|
||||
|
||||
// Town
|
||||
print '<tr><td>'.$langs->trans('Town').'</td><td>';
|
||||
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectpays_id'));
|
||||
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectcountry_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($address->pays_id,'pays_id');
|
||||
print $form->select_country($address->country_id,'selectcountry_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$address->tel.'"></td></tr>';
|
||||
@ -328,29 +321,19 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
||||
$address->address = $_POST["address"];
|
||||
$address->cp = $_POST["zipcode"];
|
||||
$address->ville = $_POST["town"];
|
||||
$address->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||
$address->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$address->tel = $_POST["tel"];
|
||||
$address->fax = $_POST["fax"];
|
||||
$address->note = $_POST["note"];
|
||||
|
||||
// On positionne pays_id, pays_code et libelle du pays choisi
|
||||
if ($address->pays_id)
|
||||
// On positionne country_id, pays_code et libelle du pays choisi
|
||||
if ($address->country_id)
|
||||
{
|
||||
$sql = "SELECT code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= "WHERE rowid = ".$address->pays_id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$address->pays_code = $obj->code;
|
||||
$address->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
$tmparray=getCountry($address->country_id,'all');
|
||||
$address->pays_code = $tmparray['code'];
|
||||
$address->pays = $tmparray['label'];
|
||||
$address->country_code = $tmparray['code'];
|
||||
$address->country = $tmparray['label'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,16 +363,16 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
||||
|
||||
// Zip
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
|
||||
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectpays_id'),6);
|
||||
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectcountry_id'),6);
|
||||
print '</td></tr>';
|
||||
|
||||
// Town
|
||||
print '<tr><td>'.$langs->trans('Town').'</td><td>';
|
||||
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectpays_id'));
|
||||
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectcountry_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($address->pays_id,'pays_id');
|
||||
print $form->select_country($address->country_id,'country_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$address->tel.'"></td></tr>';
|
||||
@ -460,9 +443,9 @@ else
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$address->lines[$i]->pays.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($address->lines[$i]->tel,$address->lines[$i]->pays_code,0,$address->socid,'AC_TEL').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($address->lines[$i]->tel,$address->lines[$i]->country_code,0,$address->socid,'AC_TEL').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($address->lines[$i]->fax,$address->lines[$i]->pays_code,0,$address->socid,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($address->lines[$i]->fax,$address->lines[$i]->country_code,0,$address->socid,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ if ($resql)
|
||||
|
||||
print '<td>'.dol_print_phone($obj->email,$obj->cidp,$obj->rowid,'AC_EMAIL').'</td>';
|
||||
|
||||
print '<td>'.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->rowid,'AC_TEL').' </td>';
|
||||
print '<td>'.dol_print_phone($obj->phone,$obj->country_code,$obj->cidp,$obj->rowid,'AC_TEL').' </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -263,7 +263,7 @@ if ($id > 0)
|
||||
print '</tr>';
|
||||
|
||||
// Local Taxes
|
||||
if($mysoc->pays_code=='ES')
|
||||
if($mysoc->country_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
|
||||
@ -151,14 +151,14 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("ProposalsDraft").'</td></tr>';
|
||||
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("ProposalsDraft").'</td></tr>';
|
||||
|
||||
$i = 0;
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
@ -186,8 +186,9 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
@ -217,14 +218,14 @@ if ($conf->commande->enabled && $user->rights->commande->lire)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("DraftOrders").'</td></tr>';
|
||||
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("DraftOrders").'</td></tr>';
|
||||
|
||||
$i = 0;
|
||||
$var = true;
|
||||
while ($i < $num)
|
||||
@ -248,8 +249,10 @@ if ($conf->commande->enabled && $user->rights->commande->lire)
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1227,7 +1227,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) $rowspan++;
|
||||
|
||||
//Local taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1") $rowspan++;
|
||||
if($mysoc->localtax2_assuj=="1") $rowspan++;
|
||||
@ -1455,17 +1455,17 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td height="10">'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td height="10">'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td height="10">'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td height="10">'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
@ -116,14 +116,14 @@ if ($socid > 0)
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($societe->pays_code);
|
||||
if ($societe->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$societe->pays,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$societe->pays;
|
||||
$img=picto_from_langcode($societe->country_code);
|
||||
if ($societe->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$societe->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$societe->country;
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->fax,$societe->pays_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->tel,$societe->country_code,0,$societe->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->fax,$societe->country_code).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($societe->email,0,$societe->id,'AC_EMAIL').'</td></tr>';
|
||||
|
||||
@ -843,9 +843,26 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->commande->
|
||||
|
||||
if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider)
|
||||
{
|
||||
$object->fetch($id); // Load order and lines
|
||||
$idwarehouse=GETPOST('idwarehouse');
|
||||
|
||||
$result = $object->cancel($user);
|
||||
$object->fetch($id); // Load order and lines
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Check parameters
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1))
|
||||
{
|
||||
if (! $idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse"));
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->cancel($user,$idwarehouse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1382,16 +1399,16 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
|
||||
}
|
||||
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
|
||||
@ -1564,7 +1581,21 @@ else
|
||||
*/
|
||||
if ($action == 'cancel')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel', '', 0, 1);
|
||||
$text=$langs->trans('ConfirmCancelOrder',$object->ref);
|
||||
$formquestion=array();
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1))
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
||||
$formproduct=new FormProduct($db);
|
||||
$formquestion=array(
|
||||
//'text' => $langs->trans("ConfirmClone"),
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
|
||||
}
|
||||
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1605,7 +1636,7 @@ else
|
||||
if ($conf->projet->enabled) $nbrow++;
|
||||
|
||||
//Local taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1") $nbrow++;
|
||||
if($mysoc->localtax2_assuj=="1") $nbrow++;
|
||||
@ -1873,17 +1904,17 @@ else
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right">'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right">'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit')
|
||||
|
||||
// Country
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($account->pays_code);
|
||||
$img=picto_from_langcode($account->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($account->getCountryCode(),0,$db);
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -571,10 +571,10 @@ class Account extends CommonObject
|
||||
|
||||
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
|
||||
$sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
|
||||
$sql.= " ba.domiciliation, ba.proprio, ba.adresse_proprio, ba.fk_departement, ba.fk_pays,";
|
||||
$sql.= " ba.domiciliation, ba.proprio, ba.adresse_proprio, ba.fk_departement, ba.fk_pays as country_id,";
|
||||
$sql.= " ba.account_number, ba.currency_code,";
|
||||
$sql.= " ba.min_allowed, ba.min_desired, ba.comment,";
|
||||
$sql.= ' p.code as pays_code, p.libelle as pays,';
|
||||
$sql.= ' p.code as country_code, p.libelle as country,';
|
||||
$sql.= ' d.code_departement as departement_code, d.nom as departement';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON ba.fk_pays = p.rowid';
|
||||
@ -617,9 +617,12 @@ class Account extends CommonObject
|
||||
$this->departement_code= $obj->departement_code;
|
||||
$this->departement = $obj->departement;
|
||||
|
||||
$this->fk_pays = $obj->fk_pays;
|
||||
$this->pays_code = $obj->pays_code;
|
||||
$this->pays = $obj->pays;
|
||||
$this->fk_pays = $obj->country_id;
|
||||
$this->pays_code = $obj->country_code;
|
||||
$this->pays = $obj->country;
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_code;
|
||||
$this->country = $obj->country;
|
||||
|
||||
$this->account_number = $obj->account_number;
|
||||
|
||||
@ -942,12 +945,12 @@ class Account extends CommonObject
|
||||
global $mysoc;
|
||||
|
||||
// We return country code of bank account
|
||||
if (! empty($this->pays_code)) return $this->pays_code;
|
||||
if (! empty($this->country_code)) return $this->country_code;
|
||||
|
||||
// For backward compatibility, we try to guess country from other information
|
||||
if (! empty($this->iban))
|
||||
{
|
||||
if ($mysoc->pays_code === 'IN') return $mysoc->pays_code; // Test to know if we can trust IBAN
|
||||
if ($mysoc->country_code === 'IN') return $mysoc->country_code; // Test to know if we can trust IBAN
|
||||
|
||||
// If IBAN defined, we can know country of account from it
|
||||
if (preg_match("/^([a-zA-Z][a-zA-Z])/i",$this->iban,$reg)) return $reg[1];
|
||||
@ -959,11 +962,11 @@ class Account extends CommonObject
|
||||
require_once(DOL_DOCUMENT_ROOT ."/societe/class/societe.class.php");
|
||||
$company=new Societe($this->db);
|
||||
$result=$company->fetch($this->socid);
|
||||
if (! empty($company->pays_code)) return $company->pays_code;
|
||||
if (! empty($company->country_code)) return $company->country_code;
|
||||
}
|
||||
|
||||
// We return country code of managed company
|
||||
if (! empty($mysoc->pays_code)) return $mysoc->pays_code;
|
||||
if (! empty($mysoc->country_code)) return $mysoc->country_code;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -262,10 +262,10 @@ if ($action == 'create')
|
||||
$selectedcode='';
|
||||
if (isset($_POST["account_country_id"]))
|
||||
{
|
||||
$selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->pays_code;
|
||||
$selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->country_code;
|
||||
}
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->pays_code;
|
||||
$form->select_pays($selectedcode,'account_country_id');
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||
print $form->select_country($selectedcode,'account_country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -398,7 +398,7 @@ else
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
||||
if ($account->fk_pays > 0)
|
||||
{
|
||||
$img=picto_from_langcode($account->pays_code);
|
||||
$img=picto_from_langcode($account->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($account->getCountryCode(),0,$db);
|
||||
}
|
||||
@ -530,13 +530,13 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
$account->pays_id=$account->pays_id?$account->pays_id:$mysoc->pays_id;
|
||||
$account->country_id=$account->country_id?$account->country_id:$mysoc->country_id;
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->pays_code;
|
||||
$selectedcode=$account->country_code;
|
||||
if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->pays_code;
|
||||
$form->select_pays($selectedcode,'account_country_id');
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||
print $form->select_country($selectedcode,'account_country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -544,7 +544,7 @@ else
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
||||
if ($selectedcode)
|
||||
{
|
||||
$formcompany->select_departement(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:$account->fk_departement,$selectedcode,'account_departement_id');
|
||||
print $formcompany->select_state(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:$account->fk_departement,$selectedcode,'account_departement_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -366,17 +366,17 @@ if ($_REQUEST["facid"] > 0 || $_REQUEST["ref"])
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($fac->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($fac->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ $fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
|
||||
// Affiche en-tete du rapport
|
||||
if ($modetax==1) // Calculate on invoice for goods and services
|
||||
{
|
||||
$nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->pays_code);
|
||||
$nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$description=$langs->trans("RulesVATDue");
|
||||
if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
@ -121,7 +121,7 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
||||
}
|
||||
if ($modetax==0) // Invoice for goods, payment for services
|
||||
{
|
||||
$nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->pays_code);
|
||||
$nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$description=$langs->trans("RulesVATIn");
|
||||
if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
@ -138,8 +138,8 @@ if ($modetax==0) // Invoice for goods, payment for services
|
||||
}
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
|
||||
|
||||
$vatcust=$langs->transcountry("LT2",$mysoc->pays_code);
|
||||
$vatsup=$langs->transcountry("LT2",$mysoc->pays_code);
|
||||
$vatcust=$langs->transcountry("LT2",$mysoc->country_code);
|
||||
$vatsup=$langs->transcountry("LT2",$mysoc->country_code);
|
||||
|
||||
// IRPF that the customer has retained me
|
||||
|
||||
@ -147,7 +147,7 @@ print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Customer")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->pays_code)."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatcust."</td>";
|
||||
print "</tr>\n";
|
||||
@ -214,7 +214,7 @@ else
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Supplier")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->pays_code)."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatsup."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -147,7 +147,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print_fiche_titre($langs->transcountry("newLT2Payment",$mysoc->pays_code));
|
||||
print_fiche_titre($langs->transcountry("newLT2Payment",$mysoc->country_code));
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
@ -163,7 +163,7 @@ if ($_GET["action"] == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->transcountry("LT2Payment",$mysoc->pays_code)).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->transcountry("LT2Payment",$mysoc->country_code)).'"></td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
|
||||
|
||||
@ -119,8 +119,8 @@ print '<tr><td width="50%" valign="top">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td width=\"30%\">".$langs->trans("Year")." $y</td>";
|
||||
print "<td align=\"right\">".$langs->transcountry("LT2Customer",$mysoc->pays_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->transcountry("LT2Supplier",$mysoc->pays_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->transcountry("LT2Customer",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->transcountry("LT2Supplier",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalToPay")."</td>";
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -40,7 +40,7 @@ llxHeader();
|
||||
|
||||
$localtax_static = new localtax($db);
|
||||
|
||||
print_fiche_titre($langs->transcountry("LT2Payments",$mysoc->pays_code));
|
||||
print_fiche_titre($langs->transcountry("LT2Payments",$mysoc->country_code));
|
||||
|
||||
$sql = "SELECT rowid, amount, label, f.datev as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."localtax as f ";
|
||||
|
||||
@ -1178,7 +1178,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->file = fopen($this->filename,"w");
|
||||
|
||||
//Build file for Spain
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($conf->esaeb->enabled)
|
||||
{
|
||||
@ -1270,7 +1270,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
//Build file for France
|
||||
elseif ($mysoc->pays_code=='FR')
|
||||
elseif ($mysoc->country_code=='FR')
|
||||
{
|
||||
/*
|
||||
* En-tete Emetteur
|
||||
|
||||
@ -181,7 +181,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($conf->projet->enabled) $rowspan++;
|
||||
|
||||
//Local taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1") $rowspan++;
|
||||
if($mysoc->localtax2_assuj=="1") $rowspan++;
|
||||
@ -295,17 +295,17 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2">'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2">'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ abstract class ActionsContactCardCommon
|
||||
{
|
||||
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#selectpays_id").change(function() {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="'.$action.'";
|
||||
document.formsoc.canvas.value="'.$canvas.'";
|
||||
document.formsoc.submit();
|
||||
@ -284,21 +284,21 @@ abstract class ActionsContactCardCommon
|
||||
}
|
||||
|
||||
// Zip
|
||||
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectpays_id','departement_id'),6);
|
||||
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
|
||||
|
||||
// Town
|
||||
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectpays_id','departement_id'));
|
||||
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
|
||||
if (dol_strlen(trim($this->object->fk_pays)) == 0) $this->object->fk_pays = $objsoc->pays_id;
|
||||
if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
|
||||
|
||||
// Country
|
||||
$this->tpl['select_country'] = $form->select_country($this->object->fk_pays,'pays_id');
|
||||
$this->tpl['select_country'] = $form->select_country($this->object->country_id,'country_id');
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
|
||||
// State
|
||||
if ($this->object->fk_pays) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement,$this->object->pays_code);
|
||||
if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement,$this->object->country_code);
|
||||
else $this->tpl['select_state'] = $countrynotdefined;
|
||||
|
||||
// Public or private
|
||||
@ -378,13 +378,13 @@ abstract class ActionsContactCardCommon
|
||||
|
||||
$this->tpl['zip'] = ($this->object->zip?$this->object->zip.' ':'');
|
||||
|
||||
$img=picto_from_langcode($this->object->pays_code);
|
||||
$this->tpl['country'] = ($img?$img.' ':'').$this->object->pays;
|
||||
$img=picto_from_langcode($this->object->country_code);
|
||||
$this->tpl['country'] = ($img?$img.' ':'').$this->object->country;
|
||||
|
||||
$this->tpl['phone_pro'] = dol_print_phone($this->object->phone_pro,$this->object->pays_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso,$this->object->pays_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile,$this->object->pays_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->pays_code,0,$this->object->id,'AC_FAX');
|
||||
$this->tpl['phone_pro'] = dol_print_phone($this->object->phone_pro,$this->object->country_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso,$this->object->country_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile,$this->object->country_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->country_code,0,$this->object->id,'AC_FAX');
|
||||
$this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL');
|
||||
|
||||
$this->tpl['visibility'] = $this->object->LibPubPriv($this->object->priv);
|
||||
@ -430,8 +430,10 @@ abstract class ActionsContactCardCommon
|
||||
$this->object->address = $_POST["address"];
|
||||
$this->object->zip = $_POST["zipcode"];
|
||||
$this->object->town = $_POST["town"];
|
||||
$this->object->fk_pays = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||
$this->object->fk_pays = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$this->object->fk_departement = $_POST["departement_id"];
|
||||
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$this->object->state_id = $_POST["departement_id"];
|
||||
$this->object->phone_pro = $_POST["phone_pro"];
|
||||
$this->object->phone_perso = $_POST["phone_perso"];
|
||||
$this->object->phone_mobile = $_POST["phone_mobile"];
|
||||
@ -442,10 +444,10 @@ abstract class ActionsContactCardCommon
|
||||
$this->object->note = $_POST["note"];
|
||||
$this->object->canvas = $_POST["canvas"];
|
||||
|
||||
// We set pays_id, and pays_code label of the chosen country
|
||||
if ($this->object->fk_pays)
|
||||
// We set country_id, and country_code label of the chosen country
|
||||
if ($this->object->country_id)
|
||||
{
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->fk_pays;
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->country_id;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -457,6 +459,8 @@ abstract class ActionsContactCardCommon
|
||||
}
|
||||
$this->object->pays_code = $obj->code;
|
||||
$this->object->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
$this->object->country_code = $obj->code;
|
||||
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,9 @@ class Contact extends CommonObject
|
||||
var $fk_pays; // Id of country
|
||||
var $pays_code; // Code of country
|
||||
var $pays; // Label of country
|
||||
var $country_id; // Id of country
|
||||
var $country_code; // Code of country
|
||||
var $country; // Label of country
|
||||
|
||||
var $socid; // fk_soc
|
||||
var $status; // 0=brouillon, 1=4=actif, 5=inactif
|
||||
@ -214,6 +217,7 @@ class Contact extends CommonObject
|
||||
$this->phone_perso=trim($this->phone_perso);
|
||||
$this->phone_mobile=trim($this->phone_mobile);
|
||||
$this->fax=trim($this->fax);
|
||||
$this->country_id=($this->country_id > 0?$this->country_id:$this->fk_pays);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -226,7 +230,7 @@ class Contact extends CommonObject
|
||||
$sql .= ", address='".$this->db->escape($this->address)."'";
|
||||
$sql .= ", cp='".$this->db->escape($this->zip)."'";
|
||||
$sql .= ", ville='".$this->db->escape($this->town)."'";
|
||||
$sql .= ", fk_pays=".($this->fk_pays>0?$this->fk_pays:'NULL');
|
||||
$sql .= ", fk_pays=".($this->country_id>0?$this->country_id:'NULL');
|
||||
$sql .= ", fk_departement=".($this->fk_departement>0?$this->fk_departement:'NULL');
|
||||
$sql .= ", poste='".$this->db->escape($this->poste)."'";
|
||||
$sql .= ", fax='".$this->db->escape($this->fax)."'";
|
||||
@ -331,7 +335,7 @@ class Contact extends CommonObject
|
||||
if ($this->address && $conf->global->LDAP_CONTACT_FIELD_ADDRESS) $info[$conf->global->LDAP_CONTACT_FIELD_ADDRESS] = $this->address;
|
||||
if ($this->cp && $conf->global->LDAP_CONTACT_FIELD_ZIP) $info[$conf->global->LDAP_CONTACT_FIELD_ZIP] = $this->cp;
|
||||
if ($this->ville && $conf->global->LDAP_CONTACT_FIELD_TOWN) $info[$conf->global->LDAP_CONTACT_FIELD_TOWN] = $this->ville;
|
||||
if ($this->pays_code && $conf->global->LDAP_CONTACT_FIELD_COUNTRY) $info[$conf->global->LDAP_CONTACT_FIELD_COUNTRY] = $this->pays_code;
|
||||
if ($this->country_code && $conf->global->LDAP_CONTACT_FIELD_COUNTRY) $info[$conf->global->LDAP_CONTACT_FIELD_COUNTRY] = $this->country_code;
|
||||
if ($this->phone_pro && $conf->global->LDAP_CONTACT_FIELD_PHONE) $info[$conf->global->LDAP_CONTACT_FIELD_PHONE] = $this->phone_pro;
|
||||
if ($this->phone_perso && $conf->global->LDAP_CONTACT_FIELD_HOMEPHONE) $info[$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE] = $this->phone_perso;
|
||||
if ($this->phone_mobile && $conf->global->LDAP_CONTACT_FIELD_MOBILE) $info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile;
|
||||
@ -488,12 +492,16 @@ class Contact extends CommonObject
|
||||
$this->town = $obj->ville;
|
||||
|
||||
$this->fk_departement = $obj->fk_departement;
|
||||
$this->departement_code = $obj->departement_code;
|
||||
$this->state_id = $obj->fk_departement;
|
||||
$this->departement_code = $obj->departement_code; // TODO deprecated
|
||||
$this->state_code = $obj->departement_code;
|
||||
$this->departement = $obj->departement; // TODO deprecated
|
||||
$this->state = $obj->departement;
|
||||
|
||||
$this->fk_pays = $obj->fk_pays;
|
||||
$this->country_id = $obj->fk_pays;
|
||||
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
|
||||
$this->country_code = $obj->fk_pays?$obj->pays_code:'';
|
||||
$this->pays = ($obj->fk_pays > 0)?$langs->transnoentitiesnoconv("Country".$obj->pays_code):'';
|
||||
$this->country = ($obj->fk_pays > 0)?$langs->transnoentitiesnoconv("Country".$obj->pays_code):'';
|
||||
|
||||
|
||||
@ -136,8 +136,10 @@ if (empty($reshook))
|
||||
$object->address = $_POST["address"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->fk_pays = $_POST["pays_id"];
|
||||
$object->fk_pays = $_POST["country_id"];
|
||||
$object->fk_departement = $_POST["departement_id"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
$object->state_id = $_POST["departement_id"];
|
||||
$object->email = $_POST["email"];
|
||||
$object->phone_pro = $_POST["phone_pro"];
|
||||
$object->phone_perso = $_POST["phone_perso"];
|
||||
@ -227,7 +229,9 @@ if (empty($reshook))
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->fk_departement = $_POST["departement_id"];
|
||||
$object->fk_pays = $_POST["pays_id"];
|
||||
$object->fk_pays = $_POST["country_id"];
|
||||
$object->state_id = $_POST["departement_id"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
|
||||
$object->email = $_POST["email"];
|
||||
$object->phone_pro = $_POST["phone_pro"];
|
||||
@ -332,24 +336,15 @@ else
|
||||
|
||||
$object->fk_departement = $_POST["departement_id"];
|
||||
|
||||
// We set pays_id, pays_code and label for the selected country
|
||||
$object->fk_pays=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||
if ($object->fk_pays)
|
||||
// We set country_id, country_code and label for the selected country
|
||||
$object->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
if ($object->country_id)
|
||||
{
|
||||
$sql = "SELECT code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " WHERE rowid = ".$object->fk_pays;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$object->pays_code=$obj->code;
|
||||
$object->pays=$obj->libelle;
|
||||
$tmparray=getCountry($object->country_id,'all');
|
||||
$object->pays_code = $tmparray['code'];
|
||||
$object->pays = $tmparray['label'];
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
print_fiche_titre($langs->trans("AddContact"));
|
||||
@ -361,7 +356,7 @@ else
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectpays_id").change(function() {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
@ -416,14 +411,14 @@ else
|
||||
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 '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectpays_id','departement_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectpays_id','departement_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
if (dol_strlen(trim($object->fk_pays)) == 0) $object->fk_pays = $objsoc->pays_id; // Predefined with third party
|
||||
if (dol_strlen(trim($object->fk_pays)) == 0) $object->fk_pays = $objsoc->country_id; // Predefined with third party
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$form->select_pays((isset($_POST["pays_id"])?$_POST["pays_id"]:$object->fk_pays),'pays_id');
|
||||
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 '</td></tr>';
|
||||
|
||||
@ -431,9 +426,9 @@ else
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
||||
if ($object->fk_pays)
|
||||
if ($object->country_id)
|
||||
{
|
||||
$formcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$object->fk_departement,$object->pays_code);
|
||||
print $formcompany->select_state(isset($_POST["departement_id"])?$_POST["departement_id"]:$object->fk_departement,$object->country_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -519,21 +514,14 @@ else
|
||||
* Fiche en mode edition
|
||||
*/
|
||||
|
||||
// We set pays_id, and pays_code label of the chosen country
|
||||
if (isset($_POST["pays_id"]) || $object->fk_pays)
|
||||
// We set country_id, and country_code label of the chosen country
|
||||
if (isset($_POST["country_id"]) || $object->country_id)
|
||||
{
|
||||
$sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["pays_id"])?$_POST["pays_id"]:$object->fk_pays);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$object->pays_code=$obj->code;
|
||||
$object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
$tmparray=getCountry($object->country_id,'all');
|
||||
$object->pays_code = $tmparray['code'];
|
||||
$object->pays = $tmparray['label'];
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
// Affiche les erreurs
|
||||
@ -543,7 +531,7 @@ else
|
||||
{
|
||||
print '<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectpays_id").change(function() {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
@ -592,13 +580,13 @@ else
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectpays_id','departement_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectpays_id','departement_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$form->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$object->fk_pays,'pays_id');
|
||||
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 '</td></tr>';
|
||||
|
||||
@ -606,7 +594,7 @@ else
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
||||
$formcompany->select_departement($object->fk_departement,$object->pays_code);
|
||||
print $formcompany->select_state($object->fk_departement,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -785,7 +773,7 @@ else
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($object->pays_code);
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
if ($img) print $img.' ';
|
||||
print $object->pays;
|
||||
print '</td></tr>';
|
||||
@ -797,11 +785,11 @@ else
|
||||
}
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td>'.dol_print_phone($object->phone_pro,$object->pays_code,$object->id,$object->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td>'.dol_print_phone($object->phone_perso,$object->pays_code,$object->id,$object->socid,'AC_TEL').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td>'.dol_print_phone($object->phone_pro,$object->country_code,$object->id,$object->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td>'.dol_print_phone($object->phone_perso,$object->country_code,$object->id,$object->socid,'AC_TEL').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td>'.dol_print_phone($object->phone_mobile,$object->pays_code,$object->id,$object->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($object->fax,$object->pays_code,$object->id,$object->socid,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td>'.dol_print_phone($object->phone_mobile,$object->country_code,$object->id,$object->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($object->fax,$object->country_code,$object->id,$object->socid,'AC_FAX').'</td></tr>';
|
||||
|
||||
// Email
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($object->email,$object->id,$object->socid,'AC_EMAIL').'</td>';
|
||||
|
||||
@ -513,7 +513,7 @@ class Form
|
||||
|
||||
/**
|
||||
* Return list of social contributions.
|
||||
* Use mysoc->pays_id or mysoc->pays_code so they must be defined.
|
||||
* Use mysoc->country_id or mysoc->country_code so they must be defined.
|
||||
*
|
||||
* @param selected Preselected type
|
||||
* @param htmlname Name of field in form
|
||||
@ -525,18 +525,18 @@ class Form
|
||||
{
|
||||
global $db,$langs,$user,$mysoc;
|
||||
|
||||
if (empty($mysoc->pays_id) && empty($mysoc->pays_code))
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
{
|
||||
dol_print_error('','Call to select_type_socialcontrib with mysoc country not yet defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! empty($mysoc->pays_id))
|
||||
if (! empty($mysoc->country_id))
|
||||
{
|
||||
$sql = "SELECT c.id, c.libelle as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= " WHERE c.active = 1";
|
||||
$sql.= " AND c.fk_pays = ".$mysoc->pays_id;
|
||||
$sql.= " AND c.fk_pays = ".$mysoc->country_id;
|
||||
$sql.= " ORDER BY c.libelle ASC";
|
||||
}
|
||||
else
|
||||
@ -544,7 +544,7 @@ class Form
|
||||
$sql = "SELECT c.id, c.libelle as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE c.active = 1 AND c.fk_pays = p.rowid";
|
||||
$sql.= " AND p.code = '".$mysoc->pays_code."'";
|
||||
$sql.= " AND p.code = '".$mysoc->country_code."'";
|
||||
$sql.= " ORDER BY c.libelle ASC";
|
||||
}
|
||||
|
||||
@ -572,7 +572,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorNoSocialContributionForSellerCountry",$mysoc->pays_code);
|
||||
print $langs->trans("ErrorNoSocialContributionForSellerCountry",$mysoc->country_code);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3018,7 +3018,7 @@ class Form
|
||||
$defaulttx=str_replace('*','',$selectedrate);
|
||||
|
||||
// Check parameters
|
||||
if (is_object($societe_vendeuse) && ! $societe_vendeuse->pays_code)
|
||||
if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code)
|
||||
{
|
||||
if ($societe_vendeuse->id == $mysoc->id)
|
||||
{
|
||||
@ -3032,18 +3032,18 @@ class Form
|
||||
}
|
||||
|
||||
//var_dump($societe_acheteuse);
|
||||
//print "name=$name, selectedrate=$selectedrate, seller=".$societe_vendeuse->pays_code." buyer=".$societe_acheteuse->pays_code." buyer is company=".$societe_acheteuse->isACompany()." idprod=$idprod, info_bits=$info_bits type=$type";
|
||||
//print "name=$name, selectedrate=$selectedrate, seller=".$societe_vendeuse->country_code." buyer=".$societe_acheteuse->country_code." buyer is company=".$societe_acheteuse->isACompany()." idprod=$idprod, info_bits=$info_bits type=$type";
|
||||
//exit;
|
||||
|
||||
// Get list of all VAT rates to show
|
||||
// First we defined code_pays to use to find list
|
||||
if (is_object($societe_vendeuse))
|
||||
{
|
||||
$code_pays="'".$societe_vendeuse->pays_code."'";
|
||||
$code_pays="'".$societe_vendeuse->country_code."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$code_pays="'".$mysoc->pays_code."'"; // Pour compatibilite ascendente
|
||||
$code_pays="'".$mysoc->country_code."'"; // Pour compatibilite ascendente
|
||||
}
|
||||
if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on
|
||||
{
|
||||
@ -3054,12 +3054,12 @@ class Form
|
||||
{
|
||||
if ($type == 1) // We know product is a service
|
||||
{
|
||||
$code_pays.=",'".$societe_acheteuse->pays_code."'";
|
||||
$code_pays.=",'".$societe_acheteuse->country_code."'";
|
||||
}
|
||||
}
|
||||
else if (! $idprod) // We don't know type of product
|
||||
{
|
||||
$code_pays.=",'".$societe_acheteuse->pays_code."'";
|
||||
$code_pays.=",'".$societe_acheteuse->country_code."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3067,7 +3067,7 @@ class Form
|
||||
$prodstatic->fetch($idprod);
|
||||
if ($prodstatic->type == 1) // We know product is a service
|
||||
{
|
||||
$code_pays.=",'".$societe_acheteuse->pays_code."'";
|
||||
$code_pays.=",'".$societe_acheteuse->country_code."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,32 +190,34 @@ class FormCompany
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
|
||||
* \remarks Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
|
||||
* \remarks La cle de la liste est le code (il peut y avoir plusieurs entree pour
|
||||
* un code donnee mais dans ce cas, le champ pays differe).
|
||||
* Ainsi les liens avec les departements se font sur un departement independemment de son nom.
|
||||
* \param selected Code state preselected
|
||||
* \param pays_code 0=list for all countries, otherwise country code or country rowid to show
|
||||
* \param departement_id Id of department
|
||||
* Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
|
||||
* Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
|
||||
* La cle de la liste est le code (il peut y avoir plusieurs entree pour
|
||||
* un code donnee mais dans ce cas, le champ pays differe).
|
||||
* Ainsi les liens avec les departements se font sur un departement independemment de son nom.
|
||||
*
|
||||
* @param string $selected Code state preselected
|
||||
* @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
|
||||
* @param int $departement_id Id of department
|
||||
* @return void
|
||||
*/
|
||||
function select_state($selected='',$pays_code=0, $htmlname='departement_id')
|
||||
function select_state($selected='',$country_codeid=0, $htmlname='departement_id')
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
dol_syslog("FormCompany::select_departement selected=$selected, pays_code=$pays_code",LOG_DEBUG);
|
||||
dol_syslog("FormCompany::select_departement selected=$selected, country_codeid=$country_codeid",LOG_DEBUG);
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
$out='';
|
||||
|
||||
// On recherche les departements/cantons/province active d'une region et pays actif
|
||||
$sql = "SELECT d.rowid, d.code_departement as code , d.nom, d.active, p.libelle as libelle_pays, p.code as code_pays FROM";
|
||||
$sql = "SELECT d.rowid, d.code_departement as code , d.nom, d.active, p.libelle as libelle_pays, p.code as country_code FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid";
|
||||
$sql .= " AND d.active = 1 AND r.active = 1 AND p.active = 1";
|
||||
if ($pays_code && is_numeric($pays_code)) $sql .= " AND p.rowid = '".$pays_code."'";
|
||||
if ($pays_code && ! is_numeric($pays_code)) $sql .= " AND p.code = '".$pays_code."'";
|
||||
if ($country_codeid && is_numeric($country_codeid)) $sql .= " AND p.rowid = '".$country_codeid."'";
|
||||
if ($country_codeid && ! is_numeric($country_codeid)) $sql .= " AND p.code = '".$country_codeid."'";
|
||||
$sql .= " ORDER BY p.code, d.code_departement";
|
||||
|
||||
dol_syslog("FormCompany::select_departement sql=".$sql);
|
||||
@ -223,10 +225,10 @@ class FormCompany
|
||||
if ($result)
|
||||
{
|
||||
if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
|
||||
if ($pays_code) $out.= '<option value="0"> </option>';
|
||||
if ($country_codeid) $out.= '<option value="0"> </option>';
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
dol_syslog("FormCompany::select_departement num=$num",LOG_DEBUG);
|
||||
dol_syslog("FormCompany::select_departement num=".$num,LOG_DEBUG);
|
||||
if ($num)
|
||||
{
|
||||
$pays='';
|
||||
@ -241,7 +243,7 @@ class FormCompany
|
||||
if (! $pays || $pays != $obj->libelle_pays)
|
||||
{
|
||||
// Affiche la rupture si on est en mode liste multipays
|
||||
if (! $pays_code && $obj->code_pays)
|
||||
if (! $country_codeid && $obj->country_code)
|
||||
{
|
||||
$out.= '<option value="-1" disabled="disabled">----- '.$obj->libelle_pays." -----</option>\n";
|
||||
$pays=$obj->libelle_pays;
|
||||
@ -288,7 +290,7 @@ class FormCompany
|
||||
global $conf,$langs;
|
||||
$langs->load("dict");
|
||||
|
||||
$sql = "SELECT r.rowid, r.code_region as code, r.nom as libelle, r.active, p.code as pays_code, p.libelle as libelle_pays FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql = "SELECT r.rowid, r.code_region as code, r.nom as libelle, r.active, p.code as country_code, p.libelle as country FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE r.fk_pays=p.rowid AND r.active = 1 and p.active = 1 ORDER BY pays_code, libelle ASC";
|
||||
|
||||
dol_syslog("Form::select_region sql=".$sql);
|
||||
@ -308,13 +310,13 @@ class FormCompany
|
||||
print '<option value="0"> </option>';
|
||||
}
|
||||
else {
|
||||
if ($pays == '' || $pays != $obj->libelle_pays)
|
||||
if ($pays == '' || $pays != $obj->country)
|
||||
{
|
||||
// Show break
|
||||
$key=$langs->trans("Country".strtoupper($obj->pays_code));
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->libelle_pays;
|
||||
$key=$langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code))?$obj->country_code." - ".$key:$obj->country;
|
||||
print '<option value="-1" disabled="disabled">----- '.$valuetoshow." -----</option>\n";
|
||||
$pays=$obj->libelle_pays;
|
||||
$pays=$obj->country;
|
||||
}
|
||||
|
||||
if ($selected > 0 && $selected == $obj->code)
|
||||
|
||||
@ -3319,14 +3319,14 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && ($societe_acheteuse->tva_assuj == 1 || $societe_acheteuse->tva_assuj == 'reel'))
|
||||
//if (is_object($societe_acheteuse) && ($societe_vendeuse->country_id == $societe_acheteuse->country_id) && ($societe_acheteuse->tva_assuj == 1 || $societe_acheteuse->tva_assuj == 'reel'))
|
||||
// Le test ci-dessus ne devrait pas etre necessaire. Me signaler l'exemple du cas juridique concerne si le test suivant n'est pas suffisant.
|
||||
|
||||
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
|
||||
if ($societe_vendeuse->pays_code == $societe_acheteuse->pays_code) // Warning ->pays_code not always defined
|
||||
if ($societe_vendeuse->country_code == $societe_acheteuse->country_code) // Warning ->country_code not always defined
|
||||
{
|
||||
//print 'VATRULE 3';
|
||||
return get_product_vat_for_country($idprod,$societe_vendeuse->pays_code);
|
||||
return get_product_vat_for_country($idprod,$societe_vendeuse->country_code);
|
||||
}
|
||||
|
||||
// Si (vendeur et acheteur dans Communaute europeenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle.
|
||||
@ -3345,7 +3345,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
|
||||
else
|
||||
{
|
||||
//print 'VATRULE 5';
|
||||
return get_product_vat_for_country($idprod,$societe_vendeuse->pays_code);
|
||||
return get_product_vat_for_country($idprod,$societe_vendeuse->country_code);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3357,7 +3357,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
|
||||
if (! $societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC() && ! $societe_acheteuse->isACompany())
|
||||
{
|
||||
//print 'VATRULE 6';
|
||||
return get_product_vat_for_country($idprod,$societe_acheteuse->pays_code);
|
||||
return get_product_vat_for_country($idprod,$societe_acheteuse->country_code);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3395,7 +3395,7 @@ function get_default_localtax($societe_vendeuse, $societe_acheteuse, $local, $id
|
||||
if (!is_object($societe_vendeuse)) return -1;
|
||||
if (!is_object($societe_acheteuse)) return -1;
|
||||
|
||||
if ($societe_vendeuse->pays_id=='ES' || $societe_vendeuse->pays_code=='ES')
|
||||
if ($societe_vendeuse->country_id=='ES' || $societe_vendeuse->country_code=='ES')
|
||||
{
|
||||
if ($local==1) //RE
|
||||
{
|
||||
@ -3410,7 +3410,7 @@ function get_default_localtax($societe_vendeuse, $societe_acheteuse, $local, $id
|
||||
if (! is_numeric($societe_vendeuse->localtax2_assuj) && $societe_vendeuse->localtax2_assuj=='localtax2off') return 0;
|
||||
} else return -1;
|
||||
|
||||
if ($idprod) return get_product_localtax_for_country($idprod, $local, $societe_vendeuse->pays_code);
|
||||
if ($idprod) return get_product_localtax_for_country($idprod, $local, $societe_vendeuse->country_code);
|
||||
else return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -209,13 +209,13 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
|
||||
// Country
|
||||
if ($targetcontact->pays_code && $targetcontact->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->pays_code))."\n";
|
||||
if ($targetcontact->country_code && $targetcontact->country_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->pays_code))."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
// Country
|
||||
if ($targetcompany->pays_code && $targetcompany->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->pays_code))."\n";
|
||||
if ($targetcompany->country_code && $targetcompany->country_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->pays_code))."\n";
|
||||
}
|
||||
|
||||
// Intra VAT
|
||||
@ -224,25 +224,25 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
// Professionnal Ids
|
||||
if ($conf->global->MAIN_PROFID1_IN_ADDRESS)
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->pays_code);
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
|
||||
}
|
||||
if ($conf->global->MAIN_PROFID2_IN_ADDRESS)
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->pays_code);
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
|
||||
}
|
||||
if ($conf->global->MAIN_PROFID3_IN_ADDRESS)
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->pays_code);
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
|
||||
}
|
||||
if ($conf->global->MAIN_PROFID4_IN_ADDRESS)
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->pays_code);
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
|
||||
}
|
||||
@ -563,16 +563,16 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
$line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->currency);
|
||||
}
|
||||
// Prof Id 1
|
||||
if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2))
|
||||
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2))
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
|
||||
$field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line3.=($line3?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->idprof2)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
|
||||
$field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line3.=($line3?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof2);
|
||||
}
|
||||
@ -582,14 +582,14 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
// Prof Id 3
|
||||
if ($fromcompany->idprof3)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
|
||||
$field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line4.=($line4?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->idprof4)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
|
||||
$field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line4.=($line4?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $txlocalta
|
||||
$result[12] = price2num(($pu * (1 + ( $txlocaltax2 / 100))) - $pu, 'MT');
|
||||
|
||||
//If Country is Spain, localtax2 (IRPF) will be subtracted
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
$result[8] = $result[8] - $result[15];
|
||||
$result[2] = $result[2] - $result[10];
|
||||
|
||||
@ -944,9 +944,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
||||
global $mysoc;
|
||||
|
||||
//Local Taxes
|
||||
if($mysoc->pays_code=='ES' && $mysoc->localtax2_assuj=="1")
|
||||
if($mysoc->country_code=='ES' && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->pays_code),1,$user->rights->tax->charges->lire);
|
||||
if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire);
|
||||
if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
||||
if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
||||
if (preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
||||
|
||||
@ -71,7 +71,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini
|
||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
// Get source company
|
||||
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
|
||||
$this->emetteur=$object->thirdparty;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
||||
|
||||
// Defini position des colonnes
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
@ -408,7 +408,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $tab2_top + 0);
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1)
|
||||
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
|
||||
{
|
||||
$pdf->MultiCell(100, $tab2_hl, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
}
|
||||
@ -465,7 +465,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
{
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
|
||||
}
|
||||
@ -475,7 +475,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
{
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
|
||||
}
|
||||
@ -500,7 +500,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$tvakey=str_replace('*','',$tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
|
||||
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
|
||||
$totalvat.=vatrate($tvakey,1).$tvacompl;
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini
|
||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini
|
||||
|
||||
// Defini position des colonnes
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
@ -409,7 +409,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY($this->marge_gauche, $tab2_top + 0);
|
||||
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1)
|
||||
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
|
||||
{
|
||||
$pdf->MultiCell(100, $tab2_hl, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
}
|
||||
@ -468,7 +468,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
{
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1);
|
||||
}
|
||||
@ -478,7 +478,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
{
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1);
|
||||
}
|
||||
@ -503,7 +503,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$tvakey=str_replace('*','',$tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
|
||||
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
|
||||
$totalvat.=vatrate($tvakey,1).$tvacompl;
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
@ -531,7 +531,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$tvakey=str_replace('*','',$tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
|
||||
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
|
||||
$totalvat.=vatrate($tvakey,1).$tvacompl;
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
|
||||
@ -923,7 +923,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($conf->projet->enabled) $nbrow++;
|
||||
|
||||
//Local taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1") $nbrow++;
|
||||
if($mysoc->localtax2_assuj=="1") $nbrow++;
|
||||
@ -1050,17 +1050,17 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right">'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right">'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
@ -1093,16 +1093,16 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
|
||||
}
|
||||
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
|
||||
@ -1315,7 +1315,7 @@ else
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
|
||||
// Local taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1") $nbrow++;
|
||||
if($mysoc->localtax2_assuj=="1") $nbrow++;
|
||||
@ -1406,17 +1406,17 @@ else
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right">'.price($object->total_tva).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->pays_code=='ES')
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right">'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td>';
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right">'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ InvoiceBackToDraftInDolibarr=Invoice %s go back to draft status
|
||||
OrderValidatedInDolibarr= Order %s validated
|
||||
OrderApprovedInDolibarr=Order %s approved
|
||||
OrderBackToDraftInDolibarr=Order %s go back to draft status
|
||||
OrderCanceledInDolibarr=Order %s canceled
|
||||
InterventionValidatedInDolibarr=Intervention %s validated
|
||||
ProposalSentByEMail=Commercial proposal %s sent by EMail
|
||||
OrderSentByEMail=Customer order %s sent by EMail
|
||||
|
||||
@ -220,6 +220,7 @@ DiscountNone=None
|
||||
Supplier=Supplier
|
||||
CompanyList=Company's list
|
||||
AddContact=Add contact/address
|
||||
EditContact=Edit contact/address
|
||||
Contact=Contact
|
||||
ContactsAddresses=Contacts/Addresses
|
||||
NoContactDefined=No contact defined for this third party
|
||||
|
||||
@ -39,6 +39,7 @@ InvoiceBackToDraftInDolibarr=Facture %s repassée en brouillon
|
||||
OrderValidatedInDolibarr=Commande %s validée
|
||||
OrderApprovedInDolibarr=Commande %s approuvée
|
||||
OrderBackToDraftInDolibarr=Commande %s repassée en brouillon
|
||||
OrderCanceledInDolibarr=Commande %s annulée
|
||||
InterventionValidatedInDolibarr=Intervention %s validée
|
||||
ProposalSentByEMail=Proposition commerciale %s envoyée par EMail
|
||||
OrderSentByEMail=Commande client %s envoyée par EMail
|
||||
|
||||
@ -222,6 +222,7 @@ DiscountNone=Aucune
|
||||
Supplier=Fournisseur
|
||||
CompanyList=Liste des sociétés
|
||||
AddContact=Créer contact/adresse
|
||||
EditContact=Editer contact/adresse
|
||||
Contact=Contact
|
||||
NoContactDefined=Aucun contact défini pour ce tiers
|
||||
DefaultContact=Contact par défaut
|
||||
|
||||
@ -267,7 +267,7 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
|
||||
$mysoc->localtax2_assuj=((isset($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')?1:0);
|
||||
|
||||
// For some countries, we need to invert our address with customer address
|
||||
if ($mysoc->pays_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1;
|
||||
if ($mysoc->country_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -266,16 +266,16 @@ function html_print_paybox_footer($fromcompany,$langs)
|
||||
$line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
|
||||
}
|
||||
// Prof Id 1
|
||||
if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2))
|
||||
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2))
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->idprof2)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
|
||||
}
|
||||
@ -285,14 +285,14 @@ function html_print_paybox_footer($fromcompany,$langs)
|
||||
// Prof Id 3
|
||||
if ($fromcompany->idprof3)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->idprof4)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
|
||||
}
|
||||
|
||||
@ -96,14 +96,14 @@ function html_print_paypal_footer($fromcompany,$langs)
|
||||
// Prof Id 1
|
||||
if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2))
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->idprof2)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
|
||||
}
|
||||
@ -113,14 +113,14 @@ function html_print_paypal_footer($fromcompany,$langs)
|
||||
// Prof Id 3
|
||||
if ($fromcompany->idprof3)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->idprof4)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
|
||||
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
|
||||
}
|
||||
|
||||
@ -776,7 +776,7 @@ else
|
||||
|
||||
// Origin country
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||
$form->select_pays($_POST["country_id"],'country_id');
|
||||
print $form->select_country($_POST["country_id"],'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -966,7 +966,7 @@ else
|
||||
|
||||
// Origin country
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">';
|
||||
$form->select_pays($object->country_id,'country_id');
|
||||
print $form->select_country($object->country_id,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -136,10 +136,9 @@ class Entrepot extends CommonObject
|
||||
$this->address=$this->db->escape(trim($this->address));
|
||||
$this->cp=trim($this->cp);
|
||||
$this->ville=$this->db->escape(trim($this->ville));
|
||||
$this->pays_id=trim($this->pays_id?$this->pays_id:0);
|
||||
$this->zip=trim($this->cp);
|
||||
$this->town=$this->db->escape(trim($this->ville));
|
||||
$this->country_id=trim($this->pays_id?$this->pays_id:0);
|
||||
$this->country_id=($this->country_id > 0 ? $this->country_id:$this->pays_id);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
|
||||
$sql .= " SET label = '" . $this->libelle ."'";
|
||||
|
||||
@ -62,10 +62,10 @@ if ($action == 'add' && $user->rights->stock->creer)
|
||||
$object->address = $_POST["address"];
|
||||
$object->cp = $_POST["zipcode"];
|
||||
$object->ville = $_POST["town"];
|
||||
$object->pays_id = $_POST["pays_id"];
|
||||
$object->pays_id = $_POST["country_id"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->country_id = $_POST["pays_id"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
|
||||
if ($object->libelle) {
|
||||
$id = $object->create($user);
|
||||
@ -115,10 +115,10 @@ if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$object->address = $_POST["address"];
|
||||
$object->cp = $_POST["zipcode"];
|
||||
$object->ville = $_POST["town"];
|
||||
$object->pays_id = $_POST["pays_id"];
|
||||
$object->pays_id = $_POST["country_id"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->country_id = $_POST["pays_id"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
|
||||
if ( $object->update($_POST["id"], $user) > 0)
|
||||
{
|
||||
@ -193,14 +193,14 @@ if ($action == 'create')
|
||||
|
||||
// Zip / Town
|
||||
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 $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>';
|
||||
|
||||
// Country
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($object->country_id?$object->country_id:$mysoc->country_code,'pays_id');
|
||||
print $form->select_country($object->country_id?$object->country_id:$mysoc->country_code,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -512,14 +512,14 @@ else
|
||||
|
||||
// Zip / Town
|
||||
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 $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>';
|
||||
|
||||
// Country
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($object->country_id?$object->country_id:$mysoc->country_code,'pays_id');
|
||||
print $form->select_country($object->country_id?$object->country_id:$mysoc->country_code,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -542,9 +542,7 @@ else
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -186,7 +186,7 @@ if ($resql)
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($entrepot->pays_code);
|
||||
$img=picto_from_langcode($entrepot->country_code);
|
||||
print ($img?$img.' ':'');
|
||||
print $entrepot->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
@ -228,8 +228,8 @@ if ($action == 'add')
|
||||
}
|
||||
$adh->photo = $_POST["photo"];
|
||||
$adh->note = $_POST["note"];
|
||||
$adh->country_id = $_POST["pays_id"];
|
||||
$adh->pays_id = $_POST["pays_id"]; // TODO deprecated
|
||||
$adh->country_id = $_POST["country_id"];
|
||||
$adh->pays_id = $_POST["country_id"]; // TODO deprecated
|
||||
$adh->state_id = $_POST["state_id"];
|
||||
$adh->typeid = $_POST["type"];
|
||||
$adh->note = $_POST["comment"];
|
||||
|
||||
@ -439,7 +439,7 @@ if (GETPOST("source") == 'order' && $valid)
|
||||
$shipToStreet=$order->client->address;
|
||||
$shipToCity=$order->client->ville;
|
||||
$shipToState=$order->client->departement_code;
|
||||
$shipToCountryCode=$order->client->pays_code;
|
||||
$shipToCountryCode=$order->client->country_code;
|
||||
$shipToZip=$order->client->cp;
|
||||
$shipToStreet2='';
|
||||
$phoneNum=$order->client->tel;
|
||||
@ -542,7 +542,7 @@ if (GETPOST("source") == 'invoice' && $valid)
|
||||
$shipToStreet=$invoice->client->address;
|
||||
$shipToCity=$invoice->client->ville;
|
||||
$shipToState=$invoice->client->departement_code;
|
||||
$shipToCountryCode=$invoice->client->pays_code;
|
||||
$shipToCountryCode=$invoice->client->country_code;
|
||||
$shipToZip=$invoice->client->cp;
|
||||
$shipToStreet2='';
|
||||
$phoneNum=$invoice->client->tel;
|
||||
@ -852,7 +852,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
|
||||
$shipToStreet=$member->address;
|
||||
$shipToCity=$member->ville;
|
||||
$shipToState=$member->departement_code;
|
||||
$shipToCountryCode=$member->pays_code;
|
||||
$shipToCountryCode=$member->country_code;
|
||||
$shipToZip=$member->cp;
|
||||
$shipToStreet2='';
|
||||
$phoneNum=$member->tel;
|
||||
|
||||
@ -506,13 +506,13 @@ print '<td align="center">'.$langs->trans("MustBeUnique").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$profid[0][0]=$langs->trans("ProfId1");
|
||||
$profid[0][1]=$langs->transcountry('ProfId1', $mysoc->pays_code);
|
||||
$profid[0][1]=$langs->transcountry('ProfId1', $mysoc->country_code);
|
||||
$profid[1][0]=$langs->trans("ProfId2");
|
||||
$profid[1][1]=$langs->transcountry('ProfId2', $mysoc->pays_code);
|
||||
$profid[1][1]=$langs->transcountry('ProfId2', $mysoc->country_code);
|
||||
$profid[2][0]=$langs->trans("ProfId3");
|
||||
$profid[2][1]=$langs->transcountry('ProfId3', $mysoc->pays_code);
|
||||
$profid[2][1]=$langs->transcountry('ProfId3', $mysoc->country_code);
|
||||
$profid[3][0]=$langs->trans("ProfId4");
|
||||
$profid[3][1]=$langs->transcountry('ProfId4', $mysoc->pays_code);
|
||||
$profid[3][1]=$langs->transcountry('ProfId4', $mysoc->country_code);
|
||||
|
||||
$var = true;
|
||||
$i=0;
|
||||
|
||||
@ -121,14 +121,14 @@ if ($_GET["socid"])
|
||||
// Country
|
||||
if ($soc->pays) {
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($soc->pays_code);
|
||||
$img=picto_from_langcode($soc->country_code);
|
||||
print ($img?$img.' ':'');
|
||||
print $soc->pays;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans('EMail').'</td><td>';
|
||||
|
||||
@ -422,7 +422,7 @@ abstract class ActionsCardCommon
|
||||
{
|
||||
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#selectpays_id").change(function() {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="'.$action.'";
|
||||
document.formsoc.canvas.value="'.$canvas.'";
|
||||
document.formsoc.submit();
|
||||
@ -490,19 +490,19 @@ abstract class ActionsCardCommon
|
||||
}
|
||||
|
||||
// Zip
|
||||
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectpays_id','departement_id'),6);
|
||||
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
|
||||
|
||||
// Town
|
||||
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectpays_id','departement_id'));
|
||||
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
|
||||
// Country
|
||||
$this->tpl['select_country'] = $form->select_country($this->object->pays_id,'pays_id');
|
||||
$this->tpl['select_country'] = $form->select_country($this->object->country_id,'country_id');
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
|
||||
// State
|
||||
if ($this->object->pays_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->pays_code);
|
||||
if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code);
|
||||
else $this->tpl['select_state'] = $countrynotdefined;
|
||||
|
||||
// Language
|
||||
@ -516,7 +516,7 @@ abstract class ActionsCardCommon
|
||||
|
||||
// Local Tax
|
||||
// TODO mettre dans une classe propre au pays
|
||||
if($mysoc->pays_code=='ES')
|
||||
if($mysoc->country_code=='ES')
|
||||
{
|
||||
$this->tpl['localtax'] = '';
|
||||
|
||||
@ -560,8 +560,8 @@ abstract class ActionsCardCommon
|
||||
if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
$this->tpl['country'] = ($img?$img.' ':'').$this->object->country;
|
||||
|
||||
$this->tpl['phone'] = dol_print_phone($this->object->tel,$this->object->pays_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->pays_code,0,$this->object->id,'AC_FAX');
|
||||
$this->tpl['phone'] = dol_print_phone($this->object->tel,$this->object->country_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->country_code,0,$this->object->id,'AC_FAX');
|
||||
$this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL');
|
||||
$this->tpl['url'] = dol_print_url($this->object->url);
|
||||
|
||||
@ -629,7 +629,7 @@ abstract class ActionsCardCommon
|
||||
|
||||
// Local Tax
|
||||
// TODO mettre dans une classe propre au pays
|
||||
if($mysoc->pays_code=='ES')
|
||||
if($mysoc->country_code=='ES')
|
||||
{
|
||||
$this->tpl['localtax'] = '';
|
||||
|
||||
@ -674,7 +674,7 @@ abstract class ActionsCardCommon
|
||||
$this->object->address = $_POST["adresse"];
|
||||
$this->object->zip = $_POST["zipcode"];
|
||||
$this->object->town = $_POST["town"];
|
||||
$this->object->country_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->country_id;
|
||||
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$this->object->state_id = $_POST["departement_id"];
|
||||
$this->object->tel = $_POST["tel"];
|
||||
$this->object->fax = $_POST["fax"];
|
||||
|
||||
@ -128,15 +128,15 @@ class ActionsCardCompany extends ActionsCardCommon
|
||||
{
|
||||
for ($i=1; $i<=4; $i++)
|
||||
{
|
||||
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->pays_code);
|
||||
$this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->pays_code);
|
||||
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code);
|
||||
$this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->country_code);
|
||||
}
|
||||
|
||||
// Type
|
||||
$this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id);
|
||||
|
||||
// Juridical Status
|
||||
$this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->pays_code);
|
||||
$this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->country_code);
|
||||
|
||||
// Workforce
|
||||
$this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id);
|
||||
@ -172,7 +172,7 @@ class ActionsCardCompany extends ActionsCardCommon
|
||||
|
||||
for ($i=1; $i<=4; $i++)
|
||||
{
|
||||
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->pays_code);
|
||||
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code);
|
||||
$this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object);
|
||||
$this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object);
|
||||
}
|
||||
|
||||
@ -172,6 +172,7 @@ class Address
|
||||
$this->cp = trim($this->cp);
|
||||
$this->ville = trim($this->ville);
|
||||
$this->pays_id = trim($this->pays_id);
|
||||
$this->country_id = trim($this->country_id);
|
||||
$this->tel = trim($this->tel);
|
||||
$this->tel = preg_replace("/\s/","",$this->tel);
|
||||
$this->tel = preg_replace("/\./","",$this->tel);
|
||||
@ -197,7 +198,7 @@ class Address
|
||||
if ($this->ville)
|
||||
{ $sql .= ",ville = '" . $this->db->escape($this->ville) ."'"; }
|
||||
|
||||
$sql .= ",fk_pays = '" . ($this->pays_id?$this->pays_id:'0') ."'";
|
||||
$sql .= ",fk_pays = '" . ($this->country_id?$this->country_id:'0') ."'";
|
||||
$sql.= ",note = '" . $this->db->escape($this->note) ."'";
|
||||
|
||||
if ($this->tel)
|
||||
@ -275,8 +276,8 @@ class Address
|
||||
{
|
||||
$sql = 'SELECT a.rowid as id, a.label, a.name, a.address, a.datec as dc';
|
||||
$sql .= ', a.tms as date_update, a.fk_soc';
|
||||
$sql .= ', a.cp, a.ville, a.note, a.fk_pays, a.tel, a.fax';
|
||||
$sql .= ', p.code as pays_code, p.libelle as pays';
|
||||
$sql .= ', a.cp as zip, a.ville as town, a.note, a.fk_pays as country_id, a.tel, a.fax';
|
||||
$sql .= ', p.code as country_code, p.libelle as country';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid';
|
||||
$sql .= ' WHERE a.fk_soc = '.$this->socid;
|
||||
@ -298,11 +299,16 @@ class Address
|
||||
$line->label = $objp->label;
|
||||
$line->name = $objp->name;
|
||||
$line->address = $objp->address;
|
||||
$line->cp = $objp->cp;
|
||||
$line->ville = $objp->ville;
|
||||
$line->pays_id = $objp->fk_pays;
|
||||
$line->pays_code = $objp->fk_pays?$objp->pays_code:'';
|
||||
$line->pays = $objp->fk_pays?($langs->trans('Country'.$objp->pays_code)!='Country'.$objp->pays_code?strtoupper($langs->trans('Country'.$objp->pays_code)):$objp->pays):'';
|
||||
$line->cp = $objp->zip;
|
||||
$line->ville = $objp->town;
|
||||
$line->zip = $objp->zip;
|
||||
$line->town = $objp->town;
|
||||
$line->pays_id = $objp->country_id;
|
||||
$line->pays_code = $objp->country_id?$objp->country_code:'';
|
||||
$line->pays = $objp->country_id?($langs->trans('Country'.$objp->country_code)!='Country'.$objp->country_code?strtoupper($langs->trans('Country'.$objp->country_code)):$objp->country):'';
|
||||
$line->country_id = $objp->country_id;
|
||||
$line->country_code = $objp->country_id?$objp->country_code:'';
|
||||
$line->country = $objp->country_id?($langs->trans('Country'.$objp->country_code)!='Country'.$objp->country_code?strtoupper($langs->trans('Country'.$objp->country_code)):$objp->country):'';
|
||||
$line->tel = $objp->tel;
|
||||
$line->fax = $objp->fax;
|
||||
$line->note = $objp->note;
|
||||
@ -346,8 +352,8 @@ class Address
|
||||
|
||||
$sql = 'SELECT a.rowid, a.fk_soc, a.label, a.name, a.address, a.datec as date_creation';
|
||||
$sql .= ', a.tms as date_update';
|
||||
$sql .= ', a.cp,a.ville, a.note, a.fk_pays, a.tel, a.fax';
|
||||
$sql .= ', p.code as pays_code, p.libelle as pays';
|
||||
$sql .= ', a.cp as zip, a.ville as town, a.note, a.fk_pays as country_id, a.tel, a.fax';
|
||||
$sql .= ', p.code as country_code, p.libelle as country';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid';
|
||||
$sql .= ' WHERE a.rowid = '.$id;
|
||||
@ -367,12 +373,17 @@ class Address
|
||||
$this->label = $obj->label;
|
||||
$this->name = $obj->name;
|
||||
$this->address = $obj->address;
|
||||
$this->cp = $obj->cp;
|
||||
$this->ville = $obj->ville;
|
||||
$this->cp = $obj->zip;
|
||||
$this->ville = $obj->town;
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
|
||||
$this->pays_id = $obj->fk_pays;
|
||||
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
|
||||
$this->pays = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):'';
|
||||
$this->pays_id = $obj->country_id;
|
||||
$this->pays_code = $obj->country_id?$obj->country_code:'';
|
||||
$this->pays = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):'';
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):'';
|
||||
|
||||
$this->tel = $obj->tel;
|
||||
$this->fax = $obj->fax;
|
||||
|
||||
@ -400,8 +400,8 @@ class Societe extends CommonObject
|
||||
$this->town=$this->town?trim($this->town):trim($this->ville);
|
||||
$this->ville=$this->town; // TODO obsolete
|
||||
$this->state_id=trim($this->state_id);
|
||||
$this->pays_id=trim($this->pays_id);
|
||||
$this->country_id = trim($this->country_id);
|
||||
$this->country_id = ($this->country_id > 0)?$this->country_id:$this->pays_id;
|
||||
$this->pays_id = $this->country_id;
|
||||
$this->tel = trim($this->tel);
|
||||
$this->fax = trim($this->fax);
|
||||
$this->tel = preg_replace("/\s/","",$this->tel);
|
||||
@ -633,12 +633,12 @@ class Societe extends CommonObject
|
||||
$sql .= ', s.fk_effectif as effectif_id';
|
||||
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
|
||||
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
|
||||
$sql .= ', s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
|
||||
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
|
||||
$sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
|
||||
$sql .= ', s.import_key';
|
||||
$sql .= ', fj.libelle as forme_juridique';
|
||||
$sql .= ', e.libelle as effectif';
|
||||
$sql .= ', p.code as pays_code, p.libelle as pays';
|
||||
$sql .= ', p.code as country_code, p.libelle as country';
|
||||
$sql .= ', d.code_departement as departement_code, d.nom as departement';
|
||||
$sql .= ', st.libelle as stcomm';
|
||||
$sql .= ', te.code as typent_code';
|
||||
@ -692,12 +692,13 @@ class Societe extends CommonObject
|
||||
$this->town = $obj->town;
|
||||
$this->ville = $obj->town; // TODO obsolete
|
||||
|
||||
$this->pays_id = $obj->fk_pays; // TODO obsolete
|
||||
$this->country_id = $obj->fk_pays;
|
||||
$this->pays_code = $obj->fk_pays?$obj->pays_code:''; // TODO obsolete
|
||||
$this->country_code = $obj->fk_pays?$obj->pays_code:'';
|
||||
$this->pays = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):''; // TODO obsolete
|
||||
$this->country = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):'';
|
||||
$this->pays_id = $obj->country_id; // TODO obsolete
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->pays_code = $obj->country_id?$obj->country_code:''; // TODO obsolete
|
||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||
$this->pays = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):''; // TODO obsolete
|
||||
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):'';
|
||||
|
||||
$this->state_id = $obj->fk_departement;
|
||||
$this->state_code = $obj->departement_code;
|
||||
$this->state = $obj->departement;
|
||||
@ -1972,7 +1973,7 @@ class Societe extends CommonObject
|
||||
if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return 1;
|
||||
|
||||
// Verifie SIREN si pays FR
|
||||
if ($idprof == 1 && $soc->pays_code == 'FR')
|
||||
if ($idprof == 1 && $soc->country_code == 'FR')
|
||||
{
|
||||
$chaine=trim($this->idprof1);
|
||||
$chaine=preg_replace('/(\s)/','',$chaine);
|
||||
@ -2001,7 +2002,7 @@ class Societe extends CommonObject
|
||||
}
|
||||
|
||||
// Verifie SIRET si pays FR
|
||||
if ($idprof == 2 && $soc->pays_code == 'FR')
|
||||
if ($idprof == 2 && $soc->country_code == 'FR')
|
||||
{
|
||||
$chaine=trim($this->idprof1);
|
||||
$chaine=preg_replace('/(\s)/','',$chaine);
|
||||
@ -2011,7 +2012,7 @@ class Societe extends CommonObject
|
||||
|
||||
//Verify CIF/NIF/NIE if pays ES
|
||||
//Returns: 1 if NIF ok, 2 if CIF ok, 3 if NIE ok, -1 if NIF bad, -2 if CIF bad, -3 if NIE bad, 0 if unexpected bad
|
||||
if ($idprof == 1 && $soc->pays_code == 'ES')
|
||||
if ($idprof == 1 && $soc->country_code == 'ES')
|
||||
{
|
||||
$string=trim($this->idprof1);
|
||||
$string=preg_replace('/(\s)/','',$string);
|
||||
@ -2087,9 +2088,9 @@ class Societe extends CommonObject
|
||||
|
||||
$url='';
|
||||
|
||||
if ($idprof == 1 && $soc->pays_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->idprof1;
|
||||
if ($idprof == 1 && $soc->pays_code == 'GB') $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/';
|
||||
if ($idprof == 1 && $soc->pays_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$soc->idprof1;
|
||||
if ($idprof == 1 && $soc->country_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->idprof1;
|
||||
if ($idprof == 1 && $soc->country_code == 'GB') $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/';
|
||||
if ($idprof == 1 && $soc->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$soc->idprof1;
|
||||
|
||||
if ($url) return '<a target="_blank" href="'.$url.'">['.$langs->trans("Check").']</a>';
|
||||
return '';
|
||||
@ -2242,8 +2243,8 @@ class Societe extends CommonObject
|
||||
'SI', // Slovenia
|
||||
//'CH', // Switzerland - No. Swizerland in not in EEC
|
||||
);
|
||||
//print "dd".$this->pays_code;
|
||||
return in_array($this->pays_code,$country_code_in_EEC);
|
||||
//print "dd".$this->country_code;
|
||||
return in_array($this->country_code,$country_code_in_EEC);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2316,10 +2317,10 @@ class Societe extends CommonObject
|
||||
$this->zip=$member->cp;
|
||||
$this->ville=$member->ville; // TODO obsolete
|
||||
$this->town=$member->ville;
|
||||
$this->pays_code=$member->pays_code; // TODO obsolete
|
||||
$this->country_code=$member->pays_code;
|
||||
$this->pays_id=$member->pays_id; // TODO obsolete
|
||||
$this->country_id=$member->pays_id;
|
||||
$this->pays_code=$member->country_code; // TODO obsolete
|
||||
$this->country_code=$member->country_code;
|
||||
$this->pays_id=$member->country_id; // TODO obsolete
|
||||
$this->country_id=$member->country_id;
|
||||
$this->tel=$member->phone; // Prof phone
|
||||
$this->email=$member->email;
|
||||
|
||||
@ -2382,13 +2383,9 @@ class Societe extends CommonObject
|
||||
$this->name = 'THIRDPARTY SPECIMEN '.dol_print_date($now,'dayhourlog');
|
||||
$this->nom = $this->name; // For backward compatibility
|
||||
$this->specimen=1;
|
||||
$this->cp='99999';
|
||||
$this->zip='99999';
|
||||
$this->ville='MyTown';
|
||||
$this->town='MyTown';
|
||||
$this->pays_id=1;
|
||||
$this->country_id=1;
|
||||
$this->pays_code='FR';
|
||||
$this->country_code='FR';
|
||||
|
||||
$this->code_client='CC-'.dol_print_date($now,'dayhourlog');
|
||||
|
||||
@ -130,8 +130,8 @@ if ($_GET["socid"])
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$soc->pays.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
|
||||
if ($soc->url) { print '<a href="http://'.$soc->url.'">http://'.$soc->url.'</a>'; }
|
||||
|
||||
@ -128,13 +128,13 @@ if ($socid)
|
||||
|
||||
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->address)."</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans('Zip').'</td><td width="20%">'.$soc->cp."</td>";
|
||||
print "<td>".$langs->trans('Town')."</td><td>".$soc->ville."</td></tr>";
|
||||
print "<tr><td>".$langs->trans('Zip').'</td><td width="20%">'.$soc->zip."</td>";
|
||||
print "<td>".$langs->trans('Town')."</td><td>".$soc->town."</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans('Country')."</td><td colspan=\"3\">".$soc->pays."</td></tr>";
|
||||
print "<tr><td>".$langs->trans('Country')."</td><td colspan=\"3\">".$soc->country."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
|
||||
if ($soc->url) { print '<a href="http://'.$soc->url.'">http://'.$soc->url.'</a>'; }
|
||||
@ -143,40 +143,40 @@ if ($socid)
|
||||
$object=$soc;
|
||||
print '<tr>';
|
||||
// IdProf1 (SIREN for France)
|
||||
$idprof=$langs->transcountry('ProfId1',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId1',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $formcompany->get_input_id_prof(1,'idprof1',$object->idprof1,$object->pays_code);
|
||||
print $formcompany->get_input_id_prof(1,'idprof1',$object->idprof1,$object->country_code);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
// IdProf2 (SIRET for France)
|
||||
$idprof=$langs->transcountry('ProfId2',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId2',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $formcompany->get_input_id_prof(2,'idprof2',$object->idprof2,$object->pays_code);
|
||||
print $formcompany->get_input_id_prof(2,'idprof2',$object->idprof2,$object->paycountry_codes_code);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
// IdProf3 (APE for France)
|
||||
$idprof=$langs->transcountry('ProfId3',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId3',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $formcompany->get_input_id_prof(3,'idprof3',$object->idprof3,$object->pays_code);
|
||||
print $formcompany->get_input_id_prof(3,'idprof3',$object->idprof3,$object->country_code);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
// IdProf4 (NU for France)
|
||||
$idprof=$langs->transcountry('ProfId4',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId4',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
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>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
|
||||
@ -206,7 +206,7 @@ if (empty($reshook))
|
||||
if($object->id_prof_exists($i,$_POST["$slabel"],$object->id))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++; $errors[] = $langs->transcountry('ProfId'.$i ,$object->pays_code)." ".$langs->trans("ErrorProdIdAlreadyExist",$_POST["$slabel"]);
|
||||
$error++; $errors[] = $langs->transcountry('ProfId'.$i ,$object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist",$_POST["$slabel"]);
|
||||
$action = ($action=='add'?'create':'edit');
|
||||
}
|
||||
}
|
||||
@ -595,7 +595,7 @@ else
|
||||
$object->pays_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
if ($object->country_id)
|
||||
{
|
||||
$tmparray=getCountry($object->country_id,'all',$db,$langs,0);
|
||||
$tmparray=getCountry($object->country_id,'all');
|
||||
$object->pays_code=$tmparray['code'];
|
||||
$object->pays=$tmparray['label'];
|
||||
$object->country_code=$tmparray['code'];
|
||||
@ -798,40 +798,40 @@ else
|
||||
|
||||
print '<tr>';
|
||||
// IdProf1 (SIREN for France)
|
||||
$idprof=$langs->transcountry('ProfId1',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId1',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $formcompany->get_input_id_prof(1,'idprof1',$object->idprof1,$object->pays_code);
|
||||
print $formcompany->get_input_id_prof(1,'idprof1',$object->idprof1,$object->country_code);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
// IdProf2 (SIRET for France)
|
||||
$idprof=$langs->transcountry('ProfId2',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId2',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $formcompany->get_input_id_prof(2,'idprof2',$object->idprof2,$object->pays_code);
|
||||
print $formcompany->get_input_id_prof(2,'idprof2',$object->idprof2,$object->country_code);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
// IdProf3 (APE for France)
|
||||
$idprof=$langs->transcountry('ProfId3',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId3',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
print $formcompany->get_input_id_prof(3,'idprof3',$object->idprof3,$object->pays_code);
|
||||
print $formcompany->get_input_id_prof(3,'idprof3',$object->idprof3,$object->country_code);
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
// IdProf4 (NU for France)
|
||||
$idprof=$langs->transcountry('ProfId4',$object->pays_code);
|
||||
$idprof=$langs->transcountry('ProfId4',$object->country_code);
|
||||
if ($idprof!='-')
|
||||
{
|
||||
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>';
|
||||
}
|
||||
else print '<td> </td><td> </td>';
|
||||
@ -887,7 +887,7 @@ else
|
||||
print '<td colspan="3">';
|
||||
if ($object->country_id)
|
||||
{
|
||||
$formcompany->select_forme_juridique($object->forme_juridique_code,$object->pays_code);
|
||||
$formcompany->select_forme_juridique($object->forme_juridique_code,$object->country_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -900,7 +900,7 @@ else
|
||||
|
||||
// Local Taxes
|
||||
// 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")
|
||||
{
|
||||
@ -1356,7 +1356,7 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">';
|
||||
$formcompany->select_forme_juridique($object->forme_juridique_code,$object->pays_code);
|
||||
$formcompany->select_forme_juridique($object->forme_juridique_code,$object->country_code);
|
||||
print '</td></tr>';
|
||||
|
||||
// Capital
|
||||
@ -1541,7 +1541,7 @@ else
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'" nowrap="nowrap">';
|
||||
$img=picto_from_langcode($object->pays_code);
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->pays,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->pays;
|
||||
print '</td></tr>';
|
||||
@ -1549,8 +1549,8 @@ else
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->pays_code,0,$object->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->pays_code,0,$object->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans('EMail').'</td><td width="25%">';
|
||||
@ -1563,7 +1563,7 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// ProfId1 (SIREN for France)
|
||||
$profid=$langs->transcountry('ProfId1',$object->pays_code);
|
||||
$profid=$langs->transcountry('ProfId1',$object->country_code);
|
||||
if ($profid!='-')
|
||||
{
|
||||
print '<tr><td>'.$profid.'</td><td>';
|
||||
@ -1577,7 +1577,7 @@ else
|
||||
}
|
||||
else print '<tr><td> </td><td> </td>';
|
||||
// ProfId2 (SIRET for France)
|
||||
$profid=$langs->transcountry('ProfId2',$object->pays_code);
|
||||
$profid=$langs->transcountry('ProfId2',$object->country_code);
|
||||
if ($profid!='-')
|
||||
{
|
||||
print '<td>'.$profid.'</td><td>';
|
||||
@ -1592,7 +1592,7 @@ else
|
||||
else print '<td> </td><td> </td></tr>';
|
||||
|
||||
// ProfId3 (APE for France)
|
||||
$profid=$langs->transcountry('ProfId3',$object->pays_code);
|
||||
$profid=$langs->transcountry('ProfId3',$object->country_code);
|
||||
if ($profid!='-')
|
||||
{
|
||||
print '<tr><td>'.$profid.'</td><td>';
|
||||
@ -1606,7 +1606,7 @@ else
|
||||
}
|
||||
else print '<tr><td> </td><td> </td>';
|
||||
// ProfId4 (NU for France)
|
||||
$profid=$langs->transcountry('ProfId4',$object->pays_code);
|
||||
$profid=$langs->transcountry('ProfId4',$object->country_code);
|
||||
if ($profid!='-')
|
||||
{
|
||||
print '<td>'.$profid.'</td><td>';
|
||||
@ -1668,7 +1668,7 @@ else
|
||||
|
||||
// Local Taxes
|
||||
// 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")
|
||||
{
|
||||
|
||||
@ -278,12 +278,12 @@ if ($resql)
|
||||
$textprofid=array();
|
||||
foreach(array(1,2,3,4) as $key)
|
||||
{
|
||||
$label=$langs->transnoentities("ProfId".$key.$mysoc->pays_code);
|
||||
$label=$langs->transnoentities("ProfId".$key.$mysoc->country_code);
|
||||
$textprofid[$key]='';
|
||||
if ($label != "ProfId".$key.$mysoc->pays_code)
|
||||
if ($label != "ProfId".$key.$mysoc->country_code)
|
||||
{ // Get only text between ()
|
||||
if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1];
|
||||
$textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->pays_code,$label);
|
||||
$textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertContains("New address\nNew zip New town", $result);
|
||||
|
||||
$result=$localobject->isInEEC();
|
||||
print __METHOD__." id=".$localobject->id." pays_code=".$this->pays_code." result=".$result."\n";
|
||||
print __METHOD__." id=".$localobject->id." country_code=".$this->country_code." result=".$result."\n";
|
||||
$this->assertTrue(true, $result);
|
||||
|
||||
$localobject->info($localobject->id);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user