Clean code

This commit is contained in:
Laurent Destailleur 2023-06-29 11:20:19 +02:00
parent f058a6fc46
commit a5d5847e04
4 changed files with 35 additions and 14 deletions

View file

@ -168,14 +168,17 @@ if (isModEnabled('facture')) {
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("INVOICE_ADD_SWISS_QR_CODE"), $langs->trans("INVOICE_ADD_SWISS_QR_CODEMore"));
if (getDolGlobalString('INVOICE_ADD_ZATCA_QR_CODE') == 'bottom') {
print $form->textwithpicto($langs->trans("INVOICE_ADD_SWISS_QR_CODE"), $langs->trans("INVOICE_ADD_SWISS_QR_CODEMore"));
} else {
print $langs->trans("INVOICE_ADD_SWISS_QR_CODE");
}
print '</td><td>';
//if ($conf->use_javascript_ajax) {
// print ajax_constantonoff('INVOICE_ADD_SWISS_QR_CODE');
//} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"), 'bottom' => $langs->trans("AtBottomOfPage").' ('.$langs->trans("Experimental").' - Need PHP 8.1+)');
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
if (getDolGlobalString('MAIN_FEATURE_LEVEL') >= 1) {
$arrval['bottom'] = $langs->trans("AtBottomOfPage").' ('.$langs->trans("Experimental").' - Need PHP 8.1+)';
}
print $form->selectarray("INVOICE_ADD_SWISS_QR_CODE", $arrval, $conf->global->INVOICE_ADD_SWISS_QR_CODE);
//}
print '</td></tr>';
// Mention category of operations

View file

@ -800,16 +800,22 @@ class Fichinter extends CommonObject
* @param string $option Options
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param string $morecss Add more css on link
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
{
global $conf, $langs, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
}
$result = '';
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
@ -841,20 +847,32 @@ class Fichinter extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
$linkstart = '<a href="'.$url.'"';
if ($option == 'nolink' || empty($url)) {
$linkstart = '<span';
} else {
$linkstart = '<a href="'.$url.'"';
}
$linkstart .= $linkclose.'>';
$linkend = '</a>';
if ($option == 'nolink' || empty($url)) {
$linkend = '</span>';
} else {
$linkend = '</a>';
}
$result .= $linkstart;
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
}
$result .= $linkend;
global $action;

View file

@ -330,8 +330,8 @@ DiscountFromExcessPaid=Payments in excess of invoice %s
AbsoluteDiscountUse=This kind of credit can be used on invoice before its validation
CreditNoteDepositUse=Invoice must be validated to use this kind of credits
NewGlobalDiscount=New absolute discount
NewSupplierGlobalDiscount=New supplier absolute discount
NewClientGlobalDiscount=New client absolute discount
NewSupplierGlobalDiscount=New absolute supplier discount
NewClientGlobalDiscount=New absolute client discount
NewRelativeDiscount=New relative discount
DiscountType=Discount type
NoteReason=Note/Reason

View file

@ -315,7 +315,7 @@ ErrorUploadFileDragDropPermissionDenied=There was an error while the file(s) upl
ErrorFixThisHere=<a href="%s">Fix this here</a>
ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup=Error: The URL of you current instance (%s) does not match the URL defined into your OAuth2 login setup (%s). Doing OAuth2 login in such a configuration is not allowed.
ErrorMenuExistValue=A Menu already exist with this Title or URL
ErrorSVGFilesNotAllowedAsLinksWithout=SVG files are not allowed as external links without option %s
ErrorSVGFilesNotAllowedAsLinksWithout=SVG files are not allowed as external links without the option %s
ErrorTypeMenu=Impossible to add another menu for the same module on the navbar, not handle yet
# Warnings