diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index dd10071abf6..bbff14ebd63 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -4,10 +4,9 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2021 Alexandre Spangaro + * Copyright (C) 2021-2024 Alexandre Spangaro * Copyright (C) 2022 Frédéric France * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -356,7 +355,7 @@ class modFacture extends DolibarrModules $this->import_fields_array[$r] = array( 'fd.fk_facture' => 'InvoiceRef*', 'fd.fk_parent_line' => 'FacParentLine', - 'fd.fk_product' => 'IdProduct', + 'fd.fk_product' => 'ProductOrService', 'fd.label' => 'Label', 'fd.description' => 'LineDescription*', 'fd.vat_src_code' => 'Vat Source Code', @@ -415,13 +414,12 @@ class modFacture extends DolibarrModules // End add extra fields $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facturedet'); $this->import_regex_array[$r] = array( - 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency' ); $import_sample = array( 'fd.fk_facture' => '(PROV00001)', 'fd.fk_parent_line' => '', - 'fd.fk_product' => '', + 'fd.fk_product' => 'ref:PRODUCT_REF or id:123456', 'fd.label' => '', 'fd.description' => 'Test product', 'fd.vat_src_code' => '', @@ -466,7 +464,8 @@ class modFacture extends DolibarrModules $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); $this->import_updatekeys_array[$r] = array( 'fd.rowid' => 'Row Id', - 'fd.fk_facture' => 'Invoice Id' + 'fd.fk_facture' => 'Invoice Id', + 'fd.fk_product'=> 'ProductRef' ); $this->import_convertvalue_array[$r] = array( 'fd.fk_facture' => array( @@ -476,6 +475,13 @@ class modFacture extends DolibarrModules 'method' => 'fetch', 'element' => 'facture' ), + 'fd.fk_product' => array( + 'rule'=>'fetchidfromref', + 'classfile'=>'/product/class/product.class.php', + 'class'=>'Product', + 'method'=>'fetch', + 'element'=>'Product' + ), 'fd.fk_projet' => array( 'rule' => 'fetchidfromref', 'file' => '/projet/class/project.class.php',