Skip to content

Commit

Permalink
#14 [Tools] add: more info in tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Nov 7, 2022
1 parent cba70d9 commit d5b19de
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 91 deletions.
35 changes: 12 additions & 23 deletions dolisirhindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@
*/

// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
// Try main.inc.php using relative path
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";
if (!$res) die("Include of main fails");
if (file_exists('../../main.inc.php')) {
require_once '../../main.inc.php';
} else {
die('Include of main fails');
}

// Libraries
require_once './core/modules/modDoliSIRH.class.php';
Expand All @@ -43,10 +35,7 @@
global $conf, $db, $langs, $user;

// Load translation files required by the page
$langs->loadLangs(array("dolisirh@dolisirh"));

// Get parameters
$action = GETPOST('action', 'alpha');
$langs->load('dolisirh@dolisirh');

// Initialize technical objects
$dolisirh = new modDoliSIRH($db);
Expand All @@ -59,9 +48,9 @@
*/

$help_url = 'FR:Module_DoliSIRH';
$title = $langs->trans("DoliSIRHArea");
$morejs = array("/dolisirh/js/dolisirh.js.php");
$morecss = array("/dolisirh/css/dolisirh.css");
$title = $langs->trans('DoliSIRHArea');
$morejs = ['/dolisirh/js/dolisirh.js.php'];
$morecss = ['/dolisirh/css/dolisirh.css'];

llxHeader('', $title . ' ' . $dolisirh->version, $help_url, '', 0, 0, $morejs, $morecss);

Expand All @@ -70,11 +59,11 @@
if ($conf->global->DOLISIRH_HR_PROJECT_SET == 0) : ?>
<div class="wpeo-notice notice-info">
<div class="notice-content">
<div class="notice-title"><strong><?php echo $langs->trans("SetupDefaultDataNotCreated"); ?></strong></div>
<div class="notice-subtitle"><strong><?php echo $langs->trans("HowToSetupDefaultData") . ' ' ?><a href="admin/setup.php"><?php echo $langs->trans('ConfigDefaultData'); ?></a></strong></div>
<div class="notice-title"><strong><?php echo $langs->trans('SetupDefaultDataNotCreated'); ?></strong></div>
<div class="notice-subtitle"><strong><?php echo $langs->trans('HowToSetupDefaultData') . ' ' ?><a href="admin/setup.php"><?php echo $langs->trans('ConfigDefaultData'); ?></a></strong></div>
</div>
</div>
<?php endif;
// End of page
llxFooter();
$db->close();
$db->close();
18 changes: 0 additions & 18 deletions langs/fr_FR/dolisirh.lang
Original file line number Diff line number Diff line change
Expand Up @@ -360,24 +360,6 @@ NoSocietyAttendants = Pas de signataires liés à cet objet. Pour ajouter des si
FileGenerated


#
# Tools - Outils
#

# Data - Donnée
Tools = Outils
DataUpdateManagement = Gestion des mises à jour de données
DataUpdateUser = Mise à jour des utilisateurs externes salariés
DataUpdateUserDescription = Les utilisateurs externes salariés passeront au statut de non salarié
DataUpdateSaved = Mise à jour des données utilisateurs effectuées
DataUpdateNotSaved = Aucune données utilisateurs à mettre à jour
DataUpdateUserHaveTodoTitle = Informations sur les statuts des utilisateurs internes/externes - salariés/non salariés
DataUpdateUserAll = Il y a 3 utilisateur(s) au total
DataUpdateUserInternalNotEmployees = Il y a %s utilisateur(s) interne(s) et non salarié(s)
DataUpdateUserInternal = Il y a %s utilisateur(s) interne(s) et salarié(s)
DataUpdateUserExternal = Il y a %s utilisateur(s) externe(s) et salarié(s)



#
# Other
Expand Down
31 changes: 31 additions & 0 deletions langs/fr_FR/tools.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (C) 2023 EVARISK <dev@evarisk.com>
#
# 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 <https://www.gnu.org/licenses/>.

#
# Tools - Outils
#

# Data - Donnée
Tools = Outils
UserStatusTitle = Informations sur les statuts des utilisateurs internes/externes - salariés/non salariés
AllUsers = Il y a 3 utilisateur(s) au total
InternalUsersNotEmployee = Il y a %s utilisateur(s) interne(s) et non salarié(s)
EmployeeInternalUsers = Il y a %s utilisateur(s) interne(s) et salarié(s)
EmployeeExternalUsers = Il y a %s utilisateur(s) externe(s) et salarié(s)
DataUpdateManagement = Gestion des mises à jour de données
UpdateEmployeeExternalUsers = Mise à jour des utilisateurs externes salariés
UpdateEmployeeExternalUsersDescription = Les utilisateurs externes salariés passeront au statut de non salarié
UpdateEmployeeExternalUsersSaved = Mise à jour des données utilisateurs effectuées
UpdateEmployeeExternalUsersNotSaved = Aucune données utilisateurs à mettre à jour
98 changes: 48 additions & 50 deletions view/dolisirhtools.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,17 @@

// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
// Try main.inc.php using relative path
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) die("Include of main fails");
if (file_exists('../../../main.inc.php')) {
$res = include '../../../main.inc.php';
}
if (!$res) {
die('Include of main fails');
}

global $conf, $db, $langs, $user;

// Load translation files required by the page
$langs->loadLangs(array("dolisirh@dolisirh"));

// Parameters
$action = GETPOST('action', 'alpha');

$langs->load('tools@dolisirh');

// Initialize technical objects
$usertmp = new User($db);
Expand All @@ -56,17 +47,17 @@
* Actions
*/

if (GETPOST('dataUpdate', 'alpha')) {
$allusers = $usertmp->get_full_tree(0, 'u.employee = 1 AND u.fk_soc IS NOT NULL');
if (!empty($allusers) && is_array($allusers)) {
foreach ($allusers as $usersingle) {
$usertmp->fetch($usersingle['id']);
if (GETPOST('updateEmployeeExternalUsers', 'alpha')) {
$employeeExternalUsers = $usertmp->get_full_tree(0, 'u.employee = 1 AND u.fk_soc IS NOT NULL');
if (!empty($employeeExternalUsers) && is_array($employeeExternalUsers)) {
foreach ($employeeExternalUsers as $userSingle) {
$usertmp->fetch($userSingle['id']);
$usertmp->employee = 0;
$usertmp->update($user, 1);
}
setEventMessage($langs->trans('DataUpdateSaved'));
setEventMessage($langs->trans('UpdateEmployeeExternalUsersSaved'));
} else {
setEventMessage($langs->trans('DataUpdateNotSaved'));
setEventMessage($langs->trans('UpdateEmployeeExternalUsersNotSaved'));
}
}

Expand All @@ -75,54 +66,61 @@
*/

$help_url = 'FR:Module_DoliSIRH';
$morejs = array("/dolisirh/js/dolisirh.js");
$morecss = array("/dolisirh/css/dolisirh.css");
$morejs = ['/dolisirh/js/dolisirh.js'];
$morecss = ['/dolisirh/css/dolisirh.css'];

llxHeader("", $langs->trans("Tools"), $help_url, '', '', '', $morejs, $morecss);
llxHeader('', $langs->trans('Tools'), $help_url, '', '', '', $morejs, $morecss);

print load_fiche_titre($langs->trans("Tools"), '', 'wrench');
print load_fiche_titre($langs->trans('Tools'), '', 'wrench');

if ($user->rights->dolisirh->adminpage->read) { ?>
<div class="wpeo-notice notice-info">
<div class="notice-content">
<div class="notice-title"><strong><?php echo $langs->trans("DataUpdateUserHaveTodoTitle"); ?></strong></div>
<div class="notice-title"><strong><?php echo $langs->trans('UserStatusTitle'); ?></strong></div>
<div class="notice-subtitle">
<?php
$allusers = $usertmp->get_full_tree(0, 'u.employee = 1 AND u.fk_soc IS NOT NULL');
if (!empty($allusers) && is_array($allusers)) {
$dataUpdateUser = count($allusers);
} else {
$dataUpdateUser = 0;
}
print $langs->trans("DataUpdateUserAll") . '<br>';
print $langs->trans("DataUpdateUserInternalNotEmployees", 0) . '<br>';
print $langs->trans("DataUpdateUserInternal", 3 - $dataUpdateUser) . '<br>';
print $langs->trans("DataUpdateUserExternal", $dataUpdateUser) ?>
$usersData = [
'AllUsers' => $usertmp->get_full_tree(),
'InternalUsersNotEmployee' => $usertmp->get_full_tree(0, 'u.employee = 0 AND u.fk_soc IS NULL'),
'EmployeeInternalUsers' => $usertmp->get_full_tree(0, 'u.employee = 1 AND u.fk_soc IS NULL'),
'EmployeeExternalUsers' => $usertmp->get_full_tree(0, 'u.employee = 1 AND u.fk_soc IS NOT NULL'),
];
foreach ($usersData as $key => $userData) {
if (!empty($userData) && is_array($userData)) {
$countedUserData = count($userData);
} else {
$countedUserData = 0;
}
print $langs->trans($key, $countedUserData) . '<br>';
} ?>
</div>
</div>
</div>

<?php print load_fiche_titre($langs->trans("DataUpdateManagement"), '', '');
<?php print load_fiche_titre($langs->trans('DataUpdateManagement'), '', '');

print '<form class="data-update-from" name="DataUpdate" id="DataUpdate" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<form class="data-update-from" name="DataUpdate" id="DataUpdate" action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="action" value="">';

print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Name") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td class="center">' . $langs->trans("Action") . '</td>';
print '<td>' . $langs->trans('Name') . '</td>';
print '<td>' . $langs->trans('Description') . '</td>';
print '<td class="center">' . $langs->trans('Action') . '</td>';
print '</tr>';

print '<tr class="oddeven"><td>';
print $langs->trans('DataUpdateUser');
print "</td><td>";
print $langs->trans('DataUpdateUserDescription');
print $langs->trans('UpdateEmployeeExternalUsers');
print '</td><td>';
print $langs->trans('UpdateEmployeeExternalUsersDescription');
print '</td>';

print '<td class="center data-update">';
print '<input type="submit" class="button reposition data-update" name="dataUpdate" value="' . $langs->trans("Validate") . '">';
print '<td class="center">';
if ($user->rights->user->user->creer) {
print '<input type="submit" class="button" name="updateEmployeeExternalUsers" value="' . $langs->trans('Validate') . '">';
} else {
print '<span class="butActionRefused classfortooltip" title="' . dol_escape_htmltag($langs->trans('PermissionDenied')) . '">' . $langs->trans('Validate') . '</span>';
}
print '</td>';
print '</tr>';
print '</table>';
Expand All @@ -131,4 +129,4 @@

// End of page
llxFooter();
$db->close();
$db->close();

0 comments on commit d5b19de

Please sign in to comment.