From b37a43806795a5382caea3d0b7b39346fc82ab50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Oct 2023 11:10:25 +0200 Subject: [PATCH] The property ->user_validation to store ID of user validating has been renamed into ->user_validation_id. --- ChangeLog | 1 + htdocs/comm/mailing/card.php | 2 +- htdocs/comm/mailing/class/mailing.class.php | 5 ++--- htdocs/comm/propal/class/propal.class.php | 11 ++++------- htdocs/commande/class/commande.class.php | 6 ++---- htdocs/compta/facture/class/facture.class.php | 12 +++++------- .../sociales/class/chargesociales.class.php | 4 +--- htdocs/core/ajax/onlineSign.php | 2 +- htdocs/delivery/class/delivery.class.php | 3 ++- .../class/expensereport.class.php | 4 +--- htdocs/fichinter/class/fichinter.class.php | 7 +++---- .../class/fournisseur.commande.class.php | 8 ++++---- .../fourn/class/fournisseur.facture.class.php | 6 ++---- htdocs/holiday/class/holiday.class.php | 4 +--- .../class/productfournisseurprice.class.php | 4 +--- .../inventory/class/inventory.class.php | 4 +--- htdocs/public/onlinesign/newonlinesign.php | 2 +- .../class/supplier_proposal.class.php | 19 +++++++++---------- htdocs/webservices/server_invoice.php | 8 ++++---- 19 files changed, 46 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8d4cf772d7..81a1a5d9350 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ Following changes may create regressions for some external modules, but were nec * 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 property ->user_validation to store ID of user validating has been renamed into ->user_validation_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 diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 8a0a4ecdd3b..6ba1f8fc0f8 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1058,7 +1058,7 @@ if ($action == 'create') { if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test', 'editevenunsubscribe'))) { print "\n\n
\n"; - if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation == $user->id)) { + if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation_id == $user->id)) { print ''.$langs->trans("SetToDraft").''; } diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 54d9441a489..f1831472a58 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -415,7 +415,6 @@ class Mailing extends CommonObject $this->user_creat = $obj->fk_user_creat; $this->user_creation = $obj->fk_user_creat; - $this->user_valid = $obj->fk_user_valid; $this->user_validation = $obj->fk_user_valid; $this->date_creat = $this->db->jdate($obj->date_creat); @@ -479,8 +478,8 @@ class Mailing extends CommonObject $object->email_replyto = ''; $object->email_errorsto = ''; - $object->user_creat = $user->id; - $object->user_valid = ''; + $object->user_creation_id = $user->id; + $object->user_validation_id = ''; $object->date_creat = ''; $object->date_valid = ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 526fefb5061..9de10af17ab 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -199,7 +199,6 @@ class Propal extends CommonObject public $fin_validite; public $user_author_id; - public $user_valid_id; /** * @deprecated @@ -1512,7 +1511,7 @@ class Propal extends CommonObject // Clear fields $object->user_author = $user->id; - $object->user_valid = 0; + $object->user_validation_id = 0; $object->date = $now; $object->datep = $now; // deprecated $object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600); @@ -1803,7 +1802,7 @@ class Propal extends CommonObject $sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").","; $sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").","; $sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").","; - $sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").","; + $sql .= " fk_user_valid=".(isset($this->user_validation_id) ? $this->user_validation_id : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " deposit_percent=".(!empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : "null").","; @@ -2093,7 +2092,7 @@ class Propal extends CommonObject $this->ref = $num; $this->statut = self::STATUS_VALIDATED; $this->status = self::STATUS_VALIDATED; - $this->user_valid_id = $user->id; + $this->user_validation_id = $user->id; $this->datev = $now; $this->date_validation = $now; @@ -3376,9 +3375,7 @@ class Propal extends CommonObject $this->user_creation = $cuser; if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if ($obj->fk_user_signature) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 16d1b7bfc14..772fc2dad8e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1241,7 +1241,6 @@ class Commande extends CommonOrder // Clear fields $this->user_author_id = $user->id; - $this->user_valid = 0; // deprecated $this->user_validation_id = 0; $this->date = dol_now(); $this->date_commande = dol_now(); @@ -1919,9 +1918,8 @@ class Commande extends CommonOrder $this->user_author_id = $obj->fk_user_author; $this->user_creation_id = $obj->fk_user_author; $this->user_validation_id = $obj->fk_user_valid; - $this->user_valid = $obj->fk_user_valid; // deprecated $this->user_modification_id = $obj->fk_user_modif; - $this->user_modification = $obj->fk_user_modif; + $this->user_modification = $obj->fk_user_modif; // deprecated $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; $this->total_localtax1 = $obj->total_localtax1; @@ -3373,7 +3371,7 @@ class Commande extends CommonOrder $sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").","; $sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").","; $sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").","; - $sql .= " fk_user_valid=".((isset($this->user_valid) && $this->user_valid > 0) ? $this->user_valid : "null").","; + $sql .= " fk_user_valid=".((isset($this->user_validation_id) && $this->user_validation_id > 0) ? $this->user_validation_id : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " deposit_percent=".(!empty($this->deposit_percent) ? strval($this->deposit_percent) : "null").","; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b86a58ef57e..56653ed08c6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1250,8 +1250,8 @@ class Facture extends CommonInvoice // Clear fields $object->date = (empty($this->date) ? dol_now() : $this->date); - $object->user_author = $user->id; // deprecated - $object->user_valid = null; // deprecated + $object->user_creation_id = $user->id; + $object->user_validation_id = null; $object->fk_user_author = $user->id; $object->fk_user_valid = null; $object->fk_facture_source = 0; @@ -2206,8 +2206,8 @@ class Facture extends CommonInvoice $this->note = $obj->note_private; // deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->user_author = $obj->fk_user_author; // deprecated - $this->user_valid = $obj->fk_user_valid; // deprecated + $this->user_creation_id = $obj->fk_user_author; // deprecated + $this->user_validation_id = $obj->fk_user_valid; // deprecated $this->user_modification = $obj->fk_user_modif; // deprecated $this->fk_user_author = $obj->fk_user_author; $this->fk_user_valid = $obj->fk_user_valid; @@ -4661,9 +4661,7 @@ class Facture extends CommonInvoice $this->user_creation = $cuser; } if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if ($obj->fk_user_closing) { $this->user_closing_id = $obj->fk_user_closing; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 26e4efc3dd9..a4678223d0e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -723,9 +723,7 @@ class ChargeSociales extends CommonObject } if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } $this->date_creation = $this->db->jdate($obj->datec); diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 86ef0f3c29d..4b2802eac35 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -221,7 +221,7 @@ if ($action == "importSignature") { if (method_exists($object, 'call_trigger')) { //customer is not a user !?! so could we use same user as validation ? $user = new User($db); - $user->fetch($object->user_valid_id); + $user->fetch($object->user_validation_id); $object->context = array('closedfromonlinesignature' => 'closedfromonlinesignature'); $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); if ($result < 0) { diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index a2cd5641a40..dc970c48606 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -342,8 +342,9 @@ class Delivery extends CommonObject $this->ref_customer = $obj->ref_customer; $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; + $this->status = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; - $this->user_valid_id = $obj->fk_user_valid; + $this->user_validation_id = $obj->fk_user_valid; $this->fk_delivery_address = $obj->fk_address; $this->note = $obj->note_private; //TODO deprecated $this->note_private = $obj->note_private; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 5a31031f5c5..9deddb5f896 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -854,9 +854,7 @@ class ExpenseReport extends CommonObject $this->user_creation = $cuser; } if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if ($obj->fk_user_modification) { $muser = new User($this->db); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index dab4b63d2c1..1c3533a0ea5 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1022,9 +1022,7 @@ class Fichinter extends CommonObject $this->user_creation = $cuser; if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if ($obj->fk_user_modification) { $muser = new User($this->db); @@ -1294,9 +1292,10 @@ class Fichinter extends CommonObject // Clear fields $this->user_author_id = $user->id; - $this->user_valid = 0; + $this->user_validation_id = 0; $this->date_creation = ''; $this->date_validation = ''; + $this->ref_client = ''; // Create clone diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 565bf3b95ff..6f746efebfa 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -183,8 +183,8 @@ class CommandeFournisseur extends CommonOrder * @var string paymnet choice label */ public $mode_reglement; + public $user_author_id; - public $user_valid_id; public $user_approve_id; public $user_approve_id2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set @@ -423,7 +423,7 @@ class CommandeFournisseur extends CommonOrder $this->status = $obj->status; $this->billed = $obj->billed; $this->user_author_id = $obj->fk_user_author; - $this->user_valid_id = $obj->fk_user_valid; + $this->user_validation_id = $obj->fk_user_valid; $this->user_approve_id = $obj->fk_user_approve; $this->user_approve_id2 = $obj->fk_user_approve2; $this->total_ht = $obj->total_ht; @@ -1650,7 +1650,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").","; $sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").","; $sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").","; - $sql .= " fk_user_valid=".(isset($this->user_valid) && $this->user_valid > 0 ? $this->user_valid : "null").","; + $sql .= " fk_user_valid=".(isset($this->user_validation_id) && $this->user_validation_id > 0 ? $this->user_validation_id : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").","; @@ -1748,7 +1748,7 @@ class CommandeFournisseur extends CommonOrder // Clear fields $this->user_author_id = $user->id; - $this->user_valid = 0; + $this->user_validation_id = 0; $this->date_creation = ''; $this->date_validation = ''; $this->ref_supplier = null; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 566af1a4fac..d4c66fb2be3 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2538,9 +2538,7 @@ class FactureFournisseur extends CommonInvoice $this->user_creation = $cuser; } if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if ($obj->fk_user_modif) { $muser = new User($this->db); @@ -3142,7 +3140,7 @@ class FactureFournisseur extends CommonInvoice // Clear fields $object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier); $object->author = $user->id; - $object->user_valid = 0; + $object->user_validation_id = 0; $object->fk_facture_source = 0; $object->date_creation = ''; $object->date_validation = ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index eb0e4a61bbb..ca1aeabc6f2 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2305,9 +2305,7 @@ class Holiday extends CommonObject $this->user_creation = $cuser; } if (!empty($obj->fk_user_valid)) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if (!empty($obj->fk_user_modification)) { $muser = new User($this->db); diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 2616213a80b..6dd911abe33 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -719,9 +719,7 @@ class ProductFournisseurPrice extends CommonObject } if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if ($obj->fk_user_cloture) { diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index c1689d81989..d8a882b1963 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -732,9 +732,7 @@ class Inventory extends CommonObject } if ($obj->fk_user_valid > 0) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } $this->date_creation = $this->db->jdate($obj->datec); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 0a9df12ae6b..394b3e92d1f 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -194,7 +194,7 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') { if (method_exists($object, 'call_trigger')) { // Online customer is not a user, so we use the use that validates the documents $user = new User($db); - $user->fetch($object->user_valid_id); + $user->fetch($object->user_validation_id); $object->context = array('closedfromonlinesignature' => 'closedfromonlinesignature'); $result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user); if ($result < 0) { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index c756c9a77f3..8db3fe8d3c8 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -103,6 +103,10 @@ class SupplierProposal extends CommonObject public $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande public $ref_supplier; //Reference saisie lors de l'ajout d'une ligne à la demande + + /** + * @deprecated + */ public $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (processed/billed) /** @@ -139,7 +143,6 @@ class SupplierProposal extends CommonObject public $user_author_id; - public $user_valid_id; /** * @deprecated @@ -1140,10 +1143,8 @@ class SupplierProposal extends CommonObject } // Clear fields - $this->user_author = $user->id; // deprecated $this->user_author_id = $user->id; - $this->user_valid = 0; // deprecated - $this->user_valid_id = 0; + $this->user_validation_id = 0; $this->date = $now; // Set ref @@ -1268,8 +1269,8 @@ 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_author_id = $obj->fk_user_author; + $this->user_validation_id = $obj->fk_user_valid; $this->user_closing_id = $obj->fk_user_cloture; // Multicurrency @@ -1479,7 +1480,7 @@ class SupplierProposal extends CommonObject $this->ref = $num; $this->statut = self::STATUS_VALIDATED; $this->status = self::STATUS_VALIDATED; - $this->user_valid_id = $user->id; + $this->user_validation_id = $user->id; $this->datev = $now; $this->date_validation = $now; @@ -2128,9 +2129,7 @@ class SupplierProposal extends CommonObject $this->user_creation = $cuser; if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; + $this->user_validation_id = $obj->fk_user_valid; } if ($obj->fk_user_cloture) { diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 7b99f120fa8..d9f44781f87 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -365,8 +365,8 @@ function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '') 'ref' => $invoice->ref, 'ref_ext' => $invoice->ref_ext ? $invoice->ref_ext : '', // If not defined, field is not added into soap 'thirdparty_id' => $invoice->socid, - 'fk_user_author' => $invoice->user_author ? $invoice->user_author : '', - 'fk_user_valid' => $invoice->user_valid ? $invoice->user_valid : '', + 'fk_user_author' => $invoice->fk_user_author ? $invoice->fk_user_author : '', + 'fk_user_valid' => $invoice->user_validation_id ? $invoice->user_validation_id : '', 'date' => $invoice->date ?dol_print_date($invoice->date, 'dayrfc') : '', 'date_due' => $invoice->date_lim_reglement ?dol_print_date($invoice->date_lim_reglement, 'dayrfc') : '', 'date_creation' => $invoice->date_creation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '', @@ -490,8 +490,8 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) 'id' => $invoice->id, 'ref' => $invoice->ref, 'ref_ext' => $invoice->ref_ext ? $invoice->ref_ext : '', // If not defined, field is not added into soap - 'fk_user_author' => $invoice->user_author ? $invoice->user_author : '', - 'fk_user_valid' => $invoice->user_valid ? $invoice->user_valid : '', + 'fk_user_author' => $invoice->fk_user_author ? $invoice->fk_user_author : '', + 'fk_user_valid' => $invoice->user_validation_id ? $invoice->user_validation_id : '', 'date' => $invoice->date ?dol_print_date($invoice->date, 'dayrfc') : '', 'date_due' => $invoice->date_lim_reglement ?dol_print_date($invoice->date_lim_reglement, 'dayrfc') : '', 'date_creation' => $invoice->date_creation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '',