Merge branch 'develop' of github.com:Dolibarr/dolibarr into retrieving-extraparams-for-lines

This commit is contained in:
yannis 2025-03-03 17:15:30 +01:00
commit e70fe9c40d
27 changed files with 83 additions and 1483 deletions

View file

@ -238,6 +238,7 @@ The following changes may create regressions for some external modules, but were
* The trigger code CATEGORY_LINK and CATEGORY_UNLINK have been replaced with code CATEGORY_MODIFY. You can read ->context['linkto'] or ->context['unlinkoff'] to detect if we want to make a link or unlink.
* The property ->domiciliation and ->propio on bank accounts has been deprecated and replaced with property ->address and ->owner_name everywhere.
* If you were using the substitution key __MEMBER_CIVILITY__, you must now use __MEMBER_TITLE__
* The hidden title of tab that was hidden by the CSS class tabTitleText has been completely removed from HTML content.
***** ChangeLog for 20.0.4 compared to 20.0.3 *****

File diff suppressed because it is too large Load diff

View file

@ -988,7 +988,6 @@ Analytic
AnalyticLabel
BankId
Bcc
Birthdate
Candidature
ClientCollation
Collation
@ -1004,9 +1003,7 @@ EmptyMessageNotAllowedError
ErrorInputRequired
ErrorLDAPFunctionsAreDisabledOnThisPHP
ErrorUpdating
Exceptions
Extra
Facture
FailedToConnectToSFTPAfterSSHAuthentication
FailedToLogin
First

View file

@ -1,13 +1,13 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2023 Nick Fragoulis
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2023 Nick Fragoulis
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -137,7 +137,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
$arrayofimages = array('logo', 'logo_squarred');
//var_dump($_FILES); exit;
foreach ($arrayofimages as $varforimage) {
if ($_FILES[$varforimage]["name"] && !preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
if ($_FILES[$varforimage]["name"] && !image_format_supported($_FILES[$varforimage]["name"], 0)) { // Logo can be used on a lot of different places. Recommend using jpg and png for better compatibility.
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
break;

View file

@ -641,10 +641,11 @@ class ExternalModules
public function getRemoteYamlFile($file_source_url, $cache_time)
{
$cache_file = $this->cache_file;
$cache_folder = dirname($cache_file);
// Check if cache directory exists
if (!dol_is_dir($cache_file)) {
dol_mkdir($cache_file, DOL_DATA_ROOT);
if (!dol_is_dir($cache_folder)) {
dol_mkdir($cache_folder, DOL_DATA_ROOT);
}
if (!file_exists($cache_file) || filemtime($cache_file) < (dol_now() - $cache_time)) {

View file

@ -165,6 +165,7 @@ if ($compression == 'zip') {
}
}
global $errormsg;
$ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip); // Can modify $errormsg
if ($ret < 0) {
if ($ret == -2) {

View file

@ -5799,7 +5799,7 @@ class Facture extends CommonInvoice
$langs->load("bills");
if (!isModEnabled('invoice')) { // Should not happen. If module disabled, cron job should not be visible.
$this->output .= $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Facture"));
$this->output .= $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Invoice"));
return 0;
}
if (!in_array($datetouse, array('duedate', 'invoicedate'))) {
@ -5808,7 +5808,7 @@ class Facture extends CommonInvoice
}
/*if (empty($conf->global->FACTURE_REMINDER_EMAIL)) {
$langs->load("bills");
$this->output .= $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Facture"));
$this->output .= $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Invoice"));
return 0;
}
*/

View file

@ -1,11 +1,12 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* 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
@ -97,7 +98,14 @@ $usercancreate = $user->hasRight("facture", "creer");
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
}
/*

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
*
@ -441,16 +441,13 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$object->email_to = $sendto;
$object->email_tocc = $sendtocc;
$object->email_tobcc = $sendtobcc;
$object->email_subject = $subject;
// Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprecated)
if (!empty($triggersendname) || !empty($trigger_name)) {
// Call trigger
$result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable
if ($result < 0) {
$error++;
}
// End call triggers
if ($error) {
setEventMessages($object->error, $object->errors, 'errors');
}

View file

@ -291,7 +291,12 @@ abstract class CommonInvoice extends CommonObject
$alreadypaid += $this->getSumDepositsUsed($multicurrency);
$alreadypaid += $this->getSumCreditNotesUsed($multicurrency);
$remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT');
if ((int) $multicurrency > 0) {
$totalamount = $this->multicurrency_total_ttc;
} else {
$totalamount = $this->total_ttc;
}
$remaintopay = price2num($totalamount - $alreadypaid, 'MT');
if ($this->status == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
$remaintopay = 0.0;
}

View file

@ -973,10 +973,7 @@ class FormFile
$out .= '<tr class="oddeven'.((!$genallowed && $i == 1) ? ' trfirstline' : '').'">';
$documenturl = DOL_URL_ROOT.'/document.php';
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
$documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP'); // To use another wrapper
}
$documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP', DOL_URL_ROOT.'/document.php'); // DOL_URL_ROOT_DOCUMENT_PHP can be used to set another wrapper
// Show file name with link to download
$imgpreview = $this->showPreview($file, $modulepart, $relativepath, 0, $param);

View file

@ -705,10 +705,10 @@ class FormSetupItem
{
global $conf;
if (isset($conf->global->{$this->confKey})) {
$this->fieldValue = getDolGlobalString($this->confKey);
$this->fieldValue = getDolGlobalString($this->confKey, null);
return true;
} else {
$this->fieldValue = '';
$this->fieldValue = null;
return false;
}
}

View file

@ -12817,7 +12817,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
// TODO: add hook
// escape all attribute
$attr = array_map('dol_escape_htmltag', $attr);
$attr = array_map('dolPrintHtmlForAttribute', $attr);
$TCompiledAttr = array();
foreach ($attr as $key => $value) {

View file

@ -329,7 +329,8 @@ function pdf_getHeightForLogo($logo, $url = false)
}
/**
* Function to try to calculate height of a HTML Content
* Function to try to calculate height of a HTML Content.
* WARNING: Do not use this function inside a TCPDF transaction.
*
* @param TCPDF $pdf PDF initialized object
* @param string $htmlcontent HTML Content
@ -340,6 +341,9 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
{
// store current object
$pdf->startTransaction();
// To avoid pagebreak effect or strange behavior of writeHTMLCell when we are out of page, we imagine we are at the begin of page to test the height of the text
// Another solution would be to do the test on another PDF instance with samefont, width...
$pdf->setY(0);
// store starting values
$start_y = $pdf->GetY();
//var_dump($start_y);
@ -1214,7 +1218,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$pdf->SetDrawColor(224, 224, 224);
// Option for footer text color
if (getDolGlobalString('PDF_FOOTER_TEXT_COLOR')) {
list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_TEXT_COLOR, '%d, %d, %d');
list($r, $g, $b) = sscanf(getDolGlobalString('PDF_FOOTER_TEXT_COLOR'), '%d, %d, %d');
$pdf->SetTextColor($r, $g, $b);
}
@ -1233,7 +1237,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$freetextheight = $pdf->getStringHeight($width, $line);
} else {
$freetextheight = pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); // New method (works for HTML content)
//print '<br>'.$freetextheight;exit;
//print '<br>'.$freetextheight;
}
}
@ -1455,6 +1459,8 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos
}
$parameters = array('pdf' => $pdf, 'i' => $i, 'outputlangs' => $outputlangs, 'w' => $w, 'h' => $h, 'posx' => $posx, 'posy' => $posy, 'hideref' => $hideref, 'hidedesc' => $hidedesc, 'issupplierline' => $issupplierline, 'special_code' => $special_code);
$action = '';
// WARNING: A hook must not close/open the PDF transaction. Doing this generates a lot of trouble.
// Test to know if content added by the hooks is already done by the main caller of pdf_writelinedesc
$reshook = $hookmanager->executeHooks('pdf_writelinedesc', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) {

View file

@ -558,7 +558,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
unset($tmpwebsitepage);
}
if ($result > 0) {
$currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&nocache=1708177483
$currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&cache=3600
$regtmp = array();
if (preg_match('/&pageref=([^&]+)/', $currenturi, $regtmp)) {
if ($regtmp[0] == $containerref) {

View file

@ -186,7 +186,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$tplcontent .= "} // Not already loaded\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
if (in_array($objectpage->type_container, array('page', 'blogpost'))) {
if (in_array($objectpage->type_container, array('page', 'blogpost', 'service'))) {
$tplcontent .= 'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n";
}
$tplcontent .= "ob_start();\n";
@ -378,7 +378,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$tplcontent .= "} // Not already loaded\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
if (in_array($objectpage->type_container, array('page', 'blogpost'))) {
if (in_array($objectpage->type_container, array('page', 'blogpost', 'service'))) {
$tplcontent .= 'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n";
}
$tplcontent .= "// END PHP ?>\n";

View file

@ -831,7 +831,7 @@ class pdf_crabe extends ModelePDFFactures
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $langs));
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $outputlangs));
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
@ -849,7 +849,7 @@ class pdf_crabe extends ModelePDFFactures
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $langs));
$this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $outputlangs));
// New page
$pdf->AddPage();
if (!empty($tplidx)) {
@ -1359,6 +1359,7 @@ class pdf_crabe extends ModelePDFFactures
$langs->loadLangs(array('payment', 'paybox', 'stripe'));
$servicename = $langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0);
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';

View file

@ -344,7 +344,7 @@ class pdf_sponge extends ModelePDFFactures
$this->heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
$heightforqrinvoice = $heightforqrinvoice_firstpage = 0;
$heightforqrinvoice = 0;
if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
if ($this->getHeightForQRInvoice(1, $object, $langs) > 0) {
// Shrink infotot to a base 30

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.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
@ -39,6 +40,7 @@ class DolExceptionsCollector extends ExceptionsCollector
{
global $langs;
$langs->load("other");
$title = $langs->transnoentities('Exceptions');
return array(

View file

@ -1009,9 +1009,9 @@ class EcmFiles extends CommonObject
if ($option) {
if ($option == 'facture_fournisseur') {
$tmppath = preg_replace('/^fournisseur\/facture\//', '', $this->filepath);
$tmppath = preg_replace('/^(\d+\/)?fournisseur\/facture\//', '', $this->filepath);
} elseif ($option == 'commande_fournisseur') {
$tmppath = preg_replace('/^fournisseur\/commande\//', '', $this->filepath);
$tmppath = preg_replace('/^(\d+\/)?fournisseur\/commande\//', '', $this->filepath);
} else {
if ((int) $this->entity > 1) {
// Remove the part "entityid/commande/" into "entityid/commande/REFXXX" to get only the ref

View file

@ -184,8 +184,10 @@ ALTER TABLE llx_product_customer_price ADD COLUMN discount_percent real DEFAULT
ALTER TABLE llx_product_customer_price_log ADD COLUMN date_begin date AFTER ref_customer;
ALTER TABLE llx_product_customer_price_log ADD COLUMN date_end date AFTER date_begin;
ALTER TABLE llx_product_customer_price_log ADD COLUMN discount_percent real DEFAULT 0 AFTER localtax2_type;
ALTER TABLE llx_product_customer_price DROP CONSTRAINT fk_product_customer_price_fk_product;
ALTER TABLE llx_product_customer_price DROP CONSTRAINT fk_product_customer_price_fk_soc;
ALTER TABLE llx_product_customer_price DROP FOREIGN KEY fk_product_customer_price_fk_product;
ALTER TABLE llx_product_customer_price DROP FOREIGN KEY fk_product_customer_price_fk_soc;
ALTER TABLE llx_product_customer_price DROP FOREIGN KEY fk_customer_price_fk_product;
ALTER TABLE llx_product_customer_price DROP FOREIGN KEY fk_customer_price_fk_soc;
ALTER TABLE llx_product_customer_price DROP INDEX uk_customer_price_fk_product_fk_soc;
ALTER TABLE llx_product_customer_price ADD UNIQUE INDEX uk_customer_price_fk_product_fk_soc (fk_product, fk_soc, date_begin);
ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product(rowid);

View file

@ -356,3 +356,4 @@ Pre-Prompt=Pre-prompt
Post-Prompt=Post-prompt
AIProcessingPleaseWait=AI (%s) is processing your request, please wait...
PayOfBankTransferInvoice=You are going to make an online payment for this invoice. However, this invoice has been set up to be paid in "Credit Transfer" mode, so to avoid paying twice, please verify that no current bank transfer has already been initiated before continuing.
Exceptions=Exceptions

View file

@ -4014,9 +4014,6 @@ a.tabTitle {
text-decoration: none;
white-space: nowrap;
}
.tabTitleText {
display: none;
}
.imgTabTitle {
max-height: 14px;
}

View file

@ -4160,9 +4160,6 @@ a.tabTitle {
text-decoration: none;
white-space: nowrap;
}
.tabTitleText {
display: none;
}
.imgTabTitle {
max-height: 14px;
}

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.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
@ -278,7 +278,7 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
// Birth date
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("Birthdate"));
print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("DateOfBirth"));
print '</td><td>';
print ajax_constantonoff("USER_PUBLIC_SHOW_BIRTH", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object);
print "</td></tr>\n";

View file

@ -193,20 +193,17 @@ if ($modulepart == 'fckeditor') {
* View
*/
if (GETPOST("cache", 'alpha')) {
$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash
if ($cachestring) {
// Important: The following code is to avoid a page request by the browser and PHP CPU at each Dolibarr page access.
// We are here when param cache=xxx to force a cache policy:
// xxx=1 means cache of 3600s
// xxx=abcdef or 123456789 means a cache of 1 week (the key will be modified to get break cache use)
if (empty($dolibarr_nocache)) {
if (GETPOST('cache', 'alpha') != '1') {
$delaycache = 3600 * 24 * 7;
} else {
$delaycache = 3600;
}
$delaycache = ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600');
header('Cache-Control: max-age='.$delaycache.', public, must-revalidate');
header('Pragma: cache'); // This is to avoid to have Pragma: no-cache set by proxy or web server
header('Expires: '.gmdate('D, d M Y H:i:s', time() + $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server
header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server
} else {
// If any cache on files were disable by config file (for test purpose)
header('Cache-Control: no-cache');

View file

@ -39,7 +39,6 @@ $limit = GETPOSTINT('limit');
if ($limit <= 0 || $limit > 100) {
$limit = 20;
}
$cachedelay = GETPOSTINT('cachedelay'); // The delay in second of the cache
// Parameters for RSS
$rss = GETPOST('rss', 'aZ09');
@ -130,12 +129,13 @@ if (GETPOSTISSET('type')) {
$original_file = str_replace("../", "/", $original_file);
// Cache or not
$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash
$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int (delay in second of the cache if < 999999, or a timestamp), or a hash
if ($cachestring || image_format_supported($original_file) >= 0) {
// Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access.
header('Cache-Control: max-age='.((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600').', public, must-revalidate');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
$delaycache = GETPOSTINT('cachedelay') ? GETPOSTINT('cachedelay') : ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600');
header('Cache-Control: max-age='.$delaycache.', public, must-revalidate');
header('Pragma: cache'); // This is to avoid having Pragma: no-cache
header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server
}
$refname = basename(dirname($original_file)."/");