diff --git a/.gitignore b/.gitignore index e4790fe7b4e..e935ec1bd59 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,8 @@ htdocs/includes/sebastian/ htdocs/includes/squizlabs/ htdocs/includes/webmozart/ htdocs/.well-known/apple-developer-merchantid-domain-association +/factory/ +/output/ # Node Modules build/yarn-error.log @@ -55,4 +57,3 @@ yarn.lock package-lock.json doc/install.lock -/factory/ diff --git a/build/docker/docker-run.sh b/build/docker/docker-run.sh index e57d9adfad0..4e69ea4a3a2 100644 --- a/build/docker/docker-run.sh +++ b/build/docker/docker-run.sh @@ -1,4 +1,6 @@ #!/bin/bash +# Script used by the Dockerfile. +# See README.md to know how to create a Dolibarr env with docker usermod -u ${HOST_USER_ID} www-data groupmod -g ${HOST_USER_ID} www-data diff --git a/dev/tools/detectnotabfiles.sh b/dev/tools/detectnotabfiles.sh index c89b999b03d..ed4df5e50d8 100755 --- a/dev/tools/detectnotabfiles.sh +++ b/dev/tools/detectnotabfiles.sh @@ -10,6 +10,7 @@ # Syntax if [ "x$1" != "xlist" -a "x$1" != "xfix" ] then + echo "Detect .sh and .spec files that does not contains any tab inside" echo "Usage: fixnotabfiles.sh [list|fix]" fi diff --git a/dev/tools/fixdosfiles.sh b/dev/tools/fixdosfiles.sh index 4be867aea98..e5e5d97b554 100755 --- a/dev/tools/fixdosfiles.sh +++ b/dev/tools/fixdosfiles.sh @@ -17,14 +17,14 @@ fi # To detec if [ "x$1" = "xlist" ] then - find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF -# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF + find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF +# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF fi # To convert if [ "x$1" = "xfix" ] then - for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' ` + for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' ` do echo "Fix file $fic" dos2unix "$fic" diff --git a/dev/tools/optimize_images.sh b/dev/tools/optimize_images.sh index dd538c5e1aa..89717063006 100755 --- a/dev/tools/optimize_images.sh +++ b/dev/tools/optimize_images.sh @@ -39,13 +39,14 @@ optimize_image() max_input_size=$(expr $max_input_size + $input_file_size) if [ "${1##*.}" = "png" ]; then - #optipng -o1 -clobber -quiet $1 -out $2.firstpass - optipng -o1 -quiet $1 -out $2.firstpass - pngcrush -q -rem alla -reduce $2.firstpass $2 >/dev/null - rm -fr $2.firstpass + #optipng -o1 -clobber -quiet "$1" -out "$2.firstpass" + echo optipng -o1 -quiet "$1" -out "$2.firstpass" + optipng -o1 -quiet "$1" -out "$2.firstpass" + pngcrush -q -rem alla -reduce "$2.firstpass" "$2" >/dev/null + rm -fr "$2.firstpass" fi if [ "${1##*.}" = "jpg" -o "${1##*.}" = "jpeg" ]; then - jpegtran -copy none -progressive $1 > $2 + jpegtran -copy none -progressive "$1" > $2 fi output_file_size=$(stat -c%s "$2") @@ -120,8 +121,8 @@ main() # Search of all jpg/jpeg/png in $INPUT # We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT - echo "Scan $INPUT to find images" - IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v $OUTPUT) + echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v $OUTPUT" + IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT) if [ "$QUIET" == "0" ]; then echo --- Optimizing $INPUT --- @@ -135,11 +136,11 @@ main() printf '%*.*s' 0 $((linelength - ${#filename} - ${#sDone} )) "$pad" fi - optimize_image $CURRENT_IMAGE $OUTPUT/$filename + optimize_image "$CURRENT_IMAGE" "$OUTPUT/$filename" # Replace file if [[ "$INPLACE" == "1" ]]; then - mv $OUTPUT/$filename $CURRENT_IMAGE + mv "$OUTPUT/$filename" "$CURRENT_IMAGE" fi if [ "$QUIET" == "0" ]; then diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index d805838566f..c8948b05012 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -281,7 +281,7 @@ class AccountingJournal extends CommonObject } $label_link = $this->code; - if ($withlabel) { + if ($withlabel && !empty($this->label)) { $label_link .= ' - '.($nourl ? '' : '').$langs->transnoentities($this->label).($nourl ? '' : ''); } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index a0a7d7bba0a..36efd3bc7d1 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1826,7 +1826,7 @@ class Adherent extends CommonObject if (!$error) { // Create payment line for invoice $paiement_id = $paiement->create($user); - if (!$paiement_id > 0) { + if (!($paiement_id > 0)) { $this->error = $paiement->error; $this->errors = $paiement->errors; $error++; diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 5567e741272..6e0a6e9085f 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -66,7 +66,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) { $value = (GETPOST($code) ? GETPOST($code) : 1); $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; $errors[] = $db->lasterror(); } @@ -86,7 +86,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; $res = dolibarr_del_const($db, $code, $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; $errors[] = $db->lasterror(); } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index a2db7bf8fcf..31d0776da6b 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -142,7 +142,7 @@ if ($action == 'updateMask') { $value = GETPOST('activate_hideClosedServiceByDefault', 'alpha'); $res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity); - if (!$res1 > 0 || !$res2 > 0 || !$res3 > 0) { + if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0)) { $error++; } diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index e662c0576a2..c002c9059d7 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -59,12 +59,12 @@ if ($action == 'set') { if (!$error) { $res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity); - if (!$res1 > 0) { + if (!($res1 > 0)) { $error++; } $res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity); - if (!$res2 > 0) { + if (!($res2 > 0)) { $error++; } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index c3c58984dc0..5902402674d 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -141,7 +141,7 @@ if ($action == 'updateMask') { $draft = GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha'); $res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res1 > 0 || !$res2 > 0) { + if (!($res1 > 0) || !($res2 > 0)) { $error++; } diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 00daaf01e27..f9b5b37ec4d 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -77,7 +77,7 @@ if ($action == 'setconst' && $user->admin) { $constnote = dol_escape_htmltag($setupconst['note']); $result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity); - if (!$result > 0) { + if (!($result > 0)) { $error++; } } @@ -96,7 +96,7 @@ if ($action == 'setvalue' && $user->admin) { $db->begin(); $result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity); - if (!$result > 0) { + if (!($result > 0)) { $error++; } diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index 0e504ec26f1..099312ef491 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -78,9 +78,10 @@ if ($action == 'updateMask') { $maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha'); $maskstocktransfer = GETPOST('maskStockTransfer', 'alpha'); - if ($maskconststocktransfer) $res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity); - - if (!$res > 0) $error++; + if ($maskconststocktransfer) { + $res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity); + if ($res <= 0) $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index f24afc0700b..af833e7e257 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -361,7 +361,7 @@ if (GETPOST('save') && !$cancel && !empty($user->rights->banque->modifier)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); } - if (!$bankaccountid > 0) { + if (!($bankaccountid > 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 21a082e9491..4c728adbfc8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -618,7 +618,7 @@ class Account extends CommonObject $this->error = $this->db->lasterror(); $this->db->rollback(); - return -3; + return -4; } } @@ -630,7 +630,7 @@ class Account extends CommonObject $this->errors = $accline->errors; $this->db->rollback(); - return -2; + return -5; } } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 30d4f4ce825..2be668fac5c 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -250,6 +250,7 @@ if ($date_endyear) { print '
| '.$langs->trans("Income").' | '; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht_income, 'MT')).' | '; +} else { + print ''; } print ' | '.price(price2num($total_ttc_income, 'MT')).' | '; print '|
| '.$langs->trans("Outcome").' | '; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num(-$total_ht_outcome, 'MT')).' | '; +} else { + print ''; } print ' | '.price(price2num(-$total_ttc_outcome, 'MT')).' | '; print '|
| '.$langs->trans("Profit").' | '; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht, 'MT')).' | '; +} else { + print ''; } print ' | '.price(price2num($total_ttc, 'MT')).' | '; print '|