Merge pull request #24164 from frederic34/multidiroutput
use a fonction to get multidir output
This commit is contained in:
commit
66eb668965
@ -2991,7 +2991,7 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
// Presend form
|
// Presend form
|
||||||
$modelmail = 'order_send';
|
$modelmail = 'order_send';
|
||||||
$defaulttopic = 'SendOrderRef';
|
$defaulttopic = 'SendOrderRef';
|
||||||
$diroutput = $conf->commande->multidir_output[$object->entity];
|
$diroutput = getMultidirOutput($object);
|
||||||
$trackid = 'ord'.$object->id;
|
$trackid = 'ord'.$object->id;
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
|
|||||||
@ -3978,6 +3978,7 @@ class Commande extends CommonOrder
|
|||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
$this->ref = 'SPECIMEN';
|
$this->ref = 'SPECIMEN';
|
||||||
$this->specimen = 1;
|
$this->specimen = 1;
|
||||||
|
$this->entity = $conf->entity;
|
||||||
$this->socid = 1;
|
$this->socid = 1;
|
||||||
$this->date = time();
|
$this->date = time();
|
||||||
$this->date_lim_reglement = $this->date + 3600 * 24 * 30;
|
$this->date_lim_reglement = $this->date + 3600 * 24 * 30;
|
||||||
|
|||||||
@ -71,6 +71,27 @@ if (!function_exists('utf8_decode')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the full path of the directory where a module (or an object of a module) stores its files. Path may depends on the entity if a multicompany module is enabled.
|
||||||
|
*
|
||||||
|
* @param CommonObject $object Dolibarr common object
|
||||||
|
* @param string $module Override object element, for example to use 'mycompany' instead of 'societe'
|
||||||
|
* @return string|void The path of the relative directory of the module
|
||||||
|
* @since Dolibarr V18
|
||||||
|
*/
|
||||||
|
function getMultidirOutput($object, $module = '')
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
if (!is_object($object)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (empty($module) && !empty($object->element)) {
|
||||||
|
$module = $object->element;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $conf->$module->multidir_output[$object->entity];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return dolibarr global constant string value
|
* Return dolibarr global constant string value
|
||||||
|
|||||||
@ -296,18 +296,18 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($conf->commande->multidir_output[$conf->entity]) {
|
if (getMultidirOutput($object)) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$deja_regle = 0;
|
$deja_regle = 0;
|
||||||
|
|
||||||
// Definition of $dir and $file
|
// Definition of $dir and $file
|
||||||
if ($object->specimen) {
|
if ($object->specimen) {
|
||||||
$dir = $conf->commande->multidir_output[$conf->entity];
|
$dir = getMultidirOutput($object);
|
||||||
$file = $dir."/SPECIMEN.pdf";
|
$file = $dir."/SPECIMEN.pdf";
|
||||||
} else {
|
} else {
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
$dir = $conf->commande->multidir_output[$object->entity]."/".$objectref;
|
$dir = getMultidirOutput($object)."/".$objectref;
|
||||||
$file = $dir."/".$objectref.".pdf";
|
$file = $dir."/".$objectref.".pdf";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1447,7 +1447,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null, $titlekey = "PdfOrderTitle")
|
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null, $titlekey = "PdfOrderTitle")
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs, $hookmanager;
|
global $conf, $langs, $hookmanager, $mysoc;
|
||||||
|
|
||||||
$ltrdirection = 'L';
|
$ltrdirection = 'L';
|
||||||
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
|
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
|
||||||
@ -1473,8 +1473,8 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||||
if ($this->emetteur->logo) {
|
if ($this->emetteur->logo) {
|
||||||
$logodir = $conf->mycompany->dir_output;
|
$logodir = $conf->mycompany->dir_output;
|
||||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
if (!empty(getMultidirOutput($mysoc, 'mycompany'))) {
|
||||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
$logodir = getMultidirOutput($mysoc, 'mycompany');
|
||||||
}
|
}
|
||||||
if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
|
if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
|
||||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||||
|
|||||||
@ -4358,7 +4358,9 @@ class Societe extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
|
$this->entity = $conf->entity;
|
||||||
$this->name = getDolGlobalString('MAIN_INFO_SOCIETE_NOM');
|
$this->name = getDolGlobalString('MAIN_INFO_SOCIETE_NOM');
|
||||||
|
$this->nom = $this->name; // deprecated
|
||||||
$this->address = getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS');
|
$this->address = getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS');
|
||||||
$this->zip = getDolGlobalString('MAIN_INFO_SOCIETE_ZIP');
|
$this->zip = getDolGlobalString('MAIN_INFO_SOCIETE_ZIP');
|
||||||
$this->town = getDolGlobalString('MAIN_INFO_SOCIETE_TOWN');
|
$this->town = getDolGlobalString('MAIN_INFO_SOCIETE_TOWN');
|
||||||
@ -4368,8 +4370,6 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$this->note_private = getDolGlobalString('MAIN_INFO_SOCIETE_NOTE');
|
$this->note_private = getDolGlobalString('MAIN_INFO_SOCIETE_NOTE');
|
||||||
|
|
||||||
$this->nom = $this->name; // deprecated
|
|
||||||
|
|
||||||
// We define country_id, country_code and country
|
// We define country_id, country_code and country
|
||||||
$country_id = $country_code = $country_label = '';
|
$country_id = $country_code = $country_label = '';
|
||||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
|
if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user