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

This commit is contained in:
Laurent Destailleur 2024-01-15 02:54:59 +01:00
commit d85ab489f5
5 changed files with 15 additions and 12 deletions

View file

@ -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}"

View file

@ -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;

View file

@ -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 .= '<option value="'.$key.'" selected>';
} else {
$html .= '<option value="'.$key.'">';
@ -97,7 +97,7 @@ class FormExpenseReport
* @param int $active 1=Active only, 0=Unactive only, -1=All
* @return string Select html
*/
public function selectTypeExpenseReport($selected = '', $htmlname = 'type', $showempty = 0, $active = 1)
public function selectTypeExpenseReport($selected = 0, $htmlname = 'type', $showempty = 0, $active = 1)
{
// phpcs:enable
global $langs, $user;

View file

@ -31,7 +31,7 @@ class Diff
*
* @param string $string1 First string
* @param string $string2 Second string
* @param string $compareCharacters true to compare characters, and false to compare lines; this optional parameter defaults to false
* @param boolean $compareCharacters true to compare characters, and false to compare lines; this optional parameter defaults to false
* @return array Array of diff
*/
public static function compare($string1, $string2, $compareCharacters = false)

View file

@ -214,11 +214,11 @@ class ExpenseReportRule extends CommonObject
* Return all rules or filtered by something
*
* @param int $fk_c_type_fees type of expense
* @param integer $date date of expense
* @param int|string $date date of expense
* @param int $fk_user user of expense
* @return array Array with ExpenseReportRule
*/
public function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '')
public function getAllRule($fk_c_type_fees = 0, $date = '', $fk_user = 0)
{
$rules = array();