From c19ffedd26714f5324e0efb256921b46d5fd3ab1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Apr 2026 19:44:55 +0200 Subject: [PATCH] NEW Supplier order - Update dir_output (#37858) * NEW Supplier order - Update dir_output * CI * CI --- htdocs/fourn/commande/card.php | 66 +++++++++++++++-------------- htdocs/fourn/commande/contact.php | 31 +++++++------- htdocs/fourn/commande/dispatch.php | 59 ++++++++++++++------------ htdocs/fourn/commande/document.php | 37 ++++++++-------- htdocs/fourn/commande/index.php | 22 +++++----- htdocs/fourn/commande/info.php | 27 ++++++------ htdocs/fourn/commande/list.php | 57 +++++++++++++------------ htdocs/fourn/commande/messaging.php | 25 +++++------ htdocs/fourn/commande/note.php | 27 ++++++------ 9 files changed, 184 insertions(+), 167 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c0da4f728d1..fc632b869b5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1,21 +1,21 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2016 Regis Houssin - * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2011-2022 Philippe Grand - * Copyright (C) 2012-2016 Marcos García - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Ion Agorria - * Copyright (C) 2018-2026 Frédéric France - * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2022-2026 Charlene Benke - * Copyright (C) 2023 Joachim Kueter - * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Nick Fragoulis - * Copyright (C) 2025 Alexandre Spangaro - * Copyright (C) 2026 William Mead +/* Copyright (C) 2004-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2016 Regis Houssin + * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2011-2022 Philippe Grand + * Copyright (C) 2012-2016 Marcos García + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Ion Agorria + * Copyright (C) 2018-2026 Frédéric France + * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2022-2026 Charlene Benke + * Copyright (C) 2023 Joachim Kueter + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024 Nick Fragoulis + * Copyright (C) 2025-2026 Alexandre Spangaro + * Copyright (C) 2026 William Mead * * 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 @@ -37,9 +37,18 @@ * \brief Card supplier order */ - // Load Dolibarr environment require '../../main.inc.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Societe $mysoc + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -72,15 +81,6 @@ if (isModEnabled('stock')) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Societe $mysoc - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'receptions', 'supplier_proposal', 'products', 'stocks', 'productbatch')); if (isModEnabled('incoterm')) { @@ -987,6 +987,7 @@ if (empty($reshook)) { $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + $line = null; if ($lineid) { $line = new CommandeFournisseurLigne($db); $res = $line->fetch($lineid); @@ -1492,7 +1493,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc - $upload_dir = $conf->fournisseur->commande->dir_output; + $upload_dir = getMultidirOutput($object); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -2210,6 +2211,8 @@ if ($action == 'create') { $result = $object->fetch($id, $ref); $object->fetch_thirdparty(); + $num = 0; + $societe = $object->thirdparty; $author = new User($db); @@ -3118,9 +3121,9 @@ if ($action == 'create') { // Generated documents $objref = dol_sanitizeFileName($object->ref); - $file = $conf->fournisseur->dir_output.'/commande/'.$objref.'/'.$objref.'.pdf'; + $file = getMultidirOutput($object).'/'.$objref.'/'.$objref.'.pdf'; $relativepath = $objref.'/'.$objref.'.pdf'; - $filedir = $conf->fournisseur->dir_output.'/commande/'.$objref; + $filedir = getMultidirOutput($object).'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $usercanread; $delallowed = $usercancreate; @@ -3280,6 +3283,7 @@ if ($action == 'create') { // Iterate each line and get the reference that uses the supplier of that product/service $i = 0; + $line = null; foreach ($object->lines as $line) { $i += 1; $ref_supplier = $line->ref_supplier; @@ -3369,7 +3373,7 @@ if ($action == 'create') { // Presend form $modelmail = 'order_supplier_send'; $defaulttopic = 'SendOrderRef'; - $diroutput = $conf->fournisseur->commande->dir_output; + $diroutput = getMultidirOutput($object); $autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'; $trackid = 'sord'.$object->id; diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 8b909374a02..81e82d0f05b 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -1,11 +1,11 @@ - * Copyright (C) 2005-2009 Destailleur Laurent - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2023 Christian Foellmann - * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW +/* Copyright (C) 2005 Patrick Rouillon + * Copyright (C) 2005-2009 Destailleur Laurent + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2023 Christian Foellmann + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 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 @@ -29,13 +29,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} /** * @var Conf $conf @@ -45,6 +38,14 @@ if (isModEnabled('project')) { * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array("facture", "orders", "sendings", "companies")); @@ -134,7 +135,7 @@ $userstatic = new User($db); /* *************************************************************************** */ /* */ -/* Card view and edit mode */ +/* Card view and edit mode */ /* */ /* *************************************************************************** */ diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 8ed4017db38..949da96ba33 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1,15 +1,15 @@ - * Copyright (C) 2004-2023 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2021 Juanjo Menent - * Copyright (C) 2014 Cedric Gross - * Copyright (C) 2016 Florian Henry - * Copyright (C) 2017-2022 Ferran Marcet - * Copyright (C) 2018-2026 Frédéric France - * Copyright (C) 2019-2020 Christophe Battarel - * Copyright (C) 2024-2025 MDW +/* Copyright (C) 2004-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2023 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2021 Juanjo Menent + * Copyright (C) 2014 Cedric Gross + * Copyright (C) 2016 Florian Henry + * Copyright (C) 2017-2022 Ferran Marcet + * Copyright (C) 2018-2026 Frédéric France + * Copyright (C) 2019-2020 Christophe Battarel + * Copyright (C) 2024-2025 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 @@ -26,13 +26,22 @@ */ /** - * \file htdocs/fourn/commande/dispatch.php - * \ingroup supplier order - * \brief Page to dispatch receiving + * \file htdocs/fourn/commande/dispatch.php + * \ingroup supplier order + * \brief Page to dispatch receiving */ // Load Dolibarr environment require '../../main.inc.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_order/modules_commandefournisseur.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; @@ -46,14 +55,6 @@ if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("bills", "orders", "sendings", "companies", "products", "stocks", "receptions")); @@ -239,6 +240,8 @@ if ($action == 'dispatch' && $permissiontoreceive) { $db->begin(); $pos = 0; + $comment = (string) GETPOST('comment', 'alpha'); + foreach ($_POST as $key => $value) { // without batch module enabled $reg = array(); @@ -425,6 +428,8 @@ $entrepot = 0; if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive) { $db->begin(); + $comment = ''; + $supplierorderdispatch = new CommandeFournisseurDispatch($db); $result = $supplierorderdispatch->fetch($lineid); if ($result > 0) { @@ -449,7 +454,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive if ($product > 0) { $mouv->origin = &$object; $mouv->setOrigin($object->element, $object->id); - $result = $mouv->livraison($user, $product, $entrepot, $qty, (float) $price, $comment, '', (int) $eatby, (int) $sellby, $batch); + $result = $mouv->livraison($user, $product, $entrepot, $qty, (float) $price, (string) $comment, '', (int) $eatby, (int) $sellby, $batch); if ($result < 0) { $errors = $mouv->errors; $error++; @@ -469,6 +474,8 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive if ($action == 'updateline' && $permissiontoreceive && empty($cancel)) { $db->begin(); + $comment = ''; + $supplierorderdispatch = new CommandeFournisseurDispatch($db); $result = $supplierorderdispatch->fetch($lineid); if ($result > 0) { @@ -495,13 +502,13 @@ if ($action == 'updateline' && $permissiontoreceive && empty($cancel)) { if ($product > 0) { $mouv->origin = &$object; $mouv->setOrigin($object->element, $object->id); - $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', (int) $eatby, (int) $sellby, $batch); + $result = $mouv->livraison($user, $product, $entrepot, $qty, $price, (string) $comment, '', (int) $eatby, (int) $sellby, $batch); if ($result < 0) { $errors = $mouv->errors; $error++; } else { $mouv->origin = &$object; - $result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, (int) $eatby, (int) $sellby, $batch); + $result = $mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, (string) $comment, (int) $eatby, (int) $sellby, $batch); if ($result < 0) { $errors = $mouv->errors; $error++; @@ -1368,7 +1375,7 @@ if ($id > 0 || !empty($ref)) { print $supplierorderdispatch->getLibStatut(5); print ''; - // Add button to check/uncheck disaptching + // Add button to check/uncheck dispatching print ''; if (!$permissiontocontrol) { if (empty($objp->status)) { diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 5eca8b8cb7c..2c73b1187eb 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -1,13 +1,13 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Marcos García - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 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 @@ -31,6 +31,15 @@ // Load Dolibarr environment require '../../main.inc.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -41,14 +50,6 @@ if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("bills", "orders", "sendings", "companies", "products", "stocks", "other")); @@ -83,7 +84,7 @@ if ($object->fetch($id, $ref) < 0) { exit; } -$upload_dir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($object->ref); +$upload_dir = getMultidirOutput($object).'/'.dol_sanitizeFileName($object->ref); $object->fetch_thirdparty(); // Security check diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index a5c6a8f75f9..2cf6c2c0020 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Vinicius Nogueira - * Copyright (C) 2019 Nicolas ZABOURI +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Vinicius Nogueira + * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -29,10 +29,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - /** * @var Conf $conf @@ -42,6 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + // Load translation files required by the page $langs->loadLangs(array("suppliers", "orders")); @@ -364,7 +364,7 @@ if ($resql) { print ''; $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $filedir = getMultidirOutput($commandestatic).'/'.dol_sanitizeFileName($obj->ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print ''; @@ -433,7 +433,7 @@ print ''; print ''; $filename=dol_sanitizeFileName($obj->ref); -$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); +$filedir=getMultidirOutput($commandestatic) . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print ''; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 6067b931dbf..1b4d26081dd 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -1,10 +1,10 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2025 MDW +/* Copyright (C) 2003-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -29,13 +29,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; -} /** * @var Conf $conf @@ -45,6 +38,14 @@ if (isModEnabled('project')) { * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; +if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array("suppliers", "orders", "companies", "stocks")); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 8ae11ae9528..521544bd26c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1,17 +1,17 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2014 Marcos García - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2018-2022 Charlene Benke - * Copyright (C) 2019 Nicolas Zabouri - * Copyright (C) 2021-2023 Alexandre Spangaro - * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 William Mead +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2022 Charlene Benke + * Copyright (C) 2019 Nicolas Zabouri + * Copyright (C) 2021-2026 Alexandre Spangaro + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024 William Mead * * 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 @@ -36,6 +36,16 @@ // Load Dolibarr environment require '../../main.inc.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Societe $mysoc + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -49,16 +59,6 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Societe $mysoc - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("orders", "sendings", 'companies', 'compta', 'bills', 'projects', 'suppliers', 'products')); @@ -162,7 +162,7 @@ if ($search_option == 'recv_late') { $search_status = '3,4'; } -$diroutputmassaction = $conf->fournisseur->commande->dir_output.'/temp/massgeneration/'.$user->id; + $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -189,9 +189,10 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); - $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$diroutputmassaction = getMultidirTemp($object).'/massgeneration/'.$user->id; + // List of fields to search into when doing a "search in all" $fieldstosearchall = array(); foreach ($object->fields as $key => $val) { @@ -359,7 +360,7 @@ if (empty($reshook)) { // Mass actions $objectclass = 'CommandeFournisseur'; $objectlabel = 'SupplierOrders'; - $uploaddir = $conf->fournisseur->commande->dir_output; + $uploaddir = getMultidirOutput($object); include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($action == 'validate' && $permissiontovalidate) { @@ -631,7 +632,7 @@ if (empty($reshook)) { // Fac builddoc $donotredirect = 1; - $upload_dir = $conf->fournisseur->facture->dir_output; + $upload_dir = getMultidirOutput($objecttmp); $permissiontoadd = ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")); //include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -1883,7 +1884,7 @@ if ($resql) { print $objectstatic->getNomUrl(1, '', 0, -1, 1); // Other picto tool $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $filedir = getMultidirOutput($objectstatic).'/'.dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print ''."\n"; diff --git a/htdocs/fourn/commande/messaging.php b/htdocs/fourn/commande/messaging.php index 82139d0e151..e9ae8cd9731 100644 --- a/htdocs/fourn/commande/messaging.php +++ b/htdocs/fourn/commande/messaging.php @@ -1,7 +1,7 @@ - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2005-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2025 Valentin Grimal * @@ -21,18 +21,12 @@ /** * \file htdocs/fourn/commande/messaging.php - * \ingroup order - * \brief Page with events on order + * \ingroup supplier order + * \brief Page with events on order */ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; /** * @var Conf $conf @@ -42,6 +36,13 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("suppliers", "orders", "companies", "stocks")); @@ -90,7 +91,7 @@ $hookmanager->initHooks(array('orderagenda', 'globalcard')); // Load object include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->order->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity] . "/" . $object->id; + $upload_dir = getMultidirOutput($object) . "/" . $object->id; } // Security check diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 16df0e02fbd..95520145223 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -1,11 +1,11 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2012 Marcos García - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW +/* Copyright (C) 2004-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2012 Marcos García + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 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 @@ -30,11 +30,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} /** * @var Conf $conf @@ -44,6 +39,12 @@ if (isModEnabled('project')) { * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array("suppliers", "orders", "companies", "stocks")); @@ -96,7 +97,7 @@ $form = new Form($db); /* *************************************************************************** */ /* */ -/* Card view and edit mode */ +/* Card view and edit mode */ /* */ /* *************************************************************************** */