diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 4e2165d6f38..c813e8af4a0 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -102,12 +102,12 @@ if ($action == 'builddoc' && $permissiontoadd) { if (empty($donotredirect)) { // This is set when include is done by bulk action "Bill Orders" setEventMessages($langs->trans("FileGenerated"), null); - $urltoredirect = $_SERVER['REQUEST_URI']; + /*$urltoredirect = $_SERVER['REQUEST_URI']; $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); $urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop header('Location: '.$urltoredirect.'#builddoc'); - exit; + exit;*/ } } } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 3f75ee30d02..7183605ae10 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -220,6 +220,7 @@ abstract class CommonDocGenerator // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple substitution key => substitution value + * For example {company_name}, {company_name_alias} * * @param Societe $object Object * @param Translate $outputlangs Language object for output diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 5ec3a4cfbc0..ee91d67b9ce 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -624,14 +624,15 @@ class Conf if (!empty($this->global->MAILING_EMAIL_FROM)) { $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; } - if (!isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) { - $this->global->MAIN_EMAIL_ADD_TRACK_ID = 1; - } if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { $this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1; } + if (!isset($this->global->MAIN_FIX_FOR_BUGGED_MTA)) { + $this->global->MAIN_FIX_FOR_BUGGED_MTA = 1; + } + // Format for date (used by default when not found or not searched in lang) $this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions) $this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 415570102f2..5e0a464fa6e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7975,7 +7975,7 @@ class Form } if (!$nboftypesoutput) { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d558571d5b8..0d1d838aad4 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -393,6 +393,38 @@ class FormFile global $langs, $conf, $user, $hookmanager; global $form; + $reshook = 0; + if (is_object($hookmanager)) { + $parameters = array( + 'modulepart'=>&$modulepart, + 'modulesubdir'=>&$modulesubdir, + 'filedir'=>&$filedir, + 'urlsource'=>&$urlsource, + 'genallowed'=>&$genallowed, + 'delallowed'=>&$delallowed, + 'modelselected'=>&$modelselected, + 'allowgenifempty'=>&$allowgenifempty, + 'forcenomultilang'=>&$forcenomultilang, + 'noform'=>&$noform, + 'param'=>&$param, + 'title'=>&$title, + 'buttonlabel'=>&$buttonlabel, + 'codelang'=>&$codelang, + 'morepicto'=>&$morepicto, + 'hideifempty'=>&$hideifempty, + 'removeaction'=>&$removeaction + ); + $reshook = $hookmanager->executeHooks('showDocuments', $parameters, $object); // Note that parameters may have been updated by hook + // May report error + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + } + // Remode default action if $reskook > 0 + if ($reshook > 0) { + return $hookmanager->resPrint; + } + if (!is_object($form)) { $form = new Form($this->db); } @@ -702,9 +734,10 @@ class FormFile $urlsource .= '#'.$forname.'_form'; // So we switch to form after a generation } if (empty($noform)) { - $out .= '
'; + $out .= ''; } $out .= ''; + $out .= ''; $out .= ''; $out .= load_fiche_titre($titletoshow, '', ''); @@ -754,7 +787,7 @@ class FormFile } // Button - $genbutton = ''.img_picto($langs->trans("Delete"), 'delete').''; } if ($printer) { - //$out.= ''; - $out .= ''.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').''; } @@ -959,7 +992,7 @@ class FormFile } if (count($file_list) == 0 && count($link_list) == 0 && $headershown) { - $out .= ''.$langs->trans("None").''."\n"; + $out .= ''.$langs->trans("None").''."\n"; } } diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 2961dea7c96..212e766589c 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -146,10 +146,6 @@ if ($action == 'presend') { $formmail->trackid = $trackid; - if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); - } $formmail->withfrom = 1; // Fill list of recipient with email inside <>. diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 4d715ed8797..4d0772225c7 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -114,10 +114,6 @@ if ($massaction == 'presend') { $formmail->fromid = $user->id; } $formmail->trackid = $trackid; - if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); - } $formmail->withfrom = 1; $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); if (count($listofselectedthirdparties) == 1) { // Only 1 different recipient selected, we can suggest contacts diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 6a7d48add5e..c4ddc7d0c4c 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -195,15 +195,16 @@ if (($line->info_bits & 2) == 2) { } } - - - //print get_date_range($line->date_start, $line->date_end, $format); } // Add description in form if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) { - print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; + if ($line->element == 'facturedetrec') { + print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; + } else { + print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; + } } // Line extrafield diff --git a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php index 17c78babfea..e4990da6424 100644 --- a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php +++ b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php @@ -58,7 +58,7 @@ if ($massaction == 'presend_attendees') { print dol_get_fiche_head(null, '', ''); - // Cree l'objet formulaire mail + // Create form for email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->withform = -1; @@ -68,10 +68,6 @@ if ($massaction == 'presend_attendees') { $formmail->fromid = $user->id; } $formmail->trackid = $trackid; - if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); - } $formmail->withfrom = 1; $liste = $langs->trans("AllRecipientSelected", count($listofselectedid)); $formmail->withtoreadonly = 1; diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 2f2975a158c..d7193d87a49 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -85,7 +85,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXP -- -- Mail Mailing -- -insert into llx_const (name, value, type, note, visible) values ('MAIN_FIX_FOR_BUGGED_MTA','1','chaine','Set constant to fix email ending from PHP with some linux ike system',1); +--insert into llx_const (name, value, type, note, visible) values ('MAIN_FIX_FOR_BUGGED_MTA','1','chaine','Set constant to fix email ending from PHP with some linux like system',1); insert into llx_const (name, value, type, note, visible) values ('MAILING_EMAIL_FROM','no-reply@mydomain.com','chaine','EMail emmetteur pour les envois d emailings',0); diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 2d3c71e7370..c68f1162790 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -225,7 +225,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase break; } //print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; - $this->assertTrue($ok, 'Found string $db-> into a .class.php file in '.$file['relativename']); + $this->assertTrue($ok, 'Found string $db-> into a .class.php file in '.$file['relativename'].'. Inside a .class file, you should use $this->db-> instead.'); //exit; } } else {