NEW : enable supplier external download links and expose substitution variables for supplier documents (#37386)
* Implement external download option for supplier invoices Added a new option to allow external downloads for supplier invoices, enhancing user flexibility. * Add option for external download in supplier order * Enable external download for supplier orders and invoices Added conditions to enable external download for supplier orders and invoices based on configuration settings. * Add direct download URLs for supplier orders and invoices * Update copyright information in supplier_invoice.php Added copyright notice for Pierre Ardoin for 2026. * Update supplier_order.php * Cast thirdparty ID to integer in fetch call --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
cd74b34708
commit
fcb11df3b8
5 changed files with 35 additions and 1 deletions
|
|
@ -8,6 +8,7 @@
|
|||
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2026 Pierre Ardoin <developpeur@lesmetiersdubatiment.fr>
|
||||
*
|
||||
* 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 '</td><td class="right">';
|
|||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Allow external download
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
|
||||
print '<td class="left" colspan="2">';
|
||||
print ajax_constantonoff('SUPPLIER_INVOICE_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Notifications
|
||||
print '<tr class="oddeven">';
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2026 Pierre Ardoin <developpeur@lesmetiersdubatiment.fr>
|
||||
*
|
||||
* 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 '<td colspan="2">';
|
|||
print ajax_constantonoff('SUPPLIER_ORDER_DISABLE_CLASSIFY_BILLED_FROM_SUPPLIER_ORDER');
|
||||
print '</td></tr>';
|
||||
|
||||
// Allow external download
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
|
||||
print '<td class="left" colspan="2">';
|
||||
print ajax_constantonoff('SUPPLIER_ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Notifications
|
||||
print '<tr class="oddeven">';
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2025 Alexandre Janniaux <alexandre.janniaux@gmail.com>
|
||||
* Copyright (C) 2025 Vincent Maury <vmaury@timgroup.fr>
|
||||
* Copyright (C) 2026 Pierre Ardoin <developpeur@lesmetiersdubatiment.fr>
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
* Copyright (C) 2024 Benoît PASCAL <contact@p-ben.com>
|
||||
* Copyright (C) 2025 Vincent Maury <vmaury@timgroup.fr>
|
||||
* Copyright (C) 2026 Benjamin Falière <benjamin@faliere.com>
|
||||
* Copyright (C) 2026 Pierre Ardoin <developpeur@lesmetiersdubatiment.fr>
|
||||
*
|
||||
* 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';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue