diff --git a/.travis.yml b/.travis.yml index 44d784ea091..a260c31e3f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,23 +93,26 @@ install: echo - | - echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" + echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION" if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then composer -n require phpunit/phpunit ^5 \ php-parallel-lint/php-parallel-lint ^1 \ php-parallel-lint/php-console-highlighter ^0 \ + php-parallel-lint/php-var-dump-check ~0.4 \ squizlabs/php_codesniffer ^3 fi if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then composer -n require phpunit/phpunit ^6 \ php-parallel-lint/php-parallel-lint ^1 \ php-parallel-lint/php-console-highlighter ^0 \ + php-parallel-lint/php-var-dump-check ~0.4 \ squizlabs/php_codesniffer ^3 fi if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then composer -n require phpunit/phpunit ^7 \ php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-console-highlighter ^0 \ + php-parallel-lint/php-var-dump-check ~0.4 \ squizlabs/php_codesniffer ^3 fi # phpunit 9 is required for php 8 @@ -117,6 +120,7 @@ install: composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-console-highlighter ^0 \ + php-parallel-lint/php-var-dump-check ~0.4 \ squizlabs/php_codesniffer ^3 fi echo @@ -166,6 +170,10 @@ before_script: which phpcs phpcs --version | head - phpcs -i | head - + # Check PHP Vardump check version + echo "PHP Vardump check version" + which var_dump_check + var_dump_check --version # Check PHPUnit version echo "PHPUnit version" which phpunit @@ -297,6 +305,17 @@ script: set +e echo +- | + echo "Checking missing debug" + # Ensure we catch errors + set -e + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php . + fi + set +e + echo + - | export INSTALL_FORCED_FILE=htdocs/install/install.forced.php echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 204988c5442..cbfecbbc19f 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -275,6 +275,13 @@ RESTLER: with $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); + +* Replace CommentParser.php line 423 + elseif (count($value) && is_numeric($value[0])) + + with + + elseif (count($value) && isset($value[0]) && is_numeric($value[0])) +With swagger 2 provided into /explorer: diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 61e131ff47d..a1c145840a9 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -540,7 +540,7 @@ if ($action == 'create') { print ''; print ''; - // Date document creation + // Date document export print ''; print ''.$langs->trans("DateExport").''; print ''; @@ -548,7 +548,7 @@ if ($action == 'create') { print ''; print ''; - // Date document creation + // Date document validation print ''; print ''.$langs->trans("DateValidation").''; print ''; @@ -607,6 +607,7 @@ if ($action == 'create') { print '
'; $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -647,11 +648,14 @@ if ($action == 'create') { print "\n"; - // Empty line is the first line of $object->linesmvt - // So we must get the first line (the empty one) and put it at the end of the array - // in order to display it correctly to the user - $empty_line = array_shift($object->linesmvt); - $object->linesmvt[]= $empty_line; + // Add an empty line if there is not yet + if (!empty($object->linesmvt[0])) { + $tmpline = $object->linesmvt[0]; + if (!empty($tmpline->numero_compte)) { + $line = new BookKeepingLine(); + $object->linesmvt[] = $line; + } + } foreach ($object->linesmvt as $line) { print ''; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 28c35016054..8cccef2d342 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -741,11 +741,11 @@ class AccountingAccount extends CommonObject global $hookmanager; // Instantiate hooks for external modules - $hookmanager->initHooks(array('accoutancyBindingCalculation')); + $hookmanager->initHooks(array('accountancyBindingCalculation')); - // Execute hook accoutancyBindingCalculation + // Execute hook accountancyBindingCalculation $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount, $type); - $reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('accountancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { $const_name = ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index d01ad89293f..992b885f272 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -606,9 +606,13 @@ class BookKeeping extends CommonObject if (empty($this->credit)) { $this->credit = 0; } + if (empty($this->montant)) { + $this->montant = 0; + } $this->debit = price2num($this->debit, 'MT'); $this->credit = price2num($this->credit, 'MT'); + $this->montant = price2num($this->montant, 'MT'); $now = dol_now(); @@ -1661,11 +1665,10 @@ class BookKeeping extends CommonObject $this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_ref = $obj->doc_ref; $this->doc_type = $obj->doc_type; - $this->date_creation = $obj->date_creation; - $this->date_modification = $obj->date_modification; - $this->date_export = $obj->date_export; - $this->date_validation = $obj->date_validated; - $this->date_validation = $obj->date_validation; + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_modification = $this->db->jdate($obj->date_modification); + $this->date_export = $this->db->jdate($obj->date_export); + $this->date_validation = $this->db->jdate($obj->date_validation); } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(__METHOD__.$this->error, LOG_ERR); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 18277eb6751..99ae0bd845b 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -86,7 +86,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S print ''.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."\n"; print "
"; -} elseif ($conf->accounting->enabled) { +} elseif (!empty($conf->accounting->enabled)) { $step = 0; $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index e46b508512d..d350e2243a2 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -38,7 +38,7 @@ $validatemonth = GETPOST('validatemonth', 'int'); $validateyear = GETPOST('validateyear', 'int'); // Security check -if (empty($conf->accounting->enabled)) { +if (!isModEnabled('accounting')) { accessforbidden(); } if ($user->socid > 0) { @@ -75,7 +75,7 @@ $action = GETPOST('action', 'aZ09'); $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); // Security check -if (empty($conf->accounting->enabled)) { +if (!isModEnabled('accounting')) { accessforbidden(); } if ($user->socid > 0) { diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index bae229bc77b..80092ea96a5 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -108,7 +108,7 @@ if ($action == 'set_default') { $res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); // Use vat for invoice creation - if (!empty($conf->facture->enabled)) { + if (isModEnabled('facture')) { $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { @@ -241,10 +241,10 @@ $arraychoices = array('0'=>$langs->trans("None")); if (!empty($conf->banque->enabled)) { $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect"); } -if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { +if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly"); } -if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { +if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice"); } print ''; @@ -256,7 +256,7 @@ print ''; print "\n"; // Use vat for invoice creation -if (!empty($conf->facture->enabled)) { +if (isModEnabled('facture')) { print ''.$langs->trans("VATToUseForSubscriptions").''; if (!empty($conf->banque->enabled)) { print ''; diff --git a/htdocs/adherents/admin/member_extrafields.php b/htdocs/adherents/admin/member_extrafields.php index 7f5262bc7c6..210e6213d6f 100644 --- a/htdocs/adherents/admin/member_extrafields.php +++ b/htdocs/adherents/admin/member_extrafields.php @@ -84,7 +84,7 @@ print dol_get_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { print '
'; - print '
".$langs->trans("NewAttribute").'
'; + print ''.$langs->trans("NewAttribute").''; print "
"; } diff --git a/htdocs/adherents/admin/member_type_extrafields.php b/htdocs/adherents/admin/member_type_extrafields.php index 68916df624f..c643d6e15d4 100644 --- a/htdocs/adherents/admin/member_type_extrafields.php +++ b/htdocs/adherents/admin/member_type_extrafields.php @@ -87,7 +87,7 @@ print dol_get_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { print '
'; - print '
".$langs->trans("NewAttribute").'
'; + print ''.$langs->trans("NewAttribute").''; print "
"; } diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 0a6abcd4955..5aeb3a281cf 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -162,11 +162,11 @@ if ($object->id > 0) { $newcardbutton = ''; - if (!empty($conf->agenda->enabled)) { + if (isModEnabled('agenda')) { $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).($object->id > 0 ? '?id='.$object->id : '').'&origin=member&originid='.$id); } - if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { print '
'; $param = '&id='.$id; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 88a63af0ae1..d7e46749de3 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -285,7 +285,7 @@ if (empty($reshook)) { $object->lastname = trim(GETPOST("lastname", 'alphanohtml')); $object->gender = trim(GETPOST("gender", 'alphanohtml')); $object->login = trim(GETPOST("login", 'alphanohtml')); - $object->pass = trim(GETPOST("pass", 'alpha')); + $object->pass = trim(GETPOST("pass", 'none')); // For password, we must use 'none' $object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated $object->company = trim(GETPOST("societe", 'alphanohtml')); @@ -450,8 +450,8 @@ if (empty($reshook)) { $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL)); $login = GETPOST("member_login", 'alphanohtml'); - $pass = GETPOST("password", 'alpha'); - $photo = GETPOST("photo", 'alpha'); + $pass = GETPOST("password", 'none'); // For password, we use 'none' + $photo = GETPOST("photo", 'alphanohtml'); $morphy = GETPOST("morphy", 'alphanohtml'); $public = GETPOST("public", 'alphanohtml'); @@ -999,7 +999,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generated_password = getRandomPassword(false); print ''.$langs->trans("Password").''; - print ''; + print ''; print ''; } @@ -1224,7 +1224,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Password").'pass).'">'; + print ''.$langs->trans("Password").'pass).'">'; } // Morphy $morphys["phy"] = $langs->trans("Physical"); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 1cfbb80f65b..cf0ad445c92 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -831,11 +831,11 @@ if ($rowid > 0) { $bankviainvoice = 1; } } else { - if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { + if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { $bankviainvoice = 1; } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) { $bankdirect = 1; - } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { + } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { $invoiceonly = 1; } } @@ -982,7 +982,7 @@ if ($rowid > 0) { print '">'; // Complementary action - if ((!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { + if ((!empty($conf->banque->enabled) || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { $company = new Societe($db); if ($object->fk_soc) { $result = $company->fetch($object->fk_soc); @@ -1003,7 +1003,7 @@ if ($rowid > 0) { print '>
'; } // Add invoice with no payments - if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { + if (!empty($conf->societe->enabled) && isModEnabled('facture')) { print 'fk_soc)) print ' disabled'; print '>
'; } // Add invoice with payments - if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { + if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { print 'fk_soc)) print ' disabled'; print '>