Skip to content

Commit

Permalink
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 5, 2024
2 parents 8e952a8 + 7ff3d61 commit 1c52869
Show file tree
Hide file tree
Showing 20 changed files with 251 additions and 130 deletions.
4 changes: 2 additions & 2 deletions htdocs/admin/tools/dolibarr_export.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ function hideoptions(domelem) {
print '<div id="backupdatabaseright" class="fichehalfright">';

$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ? SORT_ASC : SORT_DESC), 1);
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"');
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 3, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"');
print '<br>';

print '</div>';
Expand Down Expand Up @@ -683,7 +683,7 @@ function hideoptions(domelem) {
print '<div id="backupfileright" class="fichehalfright">';

$filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ? SORT_ASC : SORT_DESC), 1);
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"');
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 3, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"');
print '<br>';

print '</div>';
Expand Down
3 changes: 2 additions & 1 deletion htdocs/compta/bank/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@
} elseif (!empty($object->ref)) {
$title = $object->ref." - ".$langs->trans("Card");
}

llxHeader("", $title, $help_url);

// Creation
Expand Down Expand Up @@ -435,7 +436,7 @@
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td>';
print $form->selectarray("clos", $object->status, (GETPOSTINT('clos') != '' ? GETPOSTINT('clos') : $object->status), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
print $form->selectarray("clos", $object->labelStatus, (GETPOSTINT('clos') != '' ? GETPOSTINT('clos') : $object->status), 0, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth150onsmartphone');
print '</td></tr>';

// Country
Expand Down
6 changes: 5 additions & 1 deletion htdocs/core/ajax/onlineSign.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,12 @@
$s = $pdf->getTemplatesize($tppl);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tppl);
$propalsignonspecificpage = getDolGlobalInt("PROPAL_SIGNATURE_ON_SPECIFIC_PAGE");
if ($propalsignonspecificpage < 0) {
$propalsignonspecificpage = $pagecount - abs($propalsignonspecificpage);
}

if (getDolGlobalString("PROPAL_SIGNATURE_ON_ALL_PAGES") || getDolGlobalInt("PROPAL_SIGNATURE_ON_SPECIFIC_PAGE") == $i) {
if (getDolGlobalString("PROPAL_SIGNATURE_ON_ALL_PAGES") || $propalsignonspecificpage == $i) {
// A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF
// TODO Get position of box from PDF template

Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/class/doleditor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $

$htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false';

$out .= '<!-- Output ckeditor $disallowAnyContent='.dol_escape_htmltag($disallowAnyContent).' toolbarname='.dol_escape_htmltag($this->toolbarname).' -->'."\n";
$out .= '<!-- Output ckeditor disallowAnyContent='.dol_escape_htmltag($disallowAnyContent).' toolbarname='.dol_escape_htmltag($this->toolbarname).' -->'."\n";
$out .= '<script nonce="'.getNonce().'" type="text/javascript">
$(document).ready(function () {
/* console.log("Run ckeditor"); */
Expand All @@ -216,8 +216,8 @@ public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $
versionCheck: false,
readOnly: '.($this->readonly ? 'true' : 'false').',
htmlEncodeOutput: '.dol_escape_js($htmlencode_force).',
allowedContent: '.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */
extraAllowedContent: \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */
allowedContent: '.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is on when allowedContent is false */
extraAllowedContent: \'a[target];section[contenteditable,id];div{float,display}\', /* Allow a tag with attribute target, allow seciont tag and allow the style float and display into div to default other allowed tags */
disallowedContent: \'\', /* Tags that are not allowed */
fullPage: '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */
toolbar: \''.dol_escape_js($this->toolbarname).'\',
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/html.form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0
$extrastyle = '';
if ($direction < 0) {
$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-left: 3px;';
$extrastyle = 'padding: 0px; padding-left: 2px;';
}
if ($direction > 0) {
$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-right: 3px;';
$extrastyle = 'padding: 0px; padding-right: 2px;';
}

$classfortooltip = 'classfortooltip';
Expand Down
17 changes: 7 additions & 10 deletions htdocs/core/class/html.formfile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1175,12 +1175,11 @@ public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter =
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file.
* @param string $relativepath Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT.
* @param int $permonobject Permission on object (so permission to delete or crop document)
* @param int $useinecm Change output for use in ecm module:
* 0 or 6: Add a preview column. Show also a rename button. Show also a crop button for some values of $modulepart (must be supported into hard coded list in this function + photos_resize.php + restrictedArea + checkUserAccessToObject)
* @param int $useinecm Change output to add more information:
* 0, 4, 5, 6: Add a preview column. Show also a rename button. Show also a crop button for some values of $modulepart (must be supported into hard coded list in this function + photos_resize.php + restrictedArea + checkUserAccessToObject)
* 1: Add link to edit ECM entry
* 2: Add rename and crop link
* 4: Add a preview column
* 5: Add link to edit ECM entry and Add a preview column
* 5: Add link to edit ECM entry and add a preview column
* @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
* @param int $maxlength Maximum length of file name shown.
* @param string $title Title before list. Use 'none' to disable title.
Expand Down Expand Up @@ -1287,7 +1286,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
}

// Show list of existing files
if ((empty($useinecm) || $useinecm == 6) && $title != 'none') {
if ((empty($useinecm) || $useinecm == 3 || $useinecm == 6) && $title != 'none') {
print load_fiche_titre($title ? $title : $langs->trans("AttachedFiles"), '', 'file-upload', 0, '', 'table-list-of-attached-files');
}
if (empty($url)) {
Expand Down Expand Up @@ -1388,7 +1387,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',


// File name
print '<td class="minwith200 tdoverflowmax500">';
print '<td class="minwith200 tdoverflowmax500" title="'.dolPrintHTMLForAttribute($file['name']).'">';

// Show file name with link to download
//print "XX".$file['name']; //$file['name'] must be utf8
Expand Down Expand Up @@ -1484,8 +1483,6 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
}
print ' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(empty($object->entity) ? $conf->entity : $object->entity).'&file='.urlencode($relativepath.$smallfile).'" title="">';
print '</a>';
} else {
print '&nbsp;';
}
print '</td>';
}
Expand Down Expand Up @@ -1536,7 +1533,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
print '<a class="editfielda editfilelink" href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'&backtopage='.urlencode($backtopage).'" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
}

if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) { // 6=Media file manager
if (empty($useinecm) || $useinecm == 2 || $useinecm == 3 || $useinecm == 6) { // 6=Media file manager
$newmodulepart = $modulepart;
if (in_array($modulepart, array('product', 'produit', 'service'))) {
$newmodulepart = 'produit|service';
Expand Down Expand Up @@ -1598,7 +1595,7 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '',
if (getDolGlobalString('MAIN_ECM_DISABLE_JS')) {
$useajax = 0;
}
print '<a href="'.((($useinecm && $useinecm != 6) && $useajax) ? '#' : ($url.'?action=deletefile&token='.newToken().'&urlfile='.urlencode($filepath).$param)).'" class="reposition deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
print '<a href="'.((($useinecm && $useinecm != 3 && $useinecm != 6) && $useajax) ? '#' : ($url.'?action=deletefile&token='.newToken().'&urlfile='.urlencode($filepath).$param)).'" class="reposition deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
}
print "</td>";

Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/class/utils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,13 +560,13 @@ public function dumpDatabase($compression = 'none', $type = 'auto', $usedefault
} elseif ($compression == 'zstd') {
fclose($handle);
}
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg)) { // No error
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg) || preg_match('/^\/\*!999999/', $errormsg)) { // Start of file is ok, NOT an error
$errormsg = '';
} else {
// Renommer fichier sortie en fichier erreur
// Rename file out into a file error
//print "$outputfile -> $outputerror";
@dol_delete_file($outputerror, 1, 0, 0, null, false, 0);
@rename($outputfile, $outputerror);
@dol_move($outputfile, $outputerror, '0', 1, 0, 0);
// Si safe_mode on et command hors du parameter exec, on a un fichier out vide donc errormsg vide
if (!$errormsg) {
$langs->load("errors");
Expand Down
13 changes: 12 additions & 1 deletion htdocs/core/lib/product.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function product_lot_admin_prepare_head()


/**
* Show stats for company
* Show stats for a product
*
* @param Product $product Product object
* @param int $socid Thirdparty id
Expand Down Expand Up @@ -647,9 +647,11 @@ function show_stats_for_company($product, $socid)

print '</td><td class="right">';
print $form->textwithpicto($product->stats_bom['nb_toconsume'], $langs->trans("RowMaterial"));
print ' ';
print $form->textwithpicto($product->stats_bom['nb_toproduce'], $langs->trans("Finished"));
print '</td><td class="right">';
print $form->textwithpicto($product->stats_bom['qty_toconsume'], $langs->trans("RowMaterial"));
print ' ';
print $form->textwithpicto($product->stats_bom['qty_toproduce'], $langs->trans("Finished"));
print '</td>';
print '</tr>';
Expand All @@ -667,18 +669,27 @@ function show_stats_for_company($product, $socid)
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").'</a>';
print '</td><td class="right">';
print $form->textwithpicto($product->stats_mo['customers_toconsume'], $langs->trans("ToConsume"));
print ' ';
print $form->textwithpicto($product->stats_mo['customers_consumed'], $langs->trans("QtyAlreadyConsumed"));
print ' ';
print $form->textwithpicto($product->stats_mo['customers_toproduce'], $langs->trans("QtyToProduce"));
print ' ';
print $form->textwithpicto($product->stats_mo['customers_produced'], $langs->trans("QtyAlreadyProduced"));
print '</td><td class="right">';
print $form->textwithpicto($product->stats_mo['nb_toconsume'], $langs->trans("ToConsume"));
print ' ';
print $form->textwithpicto($product->stats_mo['nb_consumed'], $langs->trans("QtyAlreadyConsumed"));
print ' ';
print $form->textwithpicto($product->stats_mo['nb_toproduce'], $langs->trans("QtyToProduce"));
print ' ';
print $form->textwithpicto($product->stats_mo['nb_produced'], $langs->trans("QtyAlreadyProduced"));
print '</td><td class="right">';
print $form->textwithpicto($product->stats_mo['qty_toconsume'], $langs->trans("ToConsume"));
print ' ';
print $form->textwithpicto($product->stats_mo['qty_consumed'], $langs->trans("QtyAlreadyConsumed"));
print ' ';
print $form->textwithpicto($product->stats_mo['qty_toproduce'], $langs->trans("QtyToProduce"));
print ' ';
print $form->textwithpicto($product->stats_mo['qty_produced'], $langs->trans("QtyAlreadyProduced"));
print '</td>';
print '</tr>';
Expand Down
39 changes: 29 additions & 10 deletions htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,6 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
// Nothing to do
} else {
//Local tax 1 before VAT
//if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
if (in_array((string) $localtax_type, array('1', '3', '5'))) {
continue;
Expand All @@ -945,7 +943,13 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
$totalvat .= ' ';
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;

if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
$totalvat .= $tvacompl;
} else {
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
}

$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
Expand All @@ -955,10 +959,8 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
}
}
}
//}

//Local tax 2 before VAT
//if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
if (in_array((string) $localtax_type, array('1', '3', '5'))) {
continue;
Expand All @@ -977,7 +979,13 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
$totalvat .= ' ';
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;

if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
$totalvat .= $tvacompl;
} else {
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
}

$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
Expand All @@ -987,7 +995,6 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
}
}
}
//}

// VAT
foreach ($this->tva_array as $tvakey => $tvaval) {
Expand All @@ -1008,6 +1015,8 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
$totalvat .= $tvaval['vatcode'].$tvacompl;
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
$totalvat .= $tvacompl;
} else {
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$tvacompl;
}
Expand Down Expand Up @@ -1041,7 +1050,12 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
$totalvat .= ' ';

$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
$totalvat .= $tvacompl;
} else {
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
}

$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
Expand Down Expand Up @@ -1076,7 +1090,12 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
$totalvat .= ' ';

$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
$totalvat .= $tvacompl;
} else {
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
}

$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
Expand Down
Loading

0 comments on commit 1c52869

Please sign in to comment.