Skip to content

Commit

Permalink
Merge branch 'develop' into classfiles/2
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy authored Oct 26, 2024
2 parents 2586fca + 57fa017 commit 069965e
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 105 deletions.
3 changes: 2 additions & 1 deletion htdocs/admin/debugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2007 Rodolphe Quiedeville <[email protected]>
* Copyright (C) 2013 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -60,7 +61,7 @@
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($error, null, 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/fckeditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
print '<br>';

if (empty($conf->use_javascript_ajax)) {
setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors');
setEventMessages(null, array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), 'errors');
} else {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
Expand Down
71 changes: 38 additions & 33 deletions htdocs/core/actions_extrafields.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
* \brief Code for actions on extrafields admin pages
*/

/** @var ExtraFields $extrafields */
$maxsizestring = 255;
$maxsizeint = 10;
$mesg = array();
$mesg = '';
$mesgs = array();

$extrasize = GETPOST('size', 'intcomma');
$type = GETPOST('type', 'alphanohtml');
Expand Down Expand Up @@ -69,61 +71,61 @@
if (!$type) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
$action = 'create';
}
if ($type == 'varchar' && $extrasize <= 0) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
$action = 'edit';
}
if ($type == 'varchar' && $extrasize > $maxsizestring) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
$mesgs[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
$action = 'create';
}
if ($type == 'int' && $extrasize > $maxsizeint) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
$mesgs[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
$action = 'create';
}
if ($type == 'stars' && ($extrasize < 1 || $extrasize > 10)) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorSizeForStarsType");
$mesgs[] = $langs->trans("ErrorSizeForStarsType");
$action = 'create';
}
if ($type == 'select' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForSelectType");
$mesgs[] = $langs->trans("ErrorNoValueForSelectType");
$action = 'create';
}
if ($type == 'sellist' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForSelectListType");
$mesgs[] = $langs->trans("ErrorNoValueForSelectListType");
$action = 'create';
}
if ($type == 'checkbox' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForCheckBoxType");
$mesgs[] = $langs->trans("ErrorNoValueForCheckBoxType");
$action = 'create';
}
if ($type == 'link' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForLinkType");
$mesgs[] = $langs->trans("ErrorNoValueForLinkType");
$action = 'create';
}
if ($type == 'radio' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForRadioType");
$mesgs[] = $langs->trans("ErrorNoValueForRadioType");
$action = 'create';
}
if ((($type == 'radio') || ($type == 'checkbox')) && $param) {
Expand All @@ -136,13 +138,13 @@
if (count($matches[0]) > 1) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$action = 'create';
}
} else {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$action = 'create';
}
}
Expand All @@ -153,7 +155,7 @@
if (strlen(GETPOST('attrname', 'aZ09')) < 3) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3);
$mesgs[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3);
$action = 'create';
}
}
Expand All @@ -163,7 +165,7 @@
if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords)) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09'));
$mesgs[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09'));
$action = 'create';
}
}
Expand Down Expand Up @@ -233,17 +235,18 @@
} else {
$error++;
$mesg = $extrafields->error;
setEventMessages($mesg, null, 'errors');
$mesgs = array_merge($mesgs, $extrafields->errors);
setEventMessages($mesg, $mesgs, 'errors');
}
} else {
$error++;
$langs->load("errors");
$mesg = $langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters", $langs->transnoentities("AttributeCode"));
setEventMessages($mesg, null, 'errors');
setEventMessages($mesg, $mesgs, 'errors');
$action = 'create';
}
} else {
setEventMessages($mesg, null, 'errors');
setEventMessages($mesg, $mesgs, 'errors');
}
}
}
Expand All @@ -255,55 +258,55 @@
if (!$type) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
$action = 'edit';
}
if ($type == 'varchar' && $extrasize <= 0) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
$action = 'edit';
}
if ($type == 'varchar' && $extrasize > $maxsizestring) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
$mesgs[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
$action = 'edit';
}
if ($type == 'int' && $extrasize > $maxsizeint) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
$mesgs[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
$action = 'edit';
}
if ($type == 'select' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForSelectType");
$mesgs[] = $langs->trans("ErrorNoValueForSelectType");
$action = 'edit';
}
if ($type == 'sellist' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForSelectListType");
$mesgs[] = $langs->trans("ErrorNoValueForSelectListType");
$action = 'edit';
}
if ($type == 'stars' && ($extrasize < 1|| $extrasize > 10)) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorSizeForStarsType");
$mesgs[] = $langs->trans("ErrorSizeForStarsType");
$action = 'edit';
}
if ($type == 'checkbox' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForCheckBoxType");
$mesgs[] = $langs->trans("ErrorNoValueForCheckBoxType");
$action = 'edit';
}
if ($type == 'radio' && !$param) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorNoValueForRadioType");
$mesgs[] = $langs->trans("ErrorNoValueForRadioType");
$action = 'edit';
}
if ((($type == 'radio') || ($type == 'checkbox')) && $param) {
Expand All @@ -316,13 +319,13 @@
if (count($matches[0]) > 1) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$action = 'edit';
}
} else {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$mesgs[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
$action = 'edit';
}
}
Expand All @@ -333,7 +336,7 @@
if (strlen(GETPOST('attrname', 'aZ09')) < 3 && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3);
$mesgs[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3);
$action = 'edit';
}
}
Expand All @@ -343,7 +346,7 @@
if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords) && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) {
$error++;
$langs->load("errors");
$mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09'));
$mesgs[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09'));
$action = 'edit';
}
}
Expand Down Expand Up @@ -416,7 +419,8 @@
} else {
$error++;
$mesg = $extrafields->error;
setEventMessages($mesg, null, 'errors');
$mesgs = array_merge($mesgs, $extrafields->errors);
setEventMessages($mesg, $mesgs, 'errors');
}
} else {
$error++;
Expand All @@ -425,7 +429,7 @@
setEventMessages($mesg, null, 'errors');
}
} else {
setEventMessages($mesg, null, 'errors');
setEventMessages($mesg, $mesgs, 'errors');
}
}
}
Expand All @@ -443,6 +447,7 @@
exit;
} else {
$mesg = $extrafields->error;
$mesgs = array_merge($mesgs, $extrafields->errors);
}
} else {
$error++;
Expand Down
9 changes: 5 additions & 4 deletions htdocs/core/lib/functionsnumtoword.lib.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2015 Laurent Destailleur <[email protected]>
* Copyright (C) 2015 Víctor Ortiz Pérez <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
/* Copyright (C) 2015 Laurent Destailleur <[email protected]>
* Copyright (C) 2015 Víctor Ortiz Pérez <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -139,7 +140,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false)
$concatWords .= ' '.$langs->transnoentities('and');
}

$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
$concatWords .= ' '.dol_convertToWord((float) $decimalpart, $langs, '', true);
if (!empty($currency)) {
$concatWords .= ' '.$langs->transnoentities('centimes');
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/lib/invoice.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function invoice_rec_prepare_head($object)
$obj = $db->fetch_object($resql);
$nbFacture = $obj->nb;
} else {
dol_syslog('Failed to count facture with facture_rec '.$db->lasterror(), LOG_ERR);
dol_syslog('Failed to count invoices with invoice model '.$db->lasterror(), LOG_ERR);
}
if ($nbFacture > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbFacture.'</span>';
Expand Down Expand Up @@ -391,7 +391,7 @@ function supplier_invoice_rec_prepare_head($object)
$obj = $db->fetch_object($resql);
$nbFactureFourn = $obj->nb;
} else {
dol_syslog('Failed to count facture with facture fournisseur model '.$db->lasterror(), LOG_ERR);
dol_syslog('Failed to count invoices with supplier invoice model '.$db->lasterror(), LOG_ERR);
}
if ($nbFactureFourn > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbFactureFourn.'</span>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/printing/modules_printing.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2014-2023 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2014-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/printing/printgcp.modules.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2014-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2014-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,8 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
/**
* Show total to pay
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param TCPDF $pdf Object PDF
* @param StockTransfer $object Object StockTransfer
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
* @param Translate $outputlangs Object langs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param CommandeFournisseur $object Object to show
* @param CommandeFournisseur $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return integer
Expand Down Expand Up @@ -793,8 +793,8 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
* Show total to pay
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $deja_regle Montant deja regle
* @param CommandeFournisseur $object Object CommandeFournisseur
* @param int $deja_regle Amount already paid
* @param int $posy Position depart
* @param Translate $outputlangs Object langs
* @return int Position pour suite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ protected function _tableau_cheque(&$pdf, $object, $posy, $outputlangs)

// translate amount
$currency = $conf->currency;
$translateinletter = strtoupper(dol_convertToWord(price2num($object->amount, 'MT'), $outputlangs, $currency));
$translateinletter = strtoupper(dol_convertToWord((float) price2num($object->amount, 'MT'), $outputlangs, $currency));
$pdf->SetXY($this->marge_gauche + 50, $posy);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell(90, 8, $translateinletter, 0, 'L', 1);
Expand Down
Loading

0 comments on commit 069965e

Please sign in to comment.