Debug v21

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-02-12 16:22:06 +01:00
parent acc8338927
commit 2b5295497b

View File

@ -1013,9 +1013,17 @@ class EcmFiles extends CommonObject
} elseif ($option == 'commande_fournisseur') {
$tmppath = preg_replace('/^fournisseur\/commande\//', '', $this->filepath);
} else {
$tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath);
if ((int) $this->entity > 1) {
// Remove the part "entityid/commande/" into "entityid/commande/REFXXX" to get only the ref
$tmppath = preg_replace('/^\d+\/[^\/]+\//', '', $this->filepath);
} else {
// Remove the part "commande/" into "commande/REFXXX" to get only the ref
$tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath);
}
}
$url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.$this->entity;
//var_dump($this->filepath);
$url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.((int) $this->entity);
} else {
$url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id;
}