2
0
forked from Wavyzz/dolibarr

Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2023-10-12 15:01:26 +02:00
6 changed files with 60 additions and 10 deletions

View File

@@ -665,7 +665,12 @@ if ($action == 'writebookkeeping' && !$error) {
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $label_account; $bookkeeping->label_compte = $label_account;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref;
$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : join(', ', $def_tva[$key][$k]));
$bookkeeping->label_operation .= ' - '.$langs->trans("Taxes").' '.$tmpvatrate.' %';
$bookkeeping->label_operation .= ($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@@ -1226,6 +1231,7 @@ if (empty($action) || $action == 'view') {
$arrayofvat = $tablocaltax2; $arrayofvat = $tablocaltax2;
} }
// $key is id of invoice
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@@ -1244,7 +1250,12 @@ if (empty($action) || $action == 'view') {
// Subledger account // Subledger account
print "<td>"; print "<td>";
print '</td>'; print '</td>';
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : ''); print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref;
// $def_tva is array[invoiceid][accountancy_code_sell_of_vat_rate_found][vatrate]=vatrate
//var_dump($arrayofvat[$key]); var_dump($key); var_dump($k);
$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : join(', ', $def_tva[$key][$k]));
print ' - '.$langs->trans("Taxes").' '.$tmpvatrate.' %';
print ($numtax ? ' - Localtax '.$numtax : '');
print "</td>"; print "</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";

View File

@@ -175,7 +175,7 @@ $arrayfields = array(
// Détail commande // Détail commande
'rowid'=> array('label'=>'TechnicalID', 'checked'=>1, 'position'=>1, 'enabled'=>(getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0)), 'rowid'=> array('label'=>'TechnicalID', 'checked'=>1, 'position'=>1, 'enabled'=>(getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0)),
'pr.ref'=> array('label'=>'ProductRef', 'checked'=>1, 'position'=>1), 'pr.ref'=> array('label'=>'ProductRef', 'checked'=>1, 'position'=>1),
'pr.desc'=> array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1), 'pr.desc'=> array('label'=>'ProductDescription', 'checked'=>-1, 'position'=>1),
'cdet.qty'=> array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1), 'cdet.qty'=> array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1),
'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5), 'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5),
'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10), 'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10),
@@ -1544,7 +1544,9 @@ if ($resql) {
if (!empty($arrayfields['pr.desc']['checked'])) { if (!empty($arrayfields['pr.desc']['checked'])) {
// print '<td class="nowrap tdoverflowmax200">'.$obj->description.'</td>'; // print '<td class="nowrap tdoverflowmax200">'.$obj->description.'</td>';
!empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description; !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description;
print '<td class="nowrap tdoverflowmax200">'.dol_escape_htmltag($labelproduct).'</td>'; print '<td class="nowrap tdoverflowmax200">aa';
print dolGetFirstLineOfText(dolPrintHTML($labelproduct), 5);
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;

View File

@@ -1594,6 +1594,43 @@ function dol_escape_json($stringtoescape)
return str_replace('"', '\"', $stringtoescape); return str_replace('"', '\"', $stringtoescape);
} }
/**
* Return a string label ready to be output on HTML content
* To use text inside an attribute, use can use only dol_escape_htmltag()
*
* @param string $s String to print
* @return string String ready for HTML output
*/
function dolPrintLabel($s)
{
return dol_escape_htmltag(dol_htmlentitiesbr($s));
}
/**
* Return a string ready to be output on HTML page
* To use text inside an attribute, use can use only dol_escape_htmltag()
*
* @param string $s String to print
* @return string String ready for HTML output
*/
function dolPrintHTML($s)
{
return dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 1, 1)), 1, 1, 'common', 0, 1);
}
/**
* Return a string ready to be output on input textarea
* To use text inside an attribute, use can use only dol_escape_htmltag()
*
* @param string $s String to print
* @return string String ready for HTML output into a textarea
*/
function dolPrintHTMLForTextArea($s)
{
return dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 1, 1)), 1, 1, '', 0, 1);
}
/** /**
* Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input fields. * Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input fields.
* When we output string on pages, we use * When we output string on pages, we use
@@ -1626,7 +1663,7 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta
$tmp = html_entity_decode((string) $stringtoescape, ENT_COMPAT, 'UTF-8'); $tmp = html_entity_decode((string) $stringtoescape, ENT_COMPAT, 'UTF-8');
} }
if (!$keepb) { if (!$keepb) {
$tmp = strtr($tmp, array("<b>"=>'', '</b>'=>'')); $tmp = strtr($tmp, array("<b>"=>'', '</b>'=>'', '<strong>'=>'', '</strong>'=>''));
} }
if (!$keepn) { if (!$keepn) {
$tmp = strtr($tmp, array("\r"=>'\\r', "\n"=>'\\n')); $tmp = strtr($tmp, array("\r"=>'\\r', "\n"=>'\\n'));
@@ -7205,7 +7242,7 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
* @param int $cleanalsojavascript Remove also occurence of 'javascript:'. * @param int $cleanalsojavascript Remove also occurence of 'javascript:'.
* @param int $allowiframe Allow iframe tags. * @param int $allowiframe Allow iframe tags.
* @param array $allowed_tags List of allowed tags to replace the default list * @param array $allowed_tags List of allowed tags to replace the default list
* @param int $allowlink Allow link tags. * @param int $allowlink Allow "link" tags.
* @return string String cleaned * @return string String cleaned
* *
* @see dol_htmlwithnojs() dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags() * @see dol_htmlwithnojs() dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags()

View File

@@ -325,7 +325,7 @@ if (empty($reshook)) {
} }
} }
if ($action == 'update' && $user->rights->expensereport->creer) { if (($action == 'update' || $action == 'updateFromRefuse') && $user->rights->expensereport->creer) {
$object = new ExpenseReport($db); $object = new ExpenseReport($db);
$object->fetch($id); $object->fetch($id);

View File

@@ -180,7 +180,7 @@ class Odf
// Check if the value includes html tags // Check if the value includes html tags
if ($this->_hasHtmlTag($value) === true) { if ($this->_hasHtmlTag($value) === true) {
$value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); $value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter
// Default styles for strong/b, i/em, u, s, sub & sup // Default styles for strong/b, i/em, u, s, sub & sup
$automaticStyles = array( $automaticStyles = array(

View File

@@ -588,8 +588,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<td class="nowrap">'.$prod->getNomUrl(1, '').'</td>'; print '<td class="nowrap">'.$prod->getNomUrl(1, '').'</td>';
// Product label // Product label
print '<td>'.$objp->label; print '<td>';
print '<input type="hidden" name="desc'.$i.'" value="'.dol_escape_htmltag($objp->description).'">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST print dol_escape_htmltag($objp->label);
print '</td>'; print '</td>';
if ($mode == 'future') { if ($mode == 'future') {