diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 26441727d5d..39eb2b5888d 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,13 +9,13 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 410+ occurrences - // PhanTypeMismatchArgument : 65+ occurrences - // PhanUndeclaredGlobalVariable : 55+ occurrences - // PhanTypeMismatchArgumentNullable : 20+ occurrences + // PhanUndeclaredProperty : 400+ occurrences + // PhanTypeMismatchArgument : 60+ occurrences + // PhanUndeclaredGlobalVariable : 50+ occurrences // PhanTypeMismatchProperty : 20+ occurrences - // PhanTypeInvalidDimOffset : 15+ occurrences + // PhanTypeInvalidDimOffset : 10+ occurrences // PhanTypeMismatchDimFetch : 10+ occurrences + // PhanTypeMismatchArgumentNullable : 7 occurrences // PhanTypeArraySuspiciousNull : 5 occurrences // PhanTypeExpectedObjectPropAccess : 5 occurrences // PhanUndeclaredMethod : 5 occurrences @@ -39,14 +39,11 @@ return [ 'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/list.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'], - 'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/class/paymentvarious.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/bank/line.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/various_payment/card.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/compta/bank/various_payment/info.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/compta/clients.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/facture/card-rec.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'], @@ -56,7 +53,6 @@ return [ 'htdocs/compta/paiement/card.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/paiement/cheque/list.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement/rapport.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/prelevement/card.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/resultat/clientfourn.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/resultat/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/resultat/projects.php' => ['PhanTypeMismatchArgument'], @@ -73,7 +69,7 @@ return [ 'htdocs/core/class/CMailFile.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/canvas.class.php' => ['PhanUndeclaredMethod'], 'htdocs/core/class/cgenericdic.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], + 'htdocs/core/class/commonobject.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/conf.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/core/class/ctyperesource.class.php' => ['PhanUndeclaredProperty'], @@ -98,19 +94,14 @@ return [ 'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], 'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanTypeMismatchArgumentNullable'], 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/core/modules/expedition/doc/pdf_rouget.modules.php' => ['PhanTypeMismatchArgumentNullable'], + 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php' => ['PhanTypeMismatchArgumentNullable'], + 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable'], @@ -119,16 +110,16 @@ return [ 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchProperty'], - 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchProperty'], + 'htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginDuplicateArrayKey'], 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/multicompany_page.php' => ['PhanTypeMismatchArgument'], @@ -142,7 +133,6 @@ return [ 'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'], 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'], 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanUndeclaredProperty'], 'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'], 'htdocs/expensereport/card.php' => ['PhanUndeclaredProperty'], @@ -240,7 +230,6 @@ return [ 'htdocs/ticket/card.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/class/actions_ticket.class.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'], 'htdocs/user/class/user.class.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/user/class/usergroup.class.php' => ['PhanUndeclaredProperty'], 'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredProperty'], @@ -249,7 +238,6 @@ return [ 'htdocs/webhook/target_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/webportal/admin/setup.php' => ['PhanTypeMismatchArgument'], 'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/webservices/server_project.php' => ['PhanUndeclaredProperty'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 3febe0711b2..8da71c84da8 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -414,7 +414,9 @@ if ($action == 'set' && $user->admin) { // We made some check against evil eternal modules that try to low security options. $checkOldValue = getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE'); $csrfCheckOldValue = getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN'); - $resarray = activateModule($value); + + $resarray = activateModule($value, 1, 0, 'acceptredirect'); + if ($checkOldValue != getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE')) { setEventMessage($langs->trans('WarningModuleHasChangedLastVersionCheckParameter', $value), 'warnings'); } @@ -458,8 +460,11 @@ if ($action == 'set' && $user->admin) { if ($result) { setEventMessages($result, null, 'errors'); header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); + exit; } - $resarray = activateModule($value, 0, 1); + + $resarray = activateModule($value, 0, 1, 'acceptredirect'); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1), 'chaine', 0, '', $conf->entity); if (!empty($resarray['errors'])) { setEventMessages('', $resarray['errors'], 'errors'); diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 24ec3b36b15..555dcd665db 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -261,7 +261,7 @@ foreach ($syslogModules as $moduleName) { $value = (isset($option['default']) ? $option['default'] : ''); } - print ''.$option['name'].': '; + print ''.$option['name'].': '; if (!empty($option['example'])) { print '
'.$langs->trans("Example").': '.dol_escape_htmltag($option['example']); } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 0e8a6c6f2ed..5408d60f963 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -3316,7 +3316,7 @@ class Setup extends DolibarrApi $objMod = new $modName($db); //$name = strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); if ($state) { - activateModule($modulename); + activateModule($modulename, 1, 0); return array('result' => 'success', 'message' => 'Module '.$this->db->escape($modulename).' activated'); } else { unActivateModule($modulename); diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 8ac8f8cf139..6702dbeefde 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -177,7 +177,7 @@ print ''; print "\n"; print ''; -print ''; +print ''; print $langs->trans("CompanyInitialKey").''; print $block_static->getOrInitFirstSignature(); print ''; @@ -239,7 +239,7 @@ print ''; print ''; -print ''; +print ''; print $langs->trans("ListOfTrackedEvents").''; $arrayoftrackedevents = $block_static->trackedevents; foreach ($arrayoftrackedevents as $key => $val) { diff --git a/htdocs/blockedlog/admin/registration.php b/htdocs/blockedlog/admin/registration.php index 256bb795850..0c3dea38d1b 100644 --- a/htdocs/blockedlog/admin/registration.php +++ b/htdocs/blockedlog/admin/registration.php @@ -230,6 +230,8 @@ if ($withtab) { print ''.$langs->trans("BlockedLogDesc")."
\n"; +print '
'; + // Show version print '
'.$langs->trans("CurrentVersion").' '.DOL_VERSION.'
'; diff --git a/htdocs/blockedlog/lib/blockedlog.lib.php b/htdocs/blockedlog/lib/blockedlog.lib.php index 10f8b37c41a..59896d67d32 100644 --- a/htdocs/blockedlog/lib/blockedlog.lib.php +++ b/htdocs/blockedlog/lib/blockedlog.lib.php @@ -185,12 +185,16 @@ function isALNEQualifiedVersion($ignoredev = 0, $ignoremodule = 0) */ function isALNERunningVersion($blockedlogtestalreadydone = 0) { - // For Debug help: Constant set by developer to force all LNE restrictions even if country is not France so we can test them on any dev instance. - // Note that you can force, with this option, the enabling of the LNE restrictions, but there is no way to force the disabling of the LNE restriction. - if (defined('CERTIF_LNE') && (int) constant('CERTIF_LNE') === 2) { + // For Debug help: Constant set by developer to force all LNE restrictions + // even if country is not France so we can test them on any dev instance. + // Note that you can force, with this option, the enabling of the LNE restrictions, + // but there is no way to force the disabling of the LNE restriction. + if (defined('CERTIF_LNE') && (int) constant('CERTIF_LNE') === 2 + && isModEnabled('blockedlog') && ($blockedlogtestalreadydone || isBlockedLogUsed())) { return true; } - if (isModEnabled('blockedlog') && ($blockedlogtestalreadydone || isBlockedLogUsed())) { + if (defined('CERTIF_LNE') && (int) constant('CERTIF_LNE') === 1 + && isModEnabled('blockedlog') && ($blockedlogtestalreadydone || isBlockedLogUsed())) { return true; } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 9a57473f144..22668734d78 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -75,7 +75,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, if ($action == 'validate' && $user->hasRight('deplacement', 'creer')) { $object->fetch($id); if ($object->statut == Deplacement::STATUS_DRAFT) { - $result = $object->setStatut(1); + $result = $object->setStatut(Deplacement::STATUS_REFUNDED, null, '', 'DELIVERY_MODIFY'); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; @@ -86,7 +86,7 @@ if ($action == 'validate' && $user->hasRight('deplacement', 'creer')) { } elseif ($action == 'classifyrefunded' && $user->hasRight('deplacement', 'creer')) { $object->fetch($id); if ($object->statut == Deplacement::STATUS_VALIDATED) { - $result = $object->setStatut(Deplacement::STATUS_REFUNDED); + $result = $object->setStatut(Deplacement::STATUS_REFUNDED, null, '', 'DELIVERY_MODIFY'); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; diff --git a/htdocs/compta/prelevement/requests.php b/htdocs/compta/prelevement/requests.php index d447dbe9f27..2784f43b6d6 100644 --- a/htdocs/compta/prelevement/requests.php +++ b/htdocs/compta/prelevement/requests.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -255,11 +255,11 @@ if ($id > 0 || $ref) { print '
'; print ''; print ''; - print $form->selectDate($object->date_trans ? $object->date_trans : -1, 'date_trans', 0, 0, 0, "setdate_trans"); + print $form->selectDate($object->date_trans, 'date_trans', 0, 0, 0, "setdate_trans"); // $object->date_trans can't be empty due to test some lines ago print ''; print '
'; } else { - print $object->date_trans ? dol_print_date($object->date_trans, 'day') : ''; + print dol_print_date($object->date_trans, 'day'); // $object->date_trans can't be empty due to test some lines ago print '   '.$langs->trans("By").' '.$muser->getNomUrl(-1).''; } print ''; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index f0665421552..ec8cbefbec5 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1190,10 +1190,11 @@ function purgeSessions($mysessionid) * * @param string $value Name of module to activate (modModuleName) * @param int $withdeps Activate/Disable also all dependencies - * @param int $noconfverification Remove verification of $conf variable for module + * @param int $noconfverification Remove verification of $conf->global->MODULE_NAME variable for module + * @param string $options Option for init * @return array{nbmodules?:int,errors:string[],nbperms?:int} array('nbmodules'=>nb modules activated with success, 'errors=>array of error messages, 'nbperms'=>Nb permission added); */ -function activateModule($value, $withdeps = 1, $noconfverification = 0) +function activateModule($value, $withdeps = 1, $noconfverification = 0, $options = '') { global $db, $langs, $conf, $mysoc; @@ -1256,7 +1257,7 @@ function activateModule($value, $withdeps = 1, $noconfverification = 0) } } - $result = $objMod->init(); // Enable module + $result = $objMod->init($options); // Enable module if ($result <= 0) { $ret['errors'][] = $objMod->error; @@ -1281,7 +1282,7 @@ function activateModule($value, $withdeps = 1, $noconfverification = 0) $activateerr = ''; foreach ($modulesdir as $dir) { if (file_exists($dir.$modulestring.".class.php")) { - $resarray = activateModule($modulestring); + $resarray = activateModule($modulestring, 1, 0, $options); if (empty($resarray['errors'])) { $activate = true; } else { @@ -1630,7 +1631,7 @@ function activateModulesRequiredByCountry($country_code) if ($modulequalified) { // Load languages files of module if (isset($objMod->automatic_activation[$country_code])) { - activateModule($modName); + activateModule($modName, 1, 0); setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings'); } diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 0ec28ddb60a..718f32cc899 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -357,7 +357,7 @@ class pdf_espadon extends ModelePdfExpedition $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber") . " : " . $object->tracking_number, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); - $object->getUrlTrackingStatus($object->tracking_number); + $object->getUrlTrackingStatus((string) $object->tracking_number); if (!empty($object->tracking_url)) { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey @@ -532,7 +532,7 @@ class pdf_espadon extends ModelePdfExpedition $barcode_path = ''; $result = 0; if ($module->encodingIsSupported($encoding)) { - $result = $module->writeBarCode($object->ref, $encoding); + $result = $module->writeBarCode((string) $object->ref, $encoding); // get path of qrcode image $newcode = (string) $object->ref; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 598e3791b0f..1a1bd057e00 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -630,7 +630,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetTextColor(0, 0, 0); if (!empty($object->tracking_number)) { - $object->getUrlTrackingStatus($object->tracking_number); + $object->getUrlTrackingStatus((string) $object->tracking_number); if (!empty($object->tracking_url)) { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index f03bcf92ca5..404d0f62777 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -379,7 +379,7 @@ class pdf_rouget extends ModelePdfExpedition $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); - $object->getUrlTrackingStatus($object->tracking_number); + $object->getUrlTrackingStatus((string) $object->tracking_number); if (!empty($object->tracking_url)) { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey @@ -433,7 +433,7 @@ class pdf_rouget extends ModelePdfExpedition $barcode_path = ''; $result = 0; if ($module->encodingIsSupported($encoding)) { - $result = $module->writeBarCode($object->ref, $encoding); + $result = $module->writeBarCode((string) $object->ref, $encoding); // get path of qrcode image $newcode = (string) $object->ref; diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index f44c7c68da5..ff72534e896 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -175,7 +175,7 @@ class modBlockedLog extends DolibarrModules $b = new BlockedLog($this->db); // forceinit can be set to bypass this redirection - if (isALNEQualifiedVersion(1, 1) && $options != 'forceinit') { + if (isALNEQualifiedVersion(1, 1) && $options == 'acceptredirect') { // We first switch on registration page header("Location: ".DOL_URL_ROOT.'/blockedlog/admin/registration.php?origin=initmodule&withtab=0'); exit; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 9ebbaf54e55..3603140d5cf 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -389,7 +389,7 @@ class pdf_squille extends ModelePdfReception $barcode_path = ''; $result = 0; if ($module->encodingIsSupported($encoding)) { - $result = $module->writeBarCode($object->ref, $encoding); + $result = $module->writeBarCode((string) $object->ref, $encoding); // get path of qrcode image $newcode = (string) $object->ref; diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index ba0101d1356..f1bea3c9e57 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -451,7 +451,7 @@ class pdf_eagle extends ModelePDFStockTransfer $barcode_path = ''; $result = 0; if ($module->encodingIsSupported($encoding)) { - $result = $module->writeBarCode($object->ref, $encoding); + $result = $module->writeBarCode((string) $object->ref, $encoding); // get path of qrcode image $newcode = (string) $object->ref; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index e59eafa0559..2b1f9f1dd6f 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -25,7 +25,7 @@ */ /** - * \file htdocs/core/modules/supplir_proposal/doc/pdf_zenith.modules.php + * \file htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php * \ingroup fournisseur * \brief File of class to generate suppliers proposals from zenith model */ diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index caa992891d2..46a0cb78ac0 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -120,7 +120,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers $this->setErrorsFromObject($newobject); } else { if (empty($object->fk_account) && !empty($object->thirdparty->fk_account) && !getDolGlobalInt('BANK_ASK_PAYMENT_BANK_DURING_ORDER')) { - $ret = $newobject->setBankAccount($object->thirdparty->fk_account, 1, $user); + $ret = $newobject->setBankAccount((int) $object->thirdparty->fk_account, 1, $user); if ($ret < 0) { $this->setErrorsFromObject($newobject); } @@ -147,7 +147,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + if ($this->shouldClassify($conf, $totalonlinkedelements, (float) $object->total_ht)) { foreach ($object->linkedObjects['propal'] as $element) { /** @var Propal $element */ $ret = $element->classifyBilled($user); @@ -312,7 +312,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + if ($this->shouldClassify($conf, $totalonlinkedelements, (float) $object->total_ht)) { foreach ($object->linkedObjects['order_supplier'] as $element) { /** @var CommandeFournisseur $element */ $ret = $element->classifyBilled($user); @@ -336,7 +336,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + if ($this->shouldClassify($conf, $totalonlinkedelements, (float) $object->total_ht)) { foreach ($object->linkedObjects['supplier_proposal'] as $element) { /** @var SupplierProposal $element */ $ret = $element->classifyBilled($user); @@ -415,7 +415,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + if ($this->shouldClassify($conf, $totalonlinkedelements, (float) $object->total_ht)) { foreach ($object->linkedObjects['commande'] as $element) { /** @var Commande $element */ $ret = $element->classifyBilled($user); diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index f40d29ed420..c442199b7ba 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -25,7 +25,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; - /** * Class of triggered functions for agenda module */ @@ -91,6 +90,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers } if ($action === 'PAYMENT_CUSTOMER_CREATE' && $object->element == 'payment') { + include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; if (isALNERunningVersion() && $mysoc->country_code == 'FR') { if (empty($object->paiementcode) && !empty($object->paiementid)) { $object->paiementcode = dol_getIdFromCode($this->db, $object->paiementid, 'c_paiement', 'id', 'code', 1); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 098836dd042..9bd745eabbe 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1551,7 +1551,7 @@ class EmailCollector extends CommonObject //$search.=($search?' ':'').'SINCE 8-Apr-2022'; } - dol_syslog("IMAP search string = ".var_export($criteria, true)); + dol_syslog("IMAP search string = ".formatLogObject($criteria)); $search = var_export($criteria, true); } else { // Use native IMAP functions diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 303e1c41f8f..f256fda9907 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -652,7 +652,7 @@ if (empty($reshook)) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); $result = $object->cancel($user, 0, (bool) $also_update_stock); if ($result > 0) { - $result = $object->setStatut(-1); + $result = $object->setStatut(Expedition::STATUS_CANCELED); } else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -668,7 +668,7 @@ if (empty($reshook)) { // TODO add alternative status //} elseif ($action == 'reopen' && ($user->hasRight('expedition', 'creer') || $user->hasRight('expedition', 'shipping_advance', 'validate'))) //{ - // $result = $object->setStatut(0); + // $result = $object->setStatut(Expedition::STATUS_DRAFT); // if ($result < 0) // { // setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index d91025a4217..f403eaa82d6 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -984,7 +984,7 @@ if (empty($reshook)) { $object = new ExpenseReport($db); $object->fetch($id); if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid || in_array($object->fk_user_author, $childids)) { - $result = $object->setStatut(0); + $result = $object->setStatut(ExpenseReport::STATUS_DRAFT); if ($result > 0) { // Define output language diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index c15150a25b3..6840ff5fd6b 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -610,7 +610,7 @@ class ExpenseReports extends DolibarrApi throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->expensereport->setStatut(0); + $result = $this->expensereport->setStatut(ExpenseReport::STATUS_DRAFT); if ($result == 0) { throw new RestException(304, 'Error nothing done. May be object is already draft'); } diff --git a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql index 3d585c7b8d0..5f1e9db93de 100644 --- a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql +++ b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql @@ -137,4 +137,7 @@ ALTER TABLE llx_usergroup ADD COLUMN fk_parent integer DEFAULT NULL AFTER entity ALTER TABLE llx_usergroup ADD INDEX idx_usergroup_fk_parent (fk_parent); ALTER TABLE llx_usergroup ADD CONSTRAINT fk_usergroup_parent FOREIGN KEY (fk_parent) REFERENCES llx_usergroup (rowid); +-- Force change password next time +ALTER TABLE llx_user ADD COLUMN force_pass_change TINYINT DEFAULT 0 AFTER pass_temp; + -- end of migration diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 11fdafa3ecf..1ef00f09e26 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -41,6 +41,7 @@ create table llx_user pass varchar(128), pass_crypted varchar(128), pass_temp varchar(128), -- temporary password when asked for forget password or 'hashtoallowreset:YYYMMDDHHMMSS' (where date is max date of validity) + force_pass_change tinyint DEFAULT 0, -- 1 if user must change password at next login api_key varchar(128), -- key to use REST API by this user gender varchar(10), civility varchar(6), @@ -86,7 +87,7 @@ create table llx_user last_main_doc varchar(255), -- relative filepath+filename of last main generated document datelastlogin datetime, datepreviouslogin datetime, - datelastpassvalidation datetime, -- last date we change password or we made a disconnect all + datelastpassvalidation datetime, -- last date we change password or we made a disconnect all. Open session with a start date before this date will be disabled. datestartvalidity datetime, dateendvalidity datetime, flagdelsessionsbefore datetime DEFAULT NULL, -- set this to a date if we need to launch an external process to invalidate all sessions for the same login created before this date diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 745f8899a7d..9f6abc39c25 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2726,7 +2726,7 @@ if ($action == 'set' && $user->admin /* && $user->hasRight("modulebuilder", "run $param .= '&tabobj='.urlencode($tabobj); $value = GETPOST('value', 'alpha'); - $resarray = activateModule($value); + $resarray = activateModule($value, 1, 0); if (!empty($resarray['errors'])) { setEventMessages('', $resarray['errors'], 'errors'); } else { diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 9952a5a6d2f..aee14eb6b7e 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -949,16 +949,17 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $companypaymentmode->status = $servicestatus; $db->begin(); - if (!$error) { - $result = $companypaymentmode->update($user); - if ($result < 0) { - $error++; - } + + $result = $companypaymentmode->update($user); + if ($result < 0) { + $error++; } + if (!$error) { $db->commit(); } else { $db->rollback(); + http_response_code(500); return -1; } @@ -1130,7 +1131,7 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P */ // Add a flag "dispute_status" in invoice table to Dispute Open - $result = $tmpinvoice->setStatut(1, null, '', 'FACTURE_MODIFY', 'dispute_status'); + $result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'FACTURE_MODIFY', 'dispute_status'); if ($result < 0) { $errormsg = $tmpinvoice->error.implode(', ', $tmpinvoice->errors); $error++; @@ -1207,7 +1208,7 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P if (!$error) { // Add status dispute_status to Dispute Open - $result = $tmpinvoice->setStatut(1, null, '', 'FACTURE_MODIFY', 'dispute_status'); + $result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'FACTURE_MODIFY', 'dispute_status'); if ($result < 0) { $errormsg = $tmpinvoice->error.implode(', ', $tmpinvoice->errors); $error++; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index e72de94a6a5..c14d2d7a752 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -596,7 +596,7 @@ if (empty($reshook)) { // TODO add alternative status /*} elseif ($action == 'reopen' && ($user->hasRights('reception', 'creer') || $user->hasRights('reception', 'reception_advance', 'validate'))) { - $result = $object->setStatut(0); + $result = $object->setStatut(Reception::STATUS_DRAFT); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); }*/ diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 4d54f76858a..6304d927909 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -208,6 +208,7 @@ class Reception extends CommonObject */ public $detail_batch; + const STATUS_CANCELED = -1; const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; const STATUS_CLOSED = 2; @@ -1501,7 +1502,7 @@ class Reception extends CommonObject $origin_object->loadReceptions(); //var_dump($this->$origin->receptions);exit; if (count($origin_object->receptions) <= 0) { - $origin_object->setStatut(3); // ordered + $origin_object->setStatut(3); // CommandeFournisseur ordered } } } @@ -2438,7 +2439,7 @@ class Reception extends CommonObject } //var_dump($this->$origin->receptions);exit; if ($setStatut) { - $this->origin_object->setStatut(3); // ordered + $this->origin_object->setStatut(3); // CommandeFournisseur ordered } } } diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index d37eef57626..d2b49a0ae63 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -80,7 +80,7 @@ if (GETPOST('action', 'alpha') == 'set') { dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); // TakePOS connector require ReceiptPrinter module if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && !isModEnabled('receiptprinter')) { - activateModule("modReceiptPrinter"); + activateModule("modReceiptPrinter", 1, 0); } } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index cf4c724e88f..d5ac4c886f8 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -635,7 +635,7 @@ if (empty($reshook)) { if ($object->fetch(GETPOSTINT('id'), GETPOST('track_id', 'alpha')) >= 0) { $new_status = GETPOSTINT('new_status'); //$old_status = $object->status; - $res = $object->setStatut($new_status); + $res = $object->setStatut($new_status, null, '', $triggermodname); if ($res) { $url = 'card.php?track_id=' . $object->track_id; header("Location: " . $url); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4af646e2ce3..21a3cea83b9 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -3068,9 +3068,9 @@ class Ticket extends CommonObject if ((getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER', -1) < 0 && ($object->status < self::STATUS_IN_PROGRESS && !$user->socid && !$private)) || ($object->status > self::STATUS_IN_PROGRESS && $public_area)) { - $object->setStatut($object::STATUS_IN_PROGRESS); + $object->setStatut($object::STATUS_IN_PROGRESS, null, '', 'TICKET_MODIFY'); } elseif (getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER', -1) >= 0 && empty($user->socid) && empty($private)) { - $object->setStatut(getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER')); + $object->setStatut(getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER'), null, '', 'TICKET_MODIFY'); } return 1; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index e095f04700f..178b97b2417 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -298,7 +298,7 @@ if (empty($reshook)) { $result = $objecttmp->fetch($toselectid); if ($result > 0) { if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) { - $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED); + $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED, null, '', 'TICKET_MODIFY'); if ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; diff --git a/htdocs/version.inc.php b/htdocs/version.inc.php index 558dfa710ce..41b589a34ab 100644 --- a/htdocs/version.inc.php +++ b/htdocs/version.inc.php @@ -43,6 +43,8 @@ define('DOL_VERSION', constant('DOL_MAJOR_VERSION').'.'.constant('DOL_MINOR_VERS // DOL_VERSION is now a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c // Set to 1 if the beta version is the candidate for certification or if the stable version has been certified. -// Use 2 to force LNE features for debug purposes (https not required in this mode) +// Use 2 to force LNE features for debug purposes, without less restrictions: Same than 1 but https not required in this mode // Unset for standard version. -define('CERTIF_LNE', '2'); +//if (!defined('CERTIF_LNE')) { + define('CERTIF_LNE', '2'); +//} diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php index 8fabb9b80ea..ad22d790dcd 100644 --- a/test/phpunit/CommonClassTest.class.php +++ b/test/phpunit/CommonClassTest.class.php @@ -188,7 +188,7 @@ abstract class CommonClassTest extends TestCase if ($nbLinesToShow) { print "\n"; - print "## We try to output the last ".$nbLinesToShow." lines of the log file ".basename($this->logfile)." (that has ".$totalLines." lines)".PHP_EOL; + print "########## We try to output the last ".$nbLinesToShow." lines of the log file ".basename($this->logfile)." (that has ".$totalLines." lines)".PHP_EOL; $newLines = count($last_lines); if ($newLines > 0) { // Show partial log file contents when requested. @@ -196,7 +196,7 @@ abstract class CommonClassTest extends TestCase foreach ($last_lines as $line) { print $line.PHP_EOL; } - print "## end of dolibarr.log for $className::$failedTestMethod".PHP_EOL; + print "########## end of dolibarr.log for $className::$failedTestMethod".PHP_EOL; } else { print "## No new lines in 'dolibarr.log' since start of this test.".PHP_EOL; } @@ -207,7 +207,7 @@ abstract class CommonClassTest extends TestCase $logFile = '/var/log/apache2/travis_error_log'; // Check if the file exists and is readable - if (file_exists($logFile) && is_readable($logFile)) { + if (@file_exists($logFile) && is_readable($logFile)) { // Read the file into an array $lines = file($logFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); @@ -215,13 +215,13 @@ abstract class CommonClassTest extends TestCase $lastFiveLines = array_slice($lines, -10); // Print the last 5 lines - print "\n"; + print "Content of ".$logFile."\n"; echo "Last 5 lines of $logFile:\n"; foreach ($lastFiveLines as $line) { echo $line . "\n"; } } else { - echo "File $logFile does not exist or is not readable so we can't show more information.\n"; + //echo "File $logFile does not exist or is not readable so we can't show more information.\n"; }