diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 1a898e9c61800..907c684a6a9d1 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -440,4 +440,20 @@ public function getRows($sql) return false; } + static $_deprecated_table_names = array( + 'thirdparty' => 'societe', + 'contact' => 'socpeople', + 'invoice' => 'facture', + 'order_supplier' => 'commande_fournisseur', + 'categorie_extrafields' => 'categories_extrafields' + ); + /** + * Check table name and change it to new version table name if table name is deprecated. + * + * @param string $table_name table name to check + * @return string new table name or original one if no change is required + */ + static public function checkTableName($table_name) { + return CommonObject::$_deprecated_table_names[$table_name] ?? $table_name; + } }