Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
This commit is contained in:
commit
ec43a8626e
@ -2400,6 +2400,20 @@ if ($id > 0) {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mail information
|
||||||
|
if (!empty($object->email_msgid)) {
|
||||||
|
print '<tr><td>'.$langs->trans('MailTopic').'</td>';
|
||||||
|
print '<td>'.dol_escape_htmltag($object->email_subject).'</td></tr>';
|
||||||
|
print '<tr><td>'.$langs->trans('MailFrom').'</td>';
|
||||||
|
print '<td>'.dol_escape_htmltag($object->email_from).'</td></tr>';
|
||||||
|
print '<tr><td>'.$langs->trans('MailTo').'</td>';
|
||||||
|
print '<td>'.dol_escape_htmltag($object->email_to).'</td></tr>';
|
||||||
|
if (!empty($object->email_tocc)) {
|
||||||
|
print '<tr><td>'.$langs->trans('MailCC').'</td>';
|
||||||
|
print '<td>'.dol_escape_htmltag($object->email_tocc).'</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td class="wordbreak">';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td class="wordbreak">';
|
||||||
print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private));
|
print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private));
|
||||||
|
|||||||
@ -3708,6 +3708,7 @@ class Propal extends CommonObject
|
|||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
$datas = [];
|
$datas = [];
|
||||||
|
$nofetch = !empty($params['nofetch']);
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
return ['optimize' => $langs->trans("Proposal")];
|
return ['optimize' => $langs->trans("Proposal")];
|
||||||
@ -3720,9 +3721,25 @@ class Propal extends CommonObject
|
|||||||
if (!empty($this->ref)) {
|
if (!empty($this->ref)) {
|
||||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||||
}
|
}
|
||||||
|
if (!$nofetch) {
|
||||||
|
$langs->load('companies');
|
||||||
|
if (empty($this->thirdparty)) {
|
||||||
|
$this->fetch_thirdparty();
|
||||||
|
}
|
||||||
|
$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1);
|
||||||
|
}
|
||||||
if (!empty($this->ref_client)) {
|
if (!empty($this->ref_client)) {
|
||||||
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
|
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
|
||||||
}
|
}
|
||||||
|
if (!$nofetch) {
|
||||||
|
$langs->load('project');
|
||||||
|
if (empty($this->project)) {
|
||||||
|
$res = $this->fetch_project();
|
||||||
|
if ($res > 0) {
|
||||||
|
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!empty($this->total_ht)) {
|
if (!empty($this->total_ht)) {
|
||||||
$datas['amountht'] = '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
$datas['amountht'] = '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
}
|
}
|
||||||
@ -3767,6 +3784,7 @@ class Propal extends CommonObject
|
|||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'objecttype' => $this->element,
|
'objecttype' => $this->element,
|
||||||
'option' => $option,
|
'option' => $option,
|
||||||
|
'nofetch' => 1,
|
||||||
];
|
];
|
||||||
$classfortooltip = 'classfortooltip';
|
$classfortooltip = 'classfortooltip';
|
||||||
$dataparams = '';
|
$dataparams = '';
|
||||||
|
|||||||
@ -2998,7 +2998,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';
|
||||||
|
|||||||
@ -3728,6 +3728,7 @@ class Commande extends CommonOrder
|
|||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
$datas = [];
|
$datas = [];
|
||||||
|
$nofetch = !empty($params['nofetch']);
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
return ['optimize' => $langs->trans("Order")];
|
return ['optimize' => $langs->trans("Order")];
|
||||||
@ -3739,7 +3740,23 @@ class Commande extends CommonOrder
|
|||||||
$datas[] = ' '.$this->getLibStatut(5);
|
$datas[] = ' '.$this->getLibStatut(5);
|
||||||
}
|
}
|
||||||
$datas['Ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
$datas['Ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||||
|
if (!$nofetch) {
|
||||||
|
$langs->load('companies');
|
||||||
|
if (empty($this->thirdparty)) {
|
||||||
|
$this->fetch_thirdparty();
|
||||||
|
}
|
||||||
|
$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1);
|
||||||
|
}
|
||||||
$datas['RefCustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer);
|
$datas['RefCustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer);
|
||||||
|
if (!$nofetch) {
|
||||||
|
$langs->load('project');
|
||||||
|
if (empty($this->project)) {
|
||||||
|
$res = $this->fetch_project();
|
||||||
|
if ($res > 0) {
|
||||||
|
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!empty($this->total_ht)) {
|
if (!empty($this->total_ht)) {
|
||||||
$datas['AmountHT'] = '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
$datas['AmountHT'] = '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
}
|
}
|
||||||
@ -3811,6 +3828,7 @@ class Commande extends CommonOrder
|
|||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'objecttype' => $this->element,
|
'objecttype' => $this->element,
|
||||||
'option' => $option,
|
'option' => $option,
|
||||||
|
'nofetch' => 1,
|
||||||
];
|
];
|
||||||
$classfortooltip = 'classfortooltip';
|
$classfortooltip = 'classfortooltip';
|
||||||
$dataparams = '';
|
$dataparams = '';
|
||||||
@ -3960,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;
|
||||||
|
|||||||
@ -1995,6 +1995,7 @@ class Contrat extends CommonObject
|
|||||||
$langs->load('contracts');
|
$langs->load('contracts');
|
||||||
|
|
||||||
$datas = [];
|
$datas = [];
|
||||||
|
$nofetch = !empty($params['nofetch']);
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
return ['optimize' => $langs->trans("ShowContract")];
|
return ['optimize' => $langs->trans("ShowContract")];
|
||||||
@ -2006,7 +2007,23 @@ class Contrat extends CommonObject
|
|||||||
$label .= ' '.$this->getLibStatut(5);
|
$label .= ' '.$this->getLibStatut(5);
|
||||||
}*/
|
}*/
|
||||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.($this->ref ? $this->ref : $this->id);
|
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.($this->ref ? $this->ref : $this->id);
|
||||||
|
if (!$nofetch) {
|
||||||
|
$langs->load('companies');
|
||||||
|
if (empty($this->thirdparty)) {
|
||||||
|
$this->fetch_thirdparty();
|
||||||
|
}
|
||||||
|
$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1);
|
||||||
|
}
|
||||||
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer;
|
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer;
|
||||||
|
if (!$nofetch) {
|
||||||
|
$langs->load('project');
|
||||||
|
if (empty($this->project)) {
|
||||||
|
$res = $this->fetch_project();
|
||||||
|
if ($res > 0) {
|
||||||
|
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$datas['refsupplier'] = '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
|
$datas['refsupplier'] = '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
|
||||||
if (!empty($this->total_ht)) {
|
if (!empty($this->total_ht)) {
|
||||||
$datas['amountht'] = '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
$datas['amountht'] = '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
@ -2052,6 +2069,7 @@ class Contrat extends CommonObject
|
|||||||
$params = [
|
$params = [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'objecttype' => $this->element,
|
'objecttype' => $this->element,
|
||||||
|
'nofetch' => 1,
|
||||||
];
|
];
|
||||||
$classfortooltip = 'classfortooltip';
|
$classfortooltip = 'classfortooltip';
|
||||||
$dataparams = '';
|
$dataparams = '';
|
||||||
|
|||||||
@ -5496,171 +5496,165 @@ abstract class CommonObject
|
|||||||
$parameters = array('modelspath'=>$modelspath, 'modele'=>$modele, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'hidedesc'=>$hidedesc, 'hideref'=>$hideref, 'moreparams'=>$moreparams);
|
$parameters = array('modelspath'=>$modelspath, 'modele'=>$modele, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'hidedesc'=>$hidedesc, 'hideref'=>$hideref, 'moreparams'=>$moreparams);
|
||||||
$reshook = $hookmanager->executeHooks('commonGenerateDocument', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('commonGenerateDocument', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (!empty($reshook)) {
|
||||||
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
|
return $reshook;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($modele)) {
|
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
|
||||||
$this->error = 'BadValueForParameterModele';
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increase limit for PDF build
|
if (empty($modele)) {
|
||||||
$err = error_reporting();
|
$this->error = 'BadValueForParameterModele';
|
||||||
error_reporting(0);
|
return -1;
|
||||||
@set_time_limit(120);
|
}
|
||||||
error_reporting($err);
|
|
||||||
|
|
||||||
// If selected model is a filename template (then $modele="modelname" or "modelname:filename")
|
// Increase limit for PDF build
|
||||||
$tmp = explode(':', $modele, 2);
|
$err = error_reporting();
|
||||||
if (!empty($tmp[1])) {
|
error_reporting(0);
|
||||||
$modele = $tmp[0];
|
@set_time_limit(120);
|
||||||
$srctemplatepath = $tmp[1];
|
error_reporting($err);
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
// If selected model is a filename template (then $modele="modelname" or "modelname:filename")
|
||||||
$file = '';
|
$tmp = explode(':', $modele, 2);
|
||||||
$classname = '';
|
if (!empty($tmp[1])) {
|
||||||
$filefound = '';
|
$modele = $tmp[0];
|
||||||
$dirmodels = array('/');
|
$srctemplatepath = $tmp[1];
|
||||||
if (is_array($conf->modules_parts['models'])) {
|
}
|
||||||
$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
|
|
||||||
}
|
|
||||||
foreach ($dirmodels as $reldir) {
|
|
||||||
foreach (array('doc', 'pdf') as $prefix) {
|
|
||||||
if (in_array(get_class($this), array('Adherent'))) {
|
|
||||||
// Member module use prefix_modele.class.php
|
|
||||||
$file = $prefix."_".$modele.".class.php";
|
|
||||||
} else {
|
|
||||||
// Other module use prefix_modele.modules.php
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
// Search template files
|
||||||
$file = dol_buildpath($reldir.$modelspath.$file, 0);
|
$file = '';
|
||||||
if (file_exists($file)) {
|
$classname = '';
|
||||||
$filefound = $file;
|
$filefound = '';
|
||||||
$classname = $prefix.'_'.$modele;
|
$dirmodels = array('/');
|
||||||
break;
|
if (is_array($conf->modules_parts['models'])) {
|
||||||
}
|
$dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
|
||||||
|
}
|
||||||
|
foreach ($dirmodels as $reldir) {
|
||||||
|
foreach (array('doc', 'pdf') as $prefix) {
|
||||||
|
if (in_array(get_class($this), array('Adherent'))) {
|
||||||
|
// Member module use prefix_modele.class.php
|
||||||
|
$file = $prefix."_".$modele.".class.php";
|
||||||
|
} else {
|
||||||
|
// Other module use prefix_modele.modules.php
|
||||||
|
$file = $prefix."_".$modele.".modules.php";
|
||||||
}
|
}
|
||||||
if ($filefound) {
|
|
||||||
|
// On verifie l'emplacement du modele
|
||||||
|
$file = dol_buildpath($reldir.$modelspath.$file, 0);
|
||||||
|
if (file_exists($file)) {
|
||||||
|
$filefound = $file;
|
||||||
|
$classname = $prefix.'_'.$modele;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If generator was found
|
|
||||||
if ($filefound) {
|
if ($filefound) {
|
||||||
global $db; // Required to solve a conception default making an include of code using $db instead of $this->db just after.
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
require_once $file;
|
if (!$filefound) {
|
||||||
|
$this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele;
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
dol_syslog($this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$obj = new $classname($this->db);
|
// If generator was found
|
||||||
|
global $db; // Required to solve a conception default making an include of code using $db instead of $this->db just after.
|
||||||
|
|
||||||
// If generator is ODT, we must have srctemplatepath defined, if not we set it.
|
require_once $file;
|
||||||
if ($obj->type == 'odt' && empty($srctemplatepath)) {
|
|
||||||
$varfortemplatedir = $obj->scandir;
|
|
||||||
if ($varfortemplatedir && !empty($conf->global->$varfortemplatedir)) {
|
|
||||||
$dirtoscan = $conf->global->$varfortemplatedir;
|
|
||||||
|
|
||||||
$listoffiles = array();
|
$obj = new $classname($this->db);
|
||||||
|
|
||||||
// Now we add first model found in directories scanned
|
// If generator is ODT, we must have srctemplatepath defined, if not we set it.
|
||||||
$listofdir = explode(',', $dirtoscan);
|
if ($obj->type == 'odt' && empty($srctemplatepath)) {
|
||||||
foreach ($listofdir as $key => $tmpdir) {
|
$varfortemplatedir = $obj->scandir;
|
||||||
$tmpdir = trim($tmpdir);
|
if ($varfortemplatedir && !empty($conf->global->$varfortemplatedir)) {
|
||||||
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
|
$dirtoscan = $conf->global->$varfortemplatedir;
|
||||||
if (!$tmpdir) {
|
|
||||||
unset($listofdir[$key]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (is_dir($tmpdir)) {
|
|
||||||
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0);
|
|
||||||
if (count($tmpfiles)) {
|
|
||||||
$listoffiles = array_merge($listoffiles, $tmpfiles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($listoffiles)) {
|
$listoffiles = array();
|
||||||
foreach ($listoffiles as $record) {
|
|
||||||
$srctemplatepath = $record['fullname'];
|
// Now we add first model found in directories scanned
|
||||||
break;
|
$listofdir = explode(',', $dirtoscan);
|
||||||
}
|
foreach ($listofdir as $key => $tmpdir) {
|
||||||
|
$tmpdir = trim($tmpdir);
|
||||||
|
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
|
||||||
|
if (!$tmpdir) {
|
||||||
|
unset($listofdir[$key]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (is_dir($tmpdir)) {
|
||||||
|
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0);
|
||||||
|
if (count($tmpfiles)) {
|
||||||
|
$listoffiles = array_merge($listoffiles, $tmpfiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($srctemplatepath)) {
|
if (count($listoffiles)) {
|
||||||
$this->error = 'ErrorGenerationAskedForOdtTemplateWithSrcFileNotDefined';
|
foreach ($listoffiles as $record) {
|
||||||
return -1;
|
$srctemplatepath = $record['fullname'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($obj->type == 'odt' && !empty($srctemplatepath)) {
|
if (empty($srctemplatepath)) {
|
||||||
if (!dol_is_file($srctemplatepath)) {
|
$this->error = 'ErrorGenerationAskedForOdtTemplateWithSrcFileNotDefined';
|
||||||
dol_syslog("Failed to locate template file ".$srctemplatepath, LOG_WARNING);
|
|
||||||
$this->error = 'ErrorGenerationAskedForOdtTemplateWithSrcFileNotFound';
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output = empty($outputlangs->charset_output) ? '' : $outputlangs->charset_output;
|
|
||||||
|
|
||||||
if (in_array(get_class($this), array('Adherent'))) {
|
|
||||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, 'tmp_cards', $moreparams);
|
|
||||||
} else {
|
|
||||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
|
||||||
}
|
|
||||||
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
|
|
||||||
|
|
||||||
if ($resultwritefile > 0) {
|
|
||||||
$outputlangs->charset_output = $sav_charset_output;
|
|
||||||
|
|
||||||
// We delete old preview
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($this);
|
|
||||||
|
|
||||||
// Index file in database
|
|
||||||
if (!empty($obj->result['fullpath'])) {
|
|
||||||
$destfull = $obj->result['fullpath'];
|
|
||||||
|
|
||||||
// Update the last_main_doc field into main object (if document generator has property ->update_main_doc_field set)
|
|
||||||
$update_main_doc_field = 0;
|
|
||||||
if (!empty($obj->update_main_doc_field)) {
|
|
||||||
$update_main_doc_field = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->indexFile($destfull, $update_main_doc_field);
|
|
||||||
} else {
|
|
||||||
dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Success in building document. We build meta file.
|
|
||||||
dol_meta_create($this);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
$outputlangs->charset_output = $sav_charset_output;
|
|
||||||
$this->error = $obj->error;
|
|
||||||
$this->errors = $obj->errors;
|
|
||||||
dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!$filefound) {
|
|
||||||
$this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele;
|
|
||||||
$this->errors[] = $this->error;
|
|
||||||
dol_syslog($this->error, LOG_ERR);
|
|
||||||
} else {
|
|
||||||
$this->error = $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $filefound);
|
|
||||||
$this->errors[] = $this->error;
|
|
||||||
dol_syslog($this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj->type == 'odt' && !empty($srctemplatepath)) {
|
||||||
|
if (!dol_is_file($srctemplatepath)) {
|
||||||
|
dol_syslog("Failed to locate template file ".$srctemplatepath, LOG_WARNING);
|
||||||
|
$this->error = 'ErrorGenerationAskedForOdtTemplateWithSrcFileNotFound';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
|
// output format that does not support UTF8.
|
||||||
|
$sav_charset_output = empty($outputlangs->charset_output) ? '' : $outputlangs->charset_output;
|
||||||
|
|
||||||
|
if (in_array(get_class($this), array('Adherent'))) {
|
||||||
|
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, 'tmp_cards', $moreparams);
|
||||||
} else {
|
} else {
|
||||||
return $reshook;
|
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||||
|
}
|
||||||
|
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
|
||||||
|
|
||||||
|
if ($resultwritefile > 0) {
|
||||||
|
$outputlangs->charset_output = $sav_charset_output;
|
||||||
|
|
||||||
|
// We delete old preview
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
dol_delete_preview($this);
|
||||||
|
|
||||||
|
// Index file in database
|
||||||
|
if (!empty($obj->result['fullpath'])) {
|
||||||
|
$destfull = $obj->result['fullpath'];
|
||||||
|
|
||||||
|
// Update the last_main_doc field into main object (if document generator has property ->update_main_doc_field set)
|
||||||
|
$update_main_doc_field = 0;
|
||||||
|
if (!empty($obj->update_main_doc_field)) {
|
||||||
|
$update_main_doc_field = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->indexFile($destfull, $update_main_doc_field);
|
||||||
|
} else {
|
||||||
|
dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Success in building document. We build meta file.
|
||||||
|
dol_meta_create($this);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
$outputlangs->charset_output = $sav_charset_output;
|
||||||
|
$this->error = $obj->error;
|
||||||
|
$this->errors = $obj->errors;
|
||||||
|
dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,25 @@ 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) && empty($module)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (empty($module) && !empty($object->element)) {
|
||||||
|
$module = $object->element;
|
||||||
|
}
|
||||||
|
return $conf->$module->multidir_output[(!empty($object->entity) ? $object->entity : $conf->entity)];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return dolibarr global constant string value
|
* Return dolibarr global constant string value
|
||||||
|
|||||||
@ -1069,6 +1069,18 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
|
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check if Extrafields is totalizable
|
||||||
|
foreach ($extrafields->attributes['projet_task']['totalizable'] as $key=>$value) {
|
||||||
|
if ($arrayfields['ef.'.$key]['checked'] == 1) {
|
||||||
|
print '<td align="right">';
|
||||||
|
if ($value == 1) {
|
||||||
|
print $totalarray['totalizable'][$key]['total'];
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '<td class=""></td>';
|
print '<td class=""></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
-- VMYSQL4.3 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN `rank` rankorder integer;
|
-- VMYSQL4.3 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN `rank` rankorder integer;
|
||||||
-- VPGSQL8.2 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN rank rankorder integer;
|
-- VPGSQL8.2 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN rank rankorder integer;
|
||||||
|
|
||||||
ALTER TABLE llx_accounting_system CHANGE COLUMN fk_pays fk_country integer;
|
ALTER TABLE llx_accounting_system CHANGE COLUMN fk_pays fk_country integer;
|
||||||
|
|
||||||
ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128);
|
ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128);
|
||||||
ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128);
|
ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128);
|
||||||
@ -376,4 +376,3 @@ UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = 'ZWE';
|
|||||||
-- Generate documents on product batch
|
-- Generate documents on product batch
|
||||||
ALTER TABLE llx_product_lot ADD COLUMN model_pdf varchar(255) AFTER scrapping_date;
|
ALTER TABLE llx_product_lot ADD COLUMN model_pdf varchar(255) AFTER scrapping_date;
|
||||||
ALTER TABLE llx_product_lot ADD COLUMN last_main_doc varchar(255) AFTER model_pdf;
|
ALTER TABLE llx_product_lot ADD COLUMN last_main_doc varchar(255) AFTER model_pdf;
|
||||||
|
|
||||||
|
|||||||
@ -95,6 +95,7 @@ $search_accountancy_code_buy = GETPOST("search_accountancy_code_buy", 'alpha');
|
|||||||
$search_accountancy_code_buy_intra = GETPOST("search_accountancy_code_buy_intra", 'alpha');
|
$search_accountancy_code_buy_intra = GETPOST("search_accountancy_code_buy_intra", 'alpha');
|
||||||
$search_accountancy_code_buy_export = GETPOST("search_accountancy_code_buy_export", 'alpha');
|
$search_accountancy_code_buy_export = GETPOST("search_accountancy_code_buy_export", 'alpha');
|
||||||
$search_finished = GETPOST("search_finished", 'int');
|
$search_finished = GETPOST("search_finished", 'int');
|
||||||
|
$search_units = GETPOST('search_units', 'int');
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
$type = GETPOST("type", "int");
|
$type = GETPOST("type", "int");
|
||||||
$mode = GETPOST('mode', 'alpha');
|
$mode = GETPOST('mode', 'alpha');
|
||||||
@ -353,6 +354,7 @@ if (empty($reshook)) {
|
|||||||
$search_accountancy_code_buy_intra = '';
|
$search_accountancy_code_buy_intra = '';
|
||||||
$search_accountancy_code_buy_export = '';
|
$search_accountancy_code_buy_export = '';
|
||||||
$search_array_options = array();
|
$search_array_options = array();
|
||||||
|
$search_units = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
@ -571,6 +573,9 @@ if ($search_accountancy_code_buy_intra) {
|
|||||||
if ($search_accountancy_code_buy_export) {
|
if ($search_accountancy_code_buy_export) {
|
||||||
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', $search_accountancy_code_buy_export);
|
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', $search_accountancy_code_buy_export);
|
||||||
}
|
}
|
||||||
|
if (!empty($conf->global->PRODUCT_USE_UNITS) && $search_units) {
|
||||||
|
$sql .= natural_search('cu.rowid', $search_units);
|
||||||
|
}
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
@ -1021,6 +1026,7 @@ if (!empty($arrayfields['p.volume_units']['checked'])) {
|
|||||||
// Unit
|
// Unit
|
||||||
if (!empty($arrayfields['cu.label']['checked'])) {
|
if (!empty($arrayfields['cu.label']['checked'])) {
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
|
print $form->selectUnits($search_units, 'search_units', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1503,6 +1503,13 @@ while ($i < $imaxinloop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show total line
|
// Show total line
|
||||||
|
if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable'])) {
|
||||||
|
foreach ($totalarray['totalizable'] as $keytotalizable => $valtotalizable) {
|
||||||
|
$totalarray['pos'][$valtotalizable['pos']] = $keytotalizable;
|
||||||
|
$totalarray['val'][$keytotalizable] = $valtotalizable['total'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield'])
|
if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield'])
|
||||||
|| isset($totalarray['totaltobill']) || isset($totalarray['totalbilled']) || isset($totalarray['totalbudget'])) {
|
|| isset($totalarray['totaltobill']) || isset($totalarray['totalbilled']) || isset($totalarray['totalbudget'])) {
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
@ -1529,6 +1536,14 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
|
|||||||
print '<td class="center">'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'</td>';
|
print '<td class="center">'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'</td>';
|
||||||
} elseif ($totalarray['totalbudget_amountfield'] == $i) {
|
} elseif ($totalarray['totalbudget_amountfield'] == $i) {
|
||||||
print '<td class="center">'.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).'</td>';
|
print '<td class="center">'.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).'</td>';
|
||||||
|
} elseif (!empty($totalarray['pos'][$i])) {
|
||||||
|
print '<td class="right">';
|
||||||
|
if (isset($totalarray['type']) && $totalarray['type'][$i] == 'duration') {
|
||||||
|
print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0);
|
||||||
|
} else {
|
||||||
|
print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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