';
diff --git a/htdocs/admin/tools/ui/class/documentation.class.php b/htdocs/admin/tools/ui/class/documentation.class.php
index 584f6c36a7f9c..4de7133c9e620 100644
--- a/htdocs/admin/tools/ui/class/documentation.class.php
+++ b/htdocs/admin/tools/ui/class/documentation.class.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,6 +58,7 @@ class Documentation
* Constructor
*
* @param DoliDB $db Database handler
+ * @return void
*/
public function __construct(DoliDB $db)
{
@@ -75,7 +77,6 @@ public function __construct(DoliDB $db)
*/
private function setMenu()
{
-
global $hookmanager;
@@ -223,7 +224,8 @@ public function docFooter()
}
/**
- * Output sidebar
+ * Output sidebar
+ *
* @return void
*/
public function showSidebar()
@@ -312,7 +314,8 @@ public function showBreadcrumb()
}
/**
- * Output summary
+ * Output summary
+ *
* @param int $showsubmenu Show Sub menus: 0 = No, 1 = Yes
* @param int $showsubmenu_summary Show summary of sub menus: 0 = No, 1 = Yes
* @return void
@@ -320,6 +323,7 @@ public function showBreadcrumb()
public function showSummary($showsubmenu = 1, $showsubmenu_summary = 1)
{
$i = 0;
+ $menu_entry = [];
if (!empty($this->view)) :
// On se place au bon niveau
foreach ($this->view as $view) {
@@ -384,16 +388,16 @@ public function displaySummary($menu, $level = 0, $showsubmenu = 1, $showsubmenu
* Output a View Code area
*
* @param array $lines Lines of code to show
+ * @param string $option Source code language ('html', 'php' etc)
* @return void
*/
- public function showCode($lines = array())
+ public function showCode($lines = array(), $option = 'html')
{
- print '
';
}
}
diff --git a/htdocs/admin/tools/ui/components/badges.php b/htdocs/admin/tools/ui/components/badges.php
index e47b8090ce4fc..0d147b603bea2 100644
--- a/htdocs/admin/tools/ui/components/badges.php
+++ b/htdocs/admin/tools/ui/components/badges.php
@@ -1,36 +1,39 @@
+ * Copyright (C) 2024 Frédéric France
*
- * This program and files/directory inner it is free software: you can
- * redistribute it and/or modify it under the terms of the
- * GNU Affero General Public License (AGPL) as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AGPL for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU AGPL
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-$res=0;
-if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
-endif;
+// Load Dolibarr environment
+require '../../../../main.inc.php';
+
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ */
// Protection if external user
-if ($user->socid > 0) : accessforbidden();
-endif;
+if ($user->socid > 0) {
+ accessforbidden();
+}
// Includes
-dol_include_once('admin/tools/ui/class/documentation.class.php');
+require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@@ -38,8 +41,13 @@
//
$documentation = new Documentation($db);
+$morejs = [
+ '/includes/ace/src/ace.js',
+ '/includes/ace/src/ext-statusbar.js',
+ '/includes/ace/src/ext-language_tools.js',
+];
// Output html head + body - Param is Title
-$documentation->docHeader('Badges');
+$documentation->docHeader('Badges', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@@ -49,7 +57,7 @@
$documentation->showSidebar(); ?>
-
+
showBreadCrumb(); ?>
@@ -310,4 +318,4 @@
docFooter();
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/admin/tools/ui/components/buttons.php b/htdocs/admin/tools/ui/components/buttons.php
index 1ad142730f09f..0fe09e06d027a 100644
--- a/htdocs/admin/tools/ui/components/buttons.php
+++ b/htdocs/admin/tools/ui/components/buttons.php
@@ -1,45 +1,52 @@
+ * Copyright (C) 2024 Frédéric France
*
- * This program and files/directory inner it is free software: you can
- * redistribute it and/or modify it under the terms of the
- * GNU Affero General Public License (AGPL) as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AGPL for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU AGPL
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-$res=0;
-if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
-endif;
+// Load Dolibarr environment
+require '../../../../main.inc.php';
+
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ */
// Protection if external user
-if ($user->socid > 0) : accessforbidden();
-endif;
+if ($user->socid > 0) {
+ accessforbidden();
+}
// Includes
-dol_include_once('admin/tools/ui/class/documentation.class.php');
+require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
//
$documentation = new Documentation($db);
-
+$morejs = [
+ '/includes/ace/src/ace.js',
+ '/includes/ace/src/ext-statusbar.js',
+ '/includes/ace/src/ext-language_tools.js',
+];
// Output html head + body - Param is Title
-$documentation->docHeader('Buttons');
+$documentation->docHeader('Buttons', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@@ -128,7 +135,7 @@
' */',
'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);',
);
- echo $documentation->showCode($lines); ?>
+ echo $documentation->showCode($lines, 'php'); ?>
-
-
-
-
-
-
diff --git a/htdocs/admin/tools/ui/components/event-message.php b/htdocs/admin/tools/ui/components/event-message.php
index 98e3080c7d30f..f612f05a0c2dd 100644
--- a/htdocs/admin/tools/ui/components/event-message.php
+++ b/htdocs/admin/tools/ui/components/event-message.php
@@ -1,37 +1,39 @@
+ * Copyright (C) 2024 Frédéric France
*
- * This program and files/directory inner it is free software: you can
- * redistribute it and/or modify it under the terms of the
- * GNU Affero General Public License (AGPL) as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AGPL for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU AGPL
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-$res=0;
-if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
-endif;
+// Load Dolibarr environment
+require '../../../../main.inc.php';
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ */
// Protection if external user
-if ($user->socid > 0) : accessforbidden();
-endif;
+if ($user->socid > 0) {
+ accessforbidden();
+}
// Includes
-dol_include_once('admin/tools/ui/class/documentation.class.php');
+require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@@ -55,9 +57,13 @@
//
$documentation = new Documentation($db);
-
+$morejs = [
+ '/includes/ace/src/ace.js',
+ '/includes/ace/src/ext-statusbar.js',
+ '/includes/ace/src/ext-language_tools.js',
+];
// Output html head + body - Param is Title
-$documentation->docHeader('SetEventMessages');
+$documentation->docHeader('SetEventMessages', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@@ -121,7 +127,7 @@
'setEventMessages("message", null);',
'setEventMessages(null, messages[]);',
);
- echo $documentation->showCode($lines); ?>
+ echo $documentation->showCode($lines, 'php'); ?>
@@ -156,11 +162,12 @@
showCode($lines); ?>
+ echo $documentation->showCode($lines, 'php'); ?>
diff --git a/htdocs/admin/tools/ui/components/index.php b/htdocs/admin/tools/ui/components/index.php
index 32af131fb91c0..409d96d22a73c 100644
--- a/htdocs/admin/tools/ui/components/index.php
+++ b/htdocs/admin/tools/ui/components/index.php
@@ -1,36 +1,39 @@
+ * Copyright (C) 2024 Frédéric France
*
- * This program and files/directory inner it is free software: you can
- * redistribute it and/or modify it under the terms of the
- * GNU Affero General Public License (AGPL) as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AGPL for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU AGPL
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-$res=0;
-if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
-endif;
+// Load Dolibarr environment
+require '../../../../main.inc.php';
+
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ */
// Protection if external user
-if ($user->socid > 0) : accessforbidden();
-endif;
+if ($user->socid > 0) {
+ accessforbidden();
+}
// Includes
-dol_include_once('admin/tools/ui/class/documentation.class.php');
+require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@@ -48,7 +51,7 @@
$documentation->showSidebar(); ?>
-
+
showBreadCrumb(); ?>
@@ -56,11 +59,11 @@
trans('DocComponentsTitle'); ?>
trans('DocComponentsMainDescription'); ?>
- showSummary(); ?>
+ showSummary(); ?>
docFooter();
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/admin/tools/ui/components/progress-bars.php b/htdocs/admin/tools/ui/components/progress-bars.php
index f860fabb5798d..fda0b0527fc42 100644
--- a/htdocs/admin/tools/ui/components/progress-bars.php
+++ b/htdocs/admin/tools/ui/components/progress-bars.php
@@ -1,36 +1,39 @@
+ * Copyright (C) 2024 Frédéric France
*
- * This program and files/directory inner it is free software: you can
- * redistribute it and/or modify it under the terms of the
- * GNU Affero General Public License (AGPL) as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AGPL for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU AGPL
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-$res=0;
-if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
-endif;
+// Load Dolibarr environment
+require '../../../../main.inc.php';
+
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ */
// Protection if external user
-if ($user->socid > 0) : accessforbidden();
-endif;
+if ($user->socid > 0) {
+ accessforbidden();
+}
// Includes
-dol_include_once('admin/tools/ui/class/documentation.class.php');
+require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@@ -38,8 +41,13 @@
//
$documentation = new Documentation($db);
+$morejs = [
+ '/includes/ace/src/ace.js',
+ '/includes/ace/src/ext-statusbar.js',
+ '/includes/ace/src/ext-language_tools.js',
+];
// Output html head + body - Param is Title
-$documentation->docHeader('Progress-bars');
+$documentation->docHeader('Progress-bars', $morejs);
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
@@ -247,6 +255,7 @@
' ',
'',
'',
+ '',
);
echo $documentation->showCode($lines); ?>
diff --git a/htdocs/admin/tools/ui/components/test_arrays.php b/htdocs/admin/tools/ui/components/test_arrays.php
index 8954e0cd7a309..0e02e1b88855d 100644
--- a/htdocs/admin/tools/ui/components/test_arrays.php
+++ b/htdocs/admin/tools/ui/components/test_arrays.php
@@ -1,17 +1,43 @@
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
// Load Dolibarr environment
-@include '../../main.inc.php';
+require '../../../../main.inc.php';
+
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ *
+ * @var int $dolibarr_main_prod
+ */
// Security
if ($dolibarr_main_prod) {
accessforbidden('Access forbidden when $dolibarr_main_prod is set to 1');
}
+// Protection if external user
+if ($user->socid > 0) {
+ accessforbidden();
+}
-
+$optioncss = GETPOST('optioncsss', 'alpha');
/*
* View
@@ -19,7 +45,9 @@
$form = new Form($db);
-$usedolheader = 1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header
+// 1 = Test inside a dolibarr page, 0 = Use hard coded header
+// Using a dolibarr constant avoid phpstan hardcoded value always true or false
+$usedolheader = getDolGlobalInt('MAIN_TEST_UI_IN_DOLIBARR_PAGE', 1);
// HEADER
//--------
@@ -163,15 +191,14 @@
$productspecimen->initAsSpecimen();
$object = $productspecimen;
$param = '';
-$actioncode = '';
-$status = '';
-$filter = '';
-$filtert = '';
-$socid = 0;
-$type = 0;
-$usergroup = 0;
-
-$sortfield = 'aaa';
+$actioncode = getDolGlobalString('MAIN_TEST_UI_ACTION_CODE'); // '' by default
+$status = getDolGlobalString('MAIN_TEST_UI_STATUS'); // '' by default;
+$filter = getDolGlobalString('MAIN_TEST_UI_FILTER'); // '' by default;
+$filtert = getDolGlobalString('MAIN_TEST_UI_FILTERT'); // '' by default;
+$socid = getDolGlobalInt('MAIN_TEST_UI_SOCID', 0); // 0 by default;
+$type = getDolGlobalInt('MAIN_TEST_UI_TYPE', 0); // 0 by default;
+$usergroup = getDolGlobalInt('MAIN_TEST_UI_USERGROUP', 0); // 0 by default;
+$sortfield = getDolGlobalString('MAIN_TEST_UI_SORTFIELD', 'aaa'); // 'aaa' by default;
$sortorder = 'ASC';
$tasksarray = array(1, 2, 3); // To force having several lines
$tagidfortablednd = 'tablelines3';
@@ -242,18 +269,16 @@
$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
$moreforfilter .= '';
-if (!empty($moreforfilter)) {
- print '
';
- print $moreforfilter;
- $parameters = array();
- $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- print '
';
-}
+print '
';
+print $moreforfilter;
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+print '
';
?>
-
" id="tablelines3">
+
" id="tablelines3">
trans('title1'), 0, $_SERVER["PHP_SELF"], 'aaa', '', '', 'align="left"', $sortfield, $sortorder); ?>
diff --git a/htdocs/admin/tools/ui/components/test_buttons.php b/htdocs/admin/tools/ui/components/test_buttons.php
index 8eef7aa0b6cd9..449196c25a233 100644
--- a/htdocs/admin/tools/ui/components/test_buttons.php
+++ b/htdocs/admin/tools/ui/components/test_buttons.php
@@ -1,4 +1,20 @@
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
@@ -25,9 +41,18 @@
}
session_cache_limiter('public');
-require_once '../../main.inc.php';
+require '../../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ *
+ * @var int $dolibarr_main_prod
+ */
+
// Security
if ($dolibarr_main_prod) {
accessforbidden();
@@ -129,7 +154,7 @@
$url = '#'.$id;
$userRight = 1;
$params = array(
- 'confirm' => true
+ 'confirm' => [],
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);
@@ -142,13 +167,13 @@
$url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id;
$params = array(
- 'confirm' => array(
+ 'confirm' => array(
'url' => 'your confirm action url',
'title' => 'Your title to display',
'action-btn-label' => 'Your confirm label',
'cancel-btn-label' => 'Your cancel label',
- 'content' => 'Content to display with HTML compatible
test 01
test 02
test 03
'
- )
+ 'content' => 'Content to display with HTML compatible
'
- )
+ 'content' => 'Content to display with HTML compatible
test 01
test 02
test 03
',
+ )
);
print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);
diff --git a/htdocs/admin/tools/ui/components/test_forms.php b/htdocs/admin/tools/ui/components/test_forms.php
index 60f351eb9948d..60c32389b0de7 100644
--- a/htdocs/admin/tools/ui/components/test_forms.php
+++ b/htdocs/admin/tools/ui/components/test_forms.php
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
//define("NOLOGIN",1); // This means this output page does not require to be logged.
/*if (!defined('NOSESSION')) {
@@ -21,9 +22,18 @@
}*/
// Load Dolibarr environment
-require '../../main.inc.php';
+require '../../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ *
+ * @var int $dolibarr_main_prod
+ */
+
// Security
if ($dolibarr_main_prod) {
accessforbidden('Access forbidden when $dolibarr_main_prod is set to 1');
diff --git a/htdocs/admin/tools/ui/content/tables.php b/htdocs/admin/tools/ui/content/tables.php
index 00fd9bbf666f0..9ab70ba6f3826 100644
--- a/htdocs/admin/tools/ui/content/tables.php
+++ b/htdocs/admin/tools/ui/content/tables.php
@@ -1,32 +1,31 @@
+ * Copyright (C) 2024 Frédéric France
*
- * This program and files/directory inner it is free software: you can
- * redistribute it and/or modify it under the terms of the
- * GNU Affero General Public License (AGPL) as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AGPL for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU AGPL
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-$res=0;
-if (! $res && file_exists("../../main.inc.php")) {
- $res=@include '../../main.inc.php';
-}
-if (! $res && file_exists("../../../main.inc.php")) {
- $res=@include '../../../main.inc.php';
-}
-if (! $res && file_exists("../../../../main.inc.php")) {
- $res=@include '../../../../main.inc.php';
-}
+// Load Dolibarr environment
+require '../../../../main.inc.php';
+
+/**
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ */
// Protection if external user
if ($user->socid > 0) {
@@ -34,7 +33,7 @@
}
// Includes
-dol_include_once('admin/tools/ui/class/documentation.class.php');
+require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
diff --git a/htdocs/admin/tools/ui/index.php b/htdocs/admin/tools/ui/index.php
index 2e64da27e4ed0..76baca72436c7 100644
--- a/htdocs/admin/tools/ui/index.php
+++ b/htdocs/admin/tools/ui/index.php
@@ -1,36 +1,38 @@
+ * Copyright (C) 2024 Frédéric France
*
- * This program and files/directory inner it is free software: you can
- * redistribute it and/or modify it under the terms of the
- * GNU Affero General Public License (AGPL) as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AGPL for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU AGPL
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-$res=0;
-if (! $res && file_exists("../main.inc.php")) : $res=@include '../main.inc.php';
-endif;
-if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
-endif;
-if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
-endif;
+// Load Dolibarr environment
+require '../../../main.inc.php';
+
+/**
+ * @var DoliDB $db
+ * @var Translate $langs
+ * @var User $user
+ */
// Protection if external user
-if ($user->socid > 0) : accessforbidden();
-endif;
+if ($user->socid > 0) {
+ accessforbidden();
+}
// Includes
-dol_include_once('admin/tools/ui/class/documentation.class.php');
+require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php';
// Load documentation translations
$langs->load('uxdocumentation');
@@ -48,7 +50,7 @@
$documentation->showSidebar(); ?>
-
+
showBreadCrumb(); ?>
@@ -61,4 +63,4 @@
docFooter();
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php
index 1726f6395a730..f36faead44b99 100644
--- a/htdocs/compta/bank/class/api_bankaccounts.class.php
+++ b/htdocs/compta/bank/class/api_bankaccounts.class.php
@@ -691,4 +691,29 @@ public function deleteLine($id, $line_id)
)
);
}
+
+ /**
+ * Get current account balance by ID
+ *
+ * @param int $id ID of account
+ * @return float $balance balance
+ * @url GET {id}/balance
+ *
+ * @throws RestException
+ */
+ public function getBalance($id)
+ {
+ if (!DolibarrApiAccess::$user->hasRight('banque', 'lire')) {
+ throw new RestException(403);
+ }
+
+ $account = new Account($this->db);
+ $result = $account->fetch($id);
+
+ if (!$result) {
+ throw new RestException(404, 'account not found');
+ }
+ $balance = $account->solde(1); //1=Exclude future operation date (this is to exclude input made in advance and have real account sold)
+ return $balance;
+ }
}
diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php
index 8d287b33a81dc..94edfbce43c1b 100644
--- a/htdocs/core/class/doleditor.class.php
+++ b/htdocs/core/class/doleditor.class.php
@@ -394,9 +394,10 @@ public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $
$out .= ''."\n";
}
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 22c1ad326ba7f..9cc8d48b56bc7 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -1112,7 +1112,9 @@ public function delete(User $user)
$this->db->begin();
// Stock control
- if (isModEnabled('stock') && !getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION') && $this->statut > 0) {
+ if (isModEnabled('stock') && ((getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION') && $this->status > Reception::STATUS_DRAFT)
+ || (getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION_CLOSE') && $this->status == Reception::STATUS_CLOSED))
+ ) {
require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
$langs->load("agenda");
@@ -1136,7 +1138,7 @@ public function delete(User $user)
// we do not log origin because it will be deleted
$mouvS->origin = null;
- $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed
+ $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby ? $this->db->jdate($obj->eatby) : null, $obj->sellby ? $this->db->jdate($obj->sellby) : null, $obj->batch); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
$error++;
$this->error = $mouvS->error;
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index de1271a36e158..a21273cea0809 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -19,7 +19,6 @@ parameters:
- scripts
excludePaths:
analyseAndScan:
- - htdocs/admin/tools/ui/*
- htdocs/custom/*
- htdocs/documents/*
- htdocs/install/doctemplates/*