Clean code

This commit is contained in:
Laurent Destailleur 2023-10-17 10:52:19 +02:00
parent fb8b4acdbf
commit f18529f944
10 changed files with 21 additions and 80 deletions

View File

@ -20,6 +20,7 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT.
* The duplicated and deprecated property ->date_livraison that was renamed into ->delivery_date has been completely removed.
* The property ->user_close to store ID of closing user has been renamed into ->user_closing_id.
* The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead.
* The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog()
* Recheck setup of your module workflow to see if you need to enable the new setting to have shipment set to billed automatically when

View File

@ -155,7 +155,6 @@ class Asset extends CommonObject
public $import_key;
public $model_pdf;
public $status;
public $user_cloture_id;
/**
* @var Asset object oldcopy
@ -1469,7 +1468,7 @@ class Asset extends CommonObject
$this->user_creation_id = $obj->fk_user_author;
$this->user_validation_id = $obj->fk_user_valid;
$this->user_cloture_id = $obj->fk_user_cloture;
$this->user_closing_id = $obj->fk_user_cloture;
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);

View File

@ -190,12 +190,6 @@ class Propal extends CommonObject
*/
public $datep;
/**
* @var int Date expected for delivery
* @deprecated
*/
public $date_livraison; // deprecated; Use delivery_date instead.
/**
* @var integer|string $delivery_date;
*/
@ -206,7 +200,6 @@ class Propal extends CommonObject
public $user_author_id;
public $user_valid_id;
public $user_close_id;
/**
* @deprecated
@ -1712,8 +1705,8 @@ class Propal extends CommonObject
$this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array();
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
$this->user_close_id = $obj->fk_user_cloture;
$this->user_validation_id = $obj->fk_user_valid;
$this->user_closing_id = $obj->fk_user_cloture;
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
@ -3395,9 +3388,7 @@ class Propal extends CommonObject
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
$this->user_closing_id = $obj->fk_user_cloture;
}
}
$this->db->free($result);

View File

@ -206,14 +206,7 @@ class Commande extends CommonOrder
public $date_commande;
/**
* @var int Date expected for delivery
* @see $delivery_date
* @deprecated
*/
public $date_livraison;
/**
* @var int Date expected of shipment (date starting shipment, not the reception that occurs some days after)
* @var int Date expected of shipment (date of start of shipment, not the reception that occurs some days after)
*/
public $delivery_date;

View File

@ -148,15 +148,8 @@ class Facture extends CommonInvoice
/**
* @var int Date expected for delivery
* @deprecated
* @see $delivery_date
*/
public $date_livraison;
/**
* @var int Date expected for delivery
*/
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
public $delivery_date; // Date expected of shipment (date of start of shipment, not the reception that occurs some days after)
/**
* @var string customer ref
@ -4673,9 +4666,7 @@ class Facture extends CommonInvoice
$this->user_validation = $vuser;
}
if ($obj->fk_user_closing) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_closing);
$this->user_closing = $cluser;
$this->user_closing_id = $obj->fk_user_closing;
}
$this->date_creation = $this->db->jdate($obj->datec);

View File

@ -563,10 +563,7 @@ function dol_print_object_info($object, $usetable = 0)
}
// User close
if (!empty($object->user_cloture) || !empty($object->user_closing) || !empty($object->user_closing_id)) {
if (isset($object->user_cloture) && !empty($object->user_cloture)) {
$object->user_closing = $object->user_cloture;
}
if (!empty($object->user_closing_id)) {
if ($usetable) {
print '<tr><td class="titlefield">';
}
@ -576,20 +573,12 @@ function dol_print_object_info($object, $usetable = 0)
} else {
print ': ';
}
if (is_object($object->user_closing)) {
if ($object->user_closing->id) {
print $object->user_closing->getNomUrl(-1, '', 0, 0, 0);
} else {
print $langs->trans("Unknown");
}
$userstatic = new User($db);
$userstatic->fetch($object->user_closing_id);
if ($userstatic->id) {
print $userstatic->getNomUrl(-1, '', 0, 0, 0);
} else {
$userstatic = new User($db);
$userstatic->fetch($object->user_closing_id ? $object->user_closing_id : $object->user_closing);
if ($userstatic->id) {
print $userstatic->getNomUrl(-1, '', 0, 0, 0);
} else {
print $langs->trans("Unknown");
}
print $langs->trans("Unknown");
}
if ($usetable) {
print '</td></tr>';

View File

@ -142,12 +142,6 @@ class CommandeFournisseur extends CommonOrder
public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set
public $date_commande;
/**
* @var int Date expected for delivery
* @deprecated See delivery_date
*/
public $date_livraison;
/**
* @var int Date expected for delivery
*/

View File

@ -725,9 +725,7 @@ class ProductFournisseurPrice extends CommonObject
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
$this->user_closing_id = $obj->fk_user_cloture;
}
$this->date_creation = $this->db->jdate($obj->datec);

View File

@ -146,10 +146,6 @@ class Project extends CommonObject
*/
public $fk_user_close;
/**
* @var int user close id
*/
public $user_close_id;
public $public; //!< Tell if this is a public or private project
/**
@ -727,7 +723,7 @@ class Project extends CommonObject
$this->socid = $obj->fk_soc;
$this->user_author_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->user_close_id = $obj->fk_user_close;
$this->user_closing_id = $obj->fk_user_close;
$this->public = $obj->public;
$this->statut = $obj->status; // deprecated
$this->status = $obj->status;
@ -2334,9 +2330,7 @@ class Project extends CommonObject
}
if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
$this->user_closing_id = $obj->fk_user_cloture;
}
$this->date_creation = $this->db->jdate($obj->datec);

View File

@ -110,12 +110,6 @@ class SupplierProposal extends CommonObject
*/
public $date;
/**
* @var integer|string date_livraison
* @deprecated
*/
public $date_livraison;
/**
* @var integer|string date_livraison
*/
@ -146,7 +140,6 @@ class SupplierProposal extends CommonObject
public $user_author_id;
public $user_valid_id;
public $user_close_id;
/**
* @deprecated
@ -1275,9 +1268,9 @@ class SupplierProposal extends CommonObject
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
$this->user_close_id = $obj->fk_user_cloture;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
$this->user_closing_id = $obj->fk_user_cloture;
// Multicurrency
$this->fk_multicurrency = $obj->fk_multicurrency;
@ -2141,9 +2134,7 @@ class SupplierProposal extends CommonObject
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
$this->user_closing_id = $obj->fk_user_cloture;
}
}
$this->db->free($result);