Skip to content

Commit 035e5fc

Browse files
Merge pull request #4576 from Evarisk/develop
21.1.0
2 parents dd57508 + 91615f7 commit 035e5fc

66 files changed

Lines changed: 5222 additions & 1786 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
## Informations
44

55
- Numéro du module : 436302
6-
- Dernière mise à jour : 22/05/2025
6+
- Dernière mise à jour : 29/08/2025
77
- Éditeur : [Evarisk](https://evarisk.com)
88
- Thème : Eldy Menu
99
- Licence : GPLv3
1010
- Disponible sur : Windows - MacOS - Linux
1111

1212
### Version
1313

14-
- Version : 21.0.1
14+
- Version : 21.1.0
1515
- PHP : 7.4.33
1616
- Compatibilité : Dolibarr 20.0.0 - 21.0.1
1717
- Saturne Framework : 21.0.0

admin/config/digiai.php

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
/* Copyright (C) 2021-2023 EVARISK <technique@evarisk.com>
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
/**
19+
* \file admin/config/digiai.php
20+
* \ingroup digiriskdolibarr
21+
* \brief Digiriskdolibarr digiai page.
22+
*/
23+
24+
// Load DigiriskDolibarr environment
25+
if (file_exists('../digiriskdolibarr.main.inc.php')) {
26+
require_once __DIR__ . '/../digiriskdolibarr.main.inc.php';
27+
} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) {
28+
require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php';
29+
} else {
30+
die('Include of digiriskdolibarr main fails');
31+
}
32+
33+
global $conf, $db, $langs, $user;
34+
35+
// Libraries
36+
require_once DOL_DOCUMENT_ROOT . "/core/class/html.formprojet.class.php";
37+
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
38+
39+
require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php';
40+
41+
// Translations
42+
saturne_load_langs(["admin"]);
43+
44+
// Parameters
45+
$action = GETPOST('action', 'alpha');
46+
$backtopage = GETPOST('backtopage', 'alpha');
47+
$openAiApiKey = GETPOST('OpenAIApiKey', 'alpha');
48+
49+
// Security check - Protection if external user
50+
$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read;
51+
saturne_check_access($permissiontoread);
52+
53+
/*
54+
* Actions
55+
*/
56+
57+
$error = 0;
58+
59+
if ($action == 'update') {
60+
if (!empty($openAiApiKey) || $openAiApiKey === '0') {
61+
dolibarr_set_const($db, "DIGIRISKDOLIBARR_CHATGPT_API_KEY", $openAiApiKey, 'integer', 0, '', $conf->entity);
62+
}
63+
}
64+
// Actions set_mod, update_mask
65+
require_once __DIR__ . '/../../../saturne/core/tpl/actions/admin_conf_actions.tpl.php';
66+
67+
/*
68+
* View
69+
*/
70+
71+
if (isModEnabled('project')) {
72+
$formproject = new FormProjets($db);
73+
}
74+
75+
$form = new Form($db);
76+
77+
$title = $langs->trans("ModuleSetup", $moduleName);
78+
$helpUrl = 'FR:Module_Digirisk';
79+
80+
saturne_header(0,'', $title, $helpUrl);
81+
82+
// Subheader
83+
$linkback = '<a href="' . ($backtopage ?: DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1') . '">' . $langs->trans("BackToModuleList") . '</a>';
84+
print load_fiche_titre($title, $linkback, 'title_setup');
85+
86+
// Configuration header
87+
$head = digiriskdolibarr_admin_prepare_head();
88+
print dol_get_fiche_head($head, 'digiai', $title, -1, "digiriskdolibarr_color@digiriskdolibarr");
89+
90+
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
91+
print '<input type="hidden" name="token" value="' . newToken() . '">';
92+
print '<input type="hidden" name="action" value="update">';
93+
print '<table class="noborder centpercent editmode">';
94+
print '<tr class="liste_titre">';
95+
print '<td>' . $langs->trans("Name") . '</td>';
96+
print '<td>' . $langs->trans("Description") . '</td>';
97+
print '<td>' . $langs->trans("Value") . '</td>';
98+
print '<td>' . $langs->trans("Action") . '</td>';
99+
print '</tr>';
100+
101+
print '<tr class="oddeven"><td><label for="OpenAIApiKey">' . $langs->trans("OpenAIApiKey") . '</label></td>';
102+
print '<td>' . $langs->trans("OpenAIApiKeyDescription") . '</td>';
103+
print '<td><input type="text" name="OpenAIApiKey" value="' . $conf->global->DIGIRISKDOLIBARR_CHATGPT_API_KEY . '"></td>';
104+
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '">';
105+
print '</td></tr>';
106+
107+
print '</table>';
108+
print '</form>';
109+
110+
// Page end
111+
print dol_get_fiche_end();
112+
llxFooter();
113+
$db->close();

0 commit comments

Comments
 (0)