Deprecated property ->fk_departement is now ->state_id everywhere.

This commit is contained in:
Laurent Destailleur
2019-04-05 20:06:13 +02:00
parent 67760d6f41
commit 54714bc755
9 changed files with 21 additions and 31 deletions

View File

@@ -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 *****

View File

@@ -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"];

View File

@@ -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');

View File

@@ -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,11 +758,8 @@ 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->country_id = $obj->country_id;

View File

@@ -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
{

View File

@@ -343,10 +343,10 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
*
* @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 Societe|string $targetcompany Target company object
* @param Contact|string $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 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
*/
@@ -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');
$reshook=0;
$stringaddress = '';

View File

@@ -106,7 +106,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Issuer
* @var Company object that emits
* @var Societe object that emits
*/
public $emetteur;

View File

@@ -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:'');

View File

@@ -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)