From 26a020fae60efdace40a4995c077101bb53894a2 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 6 Aug 2025 12:10:08 +0200 Subject: [PATCH 1/3] Fix CI --- htdocs/webservices/server_invoice.php | 6 +++--- htdocs/webservices/server_order.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 833d6b88e94..10d6be907e2 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -553,7 +553,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) * Create an invoice * * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information - * @param array{id:string,ref:string,ref_ext:string,thirdparty_id:int,fk_user_author:string,fk_user_valid:string,date:string,date_due:string,date_creation:string,date_validation:string,date_modification:string,payment_mode_id:string,type:int,total_net:float,total_vat:float,total:float,note_private:string,note_public:string,status:int,close_code:string,close_note:string,project_id:string,lines?:array{id:string,type:int,desc:string,vat_rate:float,qty:float,unitprice:float,total_net:float,total_vat:float,total:float,date_start:string,date_end:string,product_id:int,product_ref:string,product_label:string,product_desc:string}} $invoice Invoice + * @param array{id:string,ref:string,ref_ext:string,thirdparty_id:int,fk_user_author:string,fk_user_valid:string,date:string,date_due:string,date_creation:string,date_validation:string,date_modification:string,payment_mode_id:string,type:int,total_net:float,total_vat:float,total:float,note_private:string,note_public:string,status:int,close_code:string,close_note:string,project_id:string,lines?:array} $invoice Invoice * @return array{result:array{result_code:string,result_label:string}} Array result */ function createInvoice($authentication, $invoice) @@ -617,9 +617,9 @@ function createInvoice($authentication, $invoice) foreach ($arrayoflines as $line) { // $key can be 'line' or '0','1',... $newline = new FactureLigne($db); - $newline->product_type = $line['type']; + $newline->product_type = (int) $line['type']; $newline->desc = $line['desc']; - $newline->fk_product = $line['product_id']; + $newline->fk_product = (int) $line['product_id']; $newline->tva_tx = isset($line['vat_rate']) ? $line['vat_rate'] : 0; $newline->qty = $line['qty']; $newline->subprice = isset($line['unitprice']) ? $line['unitprice'] : null; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 26ef230e0c5..fc7cac1487d 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -674,7 +674,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) * Create order * * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information - * @param array{id:string,ref:string,ref_client:string,ref_ext:string,thirdparty_id:int,status:int,billed:string,total_net:float,total_vat:float,total_localtax1:float,total_localtax2:float,total:float,date:string,date_creation:string,date_validation:string,date_modification:string,source:string,note_private:string,note_public:string,project_id:string,mode_reglement_id:string,mode_reglement_code:string,mode_reglement:string,cond_reglement_id:string,cond_reglement_code:string,cond_reglement:string,cond_reglement_doc:string,date_livraison:int,demand_reason_id:string,lines:array{lines:array}} $order Order info + * @param array{id:string,ref:string,ref_client:string,ref_ext:string,thirdparty_id:int,status:int,billed:string,total_net:float,total_vat:float,total_localtax1:float,total_localtax2:float,total:float,date:string,date_creation:string,date_validation:string,date_modification:string,source:string,note_private:string,note_public:string,project_id:string,mode_reglement_id:string,mode_reglement_code:string,mode_reglement:string,cond_reglement_id:string,cond_reglement_code:string,cond_reglement:string,cond_reglement_doc:string,date_livraison:int,demand_reason_id:string,lines:array} $order Order info * @return array{result:array{result_code:string,result_label:string}} Array result */ function createOrder($authentication, $order) From 1dbe6e579a97636a15c066a05a6cf5b8abdb642f Mon Sep 17 00:00:00 2001 From: Marc <99648320+emheyarssi@users.noreply.github.com> Date: Wed, 6 Aug 2025 12:12:09 +0200 Subject: [PATCH 2/3] FIX #34843 (#34875) * FIX #34564 * FIX #34843 * Fix code formating * Fix php-stan * Code improvement * Correcting formating * Last correction (i hope!) --- htdocs/core/class/html.formfile.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7774d7ca890..bec70274179 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1309,10 +1309,11 @@ class FormFile // Define relative path used to store the file if (empty($relativepath)) { $relativepath = (!empty($object->ref) ? dol_sanitizeFileName($object->ref) : '').'/'; - if (!empty($object->element) && $object->element == 'invoice_supplier') { + if (!empty($object->element) && $object->element == "societe" && !empty($object->id)) { + $relativepath = ($object->id).'/'; + } elseif (!empty($object->element) && $object->element == 'invoice_supplier') { $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath - } - if (!empty($object->element) && $object->element == 'project_task') { + } elseif (!empty($object->element) && $object->element == 'project_task') { $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.'; } } @@ -1584,7 +1585,6 @@ class FormFile } //print $file['path'].'/'.$smallfile.'
'; - $urlforhref = getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(empty($object->entity) ? $conf->entity : $object->entity)); if (empty($urlforhref)) { $urlforhref = DOL_URL_ROOT.'/viewimage.php?modulepart='.urlencode($modulepart).'&entity='.(empty($object->entity) ? $conf->entity : $object->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])); From 618e455ca35e20c6bbb2b798c1406d9b7cce9661 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 Aug 2025 12:33:08 +0200 Subject: [PATCH 3/3] FIX avoid php warning with "$forceFullTextIndexation" (#34881) * FIX avoid php warning, "$forceFullTextIndexation" not used in "dol_add_file_process()" function, maybe deprecated ? * FIX missing $forceFullTextIndexation parameter --------- Co-authored-by: Laurent Destailleur --- htdocs/core/actions_linkedfiles.inc.php | 1 + htdocs/core/lib/files.lib.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 9c77041439d..5c5fb2bfbbe 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -97,6 +97,7 @@ if (GETPOST('sendit', 'alpha') && getDolGlobalString('MAIN_UPLOAD_DOC') && !empt $generatethumbs = 0; } $allowoverwrite = (GETPOSTINT('overwritefile') ? 1 : 0); + $forceFullTextIndexation = (!empty($forceFullTextIndexation) ? $forceFullTextIndexation : ''); if (!empty($upload_dirold) && getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs, $object, $forceFullTextIndexation); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 21e35b2b9cd..e13b726f2ef 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1916,11 +1916,11 @@ function dol_init_file_process($pathtoscan = '', $trackid = '') * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @param int<0,1> $generatethumbs 1=Generate also thumbs for uploaded image files * @param ?Object $object Object used to set 'src_object_*' fields - * @param string $forceFullTestIndexation '1'=Force full text storage in database even if global option not set (consume a high level of data) + * @param string $forceFullTextIndexation '1'=Force full text storage in database even if global option not set (consume a high level of data) * @return int Return integer <=0 if KO, nb of success if OK (>0) * @see dol_remove_file_process() */ -function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionordb = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null, $forceFullTestIndexation = '') +function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionordb = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null, $forceFullTextIndexation = '') { global $db, $user, $conf, $langs; @@ -2041,7 +2041,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionor deleteFilesIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), ''); } - $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', $sharefile, $object); + $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', $sharefile, $object, $forceFullTextIndexation); if ($result < 0) { if ($allowoverwrite) { // Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS