diff --git a/ChangeLog b/ChangeLog index 3c9576e7544..2f31642be53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,7 +28,7 @@ Following changes may create regressions for some external modules, but were nec * Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION. * Method dolEscapeXML was moved from functions.lib.php into function2.lib.php (not used enough to be loaded by default). * Removed deprecated use of string in dol_print_date(). Only date allowed. - +* Deprecated property ->fk_departement is now ->state_id everywhere. ***** ChangeLog for 9.0.1 compared to 9.0.0 ***** diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 9dafaa58f05..8abfc9ede38 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -154,7 +154,7 @@ abstract class ActionsContactCardCommon if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); // State - if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement, $this->object->country_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; // Public or private @@ -289,7 +289,6 @@ abstract class ActionsContactCardCommon $this->object->address = $_POST["address"]; $this->object->zip = $_POST["zipcode"]; $this->object->town = $_POST["town"]; - $this->object->fk_departement = $_POST["state_id"]; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; $this->object->state_id = $_POST["state_id"]; $this->object->phone_pro = $_POST["phone_pro"]; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index dff432690be..e310d3e0b6d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -356,7 +356,6 @@ if (empty($reshook)) $object->zip = GETPOST("zipcode", 'alpha'); $object->town = GETPOST("town", 'alpha'); $object->state_id = GETPOST("state_id", 'int'); - $object->fk_departement = GETPOST("state_id", 'int'); // For backward compatibility $object->country_id = GETPOST("country_id", 'int'); $object->email = GETPOST("email", 'alpha'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 73f27f8ec1c..398640ffb64 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -337,7 +337,6 @@ class Contact extends CommonObject $this->zip=(empty($this->zip)?'':$this->zip); $this->town=(empty($this->town)?'':$this->town); $this->country_id=($this->country_id > 0?$this->country_id:$this->country_id); - $this->state_id=($this->state_id > 0?$this->state_id:$this->fk_departement); if (empty($this->statut)) $this->statut = 0; $this->db->begin(); @@ -709,7 +708,7 @@ class Contact extends CommonObject $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,"; $sql.= " c.address, c.statut, c.zip, c.town,"; $sql.= " c.fk_pays as country_id,"; - $sql.= " c.fk_departement,"; + $sql.= " c.fk_departement as state_id,"; $sql.= " c.birthday,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,"; $sql.= " c.photo,"; @@ -759,12 +758,9 @@ class Contact extends CommonObject $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); - $this->fk_departement = $obj->fk_departement; // deprecated - $this->state_id = $obj->fk_departement; - $this->departement_code = $obj->state_code; // deprecated + $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; - $this->departement = $obj->state; // deprecated - $this->state = $obj->state; + $this->state = $obj->state; $this->country_id = $obj->country_id; $this->country_code = $obj->country_id?$obj->country_code:''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 723efddc6b3..f77c6d8bb8a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1633,7 +1633,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs { $ret .= ($ret ? $sep : '' ).$object->zip; $ret .= ($object->town?(($object->zip?' ':'').$object->town):''); - $ret .= ($object->departement_id?(' ('.($object->departement_id).')'):''); + $ret .= ($object->state_id?(' ('.($object->state_id).')'):''); } else // Other: title firstname name \n address lines \n zip town \n country { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 7657031a249..2d6e41abe59 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -341,14 +341,14 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali /** * Return a string with full address formated for output on documents * - * @param Translate $outputlangs Output langs object - * @param Societe $sourcecompany Source company object - * @param Societe $targetcompany Target company object - * @param Contact $targetcontact Target contact object - * @param int $usecontact Use contact instead of company - * @param int $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url) - * @param Object $object Object we want to build document for - * @return string String with full address + * @param Translate $outputlangs Output langs object + * @param Societe $sourcecompany Source company object + * @param Societe|string $targetcompany Target company object + * @param Contact|string $targetcontact Target contact object + * @param int $usecontact Use contact instead of company + * @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url) + * @param Object $object Object we want to build document for + * @return string String with full address */ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $targetcontact = '', $usecontact = 0, $mode = 'source', $object = null) { @@ -357,12 +357,8 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t if ($mode == 'source' && ! is_object($sourcecompany)) return -1; if ($mode == 'target' && ! is_object($targetcompany)) return -1; - if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO deprecated - if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id); - if (! empty($sourcecompany->state_id) && !isset($sourcecompany->departement_id)) $sourcecompany->departement_id=getState($sourcecompany->state_id, '2'); - if (! empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id); //TODO deprecated - if (! empty($targetcompany->state_id) && empty($targetcompany->state)) $targetcompany->state=getState($targetcompany->state_id); - if (! empty($targetcompany->state_id) && !isset($targetcompany->departement_id)) $targetcompany->departement_id=getState($targetcompany->state_id, '2'); + if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id); + if (! empty($targetcompany->state_id) && empty($targetcompany->state)) $targetcompany->state=getState($targetcompany->state_id); $reshook=0; $stringaddress = ''; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 7e3f7c68c88..a28644f0e60 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -106,7 +106,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Issuer - * @var Company object that emits + * @var Societe object that emits */ public $emetteur; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9af346b35e3..4f3ea088ddb 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1252,7 +1252,7 @@ class Societe extends CommonObject $sql .= ', s.fk_forme_juridique as forme_juridique_code'; $sql .= ', s.webservices_url, s.webservices_key'; $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 as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj'; + $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj'; $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo'; $sql .= ', s.fk_shipping_method'; $sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms'; @@ -1328,7 +1328,7 @@ class Societe extends CommonObject $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->transnoentities('Country'.$obj->country_code):$obj->country):''; - $this->state_id = $obj->fk_departement; + $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; $this->state = ($obj->state!='-'?$obj->state:''); diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index f612b3ce2d4..10dc97a7fb1 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -490,7 +490,7 @@ function getContactsForThirdParty($authentication, $idthirdparty) $sql = "SELECT c.rowid, c.fk_soc, c.civility as civility_id, c.lastname, c.firstname, c.statut as status,"; $sql.= " c.address, c.zip, c.town,"; $sql.= " c.fk_pays as country_id,"; - $sql.= " c.fk_departement,"; + $sql.= " c.fk_departement as state_id,"; $sql.= " c.birthday,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,"; //$sql.= " c.priv, c.note, c.default_lang, c.canvas,"; @@ -503,7 +503,7 @@ function getContactsForThirdParty($authentication, $idthirdparty) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; - $sql.= " WHERE c.fk_soc=$idthirdparty"; + $sql.= " WHERE c.fk_soc = ".$idthirdparty; $resql=$db->query($sql); if ($resql)