diff --git a/dev/tools/github_lines_byuser.sh b/dev/tools/github_lines_byuser.sh
index fc5bd0597bd..591d74688d4 100755
--- a/dev/tools/github_lines_byuser.sh
+++ b/dev/tools/github_lines_byuser.sh
@@ -3,7 +3,6 @@
# Count number of lines modified per user for a given branch
#
-# shellcheck disable=2002,2086,2268
DEBUG=${DEBUG:=0}
if [ "$2" = "" ]; then
@@ -21,9 +20,13 @@ if [ "$START" = "START.." ]; then
START=""
fi
-[ "$DEBUG" ] && echo "git log '${START}${END}' --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
-git log "${START}${END}" --shortstat --use-mailmap | iconv -f UTF-8 -t ASCII//TRANSLIT | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp
+TMPFILE=/tmp/github_lines_perusers.tmp
+
+[ "$DEBUG" ] && echo "git log '${START}${END}' --shortstat --use-mailmap | grep ... | perl ... > '${TMPFILE}'"
+git log "${START}${END}" --shortstat --use-mailmap | iconv -f UTF-8 -t ASCII//TRANSLIT --byte-subst='?' -c | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > "${TMPFILE}"
echo "Users and nb of lines";
-cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; lastuser=""; } { if ($1 ~ /^Author:/) { sub(/<.*/, ""); lastuser=tolower($1) }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' | sort
+awk < "${TMPFILE}" 'BEGIN { FS="\n"; lastuser=""; } { if ($1 ~ /^Author:/) { sub(/<.*/, ""); lastuser=tolower($1) }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' | sort
+# Clean up
+rm "${TMPFILE}"
diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php
index f71f1736a33..fc869901f01 100644
--- a/htdocs/core/class/html.formcontract.class.php
+++ b/htdocs/core/class/html.formcontract.class.php
@@ -63,7 +63,7 @@ class FormContract
* @param string $morecss More CSS
* @return int Nbr of contract if OK, <0 if KO
*/
- public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0, $morecss = 'minwidth150')
+ public function select_contract($socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0, $morecss = 'minwidth150')
{
// phpcs:enable
global $user, $conf, $langs;
@@ -190,7 +190,7 @@ class FormContract
* @param int $noouput 1=Return the output instead of display
* @return string|void html string
*/
- public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0)
+ public function formSelectContract($page, $socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0)
{
global $langs;
diff --git a/htdocs/core/class/html.formexpensereport.class.php b/htdocs/core/class/html.formexpensereport.class.php
index 4eb12e64d2f..a94e076a3ba 100644
--- a/htdocs/core/class/html.formexpensereport.class.php
+++ b/htdocs/core/class/html.formexpensereport.class.php
@@ -59,7 +59,7 @@ class FormExpenseReport
* @param int $useshortlabel Use short labels
* @return string HTML select with status
*/
- public function selectExpensereportStatus($selected = '', $htmlname = 'fk_statut', $useempty = 1, $useshortlabel = 0)
+ public function selectExpensereportStatus($selected = 0, $htmlname = 'fk_statut', $useempty = 1, $useshortlabel = 0)
{
global $langs;
@@ -74,7 +74,7 @@ class FormExpenseReport
$arrayoflabels = $tmpep->labelStatusShort;
}
foreach ($arrayoflabels as $key => $val) {
- if ($selected != '' && $selected == $key) {
+ if (!empty($selected) && $selected == $key) {
$html .= '