Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW_deposit_payment_terms

This commit is contained in:
Marc de Lima Lucio 2021-10-05 13:35:50 +02:00
commit 6ed9e00b4d
11 changed files with 55 additions and 31 deletions

View File

@ -102,12 +102,12 @@ if ($action == 'builddoc' && $permissiontoadd) {
if (empty($donotredirect)) { // This is set when include is done by bulk action "Bill Orders" if (empty($donotredirect)) { // This is set when include is done by bulk action "Bill Orders"
setEventMessages($langs->trans("FileGenerated"), null); setEventMessages($langs->trans("FileGenerated"), null);
$urltoredirect = $_SERVER['REQUEST_URI']; /*$urltoredirect = $_SERVER['REQUEST_URI'];
$urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect);
$urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop $urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop
header('Location: '.$urltoredirect.'#builddoc'); header('Location: '.$urltoredirect.'#builddoc');
exit; exit;*/
} }
} }
} }

View File

@ -220,6 +220,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* For example {company_name}, {company_name_alias}
* *
* @param Societe $object Object * @param Societe $object Object
* @param Translate $outputlangs Language object for output * @param Translate $outputlangs Language object for output

View File

@ -624,14 +624,15 @@ class Conf
if (!empty($this->global->MAILING_EMAIL_FROM)) { if (!empty($this->global->MAILING_EMAIL_FROM)) {
$this->mailing->email_from = $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)) { if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
$this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1; $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) // 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 = "%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 $this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags

View File

@ -7975,7 +7975,7 @@ class Form
} }
if (!$nboftypesoutput) { if (!$nboftypesoutput) {
print '<tr><td class="impair opacitymedium" colspan="7">'.$langs->trans("None").'</td></tr>'; print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -393,6 +393,38 @@ class FormFile
global $langs, $conf, $user, $hookmanager; global $langs, $conf, $user, $hookmanager;
global $form; 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)) { if (!is_object($form)) {
$form = new Form($this->db); $form = new Form($this->db);
} }
@ -702,9 +734,10 @@ class FormFile
$urlsource .= '#'.$forname.'_form'; // So we switch to form after a generation $urlsource .= '#'.$forname.'_form'; // So we switch to form after a generation
} }
if (empty($noform)) { if (empty($noform)) {
$out .= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc').'" id="'.$forname.'_form" method="post">'; $out .= '<form action="'.$urlsource.'" id="'.$forname.'_form" method="post">';
} }
$out .= '<input type="hidden" name="action" value="builddoc">'; $out .= '<input type="hidden" name="action" value="builddoc">';
$out .= '<input type="hidden" name="page_y" value="">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">'; $out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= load_fiche_titre($titletoshow, '', ''); $out .= load_fiche_titre($titletoshow, '', '');
@ -754,7 +787,7 @@ class FormFile
} }
// Button // Button
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"'; $genbutton = '<input class="button buttongen reposition" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton .= ' type="submit" value="'.$buttonlabel.'"'; $genbutton .= ' type="submit" value="'.$buttonlabel.'"';
if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) { if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
$genbutton .= ' disabled'; $genbutton .= ' disabled';
@ -899,19 +932,19 @@ class FormFile
} }
$out .= '</td>'; $out .= '</td>';
// Show picto delete, print...
if ($delallowed || $printer || $morepicto) { if ($delallowed || $printer || $morepicto) {
$out .= '<td class="right nowraponall">'; $out .= '<td class="right nowraponall">';
if ($delallowed) { if ($delallowed) {
$tmpurlsource = preg_replace('/#[a-zA-Z0-9_]*$/', '', $urlsource); $tmpurlsource = preg_replace('/#[a-zA-Z0-9_]*$/', '', $urlsource);
$out .= '<a href="'.$tmpurlsource.((strpos($tmpurlsource, '?') === false) ? '?' : '&').'action='.urlencode($removeaction).'&token='.newToken().'&file='.urlencode($relativepath); $out .= '<a class="reposition" href="'.$tmpurlsource.((strpos($tmpurlsource, '?') === false) ? '?' : '&').'action='.urlencode($removeaction).'&token='.newToken().'&file='.urlencode($relativepath);
$out .= ($param ? '&'.$param : ''); $out .= ($param ? '&'.$param : '');
//$out.= '&modulepart='.$modulepart; // TODO obsolete ? //$out.= '&modulepart='.$modulepart; // TODO obsolete ?
//$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ? //$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?
$out .= '">'.img_picto($langs->trans("Delete"), 'delete').'</a>'; $out .= '">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
} }
if ($printer) { if ($printer) {
//$out.= '<td class="right">'; $out .= '<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource, '?') ? '&' : '?').'action=print_file&token='.newToken().'printer='.urlencode($modulepart).'&file='.urlencode($relativepath);
$out .= '<a class="marginleftonly" href="'.$urlsource.(strpos($urlsource, '?') ? '&' : '?').'action=print_file&token='.newToken().'printer='.urlencode($modulepart).'&file='.urlencode($relativepath);
$out .= ($param ? '&'.$param : ''); $out .= ($param ? '&'.$param : '');
$out .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>'; $out .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>';
} }
@ -959,7 +992,7 @@ class FormFile
} }
if (count($file_list) == 0 && count($link_list) == 0 && $headershown) { if (count($file_list) == 0 && count($link_list) == 0 && $headershown) {
$out .= '<tr><td colspan="'.(3 + ($addcolumforpicto ? 1 : 0)).'" class="opacitymedium">'.$langs->trans("None").'</td></tr>'."\n"; $out .= '<tr><td colspan="'.(3 + ($addcolumforpicto ? 1 : 0)).'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'."\n";
} }
} }

View File

@ -146,10 +146,6 @@ if ($action == 'presend') {
$formmail->trackid = $trackid; $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; $formmail->withfrom = 1;
// Fill list of recipient with email inside <>. // Fill list of recipient with email inside <>.

View File

@ -114,10 +114,6 @@ if ($massaction == 'presend') {
$formmail->fromid = $user->id; $formmail->fromid = $user->id;
} }
$formmail->trackid = $trackid; $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; $formmail->withfrom = 1;
$liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); $liste = $langs->trans("AllRecipientSelected", count($arrayofselected));
if (count($listofselectedthirdparties) == 1) { // Only 1 different recipient selected, we can suggest contacts if (count($listofselectedthirdparties) == 1) { // Only 1 different recipient selected, we can suggest contacts

View File

@ -195,16 +195,17 @@ if (($line->info_bits & 2) == 2) {
} }
} }
//print get_date_range($line->date_start, $line->date_end, $format); //print get_date_range($line->date_start, $line->date_end, $format);
} }
// Add description in form // Add description in form
if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) { if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if ($line->element == 'facturedetrec') {
print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : '';
} else {
print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : ''; print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : '';
} }
}
// Line extrafield // Line extrafield
if (!empty($extrafields)) { if (!empty($extrafields)) {

View File

@ -58,7 +58,7 @@ if ($massaction == 'presend_attendees') {
print dol_get_fiche_head(null, '', ''); 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'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->withform = -1; $formmail->withform = -1;
@ -68,10 +68,6 @@ if ($massaction == 'presend_attendees') {
$formmail->fromid = $user->id; $formmail->fromid = $user->id;
} }
$formmail->trackid = $trackid; $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; $formmail->withfrom = 1;
$liste = $langs->trans("AllRecipientSelected", count($listofselectedid)); $liste = $langs->trans("AllRecipientSelected", count($listofselectedid));
$formmail->withtoreadonly = 1; $formmail->withtoreadonly = 1;

View File

@ -85,7 +85,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXP
-- --
-- Mail Mailing -- 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); 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);

View File

@ -225,7 +225,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
break; break;
} }
//print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; //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; //exit;
} }
} else { } else {