diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index c3a187e5abf..8580fa53f8b 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -8,6 +8,7 @@ * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -499,6 +500,12 @@ print ''; print ''; print "\n"; +// Allow external download +print ''; +print ''.$langs->trans("AllowExternalDownload").''; +print ''; +print ajax_constantonoff('SUPPLIER_INVOICE_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); +print ''; // Notifications print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 7cc64d32a77..202f9904a9f 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -8,6 +8,7 @@ * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -538,6 +539,12 @@ print ''; print ajax_constantonoff('SUPPLIER_ORDER_DISABLE_CLASSIFY_BILLED_FROM_SUPPLIER_ORDER'); print ''; +// Allow external download +print ''; +print ''.$langs->trans("AllowExternalDownload").''; +print ''; +print ajax_constantonoff('SUPPLIER_ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); +print ''; // Notifications print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 37f29adf645..c52a6d4b422 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -21,6 +21,7 @@ * Copyright (C) 2024 William Mead * Copyright (C) 2025 Alexandre Janniaux * Copyright (C) 2025 Vincent Maury + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -6269,6 +6270,12 @@ abstract class CommonObject if ($this->element == 'supplier_proposal' && getDolGlobalInt("SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { $setsharekey = true; } + if ($this->element == 'order_supplier' && getDolGlobalInt("SUPPLIER_ORDER_ALLOW_EXTERNAL_DOWNLOAD")) { + $setsharekey = true; + } + if ($this->element == 'invoice_supplier' && getDolGlobalInt("SUPPLIER_INVOICE_ALLOW_EXTERNAL_DOWNLOAD")) { + $setsharekey = true; + } if ($this->element == 'societe_rib' && getDolGlobalInt("SOCIETE_RIB_ALLOW_ONLINESIGN")) { $setsharekey = true; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 55f1d82bab7..9b0aa7b5d6a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -27,6 +27,7 @@ * Copyright (C) 2024 Benoît PASCAL * Copyright (C) 2025 Vincent Maury * Copyright (C) 2026 Benjamin Falière + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -10254,6 +10255,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = 'Direct download url of an invoice'; $substitutionarray['__DIRECTDOWNLOAD_URL_CONTRACT__'] = 'Direct download url of a contract'; $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_PROPOSAL__'] = 'Direct download url of a supplier proposal'; + $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_ORDER__'] = 'Direct download url of a supplier order'; + $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_INVOICE__'] = 'Direct download url of a supplier invoice'; if (isModEnabled("shipping") && (!is_object($object) || $object->element == 'shipping')) { $substitutionarray['__SHIPPINGTRACKNUM__'] = 'Shipping tracking number'; @@ -10624,6 +10627,16 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } else { $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_PROPOSAL__'] = ''; } + if (getDolGlobalString('SUPPLIER_ORDER_ALLOW_EXTERNAL_DOWNLOAD') && is_object($object) && $object->element == 'order_supplier') { + $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_ORDER__'] = $object->getLastMainDocLink($object->element); + } else { + $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_ORDER__'] = ''; + } + if (getDolGlobalString('SUPPLIER_INVOICE_ALLOW_EXTERNAL_DOWNLOAD') && is_object($object) && $object->element == 'invoice_supplier') { + $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_INVOICE__'] = $object->getLastMainDocLink($object->element); + } else { + $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_INVOICE__'] = ''; + } if (is_object($object) && $object->element == 'propal') { '@phan-var-force Propal $object'; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c4e5e463f81..830fd20c5c4 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1831,7 +1831,7 @@ if ($source == 'member' || $source == 'membersubscription') { include_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; $partnership = new Partnership($db); // @phan-suppress-next-line PhanPluginSuspiciousParamPosition - $result = $partnership->fetch(0, '', 0, $member->thirdparty->id); + $result = $partnership->fetch(0, '', 0, (int) $member->thirdparty->id); if ($result > 0) { $pp = 1; }