Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-02-26 14:33:53 +01:00
commit 92e65291e6
59 changed files with 6826 additions and 6228 deletions

View File

@ -1,140 +1,142 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
}
?> ?>
/* Badge style is based on boostrap framework */ /* Badge style is based on boostrap framework */
.badge { .badge {
display: inline-block; display: inline-block;
padding: .1em .35em; padding: .1em .35em;
font-size: 80%; font-size: 80%;
font-weight: 700 !important; font-weight: 700 !important;
line-height: 1; line-height: 1;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
vertical-align: baseline; vertical-align: baseline;
border-radius: .25rem; border-radius: .25rem;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
border-width: 2px; border-width: 2px;
border-style: solid; border-style: solid;
border-color: rgba(255,255,255,0); border-color: rgba(255,255,255,0);
box-sizing: border-box; box-sizing: border-box;
} }
.badge-status { .badge-status {
font-size: 0.95em; font-size: 0.95em;
padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */ padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */
} }
.tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status { .tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
font-size: 1.1em; font-size: 1.1em;
padding: .4em .4em; padding: .4em .4em;
} }
/* Force values for small screen 767 */ /* Force values for small screen 767 */
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {
.tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status { .tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
font-size: 0.95em; font-size: 0.95em;
padding: .3em .2em; padding: .3em .2em;
} }
} }
.badge-pill, .tabs .badge { .badge-pill, .tabs .badge {
padding-right: .5em; padding-right: .5em;
padding-left: .5em; padding-left: .5em;
border-radius: 0.25rem; border-radius: 0.25rem;
} }
.badge-dot { .badge-dot {
padding: 0; padding: 0;
border-radius: 50%; border-radius: 50%;
padding: 0.45em; padding: 0.45em;
vertical-align: text-top; vertical-align: text-top;
} }
a.badge:focus, a.badge:hover { a.badge:focus, a.badge:hover {
text-decoration: none; text-decoration: none;
} }
.liste_titre .badge:not(.nochangebackground) { .liste_titre .badge:not(.nochangebackground) {
background-color: <?php print $badgeSecondary; ?>; background-color: <?php print $badgeSecondary; ?>;
color: #fff; color: #fff;
} }
span.badgeneutral { span.badgeneutral {
padding: 2px 7px 2px 7px; padding: 2px 7px 2px 7px;
background-color: #e4e4e4; background-color: #e4e4e4;
color: #666; color: #666;
border-radius: 10px; border-radius: 10px;
} }
/* PRIMARY */ /* PRIMARY */
.badge-primary{ .badge-primary{
color: #fff !important; color: #fff !important;
background-color: <?php print $badgePrimary; ?>; background-color: <?php print $badgePrimary; ?>;
} }
a.badge-primary.focus, a.badge-primary:focus { a.badge-primary.focus, a.badge-primary:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>;
} }
a.badge-primary:focus, a.badge-primary:hover { a.badge-primary:focus, a.badge-primary:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgePrimary, 10); ?>; background-color: <?php print colorDarker($badgePrimary, 10); ?>;
} }
/* SECONDARY */ /* SECONDARY */
.badge-secondary, .tabs .badge { .badge-secondary, .tabs .badge {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeSecondary; ?>; background-color: <?php print $badgeSecondary; ?>;
} }
a.badge-secondary.focus, a.badge-secondary:focus { a.badge-secondary.focus, a.badge-secondary:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>;
} }
a.badge-secondary:focus, a.badge-secondary:hover { a.badge-secondary:focus, a.badge-secondary:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeSecondary, 10); ?>; background-color: <?php print colorDarker($badgeSecondary, 10); ?>;
} }
/* SUCCESS */ /* SUCCESS */
.badge-success { .badge-success {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeSuccess; ?>; background-color: <?php print $badgeSuccess; ?>;
} }
a.badge-success.focus, a.badge-success:focus { a.badge-success.focus, a.badge-success:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>;
} }
a.badge-success:focus, a.badge-success:hover { a.badge-success:focus, a.badge-success:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeSuccess, 10); ?>; background-color: <?php print colorDarker($badgeSuccess, 10); ?>;
} }
/* DANGER */ /* DANGER */
.badge-danger { .badge-danger {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeDanger; ?>; background-color: <?php print $badgeDanger; ?>;
} }
a.badge-danger.focus, a.badge-danger:focus { a.badge-danger.focus, a.badge-danger:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>;
} }
a.badge-danger:focus, a.badge-danger:hover { a.badge-danger:focus, a.badge-danger:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeDanger, 10); ?>; background-color: <?php print colorDarker($badgeDanger, 10); ?>;
} }
/* WARNING */ /* WARNING */
.badge-warning { .badge-warning {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeWarning; ?>; background-color: <?php print $badgeWarning; ?>;
} }
a.badge-warning.focus, a.badge-warning:focus { a.badge-warning.focus, a.badge-warning:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>;
} }
a.badge-warning:focus, a.badge-warning:hover { a.badge-warning:focus, a.badge-warning:hover {
color: #212529 !important; color: #212529 !important;
background-color: <?php print colorDarker($badgeWarning, 10); ?>; background-color: <?php print colorDarker($badgeWarning, 10); ?>;
} }
/* WARNING colorblind */ /* WARNING colorblind */
@ -150,53 +152,53 @@ body[class*="colorblind-"] a.badge-warning:focus, a.badge-warning:hover {
/* INFO */ /* INFO */
.badge-info { .badge-info {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeInfo; ?>; background-color: <?php print $badgeInfo; ?>;
} }
a.badge-info.focus, a.badge-info:focus { a.badge-info.focus, a.badge-info:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>;
} }
a.badge-info:focus, a.badge-info:hover { a.badge-info:focus, a.badge-info:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeInfo, 10); ?>; background-color: <?php print colorDarker($badgeInfo, 10); ?>;
} }
/* LIGHT */ /* LIGHT */
.badge-light { .badge-light {
color: #212529 !important; color: #212529 !important;
background-color: <?php print $badgeLight; ?>; background-color: <?php print $badgeLight; ?>;
} }
a.badge-light.focus, a.badge-light:focus { a.badge-light.focus, a.badge-light:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>;
} }
a.badge-light:focus, a.badge-light:hover { a.badge-light:focus, a.badge-light:hover {
color: #212529 !important; color: #212529 !important;
background-color: <?php print colorDarker($badgeLight, 10); ?>; background-color: <?php print colorDarker($badgeLight, 10); ?>;
} }
/* DARK */ /* DARK */
.badge-dark { .badge-dark {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeDark; ?>; background-color: <?php print $badgeDark; ?>;
} }
a.badge-dark.focus, a.badge-dark:focus { a.badge-dark.focus, a.badge-dark:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>;
} }
a.badge-dark:focus, a.badge-dark:hover { a.badge-dark:focus, a.badge-dark:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeDark, 10); ?>; background-color: <?php print colorDarker($badgeDark, 10); ?>;
} }
@media only screen and (max-width: 570px) @media only screen and (max-width: 570px)
{ {
span.badge.badge-status { span.badge.badge-status {
overflow: hidden; overflow: hidden;
max-width: 130px; max-width: 130px;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
} }
@ -246,8 +248,12 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL
$thisBadgeBackgroundColor = "#fff"; $thisBadgeBackgroundColor = "#fff";
} }
if (in_array((string) $statusName, array('0', '5', '9'))) $thisBadgeTextColor = '#999999'; if (in_array((string) $statusName, array('0', '5', '9'))) {
if (in_array((string) $statusName, array('6'))) $thisBadgeTextColor = '#777777'; $thisBadgeTextColor = '#999999';
}
if (in_array((string) $statusName, array('6'))) {
$thisBadgeTextColor = '#777777';
}
print $cssPrefix.".badge-status".$statusName." {\n"; print $cssPrefix.".badge-status".$statusName." {\n";
print " color: ".$thisBadgeTextColor." !important;\n"; print " color: ".$thisBadgeTextColor." !important;\n";

View File

@ -1,19 +1,21 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
:root { :root {
--btncolortext:rgb(<?php print $colortextlink; ?>); --btncolortext:rgb(<?php print $colortextlink; ?>);
--btncolorbg: #fbfbfb; --btncolorbg: #fbfbfb;
--btncolorborderhover: none; --btncolorborderhover: none;
--btncolorborder: #FFF; --btncolorborder: #FFF;
/* --butactionbg:rgba(150, 110, 162, 0.95); */ /* --butactionbg:rgba(150, 110, 162, 0.95); */
--butactionbg:rgb(118, 145, 225); --butactionbg:rgb(118, 145, 225);
--butactionbg:rgba(150, 110, 162, 0.95); --butactionbg:rgba(150, 110, 162, 0.95);
--butactiondeletebg: rgb(234,228,225); --butactiondeletebg: rgb(234,228,225);
/* tertiary color */ /* tertiary color */
/* --butactionbg:rgb(218, 235, 225); */ /* --butactionbg:rgb(218, 235, 225); */
/* --butactionbg:rgb(228, 218, 235); */ /* --butactionbg:rgb(228, 218, 235); */
} }
<?php <?php
@ -45,60 +47,60 @@ if (!empty($conf->global->THEME_DARKMODEENABLED)) {
/* ============================================================================== */ /* ============================================================================== */
div.divButAction { div.divButAction {
margin-bottom: 1.4em; margin-bottom: 1.4em;
} }
div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete, div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete,
div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete { div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete {
margin-bottom: 1.4em !important; margin-bottom: 1.4em !important;
} }
div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused { div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
span.butAction, span.butActionDelete { span.butAction, span.butActionDelete {
cursor: pointer; cursor: pointer;
} }
.paginationafterarrows .butAction { .paginationafterarrows .butAction {
font-size: 0.9em; font-size: 0.9em;
} }
.butAction { .butAction {
background: var(--butactionbg); background: var(--butactionbg);
color: #FFF !important; color: #FFF !important;
border-radius: 3px; border-radius: 3px;
/* background: rgb(230, 232, 239); */ /* background: rgb(230, 232, 239); */
} }
.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { .butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
text-decoration: none; text-decoration: none;
text-transform: uppercase; text-transform: uppercase;
font-weight: bold; font-weight: bold;
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em; margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em; padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
display: inline-block; display: inline-block;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
/* color: #fff; */ /* color: #fff; */
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */ /* background: rgb(<?php echo $colorbackhmenu1 ?>); */
color: #444; color: #444;
/* border: 1px solid #aaa; */ /* border: 1px solid #aaa; */
/* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */ /* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */
/*border-top-right-radius: 0 !important; /*border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important; border-bottom-right-radius: 0 !important;
border-top-left-radius: 0 !important; border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;*/ border-bottom-left-radius: 0 !important;*/
} }
.butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active { .butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active {
text-decoration: none; text-decoration: none;
text-transform: uppercase; text-transform: uppercase;
font-weight: normal; font-weight: normal;
margin: 0em 0.3em 0 0.3em !important; margin: 0em 0.3em 0 0.3em !important;
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em; padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
display: inline-block; display: inline-block;
/* text-align: center; New button are on right of screen */ /* text-align: center; New button are on right of screen */
cursor: pointer; cursor: pointer;
} }
.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover, .tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover,
@ -127,66 +129,66 @@ span.butActionNewRefused>span.fa, span.butActionNewRefused>span.fa:hover
} }
.butAction:hover { .butAction:hover {
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
} }
.butActionNew:hover { .butActionNew:hover {
text-decoration: underline; text-decoration: underline;
box-shadow: unset !important; box-shadow: unset !important;
} }
.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete { .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
background: var(--butactiondeletebg); background: var(--butactiondeletebg);
/* border: 1px solid #633; */ /* border: 1px solid #633; */
color: #633; color: #633;
} }
.butActionDelete:hover { .butActionDelete:hover {
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
} }
.butActionRefused { .butActionRefused {
text-decoration: none !important; text-decoration: none !important;
text-transform: uppercase; text-transform: uppercase;
font-weight: bold !important; font-weight: bold !important;
white-space: nowrap !important; white-space: nowrap !important;
cursor: not-allowed !important; cursor: not-allowed !important;
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em; margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em; padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
font-family: <?php print $fontlist ?> !important; font-family: <?php print $fontlist ?> !important;
display: inline-block; display: inline-block;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
color: #999 !important; color: #999 !important;
border: 1px solid #ccc; border: 1px solid #ccc;
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
} }
.butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active { .butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active {
text-decoration: none !important; text-decoration: none !important;
text-transform: uppercase; text-transform: uppercase;
font-weight: normal !important; font-weight: normal !important;
white-space: nowrap !important; white-space: nowrap !important;
cursor: not-allowed !important; cursor: not-allowed !important;
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em; margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em; padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
font-family: <?php print $fontlist ?> !important; font-family: <?php print $fontlist ?> !important;
display: inline-block; display: inline-block;
/* text-align: center; New button are on right of screen */ /* text-align: center; New button are on right of screen */
cursor: pointer; cursor: pointer;
color: #999 !important; color: #999 !important;
padding-top: 0.2em; padding-top: 0.2em;
box-shadow: none !important; box-shadow: none !important;
-webkit-box-shadow: none !important; -webkit-box-shadow: none !important;
} }
.butActionTransparent { .butActionTransparent {
color: #222 ! important; color: #222 ! important;
background-color: transparent ! important; background-color: transparent ! important;
} }
@ -195,37 +197,37 @@ TITLE BUTTON
*/ */
.btnTitle, a.btnTitle { .btnTitle, a.btnTitle {
display: inline-block; display: inline-block;
padding: 4px 4px 4px 4px; padding: 4px 4px 4px 4px;
font-weight: 400; font-weight: 400;
/* line-height: 1; */ /* line-height: 1; */
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
vertical-align: middle; vertical-align: middle;
-ms-touch-action: manipulation; -ms-touch-action: manipulation;
touch-action: manipulation; touch-action: manipulation;
cursor: pointer; cursor: pointer;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
box-shadow: var(--btncolorbg); box-shadow: var(--btncolorbg);
text-decoration: none; text-decoration: none;
position: relative; position: relative;
/* margin: 0 0 0 8px; */ /* margin: 0 0 0 8px; */
min-width: 72px; min-width: 72px;
text-align: center; text-align: center;
color: var(--btncolortext); color: var(--btncolortext);
border: none; border: none;
font-size: 12px; font-size: 12px;
font-weight: 300; font-weight: 300;
background-color: var(--btncolorbg); background-color: var(--btncolorbg);
border: 1px solid var(--btncolorborder); border: 1px solid var(--btncolorborder);
} }
a.btnTitle.btnTitleSelected { a.btnTitle.btnTitleSelected {
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 3px; border-radius: 3px;
} }
.btnTitle > .btnTitle-icon{ .btnTitle > .btnTitle-icon{
@ -233,43 +235,43 @@ a.btnTitle.btnTitleSelected {
} }
.btnTitle > .btnTitle-label{ .btnTitle > .btnTitle-label{
color: #666666; color: #666666;
} }
.btnTitle:hover, a.btnTitle:hover { .btnTitle:hover, a.btnTitle:hover {
border: 1px solid #bbb; border: 1px solid #bbb;
border-radius: 3px; border-radius: 3px;
position: relative; position: relative;
text-align: center; text-align: center;
/* color: #ffffff; /* color: #ffffff;
background-color: rgb(<?php print $colortextlink; ?>); */ background-color: rgb(<?php print $colortextlink; ?>); */
font-size: 12px; font-size: 12px;
text-decoration: none; text-decoration: none;
box-shadow: none; box-shadow: none;
} }
.btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover { .btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover {
color: #8a8a8a; color: #8a8a8a;
cursor: not-allowed; cursor: not-allowed;
background-color: #fbfbfb; background-color: #fbfbfb;
background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px ); background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
} }
.btnTitle:hover .btnTitle-label{ .btnTitle:hover .btnTitle-label{
color: var(--btncolorborderhover); color: var(--btncolorborderhover);
} }
.btnTitle.refused .btnTitle-label, .btnTitle.refused:hover .btnTitle-label{ .btnTitle.refused .btnTitle-label, .btnTitle.refused:hover .btnTitle-label{
color: #8a8a8a; color: #8a8a8a;
} }
.btnTitle>.fa { .btnTitle>.fa {
font-size: 20px; font-size: 20px;
display: block; display: block;
} }
div.pagination li:first-child a.btnTitle{ div.pagination li:first-child a.btnTitle{
margin-left: 10px; margin-left: 10px;
} }
@ -284,15 +286,15 @@ div.pagination li:first-child a.btnTitle{
font-size: 0.95em; font-size: 0.95em;
} }
.btnTitle, a.btnTitle { .btnTitle, a.btnTitle {
display: inline-block; display: inline-block;
padding: 4px 4px 4px 4px; padding: 4px 4px 4px 4px;
min-width: unset; min-width: unset;
} }
} }
<?php if (!empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (!$user->admin)) { ?> <?php if (!empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (!$user->admin)) { ?>
.butActionRefused, .butActionNewRefused, .btnTitle.refused { .butActionRefused, .butActionNewRefused, .btnTitle.refused {
display: none !important; display: none !important;
} }
<?php } ?> <?php } ?>

View File

@ -1,63 +1,65 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > dont remove this line it's an ide hack */ /* <style type="text/css" > dont remove this line it's an ide hack */
/* /*
* Dropdown of user popup * Dropdown of user popup
*/ */
button.dropdown-item.global-search-item { button.dropdown-item.global-search-item {
outline: none; outline: none;
} }
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-quickadd, .open>.dropdown-menu, .dropdown dd ul.open { .open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-quickadd, .open>.dropdown-menu, .dropdown dd ul.open {
display: block; display: block;
} }
.dropdown-search { .dropdown-search {
border-color: #eee; border-color: #eee;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
z-index: 1000; z-index: 1000;
display: none; display: none;
float: left; float: left;
min-width: 160px; min-width: 160px;
margin: 2px 0 0; margin: 2px 0 0;
font-size: 14px; font-size: 14px;
text-align: left; text-align: left;
list-style: none; list-style: none;
background-color: #fff; background-color: #fff;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.15);
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-bookmark { .dropdown-bookmark {
border-color: #eee; border-color: #eee;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
z-index: 1000; z-index: 1000;
display: none; display: none;
float: left; float: left;
min-width: 160px; min-width: 160px;
margin: 2px 0 0; margin: 2px 0 0;
font-size: 14px; font-size: 14px;
text-align: left; text-align: left;
list-style: none; list-style: none;
background-color: #fff; background-color: #fff;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.15);
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-quickadd { .dropdown-quickadd {
border-color: #eee; border-color: #eee;
@ -83,107 +85,107 @@ button.dropdown-item.global-search-item {
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-menu { .dropdown-menu {
border-color: #eee; border-color: #eee;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
z-index: 1000; z-index: 1000;
display: none; display: none;
float: left; float: left;
min-width: 160px; min-width: 160px;
margin: 2px 0 0; margin: 2px 0 0;
font-size: 14px; font-size: 14px;
text-align: left; text-align: left;
list-style: none; list-style: none;
background-color: #fff; background-color: #fff;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.15);
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-toggle{ .dropdown-toggle{
text-decoration: none !important; text-decoration: none !important;
} }
.dropdown-toggle::after { .dropdown-toggle::after {
/* font part */ /* font part */
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
font-size: 0.7em; font-size: 0.7em;
font-weight: 900; font-weight: 900;
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
text-rendering: auto; text-rendering: auto;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
margin: auto 3px; margin: auto 3px;
display: inline-block; display: inline-block;
content: "\f078"; content: "\f078";
-webkit-transition: -webkit-transform .2s ease-in-out; -webkit-transition: -webkit-transform .2s ease-in-out;
-ms-transition: -ms-transform .2s ease-in-out; -ms-transition: -ms-transform .2s ease-in-out;
transition: transform .2s ease-in-out; transition: transform .2s ease-in-out;
} }
.open>.dropdown-toggle::after { .open>.dropdown-toggle::after {
transform: rotate(180deg); transform: rotate(180deg);
} }
/* /*
* MENU Dropdown * MENU Dropdown
*/ */
.login_block.usedropdown .logout-btn{ .login_block.usedropdown .logout-btn{
display: none; display: none;
} }
.tmenu .open.dropdown, .tmenu .open.dropdown { .tmenu .open.dropdown, .tmenu .open.dropdown {
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
} }
.tmenu .dropdown-menu, .login_block .dropdown-menu, .topnav .dropdown-menu { .tmenu .dropdown-menu, .login_block .dropdown-menu, .topnav .dropdown-menu {
position: absolute; position: absolute;
right: 2px; right: 2px;
<?php echo $left; ?>: auto; <?php echo $left; ?>: auto;
line-height:1.3em; line-height:1.3em;
} }
.tmenu .dropdown-menu, .login_block .dropdown-menu .user-body { .tmenu .dropdown-menu, .login_block .dropdown-menu .user-body {
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;
} }
.user-body { .user-body {
color: #333; color: #333;
} }
.side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu { .side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu {
border-top-right-radius: 0; border-top-right-radius: 0;
border-top-left-radius: 0; border-top-left-radius: 0;
padding: 1px 0 0 0; padding: 1px 0 0 0;
border-top-width: 0; border-top-width: 0;
width: 300px; width: 300px;
} }
.topnav .user-menu .dropdown-menu { .topnav .user-menu .dropdown-menu {
top: 50px; top: 50px;
} }
.side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu { .side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu {
margin-top: 0; margin-top: 0;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
} }
.side-nav-vert .user-menu .dropdown-menu > .user-header, .topnav .user-menu .dropdown-menu > .user-header { .side-nav-vert .user-menu .dropdown-menu > .user-header, .topnav .user-menu .dropdown-menu > .user-header {
min-height: 100px; min-height: 100px;
padding: 10px; padding: 10px;
text-align: center; text-align: center;
white-space: normal; white-space: normal;
} }
#topmenu-global-search-dropdown .dropdown-menu{ #topmenu-global-search-dropdown .dropdown-menu{
width: 300px; width: 300px;
max-width: 100%; max-width: 100%;
} }
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-quickadd-dropdown { div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-quickadd-dropdown {
@ -192,184 +194,184 @@ div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-q
<?php } ?> <?php } ?>
} }
a.top-menu-dropdown-link { a.top-menu-dropdown-link {
padding: 8px; padding: 8px;
} }
.dropdown-user-image { .dropdown-user-image {
border-radius: 50%; border-radius: 50%;
vertical-align: middle; vertical-align: middle;
z-index: 5; z-index: 5;
height: 90px; height: 90px;
width: 90px; width: 90px;
border: 3px solid; border: 3px solid;
border-color: transparent; border-color: transparent;
border-color: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.2);
max-width: 100%; max-width: 100%;
max-height :100%; max-height :100%;
} }
.dropdown-menu > .user-header{ .dropdown-menu > .user-header{
background: var(--colorbackhmenu1); background: var(--colorbackhmenu1);
} }
.dropdown-menu .dropdown-header{ .dropdown-menu .dropdown-header{
padding: 8px 8px 8px 8px; padding: 8px 8px 8px 8px;
} }
.dropdown-menu > .user-footer { .dropdown-menu > .user-footer {
border-top: 1px solid #f0f0f0; border-top: 1px solid #f0f0f0;
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 10px; padding: 10px;
} }
.user-footer:after { .user-footer:after {
clear: both; clear: both;
} }
.dropdown-menu > .bookmark-footer{ .dropdown-menu > .bookmark-footer{
border-top: 1px solid #f0f0f0; border-top: 1px solid #f0f0f0;
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 10px; padding: 10px;
} }
.dropdown-menu > .user-body, .dropdown-body{ .dropdown-menu > .user-body, .dropdown-body{
padding: 15px; padding: 15px;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
border-top: 1px solid #dddddd; border-top: 1px solid #dddddd;
white-space: normal; white-space: normal;
} }
.dropdown-menu > .bookmark-body, .dropdown-body{ .dropdown-menu > .bookmark-body, .dropdown-body{
overflow-y: auto; overflow-y: auto;
max-height: 60vh ; /* fallback for browsers without support for calc() */ max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 110px) ; max-height: calc(90vh - 110px) ;
white-space: normal; white-space: normal;
} }
#topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{ #topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{
max-height: 60vh ; /* fallback for browsers without support for calc() */ max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 200px) ; max-height: calc(90vh - 200px) ;
} }
.dropdown-body::-webkit-scrollbar { .dropdown-body::-webkit-scrollbar {
width: 8px; width: 8px;
} }
.dropdown-body::-webkit-scrollbar-thumb { .dropdown-body::-webkit-scrollbar-thumb {
-webkit-border-radius: 0; -webkit-border-radius: 0;
border-radius: 0; border-radius: 0;
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */ /* background: rgb(<?php echo $colorbackhmenu1 ?>); */
background: #aaa; background: #aaa;
} }
.dropdown-body::-webkit-scrollbar-track { .dropdown-body::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 0; -webkit-border-radius: 0;
border-radius: 0; border-radius: 0;
} }
#topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown { #topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown {
padding: 0 5px 0 5px; padding: 0 5px 0 5px;
} }
#topmenu-login-dropdown a:hover{ #topmenu-login-dropdown a:hover{
text-decoration: none; text-decoration: none;
} }
#topmenuloginmoreinfo-btn{ #topmenuloginmoreinfo-btn{
display: block; display: block;
text-aling: right; text-aling: right;
color:#666; color:#666;
cursor: pointer; cursor: pointer;
} }
#topmenuloginmoreinfo{ #topmenuloginmoreinfo{
display: none; display: none;
clear: both; clear: both;
font-size: 0.95em; font-size: 0.95em;
} }
.button-top-menu-dropdown { .button-top-menu-dropdown {
display: inline-block; display: inline-block;
padding: 6px 12px; padding: 6px 12px;
margin-bottom: 0; margin-bottom: 0;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
line-height: 1.42857143; line-height: 1.42857143;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
vertical-align: middle; vertical-align: middle;
-ms-touch-action: manipulation; -ms-touch-action: manipulation;
touch-action: manipulation; touch-action: manipulation;
cursor: pointer; cursor: pointer;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
background-image: none; background-image: none;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 4px; border-radius: 4px;
} }
.user-footer .button-top-menu-dropdown { .user-footer .button-top-menu-dropdown {
color: #666666; color: #666666;
border-radius: 0; border-radius: 0;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
border-width: 1px; border-width: 1px;
background-color: #f4f4f4; background-color: #f4f4f4;
border-color: #ddd; border-color: #ddd;
} }
.dropdown-menu a.top-menu-dropdown-link { .dropdown-menu a.top-menu-dropdown-link {
color: rgb(<?php print $colortextlink; ?>) !important; color: rgb(<?php print $colortextlink; ?>) !important;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
display: block; display: block;
margin: 5px 0px; margin: 5px 0px;
} }
.dropdown-item { .dropdown-item {
display: block !important; display: block !important;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
padding: .3em 1.5em .4em 1em; padding: .3em 1.5em .4em 1em;
clear: both; clear: both;
font-weight: 400; font-weight: 400;
color: #212529 !important; color: #212529 !important;
text-align: inherit; text-align: inherit;
background-color: transparent; background-color: transparent;
border: 0; border: 0;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.dropdown-item::before { .dropdown-item::before {
/* font part */ /* font part */
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
font-weight: 900; font-weight: 900;
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
text-rendering: auto; text-rendering: auto;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
margin-right: 5px; margin-right: 5px;
display: inline-block; display: inline-block;
content: "\f0da"; content: "\f0da";
/* color: rgba(0,0,0,0.3); */ /* color: rgba(0,0,0,0.3); */
} }
.dropdown-item.bookmark-item-external::before { .dropdown-item.bookmark-item-external::before {
content: "\f35d"; content: "\f35d";
} }
.dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus { .dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus {
color: #<?php echo $colortextbackhmenu; ?> !important; color: #<?php echo $colortextbackhmenu; ?> !important;
text-decoration: none; text-decoration: none;
background: rgb(<?php echo $colorbackhmenu1 ?>); background: rgb(<?php echo $colorbackhmenu1 ?>);
} }
/* /*
@ -377,34 +379,34 @@ a.top-menu-dropdown-link {
*/ */
.dropdown-search-input { .dropdown-search-input {
width: 100%; width: 100%;
padding: 10px 35px 10px 20px; padding: 10px 35px 10px 20px;
background-color: transparent; background-color: transparent;
/*font-size: 14px; /*font-size: 14px;
line-height: 16px;*/ line-height: 16px;*/
box-sizing: border-box; box-sizing: border-box;
color: #575756; color: #575756;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 16px 16px; background-size: 16px 16px;
background-position: 95% center; background-position: 95% center;
border-radius: 10px; border-radius: 10px;
border: 1px solid #c4c4c2 !important; border: 1px solid #c4c4c2 !important;
transition: all 250ms ease-in-out; transition: all 250ms ease-in-out;
backface-visibility: hidden; backface-visibility: hidden;
transform-style: preserve-3d; transform-style: preserve-3d;
} }
.dropdown-search-input::placeholder { .dropdown-search-input::placeholder {
color: color(#575756 a(0.8)); color: color(#575756 a(0.8));
letter-spacing: 1.5px; letter-spacing: 1.5px;
} }
.hidden-search-result{ .hidden-search-result{
display: none !important; display: none !important;
} }
/* /*
@ -468,11 +470,11 @@ div.quickaddblock:focus {
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {
.dropdown-search-input { .dropdown-search-input {
width: 100%; width: 100%;
} }
.tmenu .dropdown-menu, .login_block .dropdown-menu, .topnav .dropdown-menu { .tmenu .dropdown-menu, .login_block .dropdown-menu, .topnav .dropdown-menu {
margin-left: 5px; margin-left: 5px;
right: 0; right: 0;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
/* /*
@ -8,33 +10,33 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
*/ */
.info-box-module-external span.info-box-icon-version { .info-box-module-external span.info-box-icon-version {
background: #bbb; background: #bbb;
} }
.info-box { .info-box {
display: block; display: block;
position: relative; position: relative;
min-height: 90px; min-height: 90px;
/* background: #fff; */ /* background: #fff; */
width: 100%; width: 100%;
box-shadow: 1px 1px 15px rgba(192, 192, 192, 0.2); box-shadow: 1px 1px 15px rgba(192, 192, 192, 0.2);
border-radius: 2px; border-radius: 2px;
border: 1px solid #e9e9e9; border: 1px solid #e9e9e9;
margin-bottom: 15px; margin-bottom: 15px;
} }
.info-box.info-box-sm { .info-box.info-box-sm {
min-height: 80px; min-height: 80px;
margin-bottom: 10px; margin-bottom: 10px;
/* background: #fff; */ /* background: #fff; */
} }
.opened-dash-board-wrap .info-box.info-box-sm { .opened-dash-board-wrap .info-box.info-box-sm {
border-radius: 0 0 0 20px; border-radius: 0 0 0 20px;
} }
.info-box-more { .info-box-more {
float: right; float: right;
top: 5px; top: 5px;
position: absolute; position: absolute;
right: 8px; right: 8px;
} }
.info-box small { .info-box small {
@ -71,7 +73,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-bottom-left-radius: 2px; border-bottom-left-radius: 2px;
display: block; display: block;
overflow: hidden; overflow: hidden;
float: left; float: left;
height: 90px; height: 90px;
width: 90px; width: 90px;
@ -82,20 +84,20 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
} }
.info-box-module .info-box-icon { .info-box-module .info-box-icon {
padding-top: 5px; padding-top: 5px;
padding-bottom: 5px; padding-bottom: 5px;
} }
.info-box-sm .info-box-icon { .info-box-sm .info-box-icon {
height: 80px; height: 80px;
width: 78px; width: 78px;
font-size: 25px; font-size: 25px;
line-height: 92px; line-height: 92px;
} }
.opened-dash-board-wrap .info-box-sm .info-box-icon { .opened-dash-board-wrap .info-box-sm .info-box-icon {
border-radius: 0 0 0 20px; border-radius: 0 0 0 20px;
} }
.opened-dash-board-wrap .info-box-sm .info-box-icon { .opened-dash-board-wrap .info-box-sm .info-box-icon {
line-height: 80px; line-height: 80px;
} }
.info-box-module .info-box-icon { .info-box-module .info-box-icon {
height: 98px; height: 98px;
@ -104,75 +106,75 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
max-width: 100%; max-width: 100%;
} }
.info-box-module .info-box-icon > img { .info-box-module .info-box-icon > img {
max-width: 60%; max-width: 60%;
} }
a.info-box-text.info-box-text-a { a.info-box-text.info-box-text-a {
display: table-cell; display: table-cell;
} }
a.info-box-text-a i.fa.fa-exclamation-triangle { a.info-box-text-a i.fa.fa-exclamation-triangle {
font-size: 0.9em; font-size: 0.9em;
} }
.info-box-icon-text{ .info-box-icon-text{
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
position: absolute; position: absolute;
width: 90px; width: 90px;
bottom: 0px; bottom: 0px;
color: #ffffff; color: #ffffff;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
cursor: default; cursor: default;
font-size: 10px; font-size: 10px;
line-height: 15px; line-height: 15px;
padding: 0px 3px; padding: 0px 3px;
text-align: center; text-align: center;
opacity: 0; opacity: 0;
-webkit-transition: opacity 0.5s, visibility 0s 0.5s; -webkit-transition: opacity 0.5s, visibility 0s 0.5s;
transition: opacity 0.5s, visibility 0s 0.5s; transition: opacity 0.5s, visibility 0s 0.5s;
} }
.info-box-icon-version { .info-box-icon-version {
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
position: absolute; position: absolute;
width: 90px; width: 90px;
bottom: 0px; bottom: 0px;
color: #ffffff; color: #ffffff;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
cursor: default; cursor: default;
font-size: 10px; font-size: 10px;
line-height: 22px; line-height: 22px;
padding: 0px 3px; padding: 0px 3px;
text-align: center; text-align: center;
opacity: 1; opacity: 1;
-webkit-transition: opacity 0.5s, visibility 0s 0.5s; -webkit-transition: opacity 0.5s, visibility 0s 0.5s;
transition: opacity 0.5s, visibility 0s 0.5s; transition: opacity 0.5s, visibility 0s 0.5s;
} }
.box-flex-item.info-box-module.info-box-module-disabled { .box-flex-item.info-box-module.info-box-module-disabled {
/* opacity: 0.6; */ /* opacity: 0.6; */
} }
.info-box-actions { .info-box-actions {
position: absolute; position: absolute;
right: 0; right: 0;
bottom: 0; bottom: 0;
} }
<?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?> <?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?>
.info-box-icon-text{ .info-box-icon-text{
opacity: 1; opacity: 1;
} }
<?php } ?> <?php } ?>
.info-box-sm .info-box-icon-text, .info-box-sm .info-box-icon-version{ .info-box-sm .info-box-icon-text, .info-box-sm .info-box-icon-version{
overflow: hidden; overflow: hidden;
width: 80px; width: 80px;
} }
.info-box:hover .info-box-icon-text{ .info-box:hover .info-box-icon-text{
opacity: 1; opacity: 1;
} }
.info-box-content { .info-box-content {
@ -180,11 +182,11 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
margin-left: 84px; margin-left: 84px;
} }
.info-box-sm .info-box-content{ .info-box-sm .info-box-content{
margin-left: 80px; margin-left: 80px;
} }
.info-box-sm .info-box-module-enabled { .info-box-sm .info-box-module-enabled {
/* background: linear-gradient(0.35turn, #fff, #fff, #f6faf8, #e4efe8) */ /* background: linear-gradient(0.35turn, #fff, #fff, #f6faf8, #e4efe8) */
background: linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8); background: linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8);
} }
.info-box-content-warning span.font-status4 { .info-box-content-warning span.font-status4 {
color: #bc9526 !important; color: #bc9526 !important;
@ -193,7 +195,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
background: #ffd7a3; background: #ffd7a3;
}*/ }*/
/*.info-box-icon.info-box-icon-module-enabled { /*.info-box-icon.info-box-icon-module-enabled {
background: #e4f0e4 !important; background: #e4f0e4 !important;
}*/ }*/
.info-box-number { .info-box-number {
@ -240,20 +242,26 @@ a.info-box-text{ text-decoration: none;}
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$prefix = ''; $prefix = '';
if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'background-'; if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) {
$prefix = 'background-';
}
if (!isset($conf->global->THEME_SATURATE_RATIO)) $conf->global->THEME_SATURATE_RATIO = 0.7; if (!isset($conf->global->THEME_SATURATE_RATIO)) {
if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int'); $conf->global->THEME_SATURATE_RATIO = 0.7;
}
if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
$conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
}
?> ?>
.info-box-icon { .info-box-icon {
<?php if ($prefix) { ?> <?php if ($prefix) { ?>
color: #fff !important; color: #fff !important;
<?php } ?> <?php } ?>
opacity: 0.95; opacity: 0.95;
<?php if (isset($conf->global->THEME_SATURATE_RATIO)) { ?> <?php if (isset($conf->global->THEME_SATURATE_RATIO)) { ?>
filter: saturate(<?php echo $conf->global->THEME_SATURATE_RATIO; ?>); filter: saturate(<?php echo $conf->global->THEME_SATURATE_RATIO; ?>);
<?php } ?> <?php } ?>
} }
.customer-back { .customer-back {
@ -435,13 +443,13 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
} }
.info-box-module { .info-box-module {
min-width: 350px; min-width: 350px;
max-width: 350px; max-width: 350px;
} }
@media only screen and (max-width: 1740px) { @media only screen and (max-width: 1740px) {
.info-box-module { .info-box-module {
min-width: 315px; min-width: 315px;
max-width: 315px; max-width: 315px;
} }
} }
@ -463,8 +471,8 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {
.box-flex-container { .box-flex-container {
margin: 0 0 0 0px !important; margin: 0 0 0 0px !important;
width: 100% !important; width: 100% !important;
} }
.info-box-module { .info-box-module {
width: 100%; width: 100%;

View File

@ -1,23 +1,25 @@
<?php if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> <?php if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
.mainmenu::before{ .mainmenu::before{
/* font part */ /* font part */
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
font-weight: 900; font-weight: 900;
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
text-rendering: auto; text-rendering: auto;
line-height: 23px; line-height: 23px;
font-size: <?php echo $topMenuFontSize; ?>; font-size: <?php echo $topMenuFontSize; ?>;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
color: #<?php echo $colortextbackhmenu; ?>; color: #<?php echo $colortextbackhmenu; ?>;
} }
.fa-15x { .fa-15x {
font-size: 1.5em; font-size: 1.5em;
} }
div.mainmenu.menu { div.mainmenu.menu {
@ -34,116 +36,116 @@ div.mainmenu.home::before{
} }
div.mainmenu.billing::before { div.mainmenu.billing::before {
content: "\f51e"; content: "\f51e";
} }
div.mainmenu.accountancy::before { div.mainmenu.accountancy::before {
content: "\f53d"; content: "\f53d";
} }
div.mainmenu.agenda::before { div.mainmenu.agenda::before {
content: "\f073"; content: "\f073";
} }
div.mainmenu.bank::before { div.mainmenu.bank::before {
content: "\f19c"; content: "\f19c";
} }
<?php if ($conf->global->MAIN_FEATURES_LEVEL == 2) { ?> <?php if ($conf->global->MAIN_FEATURES_LEVEL == 2) { ?>
/* TESTING USAGE OF SVG WITHOUT FONT */ /* TESTING USAGE OF SVG WITHOUT FONT */
div.mainmenu.cashdesk { div.mainmenu.cashdesk {
line-height: 26px; line-height: 26px;
} }
div.mainmenu.cashdesk .tmenuimage { div.mainmenu.cashdesk .tmenuimage {
line-height: 26px; line-height: 26px;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
height: <?php echo $topMenuFontSize; ?>; height: <?php echo $topMenuFontSize; ?>;
background-color: #<?php echo $colortextbackhmenu; ?>; background-color: #<?php echo $colortextbackhmenu; ?>;
width: 100%; width: 100%;
-webkit-mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%; /* for old webkit browser */ -webkit-mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%; /* for old webkit browser */
mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%; mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%;
} }
<?php } else { ?> <?php } else { ?>
div.mainmenu.cashdesk::before { div.mainmenu.cashdesk::before {
content: "\f788"; content: "\f788";
} }
<?php } ?> <?php } ?>
div.mainmenu.takepos::before { div.mainmenu.takepos::before {
content: "\f788"; content: "\f788";
} }
div.mainmenu.companies::before { div.mainmenu.companies::before {
content: "\f1ad"; content: "\f1ad";
} }
div.mainmenu.commercial::before { div.mainmenu.commercial::before {
content: "\f0f2"; content: "\f0f2";
} }
div.mainmenu.ecm::before { div.mainmenu.ecm::before {
content: "\f07c"; content: "\f07c";
} }
div.mainmenu.externalsite::before { div.mainmenu.externalsite::before {
content: "\f360"; content: "\f360";
} }
div.mainmenu.ftp::before { div.mainmenu.ftp::before {
content: "\f362"; content: "\f362";
} }
div.mainmenu.hrm::before { div.mainmenu.hrm::before {
content: "\f508"; content: "\f508";
} }
div.mainmenu.members::before { div.mainmenu.members::before {
content: "\f007"; content: "\f007";
} }
div.mainmenu.products::before { div.mainmenu.products::before {
content: "\f1b2"; content: "\f1b2";
} }
div.mainmenu.mrp::before { div.mainmenu.mrp::before {
content: "\f1b3"; content: "\f1b3";
} }
div.mainmenu.project::before { div.mainmenu.project::before {
content: "\f0e8"; content: "\f0e8";
} }
div.mainmenu.ticket::before { div.mainmenu.ticket::before {
content: "\f3ff"; content: "\f3ff";
} }
div.mainmenu.tools::before { div.mainmenu.tools::before {
content: "\f0ad"; content: "\f0ad";
} }
div.mainmenu.website::before { div.mainmenu.website::before {
content: "\f57d"; content: "\f57d";
} }
div.mainmenu.generic1::before { div.mainmenu.generic1::before {
content: "\f249"; content: "\f249";
} }
div.mainmenu.generic2::before { div.mainmenu.generic2::before {
content: "\f249"; content: "\f249";
} }
div.mainmenu.generic3::before { div.mainmenu.generic3::before {
content: "\f249"; content: "\f249";
} }
div.mainmenu.generic4::before { div.mainmenu.generic4::before {
content: "\f249"; content: "\f249";
} }
/* Define color of some picto */ /* Define color of some picto */

View File

@ -25,16 +25,36 @@
* \brief File for The Web App * \brief File for The Web App
*/ */
if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); if (!defined('NOREQUIREUSER')) {
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); define('NOREQUIREUSER', '1');
if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); }
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOREQUIRESOC')) {
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); define('NOREQUIRESOC', '1');
if (!defined('NOLOGIN')) define('NOLOGIN', '1'); }
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIRETRAN')) {
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); define('NOREQUIRETRAN', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); }
if (!defined('NOSESSION')) define('NOSESSION', '1'); if (!defined('NOCSRFCHECK')) {
define('NOCSRFCHECK', '1');
}
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1');
}
if (!defined('NOLOGIN')) {
define('NOLOGIN', '1');
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOSESSION')) {
define('NOSESSION', '1');
}
require_once __DIR__.'/../../main.inc.php'; require_once __DIR__.'/../../main.inc.php';
@ -45,8 +65,7 @@ if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=10800, public, must-revalidate'); header('Cache-Control: max-age=10800, public, must-revalidate');
// For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server // For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server
header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT'); header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT');
} } else {
else {
header('Cache-Control: no-cache'); header('Cache-Control: no-cache');
} }
@ -55,7 +74,9 @@ $manifest = new stdClass();
$manifest->name = constant('DOL_APPLICATION_TITLE'); $manifest->name = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $manifest->name = $conf->global->MAIN_APPLICATION_TITLE; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$manifest->name = $conf->global->MAIN_APPLICATION_TITLE;
}
$manifest->theme_color = !empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR)?$conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR:'#F05F40'; $manifest->theme_color = !empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR)?$conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR:'#F05F40';
@ -64,21 +85,23 @@ $manifest->display = "standalone";
$manifest->splash_pages = null; $manifest->splash_pages = null;
$manifest->icons = array(); $manifest->icons = array();
if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)){ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
$icon = new stdClass(); $icon = new stdClass();
$icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL; $icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL;
if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) { $icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE."x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE; } if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) {
else { $icon->sizes = "512x512"; } $icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE."x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE;
} else {
$icon->sizes = "512x512";
}
$icon->type = "image/png"; $icon->type = "image/png";
$manifest->icons[] = $icon; $manifest->icons[] = $icon;
} } elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)) {
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)){
$iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI;
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) { if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath); $imgSize = getimagesize($iconPath);
if ($imgSize){ if ($imgSize) {
$icon = new stdClass(); $icon = new stdClass();
$icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
$icon->sizes = $imgSize[0]."x".$imgSize[1]; $icon->sizes = $imgSize[0]."x".$imgSize[1];
@ -88,12 +111,12 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
} }
} }
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)){ if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)) {
$iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL;
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) { if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath); $imgSize = getimagesize($iconPath);
if ($imgSize){ if ($imgSize) {
$icon = new stdClass(); $icon = new stdClass();
$icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
$icon->sizes = $imgSize[0]."x".$imgSize[1]; $icon->sizes = $imgSize[0]."x".$imgSize[1];
@ -103,12 +126,12 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
} }
} }
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){ if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
$iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; $iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED;
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) { if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath); $imgSize = getimagesize($iconPath);
if ($imgSize){ if ($imgSize) {
$icon = new stdClass(); $icon = new stdClass();
$icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
$icon->sizes = $imgSize[0]."x".$imgSize[1]; $icon->sizes = $imgSize[0]."x".$imgSize[1];
@ -120,7 +143,7 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
} }
// Add Dolibarr std icon // Add Dolibarr std icon
if (empty($manifest->icons)){ if (empty($manifest->icons)) {
$icon = new stdClass(); $icon = new stdClass();
$icon->src = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png'; $icon->src = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png';
$icon->sizes = "256x256"; $icon->sizes = "256x256";

View File

@ -1,5 +1,7 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
/* /*
progress style is based on boostrap and admin lte framework progress style is based on boostrap and admin lte framework
@ -12,183 +14,183 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
*/ */
.progress * { .progress * {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
.progress { .progress {
height: 20px; height: 20px;
overflow: hidden; overflow: hidden;
background-color: #f5f5f5; background-color: #f5f5f5;
background-color: rgba(128, 128, 128, 0.1); background-color: rgba(128, 128, 128, 0.1);
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
} }
.progress.spaced{ .progress.spaced{
margin-bottom: 20px; margin-bottom: 20px;
} }
.progress-bar { .progress-bar {
float: left; float: left;
width: 0; width: 0;
height: 100%; height: 100%;
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
color: #fff; color: #fff;
text-align: center; text-align: center;
background-color: #337ab7; background-color: #337ab7;
-webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
-webkit-transition: width .6s ease; -webkit-transition: width .6s ease;
-o-transition: width .6s ease; -o-transition: width .6s ease;
transition: width .6s ease; transition: width .6s ease;
} }
.progress-group > .progress{ .progress-group > .progress{
clear: both; clear: both;
} }
.progress, .progress,
.progress > .progress-bar { .progress > .progress-bar {
-webkit-box-shadow: none; -webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.progress, .progress,
.progress > .progress-bar, .progress > .progress-bar,
.progress .progress-bar, .progress .progress-bar,
.progress > .progress-bar .progress-bar { .progress > .progress-bar .progress-bar {
border-radius: 1px; border-radius: 1px;
} }
/* size variation */ /* size variation */
.progress.sm, .progress.sm,
.progress-sm { .progress-sm {
height: 10px; height: 10px;
} }
.progress.sm, .progress.sm,
.progress-sm, .progress-sm,
.progress.sm .progress-bar, .progress.sm .progress-bar,
.progress-sm .progress-bar { .progress-sm .progress-bar {
border-radius: 1px; border-radius: 1px;
} }
.progress.xs, .progress.xs,
.progress-xs { .progress-xs {
height: 7px; height: 7px;
} }
.progress.xs, .progress.xs,
.progress-xs, .progress-xs,
.progress.xs .progress-bar, .progress.xs .progress-bar,
.progress-xs .progress-bar { .progress-xs .progress-bar {
border-radius: 1px; border-radius: 1px;
} }
.progress.xxs, .progress.xxs,
.progress-xxs { .progress-xxs {
height: 3px; height: 3px;
} }
.progress.xxs, .progress.xxs,
.progress-xxs, .progress-xxs,
.progress.xxs .progress-bar, .progress.xxs .progress-bar,
.progress-xxs .progress-bar { .progress-xxs .progress-bar {
border-radius: 1px; border-radius: 1px;
} }
/* Vertical bars */ /* Vertical bars */
.progress.vertical { .progress.vertical {
position: relative; position: relative;
width: 30px; width: 30px;
height: 200px; height: 200px;
display: inline-block; display: inline-block;
margin-right: 10px; margin-right: 10px;
} }
.progress.vertical > .progress-bar { .progress.vertical > .progress-bar {
width: 100%; width: 100%;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
} }
.progress.vertical.sm, .progress.vertical.sm,
.progress.vertical.progress-sm { .progress.vertical.progress-sm {
width: 20px; width: 20px;
} }
.progress.vertical.xs, .progress.vertical.xs,
.progress.vertical.progress-xs { .progress.vertical.progress-xs {
width: 10px; width: 10px;
} }
.progress.vertical.xxs, .progress.vertical.xxs,
.progress.vertical.progress-xxs { .progress.vertical.progress-xxs {
width: 3px; width: 3px;
} }
.progress-group .progress-text { .progress-group .progress-text {
/* font-weight: 600; */ /* font-weight: 600; */
} }
.progress-group .progress-number { .progress-group .progress-number {
float: right; float: right;
} }
/* Remove margins from progress bars when put in a table */ /* Remove margins from progress bars when put in a table */
.table tr > td .progress { .table tr > td .progress {
margin: 0; margin: 0;
} }
.progress-bar-light-blue, .progress-bar-light-blue,
.progress-bar-primary { .progress-bar-primary {
background-color: #3c8dbc; background-color: #3c8dbc;
} }
.progress-striped .progress-bar-light-blue, .progress-striped .progress-bar-light-blue,
.progress-striped .progress-bar-primary { .progress-striped .progress-bar-primary {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
} }
.progress-bar-green, .progress-bar-success { .progress-bar-green, .progress-bar-success {
background-color: <?php echo $badgeSuccess ?>; background-color: <?php echo $badgeSuccess ?>;
} }
.progress-striped .progress-bar-green, .progress-striped .progress-bar-success { .progress-striped .progress-bar-green, .progress-striped .progress-bar-success {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
} }
body[class*="colorblind-"] .progress-bar-green, body[class*="colorblind-"] .progress-bar-success { body[class*="colorblind-"] .progress-bar-green, body[class*="colorblind-"] .progress-bar-success {
background-color: <?php echo $colorblind_deuteranopes_badgeSuccess ?>; background-color: <?php echo $colorblind_deuteranopes_badgeSuccess ?>;
} }
body[class*="colorblind-"] .progress-bar-red, body[class*="colorblind-"] .progress-bar-danger { body[class*="colorblind-"] .progress-bar-red, body[class*="colorblind-"] .progress-bar-danger {
background-color: <?php echo $colorblind_deuteranopes_badgeDanger ?>; background-color: <?php echo $colorblind_deuteranopes_badgeDanger ?>;
} }
.progress-bar-aqua, .progress-bar-aqua,
.progress-bar-info { .progress-bar-info {
background-color: #00c0ef; background-color: #00c0ef;
} }
.progress-striped .progress-bar-aqua, .progress-striped .progress-bar-aqua,
.progress-striped .progress-bar-info { .progress-striped .progress-bar-info {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
} }
.progress-bar-yellow, .progress-bar-yellow,
.progress-bar-warning { .progress-bar-warning {
background-color: <?php echo $badgeWarning ?>; background-color: <?php echo $badgeWarning ?>;
} }
.progress-striped .progress-bar-yellow, .progress-striped .progress-bar-yellow,
.progress-striped .progress-bar-warning { .progress-striped .progress-bar-warning {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
} }
.progress-bar-red, .progress-bar-red,
.progress-bar-danger { .progress-bar-danger {
background-color: <?php echo $badgeDanger ?>; background-color: <?php echo $badgeDanger ?>;
} }
.progress-striped .progress-bar-red, .progress-striped .progress-bar-red,
.progress-striped .progress-bar-danger { .progress-striped .progress-bar-danger {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
} }
.progress-bar-consumed { .progress-bar-consumed {
background-color: rgb(0, 0, 0, 0.15); background-color: rgb(0, 0, 0, 0.15);

View File

@ -27,21 +27,35 @@
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); if (!defined('NOCSRFCHECK')) {
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); define('NOCSRFCHECK', 1);
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login. }
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1);
}
if (!defined('NOLOGIN')) {
define('NOLOGIN', 1); // File must be accessed by logon page so without login.
}
//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We load menu manager class (note that object loaded may have wrong content because NOLOGIN is set and some values depends on login) //if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We load menu manager class (note that object loaded may have wrong content because NOLOGIN is set and some values depends on login)
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); if (!defined('NOREQUIREHTML')) {
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); define('NOREQUIREHTML', 1);
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
define('ISLOADEDBYSTEELSHEET', '1'); define('ISLOADEDBYSTEELSHEET', '1');
require __DIR__.'/theme_vars.inc.php'; require __DIR__.'/theme_vars.inc.php';
if (defined('THEME_ONLY_CONSTANT')) return; if (defined('THEME_ONLY_CONSTANT')) {
return;
}
session_cache_limiter('public'); session_cache_limiter('public');
@ -51,8 +65,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
// and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile. // and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile.
if (empty($user->id) && !empty($_SESSION['dol_login'])) if (empty($user->id) && !empty($_SESSION['dol_login'])) {
{
$user->fetch('', $_SESSION['dol_login'], '', 1); $user->fetch('', $_SESSION['dol_login'], '', 1);
$user->getrights(); $user->getrights();
@ -65,12 +78,21 @@ if (empty($user->id) && !empty($_SESSION['dol_login']))
// Define css type // Define css type
top_httphead('text/css'); top_httphead('text/css');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); if (empty($dolibarr_nocache)) {
else header('Cache-Control: no-cache'); header('Cache-Control: max-age=10800, public, must-revalidate');
} else {
header('Cache-Control: no-cache');
}
if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL if (GETPOST('theme', 'alpha')) {
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
if (GETPOST('THEME_DARKMODEENABLED', 'int')) $conf->global->THEME_DARKMODEENABLED = GETPOST('THEME_DARKMODEENABLED', 'int'); // If darkmode was forced on URL }
if (GETPOST('lang', 'aZ09')) {
$langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
}
if (GETPOST('THEME_DARKMODEENABLED', 'int')) {
$conf->global->THEME_DARKMODEENABLED = GETPOST('THEME_DARKMODEENABLED', 'int'); // If darkmode was forced on URL
}
$langs->load("main", 0, 1); $langs->load("main", 0, 1);
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
@ -78,7 +100,9 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
$path = ''; // This value may be used in future for external module to overwrite theme $path = ''; // This value may be used in future for external module to overwrite theme
$theme = 'eldy'; // Value of theme $theme = 'eldy'; // Value of theme
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES; } if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
$path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES;
}
// Define image path files and other constants // Define image path files and other constants
$fontlist = 'arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif'; $fontlist = 'arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif';
@ -98,19 +122,36 @@ $useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->
$borderwidth = 1; $borderwidth = 1;
// Case of option always editable // Case of option always editable
if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody; if (!isset($conf->global->THEME_ELDY_BACKBODY)) {
if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; $conf->global->THEME_ELDY_BACKBODY = $colorbackbody;
if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1; }
if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1; if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover; $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked; }
if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak; if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) {
if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab; $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1;
if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink; }
if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) {
$conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1;
}
if (!isset($conf->global->THEME_ELDY_USE_HOVER)) {
$conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover;
}
if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) {
$conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked;
}
if (!isset($conf->global->THEME_ELDY_LINEBREAK)) {
$conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak;
}
if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) {
$conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab;
}
if (!isset($conf->global->THEME_ELDY_TEXTLINK)) {
$conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
}
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on // Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) {
{
$conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card $conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card
$conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234'; $conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234';
$conf->global->THEME_ELDY_TEXT = '0,0,0'; $conf->global->THEME_ELDY_TEXT = '0,0,0';
@ -142,8 +183,7 @@ $fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (emp
// Hover color // Hover color
$colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_HOVER)); $colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_HOVER));
$colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_CHECKED)); $colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_CHECKED));
if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) {
{
$colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_HOVER)); $colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_HOVER));
$colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0') ? '' : ($user->conf->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_CHECKED)); $colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0') ? '' : ($user->conf->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_CHECKED));
} }
@ -153,26 +193,42 @@ if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbackhmenu1); $tmppart = explode(',', $colorbackhmenu1);
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF'; if ($tmpval <= 460) {
else $colortextbackhmenu = '000000'; $colortextbackhmenu = 'FFFFFF';
} else {
$colortextbackhmenu = '000000';
}
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z' $colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbackvmenu1); $tmppart = explode(',', $colorbackvmenu1);
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; } else { $colortextbackvmenu = '000000'; } if ($tmpval <= 460) {
$colortextbackvmenu = 'FFFFFF';
} else {
$colortextbackvmenu = '000000';
}
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' $colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbacktitle1); $tmppart = explode(',', $colorbacktitle1);
if ($colortexttitle == '') if ($colortexttitle == '') {
{
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; } else { $colortexttitle = '000000'; $colorshadowtitle = 'FFFFFF'; } if ($tmpval <= 460) {
} else $colorshadowtitle = '888888'; $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888';
} else {
$colortexttitle = '000000'; $colorshadowtitle = 'FFFFFF';
}
} else {
$colorshadowtitle = '888888';
}
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z' $colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbacktabcard1); $tmppart = explode(',', $colorbacktabcard1);
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; } else { $colortextbacktab = '000000'; } if ($tmpval <= 460) {
$colortextbacktab = 'FFFFFF';
} else {
$colortextbacktab = '000000';
}
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255') // Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
@ -185,8 +241,12 @@ $colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1));
$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2)); $colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2));
$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1)); $colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1));
$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2)); $colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2));
if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover)); if ($colorbacklinepairhover != '') {
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked)); $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
}
if ($colorbacklinepairchecked != '') {
$colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
}
$colorbackbody = join(',', colorStringToArray($colorbackbody)); $colorbackbody = join(',', colorStringToArray($colorbackbody));
$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab)); $colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab));
$colortexttitle = join(',', colorStringToArray($colortexttitle)); $colortexttitle = join(',', colorStringToArray($colortexttitle));
@ -195,7 +255,9 @@ $colortextlink = join(',', colorStringToArray($colortextlink));
$nbtopmenuentries = $menumanager->showmenu('topnb'); $nbtopmenuentries = $menumanager->showmenu('topnb');
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10); if ($conf->browser->layout == 'phone') {
$nbtopmenuentries = max($nbtopmenuentries, 10);
}
$minwidthtmenu = 66; /* minimum width for one top menu entry */ $minwidthtmenu = 66; /* minimum width for one top menu entry */
@ -203,11 +265,19 @@ $heightmenu = 50; /* height of top menu, part with image */
$heightmenu2 = 49; /* height of top menu, part with login */ $heightmenu2 = 49; /* height of top menu, part with login */
$disableimages = 0; $disableimages = 0;
$maxwidthloginblock = 180; $maxwidthloginblock = 180;
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; } if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) {
$disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0;
}
if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) {
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } $maxwidthloginblock = $maxwidthloginblock + 55;
if (!empty($conf->bookmark->enabled)) { $maxwidthloginblock = $maxwidthloginblock + 55; } }
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
$maxwidthloginblock = $maxwidthloginblock + 55;
}
if (!empty($conf->bookmark->enabled)) {
$maxwidthloginblock = $maxwidthloginblock + 55;
}
print '/*'."\n"; print '/*'."\n";
@ -247,4 +317,6 @@ print '*/'."\n";
require __DIR__.'/global.inc.php'; require __DIR__.'/global.inc.php';
if (is_object($db)) $db->close(); if (is_object($db)) {
$db->close();
}

View File

@ -33,12 +33,9 @@
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
$theme_bordercolor = array(235, 235, 224); $theme_bordercolor = array(235, 235, 224);
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(80, 166, 90), array(190, 190, 100), array(91, 115, 247), array(140, 140, 220), array(190, 120, 120), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); $theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(80, 166, 90), array(190, 190, 100), array(91, 115, 247), array(140, 140, 220), array(190, 120, 120), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined. if (!defined('ISLOADEDBYSTEELSHEET')) { // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
{ if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) { // user is loaded by dolgraph.class.php
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy') {
{
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
{
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
} else { } else {
// for now we use the same configuration for all types of color blind // for now we use the same configuration for all types of color blind

View File

@ -1,6 +1,6 @@
<?php <?php
/*! /*!
Source : Source :
* AdminLTE v2.4.8 * AdminLTE v2.4.8
* Author: Almsaeed Studio * Author: Almsaeed Studio
* Website: Almsaeed Studio <https://adminlte.io> * Website: Almsaeed Studio <https://adminlte.io>
@ -8,7 +8,9 @@
* Please visit http://opensource.org/licenses/MIT for more information * Please visit http://opensource.org/licenses/MIT for more information
*/ */
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
@ -17,68 +19,68 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
* ------------------- * -------------------
*/ */
.timeline { .timeline {
position: relative; position: relative;
margin: 0 0 30px 0; margin: 0 0 30px 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
} }
.timeline:before { .timeline:before {
content: ''; content: '';
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 4px; width: 4px;
background: #ddd; background: #ddd;
left: 31px; left: 31px;
margin: 0; margin: 0;
border-radius: 2px; border-radius: 2px;
} }
.timeline > li { .timeline > li {
position: relative; position: relative;
margin-right: 0; margin-right: 0;
margin-bottom: 15px; margin-bottom: 15px;
} }
.timeline > li:before, .timeline > li:before,
.timeline > li:after { .timeline > li:after {
content: " "; content: " ";
display: table; display: table;
} }
.timeline > li:after { .timeline > li:after {
clear: both; clear: both;
} }
.timeline > li > .timeline-item { .timeline > li > .timeline-item {
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border:1px solid #d2d2d2; border:1px solid #d2d2d2;
border-radius: 3px; border-radius: 3px;
margin-top: 0; margin-top: 0;
background: #fff; background: #fff;
color: #444; color: #444;
margin-left: 60px; margin-left: 60px;
margin-right: 0px; margin-right: 0px;
padding: 0; padding: 0;
position: relative; position: relative;
} }
.timeline > li.timeline-code-ticket_msg_private > .timeline-item { .timeline > li.timeline-code-ticket_msg_private > .timeline-item {
background: #fffbe5; background: #fffbe5;
border-color: #d0cfc0; border-color: #d0cfc0;
} }
.timeline > li > .timeline-item > .time{ .timeline > li > .timeline-item > .time{
color: #6f6f6f; color: #6f6f6f;
float: right; float: right;
padding: 10px; padding: 10px;
font-size: 12px; font-size: 12px;
} }
.timeline > li > .timeline-item > .timeline-header-action{ .timeline > li > .timeline-item > .timeline-header-action{
color: #6f6f6f; color: #6f6f6f;
float: right; float: right;
padding: 7px; padding: 7px;
font-size: 12px; font-size: 12px;
} }
@ -87,43 +89,43 @@ a.timeline-btn:visited,
a.timeline-btn:hover, a.timeline-btn:hover,
a.timeline-btn:active a.timeline-btn:active
{ {
display: inline-block; display: inline-block;
margin-bottom: 0; margin-bottom: 0;
font-weight: 400; font-weight: 400;
border-radius: 0; border-radius: 0;
box-shadow: none; box-shadow: none;
padding: 1px 5px; padding: 1px 5px;
font-size: 12px; font-size: 12px;
line-height: 1.5; line-height: 1.5;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
vertical-align: middle; vertical-align: middle;
touch-action: manipulation; touch-action: manipulation;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
background-image: none; background-image: none;
text-decoration: none; text-decoration: none;
background-color: #f4f4f4; background-color: #f4f4f4;
color: #444; color: #444;
border: 1px solid #ddd; border: 1px solid #ddd;
} }
a.timeline-btn:hover a.timeline-btn:hover
{ {
background-color: #e7e7e7; background-color: #e7e7e7;
color: #333; color: #333;
border-color: #adadad; border-color: #adadad;
} }
.timeline > li > .timeline-item > .timeline-header { .timeline > li > .timeline-item > .timeline-header {
margin: 0; margin: 0;
color: #333; color: #333;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
padding: 10px; padding: 10px;
font-size: 14px; font-size: 14px;
font-weight: normal; font-weight: normal;
line-height: 1.1; line-height: 1.1;
} }
.timeline > li > .timeline-item > .timeline-footer { .timeline > li > .timeline-item > .timeline-footer {
@ -131,74 +133,74 @@ a.timeline-btn:hover
} }
.timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-header, .timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-footer { .timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-header, .timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-footer {
border-color: #ecebda; border-color: #ecebda;
} }
.timeline > li > .timeline-item > .timeline-header > a { .timeline > li > .timeline-item > .timeline-header > a {
font-weight: 600; font-weight: 600;
} }
.timeline > li > .timeline-item > .timeline-body, .timeline > li > .timeline-item > .timeline-body,
.timeline > li > .timeline-item > .timeline-footer { .timeline > li > .timeline-item > .timeline-footer {
padding: 10px; padding: 10px;
} }
.timeline > li > .fa, .timeline > li > .fa,
.timeline > li > .glyphicon, .timeline > li > .glyphicon,
.timeline > li > .ion { .timeline > li > .ion {
width: 30px; width: 30px;
height: 30px; height: 30px;
font-size: 15px; font-size: 15px;
line-height: 30px; line-height: 30px;
position: absolute; position: absolute;
color: #666; color: #666;
background: #d2d6de; background: #d2d6de;
border-radius: 50%; border-radius: 50%;
text-align: center; text-align: center;
left: 18px; left: 18px;
top: 5px; top: 5px;
} }
.timeline > .time-label > span { .timeline > .time-label > span {
font-weight: 600; font-weight: 600;
padding: 5px; padding: 5px;
display: inline-block; display: inline-block;
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
} }
.timeline-inverse > li > .timeline-item { .timeline-inverse > li > .timeline-item {
background: #f0f0f0; background: #f0f0f0;
border: 1px solid #ddd; border: 1px solid #ddd;
-webkit-box-shadow: none; -webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.timeline-inverse > li > .timeline-item > .timeline-header { .timeline-inverse > li > .timeline-item > .timeline-header {
border-bottom-color: #ddd; border-bottom-color: #ddd;
} }
.timeline-icon-todo, .timeline-icon-todo,
.timeline-icon-in-progress, .timeline-icon-in-progress,
.timeline-icon-done{ .timeline-icon-done{
color: #fff !important; color: #fff !important;
} }
.timeline-icon-not-applicble{ .timeline-icon-not-applicble{
color: #000; color: #000;
background-color: #f7f7f7; background-color: #f7f7f7;
} }
.timeline-icon-todo{ .timeline-icon-todo{
background-color: #dd4b39 !important; background-color: #dd4b39 !important;
} }
.timeline-icon-in-progress{ .timeline-icon-in-progress{
background-color: #00c0ef !important; background-color: #00c0ef !important;
} }
.timeline-icon-done{ .timeline-icon-done{
background-color: #00a65a !important; background-color: #00a65a !important;
} }
.timeline-badge-date{ .timeline-badge-date{
background-color: #0073b7 !important; background-color: #0073b7 !important;
color: #fff !important; color: #fff !important;
} }
.timeline-documents-container{ .timeline-documents-container{

View File

@ -1,135 +1,137 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
/* /*
Badge style is based on boostrap framework Badge style is based on boostrap framework
*/ */
.badge { .badge {
display: inline-block; display: inline-block;
padding: .1em .35em; padding: .1em .35em;
font-size: 80%; font-size: 80%;
font-weight: 700 !important; font-weight: 700 !important;
line-height: 1; line-height: 1;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
vertical-align: baseline; vertical-align: baseline;
border-radius: .25rem; border-radius: .25rem;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
border-width: 2px; border-width: 2px;
border-style: solid; border-style: solid;
border-color: rgba(255,255,255,0); border-color: rgba(255,255,255,0);
box-sizing: border-box; box-sizing: border-box;
} }
.badge-status { .badge-status {
font-size: 1em; font-size: 1em;
padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */ padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */
} }
.tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status { .tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
font-size: 1.1em; font-size: 1.1em;
padding: .4em .4em; padding: .4em .4em;
} }
/* Force values for small screen 767 */ /* Force values for small screen 767 */
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {
.tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status { .tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
font-size: 0.95em; font-size: 0.95em;
padding: .3em .2em; padding: .3em .2em;
} }
} }
.badge-pill, .tabs .badge { .badge-pill, .tabs .badge {
padding-right: .5em; padding-right: .5em;
padding-left: .5em; padding-left: .5em;
border-radius: 0.25rem; border-radius: 0.25rem;
} }
.badge-dot { .badge-dot {
padding: 0; padding: 0;
border-radius: 50%; border-radius: 50%;
padding: 0.45em; padding: 0.45em;
vertical-align: unset; vertical-align: unset;
} }
a.badge:focus, a.badge:hover { a.badge:focus, a.badge:hover {
text-decoration: none; text-decoration: none;
} }
.liste_titre .badge:not(.nochangebackground) { .liste_titre .badge:not(.nochangebackground) {
background-color: <?php print $badgeSecondary; ?>; background-color: <?php print $badgeSecondary; ?>;
color: #fff; color: #fff;
} }
/* PRIMARY */ /* PRIMARY */
.badge-primary{ .badge-primary{
color: #fff !important; color: #fff !important;
background-color: <?php print $badgePrimary; ?>; background-color: <?php print $badgePrimary; ?>;
} }
a.badge-primary.focus, a.badge-primary:focus { a.badge-primary.focus, a.badge-primary:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>;
} }
a.badge-primary:focus, a.badge-primary:hover { a.badge-primary:focus, a.badge-primary:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgePrimary, 10); ?>; background-color: <?php print colorDarker($badgePrimary, 10); ?>;
} }
/* SECONDARY */ /* SECONDARY */
.badge-secondary, .tabs .badge { .badge-secondary, .tabs .badge {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeSecondary; ?>; background-color: <?php print $badgeSecondary; ?>;
} }
a.badge-secondary.focus, a.badge-secondary:focus { a.badge-secondary.focus, a.badge-secondary:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>;
} }
a.badge-secondary:focus, a.badge-secondary:hover { a.badge-secondary:focus, a.badge-secondary:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeSecondary, 10); ?>; background-color: <?php print colorDarker($badgeSecondary, 10); ?>;
} }
/* SUCCESS */ /* SUCCESS */
.badge-success { .badge-success {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeSuccess; ?>; background-color: <?php print $badgeSuccess; ?>;
} }
a.badge-success.focus, a.badge-success:focus { a.badge-success.focus, a.badge-success:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>;
} }
a.badge-success:focus, a.badge-success:hover { a.badge-success:focus, a.badge-success:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeSuccess, 10); ?>; background-color: <?php print colorDarker($badgeSuccess, 10); ?>;
} }
/* DANGER */ /* DANGER */
.badge-danger { .badge-danger {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeDanger; ?>; background-color: <?php print $badgeDanger; ?>;
} }
a.badge-danger.focus, a.badge-danger:focus { a.badge-danger.focus, a.badge-danger:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>;
} }
a.badge-danger:focus, a.badge-danger:hover { a.badge-danger:focus, a.badge-danger:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeDanger, 10); ?>; background-color: <?php print colorDarker($badgeDanger, 10); ?>;
} }
/* WARNING */ /* WARNING */
.badge-warning { .badge-warning {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeWarning; ?>; background-color: <?php print $badgeWarning; ?>;
} }
a.badge-warning.focus, a.badge-warning:focus { a.badge-warning.focus, a.badge-warning:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>;
} }
a.badge-warning:focus, a.badge-warning:hover { a.badge-warning:focus, a.badge-warning:hover {
color: #212529 !important; color: #212529 !important;
background-color: <?php print colorDarker($badgeWarning, 10); ?>; background-color: <?php print colorDarker($badgeWarning, 10); ?>;
} }
/* WARNING colorblind */ /* WARNING colorblind */
@ -145,44 +147,44 @@ body[class*="colorblind-"] a.badge-warning:focus, a.badge-warning:hover {
/* INFO */ /* INFO */
.badge-info { .badge-info {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeInfo; ?>; background-color: <?php print $badgeInfo; ?>;
} }
a.badge-info.focus, a.badge-info:focus { a.badge-info.focus, a.badge-info:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>;
} }
a.badge-info:focus, a.badge-info:hover { a.badge-info:focus, a.badge-info:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeInfo, 10); ?>; background-color: <?php print colorDarker($badgeInfo, 10); ?>;
} }
/* LIGHT */ /* LIGHT */
.badge-light { .badge-light {
color: #212529 !important; color: #212529 !important;
background-color: <?php print $badgeLight; ?>; background-color: <?php print $badgeLight; ?>;
} }
a.badge-light.focus, a.badge-light:focus { a.badge-light.focus, a.badge-light:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>;
} }
a.badge-light:focus, a.badge-light:hover { a.badge-light:focus, a.badge-light:hover {
color: #212529 !important; color: #212529 !important;
background-color: <?php print colorDarker($badgeLight, 10); ?>; background-color: <?php print colorDarker($badgeLight, 10); ?>;
} }
/* DARK */ /* DARK */
.badge-dark { .badge-dark {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeDark; ?>; background-color: <?php print $badgeDark; ?>;
} }
a.badge-dark.focus, a.badge-dark:focus { a.badge-dark.focus, a.badge-dark:focus {
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>; box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>;
} }
a.badge-dark:focus, a.badge-dark:hover { a.badge-dark:focus, a.badge-dark:hover {
color: #fff !important; color: #fff !important;
background-color: <?php print colorDarker($badgeDark, 10); ?>; background-color: <?php print colorDarker($badgeDark, 10); ?>;
} }
@ -231,8 +233,12 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL
$thisBadgeBackgroundColor = "#fff"; $thisBadgeBackgroundColor = "#fff";
} }
if (in_array((string) $statusName, array('0', '5', '9'))) $thisBadgeTextColor = '#999999'; if (in_array((string) $statusName, array('0', '5', '9'))) {
if (in_array((string) $statusName, array('6'))) $thisBadgeTextColor = '#777777'; $thisBadgeTextColor = '#999999';
}
if (in_array((string) $statusName, array('6'))) {
$thisBadgeTextColor = '#777777';
}
print $cssPrefix.".badge-status".$statusName." {\n"; print $cssPrefix.".badge-status".$statusName." {\n";
print " color: ".$thisBadgeTextColor." !important;\n"; print " color: ".$thisBadgeTextColor." !important;\n";

View File

@ -1,17 +1,19 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
:root { :root {
--btncolortext:rgb(<?php print $colortextlink; ?>); --btncolortext:rgb(<?php print $colortextlink; ?>);
--btncolorbg: #fbfbfb; --btncolorbg: #fbfbfb;
--btncolorborderhover: none; --btncolorborderhover: none;
--btncolorborder: #FFF; --btncolorborder: #FFF;
--butactiondeletebg: rgb(234,228,225); --butactiondeletebg: rgb(234,228,225);
/* tertiary color */ /* tertiary color */
/* --butactionbg:rgb(218, 235, 225); */ /* --butactionbg:rgb(218, 235, 225); */
/* --butactionbg:rgb(228, 218, 235); */ /* --butactionbg:rgb(228, 218, 235); */
--butactionbg:rgb(118, 145, 225); --butactionbg:rgb(118, 145, 225);
} }
<?php <?php
@ -50,7 +52,7 @@ div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tab
margin-bottom: 1.4em !important; margin-bottom: 1.4em !important;
} }
div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused { div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
span.butAction, span.butActionDelete { span.butAction, span.butActionDelete {
@ -58,44 +60,44 @@ span.butAction, span.butActionDelete {
} }
.butAction { .butAction {
background: var(--butactionbg); background: var(--butactionbg);
color: #FFF !important; color: #FFF !important;
border-radius: 3px; border-radius: 3px;
/* background: rgb(230, 232, 239); */ /* background: rgb(230, 232, 239); */
} }
.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { .butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
text-decoration: none; text-decoration: none;
text-transform: uppercase; text-transform: uppercase;
font-weight: bold; font-weight: bold;
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em; margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em; padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
display: inline-block; display: inline-block;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
/* color: #fff; */ /* color: #fff; */
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */ /* background: rgb(<?php echo $colorbackhmenu1 ?>); */
color: #444; color: #444;
/* border: 1px solid #aaa; */ /* border: 1px solid #aaa; */
/* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */ /* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */
/*border-top-right-radius: 0 !important; /*border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important; border-bottom-right-radius: 0 !important;
border-top-left-radius: 0 !important; border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;*/ border-bottom-left-radius: 0 !important;*/
} }
.butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active { .butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active {
text-decoration: none; text-decoration: none;
text-transform: uppercase; text-transform: uppercase;
font-weight: normal; font-weight: normal;
margin: 0em 0.3em 0 0.3em !important; margin: 0em 0.3em 0 0.3em !important;
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em; padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
display: inline-block; display: inline-block;
/* text-align: center; New button are on right of screen */ /* text-align: center; New button are on right of screen */
cursor: pointer; cursor: pointer;
} }
.button { .button {
@ -211,61 +213,61 @@ span.butActionNewRefused>span.fa, span.butActionNewRefused>span.fa:hover
} }
.butAction:hover { .butAction:hover {
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
} }
.butActionNew:hover { .butActionNew:hover {
text-decoration: underline; text-decoration: underline;
box-shadow: unset !important; box-shadow: unset !important;
} }
.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete { .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
background: var(--butactiondeletebg); background: var(--butactiondeletebg);
/* border: 1px solid #633; */ /* border: 1px solid #633; */
color: #633; color: #633;
} }
.butActionDelete:hover { .butActionDelete:hover {
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
} }
.butActionRefused { .butActionRefused {
text-decoration: none !important; text-decoration: none !important;
text-transform: uppercase; text-transform: uppercase;
font-weight: bold !important; font-weight: bold !important;
white-space: nowrap !important; white-space: nowrap !important;
cursor: not-allowed !important; cursor: not-allowed !important;
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em; margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em; padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
font-family: <?php print $fontlist ?> !important; font-family: <?php print $fontlist ?> !important;
display: inline-block; display: inline-block;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
color: #999 !important; color: #999 !important;
border: 1px solid #ccc; border: 1px solid #ccc;
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
} }
.butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active { .butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active {
text-decoration: none !important; text-decoration: none !important;
text-transform: uppercase; text-transform: uppercase;
font-weight: normal !important; font-weight: normal !important;
white-space: nowrap !important; white-space: nowrap !important;
cursor: not-allowed !important; cursor: not-allowed !important;
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em; margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em; padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
font-family: <?php print $fontlist ?> !important; font-family: <?php print $fontlist ?> !important;
display: inline-block; display: inline-block;
/* text-align: center; New button are on right of screen */ /* text-align: center; New button are on right of screen */
cursor: pointer; cursor: pointer;
color: #999 !important; color: #999 !important;
padding-top: 0.2em; padding-top: 0.2em;
box-shadow: none !important; box-shadow: none !important;
-webkit-box-shadow: none !important; -webkit-box-shadow: none !important;
} }
.butActionTransparent { .butActionTransparent {
@ -279,41 +281,41 @@ TITLE BUTTON
*/ */
div.pagination li:first-child a.btnTitle { div.pagination li:first-child a.btnTitle {
margin-left: 10px; margin-left: 10px;
} }
.btnTitle, a.btnTitle { .btnTitle, a.btnTitle {
display: inline-block; display: inline-block;
padding: 6px 12px; padding: 6px 12px;
font-size: 14px font-size: 14px
font-weight: 400; font-weight: 400;
line-height: 1.4; line-height: 1.4;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
vertical-align: middle; vertical-align: middle;
-ms-touch-action: manipulation; -ms-touch-action: manipulation;
touch-action: manipulation; touch-action: manipulation;
cursor: pointer; cursor: pointer;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
box-shadow: none; box-shadow: none;
text-decoration: none; text-decoration: none;
position: relative; position: relative;
margin: 0 0 0 10px; margin: 0 0 0 10px;
min-width: 80px; min-width: 80px;
text-align: center; text-align: center;
color: rgb(<?php print $colortextlink; ?>); color: rgb(<?php print $colortextlink; ?>);
border: none; border: none;
font-size: 12px; font-size: 12px;
font-weight: 300; font-weight: 300;
background-color: #fbfbfb; background-color: #fbfbfb;
} }
a.btnTitle.btnTitleSelected { a.btnTitle.btnTitleSelected {
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 3px; border-radius: 3px;
} }
.btnTitle > .btnTitle-icon{ .btnTitle > .btnTitle-icon{
@ -321,42 +323,42 @@ a.btnTitle.btnTitleSelected {
} }
.btnTitle > .btnTitle-label{ .btnTitle > .btnTitle-label{
color: #666666; color: #666666;
} }
.btnTitle:hover, a.btnTitle:hover { .btnTitle:hover, a.btnTitle:hover {
border-radius: 3px; border-radius: 3px;
position: relative; position: relative;
margin: 0 0 0 10px; margin: 0 0 0 10px;
text-align: center; text-align: center;
color: #ffffff; color: #ffffff;
background-color: rgb(<?php print $colortextlink; ?>); background-color: rgb(<?php print $colortextlink; ?>);
font-size: 12px; font-size: 12px;
text-decoration: none; text-decoration: none;
box-shadow: none; box-shadow: none;
} }
.btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover { .btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover {
color: #8a8a8a; color: #8a8a8a;
cursor: not-allowed; cursor: not-allowed;
background-color: #fbfbfb; background-color: #fbfbfb;
background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px ); background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
} }
.btnTitle:hover .btnTitle-label{ .btnTitle:hover .btnTitle-label{
color: #ffffff; color: #ffffff;
} }
div.pagination .btnTitle:hover .btnTitle-label{ div.pagination .btnTitle:hover .btnTitle-label{
color: rgb(<?php print $colortextlink; ?>); color: rgb(<?php print $colortextlink; ?>);
} }
.btnTitle.refused .btnTitle-label, .btnTitle.refused:hover .btnTitle-label{ .btnTitle.refused .btnTitle-label, .btnTitle.refused:hover .btnTitle-label{
color: #8a8a8a; color: #8a8a8a;
} }
.btnTitle>.fa { .btnTitle>.fa {
font-size: 20px; font-size: 20px;
display: block; display: block;
} }
/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */ /* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */
@ -366,15 +368,15 @@ div.pagination .btnTitle:hover .btnTitle-label{
font-size: 0.95em; font-size: 0.95em;
} }
.btnTitle, a.btnTitle { .btnTitle, a.btnTitle {
display: inline-block; display: inline-block;
padding: 4px 4px 4px 4px; padding: 4px 4px 4px 4px;
min-width: unset; min-width: unset;
} }
} }
<?php if (!empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (!$user->admin)) { ?> <?php if (!empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (!$user->admin)) { ?>
.butActionRefused, .butActionNewRefused, .btnTitle.refused { .butActionRefused, .butActionNewRefused, .btnTitle.refused {
display: none !important; display: none !important;
} }
<?php } ?> <?php } ?>

View File

@ -1,5 +1,7 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > dont remove this line it's an ide hack */ /* <style type="text/css" > dont remove this line it's an ide hack */
/* /*
@ -7,15 +9,15 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
*/ */
.bookmark-footer a.top-menu-dropdown-link { .bookmark-footer a.top-menu-dropdown-link {
white-space: normal; white-space: normal;
} }
button.dropdown-item.global-search-item { button.dropdown-item.global-search-item {
outline: none; outline: none;
} }
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu, .dropdown dd ul.open { .open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu, .dropdown dd ul.open {
display: block; display: block;
} }
@ -23,9 +25,9 @@ button.dropdown-item.global-search-item {
color: #fff; color: #fff;
} }
div#topmenu-bookmark-dropdown { div#topmenu-bookmark-dropdown {
position: fixed; position: fixed;
right: 20px; right: 20px;
top: 0px; top: 0px;
} }
#topmenu-login-dropdown .dropdown-toggle:after { #topmenu-login-dropdown .dropdown-toggle:after {
@ -33,347 +35,347 @@ div#topmenu-bookmark-dropdown {
} }
#topmenu-bookmark-dropdown .dropdown-menu { #topmenu-bookmark-dropdown .dropdown-menu {
width: 300px; width: 300px;
} }
button.dropdown-item.global-search-item { button.dropdown-item.global-search-item {
outline: none; outline: none;
} }
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{ .open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{
display: block; display: block;
} }
.dropdown-search { .dropdown-search {
border-color: #eee; border-color: #eee;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
z-index: 1000; z-index: 1000;
display: none; display: none;
float: left; float: left;
min-width: 160px; min-width: 160px;
margin: 2px 0 0; margin: 2px 0 0;
font-size: 14px; font-size: 14px;
text-align: left; text-align: left;
list-style: none; list-style: none;
background-color: #fff; background-color: #fff;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.15);
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-bookmark { .dropdown-bookmark {
border-color: #eee; border-color: #eee;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
z-index: 1000; z-index: 1000;
display: none; display: none;
float: left; float: left;
min-width: 160px; min-width: 160px;
margin: 2px 0 0; margin: 2px 0 0;
font-size: 14px; font-size: 14px;
text-align: left; text-align: left;
list-style: none; list-style: none;
background-color: #fff; background-color: #fff;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.15);
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-menu { .dropdown-menu {
border-color: #eee; border-color: #eee;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
z-index: 1000; z-index: 1000;
display: none; display: none;
float: left; float: left;
min-width: 160px; min-width: 160px;
margin: 2px 0 0; margin: 2px 0 0;
font-size: 14px; font-size: 14px;
text-align: left; text-align: left;
list-style: none; list-style: none;
background-color: #fff; background-color: #fff;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.15);
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-toggle{ .dropdown-toggle{
text-decoration: none !important; text-decoration: none !important;
} }
.dropdown-toggle::after { .dropdown-toggle::after {
/* font part */ /* font part */
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
font-size: 0.7em; font-size: 0.7em;
font-weight: 900; font-weight: 900;
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
text-rendering: auto; text-rendering: auto;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
margin: auto 3px; margin: auto 3px;
display: inline-block; display: inline-block;
content: "\f078"; content: "\f078";
-webkit-transition: -webkit-transform .2s ease-in-out; -webkit-transition: -webkit-transform .2s ease-in-out;
-ms-transition: -ms-transform .2s ease-in-out; -ms-transition: -ms-transform .2s ease-in-out;
transition: transform .2s ease-in-out; transition: transform .2s ease-in-out;
} }
.open>.dropdown-toggle::after { .open>.dropdown-toggle::after {
transform: rotate(180deg); transform: rotate(180deg);
} }
/* /*
* MENU Dropdown * MENU Dropdown
*/ */
.login_block.usedropdown .logout-btn{ .login_block.usedropdown .logout-btn{
/* display: none; */ /* display: none; */
} }
.tmenu .open.dropdown, .tmenu .open.dropdown { .tmenu .open.dropdown, .tmenu .open.dropdown {
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
} }
.tmenu .dropdown-menu, .login_block .dropdown-menu { .tmenu .dropdown-menu, .login_block .dropdown-menu {
position: absolute; position: absolute;
right: 0; right: 0;
<?php echo $left; ?>: auto; <?php echo $left; ?>: auto;
line-height:1.3em; line-height:1.3em;
} }
.tmenu .dropdown-menu, .login_block .dropdown-menu .user-body { .tmenu .dropdown-menu, .login_block .dropdown-menu .user-body {
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;
} }
.user-body { .user-body {
color: #333; color: #333;
} }
.side-nav-vert .user-menu .dropdown-menu { .side-nav-vert .user-menu .dropdown-menu {
border-top-right-radius: 0; border-top-right-radius: 0;
border-top-left-radius: 0; border-top-left-radius: 0;
padding: 1px 0 0 0; padding: 1px 0 0 0;
border-top-width: 0; border-top-width: 0;
width: 300px; width: 300px;
} }
.side-nav-vert .user-menu .dropdown-menu { .side-nav-vert .user-menu .dropdown-menu {
margin-top: 0; margin-top: 0;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
} }
.side-nav-vert .user-menu .dropdown-menu > .user-header { .side-nav-vert .user-menu .dropdown-menu > .user-header {
min-height: 100px; min-height: 100px;
padding: 10px; padding: 10px;
text-align: center; text-align: center;
white-space: normal; white-space: normal;
} }
#topmenu-global-search-dropdown .dropdown-menu{ #topmenu-global-search-dropdown .dropdown-menu{
width: 300px; width: 300px;
max-width: 100%; max-width: 100%;
} }
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown {
line-height: 46px; line-height: 46px;
} }
a.top-menu-dropdown-link { a.top-menu-dropdown-link {
padding: 8px; padding: 8px;
} }
.dropdown-user-image { .dropdown-user-image {
border-radius: 50%; border-radius: 50%;
vertical-align: middle; vertical-align: middle;
z-index: 5; z-index: 5;
height: 90px; height: 90px;
width: 90px; width: 90px;
border: 3px solid; border: 3px solid;
border-color: transparent; border-color: transparent;
border-color: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.2);
max-width: 100%; max-width: 100%;
max-height :100%; max-height :100%;
} }
.dropdown-menu > .user-header{ .dropdown-menu > .user-header{
background: rgb(<?php echo $colorbackhmenu1 ?>); background: rgb(<?php echo $colorbackhmenu1 ?>);
} }
.dropdown-menu .dropdown-header{ .dropdown-menu .dropdown-header{
padding: 8px 10px 10px 10px; padding: 8px 10px 10px 10px;
} }
.dropdown-menu > .user-footer { .dropdown-menu > .user-footer {
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 10px; padding: 10px;
} }
.user-footer:after { .user-footer:after {
clear: both; clear: both;
} }
.dropdown-menu > .bookmark-footer{ .dropdown-menu > .bookmark-footer{
border-top: 1px solid #f0f0f0; border-top: 1px solid #f0f0f0;
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 10px; padding: 10px;
} }
.dropdown-menu > .user-body, .dropdown-body{ .dropdown-menu > .user-body, .dropdown-body{
padding: 15px; padding: 15px;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
border-top: 1px solid #dddddd; border-top: 1px solid #dddddd;
white-space: normal; white-space: normal;
} }
.dropdown-menu > .bookmark-body, .dropdown-body{ .dropdown-menu > .bookmark-body, .dropdown-body{
padding: 10px 0; padding: 10px 0;
overflow-y: auto; overflow-y: auto;
max-height: 60vh ; /* fallback for browsers without support for calc() */ max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 110px) ; max-height: calc(90vh - 110px) ;
white-space: normal; white-space: normal;
} }
#topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{ #topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{
max-height: 60vh ; /* fallback for browsers without support for calc() */ max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 200px) ; max-height: calc(90vh - 200px) ;
} }
.dropdown-body::-webkit-scrollbar { .dropdown-body::-webkit-scrollbar {
width: 8px; width: 8px;
} }
.dropdown-body::-webkit-scrollbar-thumb { .dropdown-body::-webkit-scrollbar-thumb {
-webkit-border-radius: 0; -webkit-border-radius: 0;
border-radius: 0; border-radius: 0;
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */ /* background: rgb(<?php echo $colorbackhmenu1 ?>); */
background: #aaa; background: #aaa;
} }
.dropdown-body::-webkit-scrollbar-track { .dropdown-body::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 0; -webkit-border-radius: 0;
border-radius: 0; border-radius: 0;
} }
#topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown { #topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown {
padding: 0 5px 0 5px; padding: 0 5px 0 5px;
} }
#topmenu-login-dropdown a:hover{ #topmenu-login-dropdown a:hover{
text-decoration: none; text-decoration: none;
} }
#topmenuloginmoreinfo-btn{ #topmenuloginmoreinfo-btn{
display: block; display: block;
text-aling: right; text-aling: right;
color:#666; color:#666;
cursor: pointer; cursor: pointer;
} }
#topmenuloginmoreinfo{ #topmenuloginmoreinfo{
display: none; display: none;
clear: both; clear: both;
font-size: 0.95em; font-size: 0.95em;
} }
.button-top-menu-dropdown { .button-top-menu-dropdown {
display: inline-block; display: inline-block;
padding: 6px 12px; padding: 6px 12px;
margin-bottom: 0; margin-bottom: 0;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
line-height: 1.42857143; line-height: 1.42857143;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
vertical-align: middle; vertical-align: middle;
-ms-touch-action: manipulation; -ms-touch-action: manipulation;
touch-action: manipulation; touch-action: manipulation;
cursor: pointer; cursor: pointer;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
background-image: none; background-image: none;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 4px; border-radius: 4px;
} }
.user-footer .button-top-menu-dropdown { .user-footer .button-top-menu-dropdown {
color: #666666; color: #666666;
border-radius: 0; border-radius: 0;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
border-width: 1px; border-width: 1px;
background-color: #f4f4f4; background-color: #f4f4f4;
border-color: #ddd; border-color: #ddd;
} }
.dropdown-menu a.top-menu-dropdown-link { .dropdown-menu a.top-menu-dropdown-link {
color: rgb(<?php print $colortextlink; ?>) !important; color: rgb(<?php print $colortextlink; ?>) !important;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
display: block; display: block;
margin: 5px 0px; margin: 5px 0px;
} }
.dropdown-item { .dropdown-item {
display: block !important; display: block !important;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
padding: .25rem 1.5rem .25rem 1rem; padding: .25rem 1.5rem .25rem 1rem;
clear: both; clear: both;
font-weight: 400; font-weight: 400;
color: #212529 !important; color: #212529 !important;
text-align: inherit; text-align: inherit;
background-color: transparent; background-color: transparent;
border: 0; border: 0;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.dropdown-item::before { .dropdown-item::before {
/* font part */ /* font part */
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
font-weight: 900; font-weight: 900;
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
text-rendering: auto; text-rendering: auto;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
margin-right: 5px; margin-right: 5px;
display: inline-block; display: inline-block;
content: "\f0da"; content: "\f0da";
color: rgba(0,0,0,0.3); color: rgba(0,0,0,0.3);
} }
.dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus { .dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus {
color: #<?php echo $colortextbackhmenu; ?> !important; color: #<?php echo $colortextbackhmenu; ?> !important;
text-decoration: none; text-decoration: none;
background: rgb(<?php echo $colorbackhmenu1 ?>); background: rgb(<?php echo $colorbackhmenu1 ?>);
} }
/* /*
@ -381,26 +383,26 @@ a.top-menu-dropdown-link {
*/ */
.dropdown-search-input { .dropdown-search-input {
width: 100%; width: 100%;
padding: 10px 35px 10px 20px; padding: 10px 35px 10px 20px;
background-color: transparent; background-color: transparent;
font-size: 14px; font-size: 14px;
line-height: 16px; line-height: 16px;
box-sizing: border-box; box-sizing: border-box;
color: #575756; color: #575756;
background-color: transparent; background-color: transparent;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 16px 16px; background-size: 16px 16px;
background-position: 95% center; background-position: 95% center;
border-radius: 50px; border-radius: 50px;
border: 1px solid #c4c4c2 !important; border: 1px solid #c4c4c2 !important;
transition: all 250ms ease-in-out; transition: all 250ms ease-in-out;
backface-visibility: hidden; backface-visibility: hidden;
transform-style: preserve-3d; transform-style: preserve-3d;
} }
@ -421,11 +423,11 @@ a.top-menu-dropdown-link {
} }
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown {
line-height: unset; line-height: unset;
} }
ul.tmenu { ul.tmenu {
margin-right: 2px; margin-right: 2px;
} }
} }
@ -450,10 +452,10 @@ a.top-menu-dropdown-link {
.dropdown-search-input::placeholder { .dropdown-search-input::placeholder {
color: color(#575756 a(0.8)); color: color(#575756 a(0.8));
letter-spacing: 1.5px; letter-spacing: 1.5px;
} }
.hidden-search-result{ .hidden-search-result{
display: none !important; display: none !important;
} }

View File

@ -1,5 +1,7 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
@ -12,10 +14,16 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$prefix = ''; $prefix = '';
if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'background-'; if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) {
$prefix = 'background-';
}
if (!isset($conf->global->THEME_SATURATE_RATIO)) $conf->global->THEME_SATURATE_RATIO = 0.7; if (!isset($conf->global->THEME_SATURATE_RATIO)) {
if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int'); $conf->global->THEME_SATURATE_RATIO = 0.7;
}
if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
$conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
}
?> ?>
@ -112,14 +120,14 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
.info-box-module-external span.info-box-icon-version { .info-box-module-external span.info-box-icon-version {
background: #bbb; background: #bbb;
} }
a.info-box-text.info-box-text-a { a.info-box-text.info-box-text-a {
display: table-cell; display: table-cell;
} }
a.info-box-text-a i.fa.fa-exclamation-triangle { a.info-box-text-a i.fa.fa-exclamation-triangle {
font-size: 0.9em; font-size: 0.9em;
} }
.info-box { .info-box {
@ -134,14 +142,14 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
border: 1px solid #e9e9e9; border: 1px solid #e9e9e9;
} }
.info-box.info-box-sm{ .info-box.info-box-sm{
min-height: 80px; min-height: 80px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.info-box-more { .info-box-more {
float: right; float: right;
top: 4px; top: 4px;
position: absolute; position: absolute;
right: 10px; right: 10px;
} }
.info-box small { .info-box small {
@ -182,17 +190,17 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
font-size: 45px; font-size: 45px;
line-height: 90px; line-height: 90px;
background: #eee; background: #eee;
<?php if (isset($conf->global->THEME_SATURATE_RATIO)) { ?> <?php if (isset($conf->global->THEME_SATURATE_RATIO)) { ?>
filter: saturate(<?php echo $conf->global->THEME_SATURATE_RATIO; ?>); filter: saturate(<?php echo $conf->global->THEME_SATURATE_RATIO; ?>);
<?php } ?> <?php } ?>
} }
.info-box-sm .info-box-icon { .info-box-sm .info-box-icon {
width: 80px; width: 80px;
font-size: 25px; font-size: 25px;
line-height: 92px; line-height: 92px;
} }
.opened-dash-board-wrap .info-box-sm .info-box-icon { .opened-dash-board-wrap .info-box-sm .info-box-icon {
line-height: 80px; line-height: 80px;
} }
.info-box-module .info-box-icon { .info-box-module .info-box-icon {
height: 98px; height: 98px;
@ -201,69 +209,69 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
max-width: 100%; max-width: 100%;
} }
.info-box-module .info-box-icon > img { .info-box-module .info-box-icon > img {
max-width: 55%; max-width: 55%;
} }
.info-box-icon-text{ .info-box-icon-text{
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
position: absolute; position: absolute;
width: 90px; width: 90px;
bottom: 0px; bottom: 0px;
color: #ffffff; color: #ffffff;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
cursor: default; cursor: default;
font-size: 10px; font-size: 10px;
line-height: 15px; line-height: 15px;
padding: 0px 3px; padding: 0px 3px;
text-align: center; text-align: center;
opacity: 0; opacity: 0;
-webkit-transition: opacity 0.5s, visibility 0s 0.5s; -webkit-transition: opacity 0.5s, visibility 0s 0.5s;
transition: opacity 0.5s, visibility 0s 0.5s; transition: opacity 0.5s, visibility 0s 0.5s;
} }
.info-box-icon-version { .info-box-icon-version {
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
position: absolute; position: absolute;
width: 90px; width: 90px;
bottom: 0px; bottom: 0px;
color: #ffffff; color: #ffffff;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
cursor: default; cursor: default;
font-size: 10px; font-size: 10px;
line-height: 22px; line-height: 22px;
padding: 0px 3px; padding: 0px 3px;
text-align: center; text-align: center;
opacity: 1; opacity: 1;
-webkit-transition: opacity 0.5s, visibility 0s 0.5s; -webkit-transition: opacity 0.5s, visibility 0s 0.5s;
transition: opacity 0.5s, visibility 0s 0.5s; transition: opacity 0.5s, visibility 0s 0.5s;
} }
.box-flex-item.info-box-module.info-box-module-disabled { .box-flex-item.info-box-module.info-box-module-disabled {
/* opacity: 0.6; */ /* opacity: 0.6; */
} }
.info-box-actions { .info-box-actions {
position: absolute; position: absolute;
right: 0; right: 0;
bottom: 0; bottom: 0;
} }
<?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?> <?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?>
.info-box-icon-text{ .info-box-icon-text{
opacity: 1; opacity: 1;
} }
<?php } ?> <?php } ?>
.info-box-sm .info-box-icon-text, .info-box-sm .info-box-icon-version{ .info-box-sm .info-box-icon-text, .info-box-sm .info-box-icon-version{
overflow: hidden; overflow: hidden;
width: 80px; width: 80px;
} }
.info-box:hover .info-box-icon-text{ .info-box:hover .info-box-icon-text{
opacity: 1; opacity: 1;
} }
.info-box-content { .info-box-content {
@ -291,7 +299,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
margin-bottom: 6px; margin-bottom: 6px;
} }
.info-box-title { .info-box-title {
width: calc(100% - 20px); width: calc(100% - 20px);
} }
.info-box-text{ .info-box-text{
font-size: 0.92em; font-size: 0.92em;
@ -315,8 +323,12 @@ a.info-box-text{ text-decoration: none;}
} }
<?php <?php
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!isset($conf->global->THEME_SATURATE_RATIO)) $conf->global->THEME_SATURATE_RATIO = 0.7; if (!isset($conf->global->THEME_SATURATE_RATIO)) {
if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int'); $conf->global->THEME_SATURATE_RATIO = 0.7;
}
if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
$conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
}
?> ?>
.bg-infobox-project i.fa{ .bg-infobox-project i.fa{
color: #605ca8 !important; color: #605ca8 !important;
@ -471,7 +483,7 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
.info-box-module { .info-box-module {
min-width: 350px; min-width: 350px;
max-width: 350px; max-width: 350px;
} }
.info-box-module .info-box-content { .info-box-module .info-box-content {
@ -481,8 +493,8 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
@media only screen and (max-width: 1740px) { @media only screen and (max-width: 1740px) {
.info-box-module { .info-box-module {
min-width: 315px; min-width: 315px;
max-width: 315px; max-width: 315px;
} }
} }
@media only screen and (max-width: 767px) { @media only screen and (max-width: 767px) {

View File

@ -1,48 +1,50 @@
<?php if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> <?php if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
.mainmenu::before{ .mainmenu::before{
/* font part */ /* font part */
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
font-weight: 900; font-weight: 900;
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
text-rendering: auto; text-rendering: auto;
line-height: 26px; line-height: 26px;
font-size: 1.5em; font-size: 1.5em;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
color: #<?php echo $colortextbackhmenu; ?>; color: #<?php echo $colortextbackhmenu; ?>;
} }
.fa-15x { .fa-15x {
font-size: 1.5em; font-size: 1.5em;
} }
div.mainmenu.ticket::before { div.mainmenu.ticket::before {
content: "\f3ff"; content: "\f3ff";
} }
div.mainmenu.ticket { div.mainmenu.ticket {
background-image: none !important; background-image: none !important;
} }
div.mainmenu.generic1::before { div.mainmenu.generic1::before {
content: "\f249"; content: "\f249";
} }
div.mainmenu.generic2::before { div.mainmenu.generic2::before {
content: "\f249"; content: "\f249";
} }
div.mainmenu.generic3::before { div.mainmenu.generic3::before {
content: "\f249"; content: "\f249";
} }
div.mainmenu.generic4::before { div.mainmenu.generic4::before {
content: "\f249"; content: "\f249";
} }
/* Define color of some picto */ /* Define color of some picto */

View File

@ -25,22 +25,46 @@
* \brief File for The Web App * \brief File for The Web App
*/ */
if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); if (!defined('NOREQUIREUSER')) {
if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); define('NOREQUIREUSER', '1');
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); }
if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); if (!defined('NOREQUIREDB')) {
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); define('NOREQUIREDB', '1');
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); }
if (!defined('NOLOGIN')) define('NOLOGIN', '1'); if (!defined('NOREQUIRESOC')) {
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); define('NOREQUIRESOC', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); }
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (!defined('NOREQUIRETRAN')) {
if (!defined('NOSESSION')) define('NOSESSION', '1'); define('NOREQUIRETRAN', '1');
}
if (!defined('NOCSRFCHECK')) {
define('NOCSRFCHECK', '1');
}
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1');
}
if (!defined('NOLOGIN')) {
define('NOLOGIN', '1');
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOSESSION')) {
define('NOSESSION', '1');
}
require_once __DIR__.'/../../main.inc.php'; require_once __DIR__.'/../../main.inc.php';
$appli = constant('DOL_APPLICATION_TITLE'); $appli = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli = $conf->global->MAIN_APPLICATION_TITLE;
}
top_httphead('text/json'); top_httphead('text/json');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
@ -48,22 +72,21 @@ if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=10800, public, must-revalidate'); header('Cache-Control: max-age=10800, public, must-revalidate');
// For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server // For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server
header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT'); header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT');
} } else {
else {
header('Cache-Control: no-cache'); header('Cache-Control: no-cache');
} }
?> ?>
{ {
"name": "<?php echo $appli; ?>", "name": "<?php echo $appli; ?>",
"icons": [ "icons": [
{ {
"src": "<?php echo DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png'; ?>", "src": "<?php echo DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png'; ?>",
"sizes": "256x256", "sizes": "256x256",
"type": "image/png" "type": "image/png"
} }
], ],
"theme_color": "#ffffff", "theme_color": "#ffffff",
"background_color": "#ffffff", "background_color": "#ffffff",
"display": "standalone" "display": "standalone"
} }

View File

@ -1,5 +1,7 @@
<?php <?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
}
include dol_buildpath($path.'/theme/eldy/progress.inc.php', 0); // actually md use same style as eldy theme include dol_buildpath($path.'/theme/eldy/progress.inc.php', 0); // actually md use same style as eldy theme

File diff suppressed because it is too large Load Diff

View File

@ -29,12 +29,9 @@
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
$theme_bordercolor = array(235, 235, 224); $theme_bordercolor = array(235, 235, 224);
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); $theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined. if (!defined('ISLOADEDBYSTEELSHEET')) { // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
{ if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) { // user is loaded by dolgraph.class.php
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy') {
{
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
{
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
} else { } else {
// for now we use the same configuration for all types of color blind // for now we use the same configuration for all types of color blind

View File

@ -46,16 +46,21 @@ $sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0; $page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page; $page = $page == -1 ? 0 : $page;
if (!$sortfield) $sortfield = "a.datep,a.id"; if (!$sortfield) {
if (!$sortorder) $sortorder = "DESC"; $sortfield = "a.datep,a.id";
}
if (!$sortorder) {
$sortorder = "DESC";
}
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (GETPOST('actioncode', 'array')) if (GETPOST('actioncode', 'array')) {
{
$actioncode = GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0'; if (!count($actioncode)) {
$actioncode = '0';
}
} else { } else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
} }
@ -83,8 +88,7 @@ if (!$user->rights->ticket->read) {
accessforbidden(); accessforbidden();
} }
// restrict access for externals users // restrict access for externals users
if ($user->socid > 0 && ($object->fk_soc != $user->socid)) if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
{
accessforbidden(); accessforbidden();
} }
// or for unauthorized internals users // or for unauthorized internals users
@ -100,17 +104,17 @@ if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object-
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{
// Set view style // Set view style
$_SESSION['ticket-view-type'] = "list"; $_SESSION['ticket-view-type'] = "list";
} }
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
{
$actioncode = ''; $actioncode = '';
$search_agenda_label = ''; $search_agenda_label = '';
} }
@ -126,7 +130,9 @@ $userstat = new User($db);
$formticket = new FormTicket($db); $formticket = new FormTicket($db);
$title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name; $title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name;
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
}
$help_url = 'FR:DocumentationModuleTicket'; $help_url = 'FR:DocumentationModuleTicket';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
@ -167,8 +173,7 @@ if (!empty($object->origin_email)) {
} }
// Thirdparty // Thirdparty
if (!empty($conf->societe->enabled)) if (!empty($conf->societe->enabled)) {
{
$morehtmlref .= '<br>'.$langs->trans('ThirdParty'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty');
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>'; $morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
@ -182,12 +187,10 @@ if (!empty($conf->societe->enabled))
} }
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled)) {
{
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project'); $morehtmlref .= '<br>'.$langs->trans('Project');
if ($user->rights->ticket->write) if ($user->rights->ticket->write) {
{
if ($action != 'classify') { if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref .= ' : '; $morehtmlref .= ' : ';
@ -225,11 +228,14 @@ print dol_get_fiche_end();
print '<br>'; print '<br>';
if (!empty($object->id)) if (!empty($object->id)) {
{
$param = '&id='.$object->id; $param = '&id='.$object->id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; $param .= '&contextpage='.$contextpage;
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
}
$morehtmlright = ''; $morehtmlright = '';

View File

@ -60,7 +60,9 @@ $sortorder = GETPOST('sortorder', 'aZ09comma');
if (GETPOST('actioncode', 'array')) { if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0'; if (!count($actioncode)) {
$actioncode = '0';
}
} else { } else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
} }
@ -80,12 +82,15 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// Initialize array of search criterias // Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha'); $search_all = GETPOST("search_all", 'alpha');
$search = array(); $search = array();
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{ if (GETPOST('search_'.$key, 'alpha')) {
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); $search[$key] = GETPOST('search_'.$key, 'alpha');
}
} }
if (empty($action) && empty($id) && empty($ref)) $action = 'view'; if (empty($action) && empty($id) && empty($ref)) {
$action = 'view';
}
//Select mail models is same action as add_message //Select mail models is same action as add_message
if (GETPOST('modelselected', 'alpha')) { if (GETPOST('modelselected', 'alpha')) {
@ -96,8 +101,7 @@ if (GETPOST('modelselected', 'alpha')) {
//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals //include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id || $track_id || $ref) { if ($id || $track_id || $ref) {
$res = $object->fetch($id, $ref, $track_id); $res = $object->fetch($id, $ref, $track_id);
if ($res >= 0) if ($res >= 0) {
{
$id = $object->id; $id = $object->id;
$track_id = $object->track_id; $track_id = $object->track_id;
} }
@ -125,13 +129,14 @@ $now = dol_now();
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$error = 0; $error = 0;
if (empty($reshook)) { if (empty($reshook)) {
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers{ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers{
{
$actioncode = ''; $actioncode = '';
$search_agenda_label = ''; $search_agenda_label = '';
} }
@ -159,7 +164,9 @@ if (empty($reshook)) {
$action = 'create'; $action = 'create';
} }
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
if (!$error) { if (!$error) {
$db->begin(); $db->begin();
@ -289,7 +296,9 @@ if (empty($reshook)) {
array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Subject'))); array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Subject')));
} }
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
} }
if (!$error) { if (!$error) {
@ -301,7 +310,9 @@ if (empty($reshook)) {
$object->severity_code = GETPOST('severity_code', 'alpha'); $object->severity_code = GETPOST('severity_code', 'alpha');
$ret = $object->update($user); $ret = $object->update($user);
if ($ret <= 0) $error++; if ($ret <= 0) {
$error++;
}
if ($error) { if ($error) {
$db->rollback(); $db->rollback();
@ -354,11 +365,12 @@ if (empty($reshook)) {
if (!$error) { if (!$error) {
$ret = $object->assignUser($user, $usertoassign); $ret = $object->assignUser($user, $usertoassign);
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
} }
if (!$error) // Update list of contacts if (!$error) { // Update list of contacts
{
// Si déjà un user assigné on le supprime des contacts // Si déjà un user assigné on le supprime des contacts
if ($useroriginassign > 0) { if ($useroriginassign > 0) {
$internal_contacts = $object->listeContact(-1, 'internal'); $internal_contacts = $object->listeContact(-1, 'internal');
@ -373,7 +385,9 @@ if (empty($reshook)) {
} }
} }
if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0); if ($usertoassign > 0) {
$object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
}
} }
if (!$error) { if (!$error) {
@ -517,16 +531,16 @@ if (empty($reshook)) {
} }
} }
} }
} // Categorisation dans projet } elseif ($action == 'classin' && $user->rights->ticket->write) {
elseif ($action == 'classin' && $user->rights->ticket->write) { // Categorisation dans projet
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$object->setProject(GETPOST('projectid', 'int')); $object->setProject(GETPOST('projectid', 'int'));
$url = 'card.php?action=view&track_id='.$object->track_id; $url = 'card.php?action=view&track_id='.$object->track_id;
header("Location: ".$url); header("Location: ".$url);
exit(); exit();
} }
} // Categorisation dans contrat } elseif ($action == 'setcontract' && $user->rights->ticket->write) {
elseif ($action == 'setcontract' && $user->rights->ticket->write) { // Categorisation dans contrat
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$object->setContract(GETPOST('contractid', 'int')); $object->setContract(GETPOST('contractid', 'int'));
$url = 'card.php?action=view&track_id='.$object->track_id; $url = 'card.php?action=view&track_id='.$object->track_id;
@ -557,8 +571,8 @@ if (empty($reshook)) {
} }
$action = 'view'; $action = 'view';
} // Reopen ticket } elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) {
elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) { // Reopen ticket
if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$new_status = GETPOST('new_status', 'int'); $new_status = GETPOST('new_status', 'int');
$old_status = $object->fk_statut; $old_status = $object->fk_statut;
@ -582,11 +596,15 @@ if (empty($reshook)) {
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
if (!$error) { if (!$error) {
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
} }
if ($error) { if ($error) {
@ -634,7 +652,9 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Set $action to correct value for the case we used presend action to add a message // Set $action to correct value for the case we used presend action to add a message
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage'; if (GETPOSTISSET('actionbis') && $action == 'presend') {
$action = 'presend_addmessage';
}
} }
@ -645,15 +665,16 @@ if (empty($reshook)) {
$userstat = new User($db); $userstat = new User($db);
$form = new Form($db); $form = new Form($db);
$formticket = new FormTicket($db); $formticket = new FormTicket($db);
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); if (!empty($conf->projet->enabled)) {
$formproject = new FormProjets($db);
}
$help_url = 'FR:DocumentationModuleTicket'; $help_url = 'FR:DocumentationModuleTicket';
$page_title = $actionobject->getTitle($action); $page_title = $actionobject->getTitle($action);
llxHeader('', $page_title, $help_url); llxHeader('', $page_title, $help_url);
if ($action == 'create' || $action == 'presend') if ($action == 'create' || $action == 'presend') {
{
$formticket = new FormTicket($db); $formticket = new FormTicket($db);
print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket');
@ -725,12 +746,9 @@ if ($action == 'create' || $action == 'presend')
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') if ($res > 0) {
{
if ($res > 0)
{
// or for unauthorized internals users // or for unauthorized internals users
if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden('', 0, 1); accessforbidden('', 0, 1);
@ -774,8 +792,8 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
print dol_get_fiche_head($head, 'ticket', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project')); print dol_get_fiche_head($head, 'ticket', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project'));
/* /*
* Projet synthese pour rappel * Projet synthese pour rappel
*/ */
print '<table class="border centpercent">'; print '<table class="border centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -878,19 +896,20 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->ticket->write) { if ($user->rights->ticket->write) {
if ($action != 'classify') if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>'; $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
$morehtmlref .= ' : '; }
if ($action == 'classify') { $morehtmlref .= ' : ';
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<input type="hidden" name="action" value="classin">'; $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">'; $morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
$morehtmlref .= '</form>'; $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref .= '</form>';
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
} }
} else { } else {
if (!empty($object->fk_project)) { if (!empty($object->fk_project)) {
@ -1010,8 +1029,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
print '</tr>'; print '</tr>';
// Timing (Duration sum of linked fichinter) // Timing (Duration sum of linked fichinter)
if ($conf->fichinter->enabled) if ($conf->fichinter->enabled) {
{
$object->fetchObjectLinked(); $object->fetchObjectLinked();
$num = count($object->linkedObjects); $num = count($object->linkedObjects);
$timing = 0; $timing = 0;
@ -1120,8 +1138,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
} }
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
{
print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png'); print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -1245,10 +1262,11 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
print '<div class="tabsAction">'."\n"; print '<div class="tabsAction">'."\n";
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{
// Show link to add a message (if read and not closed) // Show link to add a message (if read and not closed)
if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") { if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
print '<div class="inline-block divButAction"><a class="butAction reposition" href="card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init">'.$langs->trans('TicketAddMessage').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction reposition" href="card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init">'.$langs->trans('TicketAddMessage').'</a></div>';
@ -1292,11 +1310,12 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
$action = 'presend'; $action = 'presend';
} }
// Set $action to correct value for the case we used presend action to add a message // Set $action to correct value for the case we used presend action to add a message
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage'; if (GETPOSTISSET('actionbis') && $action == 'presend') {
$action = 'presend_addmessage';
}
// add a message // add a message
if ($action == 'presend' || $action == 'presend_addmessage') if ($action == 'presend' || $action == 'presend_addmessage') {
{
$action = 'add_message'; // action to use to post the message $action = 'add_message'; // action to use to post the message
$modelmail = 'ticket_send'; $modelmail = 'ticket_send';
@ -1375,10 +1394,18 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
// Show messages on card (Note: this is a duplicate of the view Events/Agenda but on the main tab) // Show messages on card (Note: this is a duplicate of the view Events/Agenda but on the main tab)
if (!empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) { if (!empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) {
$param = '&id='.$object->id; $param = '&id='.$object->id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; $param .= '&contextpage='.$contextpage;
if ($actioncode) $param .= '&actioncode='.urlencode($actioncode); }
if ($search_agenda_label) $param .= '&search_agenda_label='.urlencode($search_agenda_label); if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
}
if ($actioncode) {
$param .= '&actioncode='.urlencode($actioncode);
}
if ($search_agenda_label) {
$param .= '&search_agenda_label='.urlencode($search_agenda_label);
}
$morehtmlright = ''; $morehtmlright = '';

View File

@ -262,14 +262,15 @@ class ActionsTicket
// Load logs in cache // Load logs in cache
$ret = $this->dao->loadCacheMsgsTicket(); $ret = $this->dao->loadCacheMsgsTicket();
if ($ret < 0) dol_print_error($this->dao->db); if ($ret < 0) {
dol_print_error($this->dao->db);
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$this->viewTicketOriginalMessage($user, $action, $object); $this->viewTicketOriginalMessage($user, $action, $object);
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
{
print '<table class="border" style="width:100%;">'; print '<table class="border" style="width:100%;">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -114,8 +114,7 @@ class Tickets extends DolibarrApi
{ {
try { try {
return $this->getCommon(0, '', $ref); return $this->getCommon(0, '', $ref);
} catch (Exception $e) } catch (Exception $e) {
{
throw $e; throw $e;
} }
} }

View File

@ -410,7 +410,9 @@ class Ticket extends CommonObject
// Clean parameters // Clean parameters
$this->datec = dol_now(); $this->datec = dol_now();
if (empty($this->track_id)) $this->track_id = generate_random_id(16); if (empty($this->track_id)) {
$this->track_id = generate_random_id(16);
}
// Check more parameters // Check more parameters
// If error, this->errors[] is filled // If error, this->errors[] is filled
@ -581,8 +583,7 @@ class Ticket extends CommonObject
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql)) {
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
@ -991,7 +992,9 @@ class Ticket extends CommonObject
if (!$error) { if (!$error) {
// Delete linked object // Delete linked object
$res = $this->deleteObjectLinked(); $res = $this->deleteObjectLinked();
if ($res < 0) $error++; if ($res < 0) {
$error++;
}
} }
// Removed extrafields // Removed extrafields
@ -1319,7 +1322,9 @@ class Ticket extends CommonObject
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager; global $menumanager;
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
}
$result = ''; $result = '';
@ -1332,33 +1337,40 @@ class Ticket extends CommonObject
$url = dol_buildpath('/ticket/card.php', 1).'?id='.$this->id; $url = dol_buildpath('/ticket/card.php', 1).'?id='.$this->id;
if ($option != 'nolink') if ($option != 'nolink') {
{
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; $add_save_lastsearch_values = 1;
}
if ($add_save_lastsearch_values) {
$url .= '&save_lastsearch_values=1';
}
} }
$linkclose = ''; $linkclose = '';
if (empty($notooltip)) if (empty($notooltip)) {
{ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label = $langs->trans("ShowTicket"); $label = $langs->trans("ShowTicket");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
$linkstart = '<a href="'.$url.'"'; $linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>'; $linkstart .= $linkclose.'>';
$linkend = '</a>'; $linkend = '</a>';
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto) {
if ($withpicto != 2) $result .= $this->ref; $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
}
$result .= $linkend; $result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@ -1437,8 +1449,7 @@ class Ticket extends CommonObject
$this->oldcopy = dol_clone($this); $this->oldcopy = dol_clone($this);
$sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; $sql = "UPDATE ".MAIN_DB_PREFIX."ticket";
if ($id_assign_user > 0) if ($id_assign_user > 0) {
{
$sql .= " SET fk_user_assign=".$id_assign_user.", fk_statut = ".Ticket::STATUS_ASSIGNED; $sql .= " SET fk_user_assign=".$id_assign_user.", fk_statut = ".Ticket::STATUS_ASSIGNED;
} else { } else {
$sql .= " SET fk_user_assign=null, fk_statut = ".Ticket::STATUS_READ; $sql .= " SET fk_user_assign=null, fk_statut = ".Ticket::STATUS_READ;
@ -1447,8 +1458,7 @@ class Ticket extends CommonObject
dol_syslog(get_class($this)."::assignUser sql=".$sql); dol_syslog(get_class($this)."::assignUser sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$this->fk_user_assign = $id_assign_user; // May be used by trigger $this->fk_user_assign = $id_assign_user; // May be used by trigger
if (!$notrigger) { if (!$notrigger) {
@ -1588,29 +1598,29 @@ class Ticket extends CommonObject
// TODO Read the table llx_actioncomm // TODO Read the table llx_actioncomm
/* /*
$sql = "SELECT rowid, fk_user_create, datec, message"; $sql = "SELECT rowid, fk_user_create, datec, message";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket_logs"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket_logs";
$sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'"; $sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'";
$sql .= " ORDER BY datec DESC"; $sql .= " ORDER BY datec DESC";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->cache_logs_ticket[$i]['id'] = $obj->rowid; $this->cache_logs_ticket[$i]['id'] = $obj->rowid;
$this->cache_logs_ticket[$i]['fk_user_create'] = $obj->fk_user_create; $this->cache_logs_ticket[$i]['fk_user_create'] = $obj->fk_user_create;
$this->cache_logs_ticket[$i]['datec'] = $this->db->jdate($obj->datec); $this->cache_logs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
$this->cache_logs_ticket[$i]['message'] = $obj->message; $this->cache_logs_ticket[$i]['message'] = $obj->message;
$i++; $i++;
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::loadCacheLogsTicket " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::loadCacheLogsTicket " . $this->error, LOG_ERR);
return -1; return -1;
}*/ }*/
return 0; return 0;
} }
@ -1669,14 +1679,12 @@ class Ticket extends CommonObject
$actioncomm->attachedfiles = $attachedfiles; $actioncomm->attachedfiles = $attachedfiles;
} }
if (!empty($mimefilename_list) && is_array($mimefilename_list)) if (!empty($mimefilename_list) && is_array($mimefilename_list)) {
{
$actioncomm->note_private = dol_concatdesc($actioncomm->note_private, "\n".$langs->transnoentities("AttachedFiles").': '.join(';', $mimefilename_list)); $actioncomm->note_private = dol_concatdesc($actioncomm->note_private, "\n".$langs->transnoentities("AttachedFiles").': '.join(';', $mimefilename_list));
} }
$actionid = $actioncomm->create($user); $actionid = $actioncomm->create($user);
if ($actionid <= 0) if ($actionid <= 0) {
{
$error++; $error++;
$this->error = $actioncomm->error; $this->error = $actioncomm->error;
$this->errors = $actioncomm->errors; $this->errors = $actioncomm->errors;
@ -1760,8 +1768,7 @@ class Ticket extends CommonObject
if (!empty($conf->ficheinter->enabled) && !empty($conf->global->WORKFLOW_TICKET_CLOSE_INTERVENTION)) { if (!empty($conf->ficheinter->enabled) && !empty($conf->global->WORKFLOW_TICKET_CLOSE_INTERVENTION)) {
dol_syslog("We have closed the ticket, so we close all linked interventions"); dol_syslog("We have closed the ticket, so we close all linked interventions");
$this->fetchObjectLinked($this->id, $this->element, null, 'fichinter'); $this->fetchObjectLinked($this->id, $this->element, null, 'fichinter');
if ($this->linkedObjectsIds) if ($this->linkedObjectsIds) {
{
foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) { foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) {
$fichinter = new Fichinter($this->db); $fichinter = new Fichinter($this->db);
$fichinter->fetch($fichinter_id); $fichinter->fetch($fichinter_id);
@ -2148,8 +2155,7 @@ class Ticket extends CommonObject
$sendto = $obj->firstname." ".$obj->lastname." <".$obj->email.">"; $sendto = $obj->firstname." ".$obj->lastname." <".$obj->email.">";
$actiondefid = $obj->adid; $actiondefid = $obj->adid;
if (dol_strlen($sendto)) if (dol_strlen($sendto)) {
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM'); $application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM');
@ -2465,8 +2471,7 @@ class Ticket extends CommonObject
foreach ($filename as $i => $val) { foreach ($filename as $i => $val) {
$destfile = $destdir.'/'.$filename[$i]; $destfile = $destdir.'/'.$filename[$i];
// If destination file already exists, we add a suffix to avoid to overwrite // If destination file already exists, we add a suffix to avoid to overwrite
if (is_file($destfile)) if (is_file($destfile)) {
{
$pathinfo = pathinfo($filename[$i]); $pathinfo = pathinfo($filename[$i]);
$now = dol_now(); $now = dol_now();
$destfile = $destdir.'/'.$pathinfo['filename'].' - '.dol_print_date($now, 'dayhourlog').'.'.$pathinfo['extension']; $destfile = $destdir.'/'.$pathinfo['filename'].' - '.dol_print_date($now, 'dayhourlog').'.'.$pathinfo['extension'];
@ -2626,11 +2631,10 @@ class Ticket extends CommonObject
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames); $this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
} }
} }
} } else {
/* /*
* Private area * Private area
*/ */
else {
/* /*
* Send emails to internal users (linked contacts) * Send emails to internal users (linked contacts)
*/ */
@ -2670,7 +2674,9 @@ class Ticket extends CommonObject
} }
if ($info_sendto['email'] != '') { if ($info_sendto['email'] != '') {
if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; if (!empty($info_sendto['email'])) {
$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
}
//Contact type //Contact type
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')';
@ -2686,7 +2692,9 @@ class Ticket extends CommonObject
// Add global email address recipient // Add global email address recipient
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
} }
// altairis: dont try to send email if no recipient // altairis: dont try to send email if no recipient
@ -2744,7 +2752,9 @@ class Ticket extends CommonObject
} }
if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) { if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) {
if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; if (!empty($info_sendto['email'])) {
$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
}
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')';
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient.'<br>' : ''); $message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient.'<br>' : '');
@ -2769,12 +2779,16 @@ class Ticket extends CommonObject
if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) { if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) {
$object->socid = $object->fk_soc; $object->socid = $object->fk_soc;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if (!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email; if (!empty($object->thirdparty->email)) {
$sendto[] = $object->thirdparty->email;
}
} }
// altairis: Add global email address reciepient // altairis: Add global email address reciepient
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
} }
// altairis: dont try to send email when no recipient // altairis: dont try to send email when no recipient
@ -2787,8 +2801,7 @@ class Ticket extends CommonObject
} }
// Set status to "answered" if not set yet, but only if internal user // Set status to "answered" if not set yet, but only if internal user
if ($object->fk_statut < 3 && !$user->socid) if ($object->fk_statut < 3 && !$user->socid) {
{
$object->setStatut(3); $object->setStatut(3);
} }
@ -2842,8 +2855,7 @@ class Ticket extends CommonObject
$from = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM; $from = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM;
if (is_array($array_receiver) && count($array_receiver) > 0) { if (is_array($array_receiver) && count($array_receiver) > 0) {
foreach ($array_receiver as $key => $receiver) foreach ($array_receiver as $key => $receiver) {
{
$deliveryreceipt = 0; $deliveryreceipt = 0;
$filepath = $filename_list; $filepath = $filename_list;
$filename = $mimefilename_list; $filename = $mimefilename_list;
@ -2903,19 +2915,21 @@ class Ticket extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec"; $sql = "SELECT p.rowid, p.ref, p.datec as datec";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
if (!$user->rights->societe->client->voir && !$user->socid) if (!$user->rights->societe->client->voir && !$user->socid) {
{
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".$user->id; $sql .= " WHERE sc.fk_user = ".$user->id;
$clause = " AND"; $clause = " AND";
} }
$sql .= $clause." p.entity IN (".getEntity('ticket').")"; $sql .= $clause." p.entity IN (".getEntity('ticket').")";
if ($mode == 'opened') $sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")"; if ($mode == 'opened') {
if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid; $sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")";
}
if ($user->socid) {
$sql .= " AND p.fk_soc = ".$user->socid;
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$label = $labelShort = ''; $label = $labelShort = '';
$status = ''; $status = '';
if ($mode == 'opened') { if ($mode == 'opened') {
@ -2934,14 +2948,11 @@ class Ticket extends CommonObject
$response->img = img_object('', "ticket"); $response->img = img_object('', "ticket");
// This assignment in condition is not a bug. It allows walking the results. // This assignment in condition is not a bug. It allows walking the results.
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql)) {
{
$response->nbtodo++; $response->nbtodo++;
if ($mode == 'opened') if ($mode == 'opened') {
{
$datelimit = $this->db->jdate($obj->datefin); $datelimit = $this->db->jdate($obj->datefin);
if ($datelimit < ($now - $delay_warning)) if ($datelimit < ($now - $delay_warning)) {
{
//$response->nbtodolate++; //$response->nbtodolate++;
} }
} }
@ -2970,8 +2981,7 @@ class Ticket extends CommonObject
$sql = "SELECT count(p.rowid) as nb"; $sql = "SELECT count(p.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->socid) if (!$user->rights->societe->client->voir && !$user->socid) {
{
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".$user->id; $sql .= " WHERE sc.fk_user = ".$user->id;
$clause = "AND"; $clause = "AND";
@ -2979,11 +2989,9 @@ class Ticket extends CommonObject
$sql .= " ".$clause." p.entity IN (".getEntity('ticket').")"; $sql .= " ".$clause." p.entity IN (".getEntity('ticket').")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
// This assignment in condition is not a bug. It allows walking the results. // This assignment in condition is not a bug. It allows walking the results.
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql)) {
{
$this->nb["ticket"] = $obj->nb; $this->nb["ticket"] = $obj->nb;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -78,8 +78,7 @@ class Diff
} }
$end2 = ($compareCharacters ? strlen($sequence1) : count($sequence1)); $end2 = ($compareCharacters ? strlen($sequence1) : count($sequence1));
for ($index = $end1 + 1; $index < $end2; $index++) for ($index = $end1 + 1; $index < $end2; $index++) {
{
$diff[] = array($sequence1[$index], self::UNMODIFIED); $diff[] = array($sequence1[$index], self::UNMODIFIED);
} }
@ -313,12 +312,12 @@ class Diff
self::DELETED self::DELETED
); );
$rightCell = self::getCellContent( $rightCell = self::getCellContent(
$diff, $diff,
$indentation, $indentation,
$separator, $separator,
$index, $index,
self::INSERTED self::INSERTED
); );
break; break;
// display the inserted content on the right // display the inserted content on the right

View File

@ -124,8 +124,7 @@ $contactstatic = new Contact($db);
$userstatic = new User($db); $userstatic = new User($db);
if ($id > 0 || !empty($track_id) || !empty($ref)) { if ($id > 0 || !empty($track_id) || !empty($ref)) {
if ($object->fetch($id, $ref, $track_id) > 0) if ($object->fetch($id, $ref, $track_id) > 0) {
{
if ($socid > 0) { if ($socid > 0) {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$head = societe_prepare_head($object->thirdparty); $head = societe_prepare_head($object->thirdparty);
@ -161,12 +160,11 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
} }
// Thirdparty // Thirdparty
if (!empty($conf->societe->enabled)) if (!empty($conf->societe->enabled)) {
{
$morehtmlref .= '<br>'.$langs->trans('ThirdParty'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty');
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>'; $morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
}*/ }*/
$morehtmlref .= ' : '; $morehtmlref .= ' : ';
if ($action == 'editcustomer') { if ($action == 'editcustomer') {
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
@ -176,12 +174,10 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
} }
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled)) {
{
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->ticket->write) if ($user->rights->ticket->write) {
{
if ($action != 'classify') { if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref .= ' : '; $morehtmlref .= ' : ';

View File

@ -22,14 +22,26 @@
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); if (!defined('NOCSRFCHECK')) {
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); define('NOCSRFCHECK', 1);
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login }
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1);
}
if (!defined('NOLOGIN')) {
define('NOLOGIN', 1); // File must be accessed by logon page so without login
}
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); if (!defined('NOREQUIREHTML')) {
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); define('NOREQUIREHTML', 1);
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
session_cache_limiter('public'); session_cache_limiter('public');
@ -39,13 +51,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Define css type // Define css type
top_httphead('text/css'); top_httphead('text/css');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); if (empty($dolibarr_nocache)) {
else header('Cache-Control: no-cache'); header('Cache-Control: max-age=3600, public, must-revalidate');
} else {
header('Cache-Control: no-cache');
}
?> ?>
html { html {
min-height: 100%; height: 100%; min-height: 100%; height: 100%;
} }
html { html {
@ -58,49 +73,49 @@ if (!empty($conf->global->TICKET_SHOW_MODULE_LOGO)) {
div.ticketform { div.ticketform {
font-family: arial; font-family: arial;
position: static; position: static;
padding: 2em 1em; padding: 2em 1em;
overflow-x: auto; overflow-x: auto;
border: 2px solid rgb(153, 153, 153); border: 2px solid rgb(153, 153, 153);
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
box-shadow: 2px 2px 2px rgb(245, 245, 245); box-shadow: 2px 2px 2px rgb(245, 245, 245);
border-radius: 10px 10px 10px 10px; border-radius: 10px 10px 10px 10px;
margin: 1.5em; margin: 1.5em;
background : #ffffff; background : #ffffff;
text-align: center; text-align: center;
} }
div.ticketform .index_create, .index_display { div.ticketform .index_create, .index_display {
display: inline-block; display: inline-block;
width: 200px; width: 200px;
height: 45px; height: 45px;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
margin: 20px; margin: 20px;
text-transform: uppercase; text-transform: uppercase;
} }
#form_create_ticket, #form_view_ticket #form_create_ticket, #form_view_ticket
{ {
margin-left: 10px; margin-left: 10px;
margin-right: 10px; margin-right: 10px;
padding-left:1em; padding-left:1em;
padding-right:1em; padding-right:1em;
padding-top:1.5em; padding-top:1.5em;
padding-bottom:12px; padding-bottom:12px;
border: 1px solid #C0C0C0; border: 1px solid #C0C0C0;
background-color: #E0E0E0; background-color: #E0E0E0;
-moz-box-shadow: 4px 4px 4px #DDD; -moz-box-shadow: 4px 4px 4px #DDD;
-webkit-box-shadow: 4px 4px 4px #DDD; -webkit-box-shadow: 4px 4px 4px #DDD;
box-shadow: 4px 4px 4px #DDD; box-shadow: 4px 4px 4px #DDD;
border-radius: 8px; border-radius: 8px;
border:solid 1px rgba(168,168,168,.4); border:solid 1px rgba(168,168,168,.4);
border-top:solid 1px f8f8f8; border-top:solid 1px f8f8f8;
background-color: #f8f8f8; background-color: #f8f8f8;
} }
#form_create_ticket input.text, #form_create_ticket textarea { width:450px;} #form_create_ticket input.text, #form_create_ticket textarea { width:450px;}

View File

@ -52,12 +52,18 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) {
if (!$sortfield) $sortfield = "position_name"; $sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "position_name";
}
$object = new Ticket($db); $object = new Ticket($db);
$result = $object->fetch($id, $ref, $track_id); $result = $object->fetch($id, $ref, $track_id);
@ -86,8 +92,7 @@ $form = new Form($db);
$help_url = ''; $help_url = '';
llxHeader('', $langs->trans("TicketDocumentsLinked").' - '.$langs->trans("Files"), $help_url); llxHeader('', $langs->trans("TicketDocumentsLinked").' - '.$langs->trans("Files"), $help_url);
if ($object->id) if ($object->id) {
{
/* /*
* Show tabs * Show tabs
*/ */
@ -126,12 +131,11 @@ if ($object->id)
} }
// Thirdparty // Thirdparty
if (!empty($conf->societe->enabled)) if (!empty($conf->societe->enabled)) {
{
$morehtmlref .= '<br>'.$langs->trans('ThirdParty'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty');
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>'; $morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
}*/ }*/
$morehtmlref .= ' : '; $morehtmlref .= ' : ';
if ($action == 'editcustomer') { if ($action == 'editcustomer') {
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
@ -141,12 +145,10 @@ if ($object->id)
} }
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled)) {
{
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->ticket->write) if ($user->rights->ticket->write) {
{
if ($action != 'classify') { if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref .= ' : '; $morehtmlref .= ' : ';
@ -190,11 +192,11 @@ if ($object->id)
//$object->ref = $object->track_id; // For compatibility we use track ID for directory //$object->ref = $object->track_id; // For compatibility we use track ID for directory
$modulepart = 'ticket'; $modulepart = 'ticket';
$permission = $user->rights->ticket->write; $permission = $user->rights->ticket->write;
$permtoedit = $user->rights->ticket->write; $permtoedit = $user->rights->ticket->write;
$param = '&id='.$object->id; $param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else { } else {
accessforbidden('', 0, 1); accessforbidden('', 0, 1);
} }

View File

@ -72,7 +72,9 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -81,32 +83,44 @@ $pagenext = $page + 1;
$object = new Ticket($db); $object = new Ticket($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->ticket->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->ticket->dir_output.'/temp/massgeneration/'.$user->id;
if ($socid > 0) $hookmanager->initHooks(array('thirdpartyticket')); if ($socid > 0) {
elseif ($projectid > 0) $hookmanager->initHooks(array('projectticket')); $hookmanager->initHooks(array('thirdpartyticket'));
else $hookmanager->initHooks(array('ticketlist')); } elseif ($projectid > 0) {
$hookmanager->initHooks(array('projectticket'));
} else {
$hookmanager->initHooks(array('ticketlist'));
}
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST) // Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) $sortfield = "t.datec"; if (!$sortfield) {
if (!$sortorder) $sortorder = "DESC"; $sortfield = "t.datec";
}
if (!$sortorder) {
$sortorder = "DESC";
}
if (GETPOST('search_fk_status', 'alpha') == 'non_closed') $_GET['search_fk_statut'][] = 'openall'; // For backward compatibility if (GETPOST('search_fk_status', 'alpha') == 'non_closed') {
$_GET['search_fk_statut'][] = 'openall'; // For backward compatibility
}
// Initialize array of search criterias // Initialize array of search criterias
$search_all = trim(GETPOSTISSET("search_all") ?GETPOSTISSET("search_all", 'alpha') : GETPOST('sall')); $search_all = trim(GETPOSTISSET("search_all") ?GETPOSTISSET("search_all", 'alpha') : GETPOST('sall'));
$search = array(); $search = array();
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{ if (GETPOST('search_'.$key, 'alpha')) {
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); $search[$key] = GETPOST('search_'.$key, 'alpha');
}
} }
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array(); $fieldstosearchall = array();
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{ if ($val['searchall']) {
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; $fieldstosearchall['t.'.$key] = $val['label'];
}
} }
$fieldstosearchall['s.name_alias'] = "AliasNameShort"; $fieldstosearchall['s.name_alias'] = "AliasNameShort";
$fieldstosearchall['s.zip'] = "Zip"; $fieldstosearchall['s.zip'] = "Zip";
@ -114,10 +128,11 @@ $fieldstosearchall['s.town'] = "Town";
// Definition of fields for list // Definition of fields for list
$arrayfields = array(); $arrayfields = array();
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
// If $val['visible']==0, then we never show the field // If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); if (!empty($val['visible'])) {
$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
}
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -136,8 +151,7 @@ if (!$user->rights->ticket->read) {
// Store current page url // Store current page url
$url_page_current = dol_buildpath('/ticket/list.php', 1); $url_page_current = dol_buildpath('/ticket/list.php', 1);
if ($project_ref) if ($project_ref) {
{
$tmpproject = new Project($db); $tmpproject = new Project($db);
$tmpproject->fetch(0, $project_ref); $tmpproject->fetch(0, $project_ref);
$projectid = $tmpproject->id; $projectid = $tmpproject->id;
@ -155,25 +169,32 @@ $error = 0;
* Actions * Actions
*/ */
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (GETPOST('cancel', 'alpha')) {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } $action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
$parameters = array(); $parameters = array();
if ($socid > 0) $parameters['socid'] = $socid; if ($socid > 0) {
if ($projectid > 0) $parameters['projectid'] = $projectid; $parameters['socid'] = $socid;
}
if ($projectid > 0) {
$parameters['projectid'] = $projectid;
}
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
{ foreach ($object->fields as $key => $val) {
foreach ($object->fields as $key => $val)
{
$search[$key] = ''; $search[$key] = '';
} }
$toselect = ''; $toselect = '';
@ -186,8 +207,7 @@ if (empty($reshook))
$search_dateclose_end = ''; $search_dateclose_end = '';
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
{
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
} }
@ -198,26 +218,23 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// Close records // Close records
if (!$error && $massaction == 'close' && $permissiontoadd) if (!$error && $massaction == 'close' && $permissiontoadd) {
{
$objecttmp = new $objectclass($db); $objecttmp = new $objectclass($db);
if (!$error) if (!$error) {
{
$db->begin(); $db->begin();
$nbok = 0; $nbok = 0;
foreach ($toselect as $toselectid) foreach ($toselect as $toselectid) {
{
$result = $objecttmp->fetch($toselectid); $result = $objecttmp->fetch($toselectid);
if ($result > 0) if ($result > 0) {
{
$result = $objecttmp->close($user); $result = $objecttmp->close($user);
if ($result < 0) if ($result < 0) {
{
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;
break; break;
} else $nbok++; } else {
$nbok++;
}
} else { } else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;
@ -225,10 +242,12 @@ if (empty($reshook))
} }
} }
if (!$error) if (!$error) {
{ if ($nbok > 1) {
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); } else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
@ -238,27 +257,24 @@ if (empty($reshook))
} }
// Reopen records // Reopen records
if (!$error && $massaction == 'reopen' && $permissiontoadd) if (!$error && $massaction == 'reopen' && $permissiontoadd) {
{
$objecttmp = new $objectclass($db); $objecttmp = new $objectclass($db);
if (!$error) if (!$error) {
{
$db->begin(); $db->begin();
$nbok = 0; $nbok = 0;
foreach ($toselect as $toselectid) foreach ($toselect as $toselectid) {
{
$result = $objecttmp->fetch($toselectid); $result = $objecttmp->fetch($toselectid);
if ($result > 0) if ($result > 0) {
{
if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) { if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) {
$result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED); $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED);
if ($result < 0) if ($result < 0) {
{
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;
break; break;
} else $nbok++; } else {
$nbok++;
}
} else { } else {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors'); setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors');
@ -272,10 +288,12 @@ if (empty($reshook))
} }
} }
if (!$error) if (!$error) {
{ if ($nbok > 1) {
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); } else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
@ -307,34 +325,37 @@ $title = $langs->trans('TicketList');
// Build and execute select // Build and execute select
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$sql = 'SELECT '; $sql = 'SELECT ';
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
$sql .= 't.'.$key.', '; $sql .= 't.'.$key.', ';
} }
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
}
}
// Add fields from hooks // Add fields from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql = preg_replace('/, $/', '', $sql); $sql = preg_replace('/, $/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
$sql .= " WHERE t.entity IN (".getEntity($object->element).")"; $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
if ($socid > 0) if ($socid > 0) {
{
$sql .= " AND t.fk_soc = ".$socid; $sql .= " AND t.fk_soc = ".$socid;
} }
foreach ($search as $key => $val) foreach ($search as $key => $val) {
{ if ($key == 'fk_statut' && !empty($search['fk_statut'])) {
if ($key == 'fk_statut' && !empty($search['fk_statut']))
{
$newarrayofstatus = array(); $newarrayofstatus = array();
foreach ($search['fk_statut'] as $key2 => $val2) { foreach ($search['fk_statut'] as $key2 => $val2) {
if (in_array($val2, array('openall', 'closeall'))) continue; if (in_array($val2, array('openall', 'closeall'))) {
continue;
}
$newarrayofstatus[] = $val2; $newarrayofstatus[] = $val2;
} }
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) { if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) {
@ -349,31 +370,54 @@ foreach ($search as $key => $val)
$newarrayofstatus[] = Ticket::STATUS_CLOSED; $newarrayofstatus[] = Ticket::STATUS_CLOSED;
$newarrayofstatus[] = Ticket::STATUS_CANCELED; $newarrayofstatus[] = Ticket::STATUS_CANCELED;
} }
if (count($newarrayofstatus)) $sql .= natural_search($key, join(',', $newarrayofstatus), 2); if (count($newarrayofstatus)) {
$sql .= natural_search($key, join(',', $newarrayofstatus), 2);
}
continue; continue;
} }
if ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') if ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') {
{ if ($search[$key] > 0) {
if ($search[$key] > 0) $sql .= natural_search($key, $search[$key], 2); $sql .= natural_search($key, $search[$key], 2);
}
continue; continue;
} }
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], $mode_search); if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], $mode_search);
}
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
} }
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
//if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2); //if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2);
if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; if ($search_date_start) {
if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'"; $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'"; }
if ($search_dateread_end) $sql .= " AND t.date_read <= '".$db->idate($search_dateread_end)."'"; if ($search_date_end) {
if ($search_dateclose_start) $sql .= " AND t.date_close >= '".$db->idate($search_dateclose_start)."'"; $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'";
if ($search_dateclose_end) $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'"; }
if ($search_dateread_start) {
$sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'";
}
if ($search_dateread_end) {
$sql .= " AND t.date_read <= '".$db->idate($search_dateread_end)."'";
}
if ($search_dateclose_start) {
$sql .= " AND t.date_close >= '".$db->idate($search_dateclose_start)."'";
}
if ($search_dateclose_end) {
$sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'";
}
if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
$sql .= " AND (t.fk_user_assign = ".$user->id; $sql .= " AND (t.fk_user_assign = ".$user->id;
if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql .= " OR t.fk_user_create = ".$user->id; if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$sql .= " OR t.fk_user_create = ".$user->id;
}
$sql .= ")"; $sql .= ")";
} }
@ -388,26 +432,22 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
{
$resql = $db->query($sql); $resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql); $nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
{
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
} }
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
{
$num = $nbtotalofrecords; $num = $nbtotalofrecords;
} else { } else {
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) if (!$resql) {
{
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
@ -416,8 +456,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
} }
// Direct jump if only one record found // Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/ticket/card.php?id='.$id); header("Location: ".DOL_URL_ROOT.'/ticket/card.php?id='.$id);
@ -449,30 +488,30 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
// Customer code // Customer code
if ($socstat->client && !empty($socstat->code_client)) { if ($socstat->client && !empty($socstat->code_client)) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td>'; print $langs->trans('CustomerCode').'</td><td>';
print $socstat->code_client; print $socstat->code_client;
$tmpcheck = $socstat->check_codeclient(); $tmpcheck = $socstat->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) { if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// Supplier code // Supplier code
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) { if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td>'; print $langs->trans('SupplierCode').'</td><td>';
print $socstat->code_fournisseur; print $socstat->code_fournisseur;
$tmpcheck = $socstat->check_codefournisseur(); $tmpcheck = $socstat->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) { if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -506,15 +545,13 @@ if ($projectid > 0 || $project_ref) {
// Title // Title
$morehtmlref .= $object->title; $morehtmlref .= $object->title;
// Thirdparty // Thirdparty
if ($object->thirdparty->id > 0) if ($object->thirdparty->id > 0) {
{
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (!$user->rights->projet->all->lire) if (!$user->rights->projet->all->lire) {
{
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
} }
@ -549,39 +586,75 @@ if ($projectid > 0 || $project_ref) {
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); $param .= '&contextpage='.urlencode($contextpage);
foreach ($search as $key => $val) }
{ if ($limit > 0 && $limit != $conf->liste_limit) {
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); $param .= '&limit='.urlencode($limit);
else $param .= '&search_'.$key.'='.urlencode($search[$key]); }
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
} else {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
} }
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
if ($socid) $param .= '&socid='.urlencode($socid); if ($socid) {
if ($projectid) $param .= '&projectid='.urlencode($projectid); $param .= '&socid='.urlencode($socid);
}
if ($projectid) {
$param .= '&projectid='.urlencode($projectid);
}
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); if ($search_date_start) {
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); $param .= '&search_date_start='.urlencode($search_date_start);
if ($search_dateread_start) $param .= '&search_dateread_start='.urlencode($search_dateread_start); }
if ($search_dateread_end) $param .= '&search_dateread_end='.urlencode($search_dateread_end); if ($search_date_end) {
if ($search_dateclose_start) $param .= '&search_dateclose_start='.urlencode($search_dateclose_start); $param .= '&search_date_end='.urlencode($search_date_end);
if ($search_dateclose_end) $param .= '&search_dateclose_end='.urlencode($search_dateclose_end); }
if ($search_dateread_start) {
$param .= '&search_dateread_start='.urlencode($search_dateread_start);
}
if ($search_dateread_end) {
$param .= '&search_dateread_end='.urlencode($search_dateread_end);
}
if ($search_dateclose_start) {
$param .= '&search_dateclose_start='.urlencode($search_dateclose_start);
}
if ($search_dateclose_end) {
$param .= '&search_dateclose_end='.urlencode($search_dateclose_end);
}
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->ticket->write) $arrayofmassactions['close'] = $langs->trans("Close"); if ($user->rights->ticket->write) {
if ($user->rights->ticket->write) $arrayofmassactions['reopen'] = $langs->trans("ReOpen"); $arrayofmassactions['close'] = $langs->trans("Close");
if ($user->rights->ticket->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); }
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); if ($user->rights->ticket->write) {
$arrayofmassactions['reopen'] = $langs->trans("ReOpen");
}
if ($user->rights->ticket->delete) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
@ -589,15 +662,23 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'" >'; print '<input type="hidden" name="mode" value="'.$mode.'" >';
if ($socid) print '<input type="hidden" name="socid" value="'.$socid.'" >'; if ($socid) {
if ($projectid) print '<input type="hidden" name="projectid" value="'.$projectid.'" >'; print '<input type="hidden" name="socid" value="'.$socid.'" >';
}
if ($projectid) {
print '<input type="hidden" name="projectid" value="'.$projectid.'" >';
}
$url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : ''); $url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : '');
if (!empty($socid)) $url .= '&socid='.$socid; if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write); $newcardbutton = dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write);
$picto = 'ticket'; $picto = 'ticket';
if ($socid > 0) $picto = ''; if ($socid > 0) {
$picto = '';
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -611,9 +692,10 @@ $objecttmp = new Ticket($db);
$trackid = 'tic'.$object->id; $trackid = 'tic'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) if ($search_all) {
{ foreach ($fieldstosearchall as $key => $val) {
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
} }
@ -624,11 +706,13 @@ $moreforfilter.= '</div>';*/
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) {
else $moreforfilter = $hookmanager->resPrint; $moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
if (!empty($moreforfilter)) if (!empty($moreforfilter)) {
{
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter; print $moreforfilter;
print '</div>'; print '</div>';
@ -645,13 +729,17 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Fields title search // Fields title search
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'fk_statut') $cssforfield .= ($cssforfield ? ' ' : '').'center'; if ($key == 'fk_statut') {
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
if ($key == 'type_code') { if ($key == 'type_code') {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
@ -672,23 +760,26 @@ foreach ($object->fields as $key => $val)
} elseif ($key == 'fk_statut') { } elseif ($key == 'fk_statut') {
$arrayofstatus = array(); $arrayofstatus = array();
$arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --'; $arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --';
foreach ($object->statuts_short as $key2 => $val2) foreach ($object->statuts_short as $key2 => $val2) {
{ if ($key2 == Ticket::STATUS_CLOSED) {
if ($key2 == Ticket::STATUS_CLOSED) $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --'; $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --';
}
$arrayofstatus[$key2] = $val2; $arrayofstatus[$key2] = $val2;
} }
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
//var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key]));
$selectedarray = null; $selectedarray = null;
if ($search[$key]) $selectedarray = array_values($search[$key]); if ($search[$key]) {
$selectedarray = array_values($search[$key]);
}
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', ''); print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', '');
print '</td>'; print '</td>';
} elseif ($key == "fk_soc") { } elseif ($key == "fk_soc") {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
} elseif ($key == "datec" || $key == 'date_read' || $key == 'date_close'){ } elseif ($key == "datec" || $key == 'date_read' || $key == 'date_close') {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">'; print '<div class="nowrap">';
switch ($key){ switch ($key) {
case 'datec': case 'datec':
print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
break; break;
@ -700,7 +791,7 @@ foreach ($object->fields as $key => $val)
} }
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
switch ($key){ switch ($key) {
case 'datec': case 'datec':
print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
break; break;
@ -712,13 +803,15 @@ foreach ($object->fields as $key => $val)
} }
print '</div>'; print '</div>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
elseif (strpos($val['type'], 'integer:') === 0) { print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
}
print '</td>'; print '</td>';
} }
} }
@ -741,15 +834,18 @@ print '</tr>'."\n";
// Fields title label // Fields title label
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'fk_statut' || $key == 'severity_code') $cssforfield .= ($cssforfield ? ' ' : '').'center'; if ($key == 'fk_statut' || $key == 'severity_code') {
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (!empty($arrayfields['t.'.$key]['checked'])) } elseif (in_array($val['type'], array('timestamp'))) {
{ $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
} }
} }
@ -765,11 +861,11 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line // Detect if we need a fetch on each output line
$needToFetchEachLine = 0; $needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
{ foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) if (preg_match('/\$object/', $val)) {
{ $needToFetchEachLine++; // There is at least one compute field that use $object
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object }
} }
} }
@ -779,70 +875,83 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
$cacheofoutputfield = array(); $cacheofoutputfield = array();
while ($i < min($num, $limit)) while ($i < min($num, $limit)) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen if (empty($obj)) {
break; // Should not happen
}
// Store properties in $object // Store properties in $object
$object->id = $obj->rowid; $object->id = $obj->rowid;
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{ if (property_exists($obj, $key)) {
if (property_exists($obj, $key)) $object->$key = $obj->$key; $object->$key = $obj->$key;
}
} }
$langs->load("ticket"); $langs->load("ticket");
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; print '<tr class="oddeven">';
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
$cssforfield = ''; $cssforfield = '';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (in_array($key, array('ref', 'fk_project'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; }
if ($key == 'fk_statut' || $key == 'severity_code') $cssforfield .= ($cssforfield ? ' ' : '').'center'; if (in_array($val['type'], array('timestamp'))) {
if (!empty($arrayfields['t.'.$key]['checked'])) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
{ }
if (in_array($key, array('ref', 'fk_project'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
}
if ($key == 'fk_statut' || $key == 'severity_code') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'; print '<td';
if ($cssforfield || $val['css']) print ' class="'; if ($cssforfield || $val['css']) {
print ' class="';
}
print $cssforfield; print $cssforfield;
if ($cssforfield && $val['css']) print ' '; if ($cssforfield && $val['css']) {
print ' ';
}
print $val['css']; print $val['css'];
if ($cssforfield || $val['css']) print '"'; if ($cssforfield || $val['css']) {
print '"';
}
print '>'; print '>';
if ($key == 'fk_statut') print $object->getLibStatut(5); if ($key == 'fk_statut') {
elseif ($key == 'subject') { print $object->getLibStatut(5);
} elseif ($key == 'subject') {
$s = $obj->subject; $s = $obj->subject;
print '<span title="'.$s.'">'; print '<span title="'.$s.'">';
print $s; print $s;
print '</span>'; print '</span>';
} } elseif ($key == 'type_code') {
elseif ($key == 'type_code') {
$s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
print '<span title="'.$s.'">'; print '<span title="'.$s.'">';
print $s; print $s;
print '</span>'; print '</span>';
} } elseif ($key == 'category_code') {
elseif ($key == 'category_code') {
$s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
print '<span title="'.$s.'">'; print '<span title="'.$s.'">';
print $s; print $s;
print '</span>'; print '</span>';
} } elseif ($key == 'severity_code') {
elseif ($key == 'severity_code') {
$s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); $s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
print '<span title="'.$s.'">'; print '<span title="'.$s.'">';
print $s; print $s;
print '</span>'; print '</span>';
} } elseif ($key == 'tms') {
elseif ($key == 'tms') print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
elseif ($key == 'fk_user_create') { } elseif ($key == 'fk_user_create') {
if ($object->fk_user_create > 0) { if ($object->fk_user_create > 0) {
$user_create->fetch($object->fk_user_create); $user_create->fetch($object->fk_user_create);
print $user_create->getNomUrl(-1); print $user_create->getNomUrl(-1);
} }
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
} else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ...
$tmp = explode(':', $val['type']); $tmp = explode(':', $val['type']);
if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) {
// It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making. // It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making.
@ -860,10 +969,13 @@ while ($i < min($num, $limit))
} }
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) {
if (!empty($val['isameasure'])) $totalarray['nbfield']++;
{ }
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; if (!empty($val['isameasure'])) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
$totalarray['val']['t.'.$key] += $obj->$key; $totalarray['val']['t.'.$key] += $obj->$key;
} }
} }
@ -876,14 +988,17 @@ while ($i < min($num, $limit))
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="nowrap center">'; print '<td class="nowrap center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0; $selected = 0;
if (in_array($obj->rowid, $arrayofselected)) $selected = 1; if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'; print '</tr>';
@ -895,10 +1010,13 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found // If no record found
if ($num == 0) if ($num == 0) {
{
$colspan = 1; $colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
} }
@ -916,10 +1034,11 @@ print '</form>'."\n";
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
{
$hidegeneratedfilelistifempty = 1; $hidegeneratedfilelistifempty = 1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
$hidegeneratedfilelistifempty = 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile = new FormFile($db); $formfile = new FormFile($db);

View File

@ -46,16 +46,21 @@ $sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0; $page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page; $page = $page == -1 ? 0 : $page;
if (!$sortfield) $sortfield = "a.datep,a.id"; if (!$sortfield) {
if (!$sortorder) $sortorder = "desc"; $sortfield = "a.datep,a.id";
}
if (!$sortorder) {
$sortorder = "desc";
}
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (GETPOST('actioncode', 'array')) if (GETPOST('actioncode', 'array')) {
{
$actioncode = GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0'; if (!count($actioncode)) {
$actioncode = '0';
}
} else { } else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
} }
@ -82,8 +87,7 @@ if (!$user->rights->ticket->read) {
accessforbidden(); accessforbidden();
} }
// restrict access for externals users // restrict access for externals users
if ($user->socid > 0 && ($object->fk_soc != $user->socid)) if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
{
accessforbidden(); accessforbidden();
} }
// or for unauthorized internals users // or for unauthorized internals users
@ -99,17 +103,17 @@ if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object-
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{
// Set view style // Set view style
$_SESSION['ticket-view-type'] = "messaging"; $_SESSION['ticket-view-type'] = "messaging";
} }
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
{
$actioncode = ''; $actioncode = '';
$search_agenda_label = ''; $search_agenda_label = '';
} }
@ -125,7 +129,9 @@ $userstat = new User($db);
$formticket = new FormTicket($db); $formticket = new FormTicket($db);
$title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name; $title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name;
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
}
$help_url = 'FR:DocumentationModuleTicket'; $help_url = 'FR:DocumentationModuleTicket';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
@ -166,8 +172,7 @@ if (!empty($object->origin_email)) {
} }
// Thirdparty // Thirdparty
if (!empty($conf->societe->enabled)) if (!empty($conf->societe->enabled)) {
{
$morehtmlref .= '<br>'.$langs->trans('ThirdParty'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty');
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>'; $morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
@ -181,12 +186,10 @@ if (!empty($conf->societe->enabled))
} }
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled)) {
{
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project'); $morehtmlref .= '<br>'.$langs->trans('Project');
if ($user->rights->ticket->write) if ($user->rights->ticket->write) {
{
if ($action != 'classify') { if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>'; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref .= ' : '; $morehtmlref .= ' : ';
@ -224,11 +227,14 @@ print dol_get_fiche_end();
print '<br>'; print '<br>';
if (!empty($object->id)) if (!empty($object->id)) {
{
$param = '&id='.$object->id; $param = '&id='.$object->id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; $param .= '&contextpage='.$contextpage;
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
}
$morehtmlright = ''; $morehtmlright = '';

View File

@ -30,15 +30,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
if (!$user->rights->ticket->read) accessforbidden(); if (!$user->rights->ticket->read) {
accessforbidden();
}
$object_status = GETPOST('object_status', 'intcomma'); $object_status = GETPOST('object_status', 'intcomma');
$userid = GETPOST('userid', 'int'); $userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
// Security check // Security check
if ($user->socid > 0) if ($user->socid > 0) {
{
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
@ -70,7 +71,9 @@ print load_fiche_titre($title, '', 'ticket');
dol_mkdir($dir); dol_mkdir($dir);
$stats = new TicketStats($db, $socid, ($userid > 0 ? $userid : 0)); $stats = new TicketStats($db, $socid, ($userid > 0 ? $userid : 0));
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND fk_statut IN ('.$db->sanitize($db->escape($object_status)).')'; if ($object_status != '' && $object_status >= -1) {
$stats->where .= ' AND fk_statut IN ('.$db->sanitize($db->escape($object_status)).')';
}
// Build graphic number of object // Build graphic number of object
@ -80,8 +83,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...) // $data = array(array('Lib',val1,val2,val3),...)
if (!$user->rights->societe->client->voir || $user->socid) if (!$user->rights->societe->client->voir || $user->socid) {
{
$filenamenb = $dir.'/ticketsnbinyear-'.$user->id.'-'.$year.'.png'; $filenamenb = $dir.'/ticketsnbinyear-'.$user->id.'-'.$year.'.png';
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$user->id.'-'.$year.'.png';
} else { } else {
@ -91,12 +93,10 @@ if (!$user->rights->societe->client->voir || $user->socid)
$px1 = new DolGraph(); $px1 = new DolGraph();
$mesg = $px1->isGraphKo(); $mesg = $px1->isGraphKo();
if (!$mesg) if (!$mesg) {
{
$px1->SetData($data); $px1->SetData($data);
$i = $startyear; $legend = array(); $i = $startyear; $legend = array();
while ($i <= $endyear) while ($i <= $endyear) {
{
$legend[] = $i; $legend[] = $i;
$i++; $i++;
} }
@ -119,8 +119,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
//var_dump($data); //var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...) // $data = array(array('Lib',val1,val2,val3),...)
if (!$user->rights->societe->client->voir || $user->socid) if (!$user->rights->societe->client->voir || $user->socid) {
{
$filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png'; $filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png';
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png';
} else { } else {
@ -130,12 +129,10 @@ if (!$user->rights->societe->client->voir || $user->socid)
$px2 = new DolGraph(); $px2 = new DolGraph();
$mesg = $px2->isGraphKo(); $mesg = $px2->isGraphKo();
if (!$mesg) if (!$mesg) {
{
$px2->SetData($data); $px2->SetData($data);
$i = $startyear; $legend = array(); $i = $startyear; $legend = array();
while ($i <= $endyear) while ($i <= $endyear) {
{
$legend[] = $i; $legend[] = $i;
$i++; $i++;
} }
@ -156,8 +153,7 @@ if (!$mesg)
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
if (!$user->rights->societe->client->voir || $user->socid) if (!$user->rights->societe->client->voir || $user->socid) {
{
$filename_avg = $dir.'/ticketsaverage-'.$user->id.'-'.$year.'.png'; $filename_avg = $dir.'/ticketsaverage-'.$user->id.'-'.$year.'.png';
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$user->id.'-'.$year.'.png'; $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$user->id.'-'.$year.'.png';
} else { } else {
@ -167,12 +163,10 @@ if (!$user->rights->societe->client->voir || $user->socid)
$px3 = new DolGraph(); $px3 = new DolGraph();
$mesg = $px3->isGraphKo(); $mesg = $px3->isGraphKo();
if (!$mesg) if (!$mesg) {
{
$px3->SetData($data); $px3->SetData($data);
$i = $startyear; $legend = array(); $i = $startyear; $legend = array();
while ($i <= $endyear) while ($i <= $endyear) {
{
$legend[] = $i; $legend[] = $i;
$i++; $i++;
} }
@ -200,7 +194,9 @@ foreach ($data as $val) {
$arrayyears[$val['year']] = $val['year']; $arrayyears[$val['year']] = $val['year'];
} }
} }
if (!count($arrayyears)) $arrayyears[$nowyear] = $nowyear; if (!count($arrayyears)) {
$arrayyears[$nowyear] = $nowyear;
}
$h = 0; $h = 0;
$head = array(); $head = array();
@ -239,8 +235,12 @@ print $form->selectarray('object_status', $liststatus, GETPOST('object_status',
print '</td></tr>'; print '</td></tr>';
// Year // Year
print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">'; print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
if (!in_array($year, $arrayyears)) $arrayyears[$year] = $year; if (!in_array($year, $arrayyears)) {
if (!in_array($nowyear, $arrayyears)) $arrayyears[$nowyear] = $nowyear; $arrayyears[$year] = $year;
}
if (!in_array($nowyear, $arrayyears)) {
$arrayyears[$nowyear] = $nowyear;
}
arsort($arrayyears); arsort($arrayyears);
print $form->selectarray('year', $arrayyears, $year, 0); print $form->selectarray('year', $arrayyears, $year, 0);
print '</td></tr>'; print '</td></tr>';
@ -263,11 +263,9 @@ print '<td class="right">%</td>';
print '</tr>'; print '</tr>';
$oldyear = 0; $oldyear = 0;
foreach ($data as $val) foreach ($data as $val) {
{
$year = $val['year']; $year = $val['year'];
while (!empty($year) && $oldyear > $year + 1) while (!empty($year) && $oldyear > $year + 1) { // If we have empty year
{ // If we have empty year
$oldyear--; $oldyear--;
print '<tr class="oddeven" height="24">'; print '<tr class="oddeven" height="24">';
@ -303,7 +301,9 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// Show graphs // Show graphs
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">'; print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
if ($mesg) { print $mesg; } else { if ($mesg) {
print $mesg;
} else {
print $px1->show(); print $px1->show();
print "<br>\n"; print "<br>\n";
//print $px2->show(); //print $px2->show();

View File

@ -16,8 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) if (empty($conf) || !is_object($conf)) {
{
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }
@ -38,52 +37,54 @@ $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'datec', 'desc', 0, 0, 1
$total = 0; $total = 0;
$ilink = 0; $ilink = 0;
foreach ($linkedObjectBlock as $key => $objectlink) foreach ($linkedObjectBlock as $key => $objectlink) {
{
$ilink++; $ilink++;
$trclass = 'oddeven'; $trclass = 'oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
$trclass .= ' liste_sub_total';
}
?> ?>
<tr class="<?php echo $trclass; ?>" > <tr class="<?php echo $trclass; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?> <td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?>
<?php if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?> <?php if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
</td> print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a';
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td> } ?>
<td class="linkedcol-ref center"><?php echo $objectlink->ref_client; ?></td> </td>
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->datec, 'day'); ?></td> <td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td>
<?php <td class="linkedcol-ref center"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->datec, 'day'); ?></td>
<?php
//$objectlink->socid = $objectlink->fk_soc; //$objectlink->socid = $objectlink->fk_soc;
//$objectlink->fetch_thirdparty(); //$objectlink->fetch_thirdparty();
?> ?>
<td class="linkedcol-amount right"><?php //echo $objectlink->thirdparty->getNomUrl(1); ?></td> <td class="linkedcol-amount right"><?php //echo $objectlink->thirdparty->getNomUrl(1); ?></td>
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action right"> <td class="linkedcol-action right">
<?php <?php
// For now, shipments must stay linked to order, so link is not deletable // For now, shipments must stay linked to order, so link is not deletable
if ($object->element != 'shipping') { if ($object->element != 'shipping') {
?> ?>
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a> <a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<?php <?php
} }
?> ?>
</td> </td>
</tr> </tr>
<?php <?php
} }
if (count($linkedObjectBlock) > 1) if (count($linkedObjectBlock) > 1) {
{
?> ?>
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>"> <tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
<td><?php echo $langs->trans("Total"); ?></td> <td><?php echo $langs->trans("Total"); ?></td>
<td></td> <td></td>
<td class="center"></td> <td class="center"></td>
<td class="center"></td> <td class="center"></td>
<td class="right"><?php echo price($total); ?></td> <td class="right"><?php echo price($total); ?></td>
<td class="right"></td> <td class="right"></td>
<td class="right"></td> <td class="right"></td>
</tr> </tr>
<?php <?php
} }
print "<!-- END PHP TEMPLATE -->\n"; print "<!-- END PHP TEMPLATE -->\n";

View File

@ -38,13 +38,17 @@ $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label = ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label = array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype = 'usergroup'; //Must be the $table_element of the class that manage extrafield $elementtype = 'usergroup'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) {
accessforbidden();
}
/* /*
@ -79,8 +83,7 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit') {
{
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
@ -93,8 +96,7 @@ if ($action != 'create' && $action != 'edit')
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'create') if ($action == 'create') {
{
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
@ -106,8 +108,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname)) {
{
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -37,13 +37,17 @@ $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label = ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label = array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype = 'user'; //Must be the $table_element of the class that manage extrafield $elementtype = 'user'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) {
accessforbidden();
}
/* /*
@ -78,8 +82,7 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit') {
{
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
@ -92,8 +95,7 @@ if ($action != 'create' && $action != 'edit')
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'create') if ($action == 'create') {
{
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
@ -105,8 +107,7 @@ if ($action == 'create')
/* Editing an optional field */ /* Editing an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname)) {
{
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -41,7 +41,9 @@ $actiontest = GETPOST('test', 'alpha');
$actionsave = GETPOST('save', 'alpha'); $actionsave = GETPOST('save', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'useragenda'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'useragenda'; // To manage different context of search
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5; if (empty($conf->global->AGENDA_EXT_NB)) {
$conf->global->AGENDA_EXT_NB = 5;
}
$MAXAGENDA = $conf->global->AGENDA_EXT_NB; $MAXAGENDA = $conf->global->AGENDA_EXT_NB;
// List of available colors // List of available colors
@ -55,14 +57,17 @@ $object->getrights();
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
// If user is not user that read and no permission to read other users, we stop // If user is not user that read and no permission to read other users, we stop
if (($object->id != $user->id) && (!$user->rights->user->user->lire)) if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
accessforbidden(); accessforbidden();
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('usercard', 'useragenda', 'globalcard')); $hookmanager->initHooks(array('usercard', 'useragenda', 'globalcard'));
@ -73,7 +78,9 @@ $hookmanager->initHooks(array('usercard', 'useragenda', 'globalcard'));
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
if ($actionsave) { if ($actionsave) {
@ -168,7 +175,11 @@ print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span
print "<br>\n"; print "<br>\n";
$selectedvalue = $conf->global->AGENDA_DISABLE_EXT; $selectedvalue = $conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue == 1) $selectedvalue = 0; else $selectedvalue = 1; if ($selectedvalue == 1) {
$selectedvalue = 0;
} else {
$selectedvalue = 1;
}
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
@ -183,8 +194,7 @@ print '<td class="right">'.$langs->trans("Color").'</td>';
print "</tr>"; print "</tr>";
$i = 1; $i = 1;
while ($i <= $MAXAGENDA) while ($i <= $MAXAGENDA) {
{
$key = $i; $key = $i;
$name = 'AGENDA_EXT_NAME_'.$id.'_'.$key; $name = 'AGENDA_EXT_NAME_'.$id.'_'.$key;
$src = 'AGENDA_EXT_SRC_'.$id.'_'.$key; $src = 'AGENDA_EXT_SRC_'.$id.'_'.$key;

View File

@ -32,9 +32,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
if (!empty($conf->holiday->enabled)) require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; if (!empty($conf->holiday->enabled)) {
if (!empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
if (!empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; }
if (!empty($conf->expensereport->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
}
if (!empty($conf->salaries->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
}
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('companies', 'commercial', 'banks', 'bills', 'trips', 'holiday', 'salaries')); $langs->loadLangs(array('companies', 'commercial', 'banks', 'bills', 'trips', 'holiday', 'salaries'));
@ -47,35 +53,44 @@ $cancel = GETPOST('cancel', 'alpha');
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
// Ok if user->rights->salaries->read or user->rights->hrm->read // Ok if user->rights->salaries->read or user->rights->hrm->read
//$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2); //$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2);
$ok = false; $ok = false;
if ($user->id == $id) $ok = true; // A user can always read its own card if ($user->id == $id) {
if (!empty($user->rights->salaries->read)) $ok = true; $ok = true; // A user can always read its own card
if (!empty($user->rights->hrm->read)) $ok = true; }
if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) $ok = true; if (!empty($user->rights->salaries->read)) {
if (!$ok) $ok = true;
{ }
if (!empty($user->rights->hrm->read)) {
$ok = true;
}
if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) {
$ok = true;
}
if (!$ok) {
accessforbidden(); accessforbidden();
} }
$object = new User($db); $object = new User($db);
if ($id > 0 || !empty($ref)) if ($id > 0 || !empty($ref)) {
{
$result = $object->fetch($id, $ref, '', 1); $result = $object->fetch($id, $ref, '', 1);
$object->getrights(); $object->getrights();
} }
$account = new UserBankAccount($db); $account = new UserBankAccount($db);
if (!$bankid) if (!$bankid) {
{
$account->fetch(0, '', $id); $account->fetch(0, '', $id);
} else { } else {
$account->fetch($bankid); $account->fetch($bankid);
} }
if (empty($account->userid)) $account->userid = $object->id; if (empty($account->userid)) {
$account->userid = $object->id;
}
$permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer)); $permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer));
@ -84,8 +99,7 @@ $permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty(
* Actions * Actions
*/ */
if ($action == 'add' && !$cancel) if ($action == 'add' && !$cancel) {
{
$account->userid = $object->id; $account->userid = $object->id;
$account->bank = GETPOST('bank', 'alpha'); $account->bank = GETPOST('bank', 'alpha');
@ -103,8 +117,7 @@ if ($action == 'add' && !$cancel)
$result = $account->create($user); $result = $account->create($user);
if (!$result) if (!$result) {
{
setEventMessages($account->error, $account->errors, 'errors'); setEventMessages($account->error, $account->errors, 'errors');
$action = 'edit'; // Force chargement page edition $action = 'edit'; // Force chargement page edition
} else { } else {
@ -113,52 +126,51 @@ if ($action == 'add' && !$cancel)
} }
} }
if ($action == 'update' && !$cancel) if ($action == 'update' && !$cancel) {
{
$account->userid = $object->id; $account->userid = $object->id;
/* /*
if ($action == 'update' && !$cancel) if ($action == 'update' && !$cancel)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($canedituser) // Case we can edit all field if ($canedituser) // Case we can edit all field
{ {
$error = 0; $error = 0;
if (!$error) if (!$error)
{ {
$objectuser->fetch($id); $objectuser->fetch($id);
$objectuser->oldcopy = clone $objectuser; $objectuser->oldcopy = clone $objectuser;
$db->begin(); $db->begin();
$objectuser->default_range = GETPOST('default_range'); $objectuser->default_range = GETPOST('default_range');
$objectuser->default_c_exp_tax_cat = GETPOST('default_c_exp_tax_cat'); $objectuser->default_c_exp_tax_cat = GETPOST('default_c_exp_tax_cat');
if (!$error) { if (!$error) {
$ret = $objectuser->update($user); $ret = $objectuser->update($user);
if ($ret < 0) { if ($ret < 0) {
$error++; $error++;
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorLoginAlreadyExists", $objectuser->login), null, 'errors'); setEventMessages($langs->trans("ErrorLoginAlreadyExists", $objectuser->login), null, 'errors');
} else { } else {
setEventMessages($objectuser->error, $objectuser->errors, 'errors'); setEventMessages($objectuser->error, $objectuser->errors, 'errors');
} }
} }
} }
if (!$error && !count($objectuser->errors)) { if (!$error && !count($objectuser->errors)) {
setEventMessages($langs->trans("UserModified"), null, 'mesgs'); setEventMessages($langs->trans("UserModified"), null, 'mesgs');
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
} }
} }
} }
}*/ }*/
$account->bank = GETPOST('bank', 'alpha'); $account->bank = GETPOST('bank', 'alpha');
$account->label = GETPOST('label', 'alpha'); $account->label = GETPOST('label', 'alpha');
@ -188,28 +200,36 @@ if ($action == 'update' && !$cancel)
if ($action == 'setpersonal_email') { if ($action == 'setpersonal_email') {
$object->personal_email = (string) GETPOST('personal_email', 'alphanohtml'); $object->personal_email = (string) GETPOST('personal_email', 'alphanohtml');
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} }
// update personal mobile // update personal mobile
if ($action == 'setpersonal_mobile') { if ($action == 'setpersonal_mobile') {
$object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml'); $object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml');
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} }
// update default_c_exp_tax_cat // update default_c_exp_tax_cat
if ($action == 'setdefault_c_exp_tax_cat') { if ($action == 'setdefault_c_exp_tax_cat') {
$object->default_c_exp_tax_cat = GETPOST('default_c_exp_tax_cat', 'int'); $object->default_c_exp_tax_cat = GETPOST('default_c_exp_tax_cat', 'int');
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} }
// update default range // update default range
if ($action == 'setdefault_range') { if ($action == 'setdefault_range') {
$object->default_range = GETPOST('default_range', 'int'); $object->default_range = GETPOST('default_range', 'int');
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} }
@ -226,16 +246,14 @@ llxHeader(null, $langs->trans("BankAccounts"));
$head = user_prepare_head($object); $head = user_prepare_head($object);
if ($id && $bankid && $action == 'edit' && $user->rights->user->user->creer) if ($id && $bankid && $action == 'edit' && $user->rights->user->user->creer) {
{
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.GETPOST("id", 'int').'">'; print '<input type="hidden" name="id" value="'.GETPOST("id", 'int').'">';
print '<input type="hidden" name="bankid" value="'.$bankid.'">'; print '<input type="hidden" name="bankid" value="'.$bankid.'">';
} }
if ($id && $action == 'create' && $user->rights->user->user->creer) if ($id && $action == 'create' && $user->rights->user->user->creer) {
{
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -244,8 +262,7 @@ if ($id && $action == 'create' && $user->rights->user->user->creer)
// View // View
if ($action != 'edit' && $action != 'create') // If not bank account yet, $account may be empty if ($action != 'edit' && $action != 'create') { // If not bank account yet, $account may be empty
{
$title = $langs->trans("User"); $title = $langs->trans("User");
print dol_get_fiche_head($head, 'bank', $title, -1, 'user'); print dol_get_fiche_head($head, 'bank', $title, -1, 'user');
@ -283,8 +300,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
{
print '<tr class="nowrap">'; print '<tr class="nowrap">';
print '<td>'; print '<td>';
print $form->editfieldkey("DefaultCategoryCar", 'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->rights->user->user->creer); print $form->editfieldkey("DefaultCategoryCar", 'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->rights->user->user->creer);
@ -338,8 +354,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
// Latest payments of salaries // Latest payments of salaries
if (!empty($conf->salaries->enabled) && if (!empty($conf->salaries->enabled) &&
$user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id) $user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)
) ) {
{
$salary = new PaymentSalary($db); $salary = new PaymentSalary($db);
$sql = "SELECT ps.rowid, ps.datesp, ps.dateep, ps.amount"; $sql = "SELECT ps.rowid, ps.datesp, ps.dateep, ps.amount";
@ -349,20 +364,18 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
$sql .= " ORDER BY ps.datesp DESC"; $sql .= " ORDER BY ps.datesp DESC";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/salaries/list.php?search_user='.$object->login.'">'.$langs->trans("AllSalaries").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>'; print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/salaries/list.php?search_user='.$object->login.'">'.$langs->trans("AllSalaries").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
print '</tr></table></td>'; print '</tr></table></td>';
print '</tr>'; print '</tr>';
$i = 0; $i = 0;
while ($i < $num && $i < $MAXLIST) while ($i < $num && $i < $MAXLIST) {
{
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -381,7 +394,9 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
} }
$db->free($resql); $db->free($resql);
if ($num <= 0) print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>'; if ($num <= 0) {
print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>';
}
print "</table>"; print "</table>";
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -393,8 +408,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
*/ */
if (!empty($conf->holiday->enabled) && if (!empty($conf->holiday->enabled) &&
($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id)) ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))
) ) {
{
$holiday = new Holiday($db); $holiday = new Holiday($db);
$sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday"; $sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
@ -404,20 +418,18 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
$sql .= " ORDER BY h.date_debut DESC"; $sql .= " ORDER BY h.date_debut DESC";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4"><table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastHolidays", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/holiday/list.php?id='.$object->id.'">'.$langs->trans("AllHolidays").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>'; print '<td colspan="4"><table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastHolidays", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/holiday/list.php?id='.$object->id.'">'.$langs->trans("AllHolidays").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
print '</tr></table></td>'; print '</tr></table></td>';
print '</tr>'; print '</tr>';
$i = 0; $i = 0;
while ($i < $num && $i < $MAXLIST) while ($i < $num && $i < $MAXLIST) {
{
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$holiday->id = $objp->rowid; $holiday->id = $objp->rowid;
@ -436,7 +448,9 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
} }
$db->free($resql); $db->free($resql);
if ($num <= 0) print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>'; if ($num <= 0) {
print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>';
}
print "</table>"; print "</table>";
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -448,8 +462,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
*/ */
if (!empty($conf->expensereport->enabled) && if (!empty($conf->expensereport->enabled) &&
($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id)) ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
) ) {
{
$exp = new ExpenseReport($db); $exp = new ExpenseReport($db);
$sql = "SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc"; $sql = "SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
@ -459,20 +472,18 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
$sql .= " ORDER BY e.date_debut DESC"; $sql .= " ORDER BY e.date_debut DESC";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4"><table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastExpenseReports", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expensereport/list.php?id='.$object->id.'">'.$langs->trans("AllExpenseReports").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>'; print '<td colspan="4"><table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastExpenseReports", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expensereport/list.php?id='.$object->id.'">'.$langs->trans("AllExpenseReports").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
print '</tr></table></td>'; print '</tr></table></td>';
print '</tr>'; print '</tr>';
$i = 0; $i = 0;
while ($i < $num && $i < $MAXLIST) while ($i < $num && $i < $MAXLIST) {
{
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$exp->id = $objp->rowid; $exp->id = $objp->rowid;
@ -490,7 +501,9 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
} }
$db->free($resql); $db->free($resql);
if ($num <= 0) print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>'; if ($num <= 0) {
print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>';
}
print "</table>"; print "</table>";
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -589,8 +602,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
} }
if ($account->id == 0) if ($account->id == 0) {
{
$colspan = 6; $colspan = 6;
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoBANRecord").'</td></tr>'; print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoBANRecord").'</td></tr>';
} }
@ -600,8 +612,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
} }
// Edit // Edit
if ($id && ($action == 'edit' || $action == 'create') && $user->rights->user->user->creer) if ($id && ($action == 'edit' || $action == 'create') && $user->rights->user->user->creer) {
{
$title = $langs->trans("User"); $title = $langs->trans("User");
print dol_get_fiche_head($head, 'bank', $title, 0, 'user'); print dol_get_fiche_head($head, 'bank', $title, 0, 'user');
@ -679,9 +690,13 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->rights->user->us
print '</div>'; print '</div>';
} }
if ($id && $action == 'edit' && $user->rights->user->user->creer) print '</form>'; if ($id && $action == 'edit' && $user->rights->user->user->creer) {
print '</form>';
}
if ($id && $action == 'create' && $user->rights->user->user->creer) print '</form>'; if ($id && $action == 'create' && $user->rights->user->user->creer) {
print '</form>';
}
// End of page // End of page
llxFooter(); llxFooter();

File diff suppressed because it is too large Load Diff

View File

@ -96,10 +96,8 @@ class UserBankAccount extends Account
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rib (fk_user, datec)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rib (fk_user, datec)";
$sql .= " VALUES (".$this->userid.", '".$this->db->idate($now)."')"; $sql .= " VALUES (".$this->userid.", '".$this->db->idate($now)."')";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{ if ($this->db->affected_rows($resql)) {
if ($this->db->affected_rows($resql))
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."user_rib"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."user_rib");
return $this->update($user); return $this->update($user);
@ -121,8 +119,7 @@ class UserBankAccount extends Account
{ {
global $conf; global $conf;
if (!$this->id) if (!$this->id) {
{
$this->create(); $this->create();
} }
@ -138,14 +135,15 @@ class UserBankAccount extends Account
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
if (trim($this->label) != '') if (trim($this->label) != '') {
$sql .= ",label = '".$this->db->escape($this->label)."'"; $sql .= ",label = '".$this->db->escape($this->label)."'";
else $sql .= ",label = NULL"; } else {
$sql .= ",label = NULL";
}
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{
return 1; return 1;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
@ -163,20 +161,26 @@ class UserBankAccount extends Account
*/ */
public function fetch($id, $ref = '', $userid = 0) public function fetch($id, $ref = '', $userid = 0)
{ {
if (empty($id) && empty($ref) && empty($userid)) return -1; if (empty($id) && empty($ref) && empty($userid)) {
return -1;
}
$sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; $sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
$sql .= " owner_address, label, datec, tms as datem"; $sql .= " owner_address, label, datec, tms as datem";
$sql .= " FROM ".MAIN_DB_PREFIX."user_rib"; $sql .= " FROM ".MAIN_DB_PREFIX."user_rib";
if ($id) $sql .= " WHERE rowid = ".$id; if ($id) {
if ($ref) $sql .= " WHERE label = '".$this->db->escape($ref)."'"; $sql .= " WHERE rowid = ".$id;
if ($userid) $sql .= " WHERE fk_user = ".((int) $userid); }
if ($ref) {
$sql .= " WHERE label = '".$this->db->escape($ref)."'";
}
if ($userid) {
$sql .= " WHERE fk_user = ".((int) $userid);
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{ if ($this->db->num_rows($resql)) {
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;

View File

@ -28,7 +28,9 @@
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
if (!empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"; if (!empty($conf->ldap->enabled)) {
require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php";
}
/** /**
@ -154,8 +156,7 @@ class UserGroup extends CommonObject
global $conf; global $conf;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
if (!empty($groupname)) if (!empty($groupname)) {
{
$result = $this->fetchCommon(0, '', ' AND nom = \''.$this->db->escape($groupname).'\''); $result = $this->fetchCommon(0, '', ' AND nom = \''.$this->db->escape($groupname).'\'');
} else { } else {
$result = $this->fetchCommon($id); $result = $this->fetchCommon($id);
@ -163,10 +164,8 @@ class UserGroup extends CommonObject
$this->name = $this->nom; // For compatibility with field name $this->name = $this->nom; // For compatibility with field name
if ($result) if ($result) {
{ if ($load_members) {
if ($load_members)
{
$this->members = $this->listUsersForGroup(); $this->members = $this->listUsersForGroup();
} }
@ -196,8 +195,7 @@ class UserGroup extends CommonObject
$sql .= " ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql .= " WHERE ug.fk_usergroup = g.rowid"; $sql .= " WHERE ug.fk_usergroup = g.rowid";
$sql .= " AND ug.fk_user = ".$userid; $sql .= " AND ug.fk_user = ".$userid;
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
{
$sql .= " AND g.entity IS NOT NULL"; $sql .= " AND g.entity IS NOT NULL";
} else { } else {
$sql .= " AND g.entity IN (0,".$conf->entity.")"; $sql .= " AND g.entity IN (0,".$conf->entity.")";
@ -206,12 +204,9 @@ class UserGroup extends CommonObject
dol_syslog(get_class($this)."::listGroupsForUser", LOG_DEBUG); dol_syslog(get_class($this)."::listGroupsForUser", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{ while ($obj = $this->db->fetch_object($result)) {
while ($obj = $this->db->fetch_object($result)) if (!array_key_exists($obj->rowid, $ret)) {
{
if (!array_key_exists($obj->rowid, $ret))
{
$newgroup = new UserGroup($this->db); $newgroup = new UserGroup($this->db);
$newgroup->fetch($obj->rowid, '', $load_members); $newgroup->fetch($obj->rowid, '', $load_members);
$ret[$obj->rowid] = $newgroup; $ret[$obj->rowid] = $newgroup;
@ -243,37 +238,43 @@ class UserGroup extends CommonObject
$ret = array(); $ret = array();
$sql = "SELECT u.rowid"; $sql = "SELECT u.rowid";
if (!empty($this->id)) $sql .= ", ug.entity as usergroup_entity"; if (!empty($this->id)) {
$sql .= ", ug.entity as usergroup_entity";
}
$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
if (!empty($this->id)) $sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; if (!empty($this->id)) {
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
}
$sql .= " WHERE 1 = 1"; $sql .= " WHERE 1 = 1";
if (!empty($this->id)) $sql .= " AND ug.fk_user = u.rowid"; if (!empty($this->id)) {
if (!empty($this->id)) $sql .= " AND ug.fk_usergroup = ".$this->id; $sql .= " AND ug.fk_user = u.rowid";
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) }
{ if (!empty($this->id)) {
$sql .= " AND ug.fk_usergroup = ".$this->id;
}
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
$sql .= " AND u.entity IS NOT NULL"; $sql .= " AND u.entity IS NOT NULL";
} else { } else {
$sql .= " AND u.entity IN (0,".$conf->entity.")"; $sql .= " AND u.entity IN (0,".$conf->entity.")";
} }
if (!empty($excludefilter)) $sql .= ' AND ('.$excludefilter.')'; if (!empty($excludefilter)) {
$sql .= ' AND ('.$excludefilter.')';
}
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG); dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{ while ($obj = $this->db->fetch_object($resql)) {
while ($obj = $this->db->fetch_object($resql)) if (!array_key_exists($obj->rowid, $ret)) {
{ if ($mode != 1) {
if (!array_key_exists($obj->rowid, $ret))
{
if ($mode != 1)
{
$newuser = new User($this->db); $newuser = new User($this->db);
$newuser->fetch($obj->rowid); $newuser->fetch($obj->rowid);
$ret[$obj->rowid] = $newuser; $ret[$obj->rowid] = $newuser;
} else $ret[$obj->rowid] = $obj->rowid; } else {
$ret[$obj->rowid] = $obj->rowid;
}
} }
if ($mode != 1 && !empty($obj->usergroup_entity)) if ($mode != 1 && !empty($obj->usergroup_entity)) {
{
$ret[$obj->rowid]->usergroup_entity[] = $obj->usergroup_entity; $ret[$obj->rowid]->usergroup_entity[] = $obj->usergroup_entity;
} }
} }
@ -308,8 +309,7 @@ class UserGroup extends CommonObject
$this->db->begin(); $this->db->begin();
if (!empty($rid)) if (!empty($rid)) {
{
$module = $perms = $subperms = ''; $module = $perms = $subperms = '';
// Si on a demande ajout d'un droit en particulier, on recupere // Si on a demande ajout d'un droit en particulier, on recupere
@ -335,25 +335,27 @@ class UserGroup extends CommonObject
// Where pour la liste des droits a ajouter // Where pour la liste des droits a ajouter
$whereforadd = "id=".((int) $rid); $whereforadd = "id=".((int) $rid);
// Find also rights that are herited to add them too // Find also rights that are herited to add them too
if ($subperms) $whereforadd .= " OR (module='".$this->db->escape($module)."' AND perms='".$this->db->escape($perms)."' AND (subperms='lire' OR subperms='read'))"; if ($subperms) {
elseif ($perms) $whereforadd .= " OR (module='".$this->db->escape($module)."' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; $whereforadd .= " OR (module='".$this->db->escape($module)."' AND perms='".$this->db->escape($perms)."' AND (subperms='lire' OR subperms='read'))";
} elseif ($perms) {
$whereforadd .= " OR (module='".$this->db->escape($module)."' AND (perms='lire' OR perms='read') AND subperms IS NULL)";
}
} else { } else {
// Where pour la liste des droits a ajouter // Where pour la liste des droits a ajouter
if (!empty($allmodule)) if (!empty($allmodule)) {
{ if ($allmodule == 'allmodules') {
if ($allmodule == 'allmodules')
{
$whereforadd = 'allmodules'; $whereforadd = 'allmodules';
} else { } else {
$whereforadd = "module='".$this->db->escape($allmodule)."'"; $whereforadd = "module='".$this->db->escape($allmodule)."'";
if (!empty($allperms)) $whereforadd .= " AND perms='".$this->db->escape($allperms)."'"; if (!empty($allperms)) {
$whereforadd .= " AND perms='".$this->db->escape($allperms)."'";
}
} }
} }
} }
// Add permission of the list $whereforadd // Add permission of the list $whereforadd
if (!empty($whereforadd)) if (!empty($whereforadd)) {
{
//print "$module-$perms-$subperms"; //print "$module-$perms-$subperms";
$sql = "SELECT id"; $sql = "SELECT id";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def";
@ -363,19 +365,21 @@ class UserGroup extends CommonObject
} }
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$nid = $obj->id; $nid = $obj->id;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights WHERE fk_usergroup = $this->id AND fk_id=".$nid." AND entity = ".$entity; $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights WHERE fk_usergroup = $this->id AND fk_id=".$nid." AND entity = ".$entity;
if (!$this->db->query($sql)) $error++; if (!$this->db->query($sql)) {
$error++;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup_rights (entity, fk_usergroup, fk_id) VALUES (".$entity.", ".$this->id.", ".$nid.")"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup_rights (entity, fk_usergroup, fk_id) VALUES (".$entity.", ".$this->id.", ".$nid.")";
if (!$this->db->query($sql)) $error++; if (!$this->db->query($sql)) {
$error++;
}
$i++; $i++;
} }
@ -384,14 +388,15 @@ class UserGroup extends CommonObject
dol_print_error($this->db); dol_print_error($this->db);
} }
if (!$error) if (!$error) {
{
$langs->load("other"); $langs->load("other");
$this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); $this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : ''));
// Call trigger // Call trigger
$result = $this->call_trigger('USERGROUP_MODIFY', $user); $result = $this->call_trigger('USERGROUP_MODIFY', $user);
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
// End call triggers // End call triggers
} }
} }
@ -426,8 +431,7 @@ class UserGroup extends CommonObject
$this->db->begin(); $this->db->begin();
if (!empty($rid)) if (!empty($rid)) {
{
$module = $perms = $subperms = ''; $module = $perms = $subperms = '';
// Si on a demande supression d'un droit en particulier, on recupere // Si on a demande supression d'un droit en particulier, on recupere
@ -453,29 +457,32 @@ class UserGroup extends CommonObject
// Where pour la liste des droits a supprimer // Where pour la liste des droits a supprimer
$wherefordel = "id=".$this->db->escape($rid); $wherefordel = "id=".$this->db->escape($rid);
// Suppression des droits induits // Suppression des droits induits
if ($subperms == 'lire' || $subperms == 'read') $wherefordel .= " OR (module='".$this->db->escape($module)."' AND perms='".$this->db->escape($perms)."' AND subperms IS NOT NULL)"; if ($subperms == 'lire' || $subperms == 'read') {
if ($perms == 'lire' || $perms == 'read') $wherefordel .= " OR (module='".$this->db->escape($module)."')"; $wherefordel .= " OR (module='".$this->db->escape($module)."' AND perms='".$this->db->escape($perms)."' AND subperms IS NOT NULL)";
}
if ($perms == 'lire' || $perms == 'read') {
$wherefordel .= " OR (module='".$this->db->escape($module)."')";
}
// Pour compatibilite, si lowid = 0, on est en mode suppression de tout // Pour compatibilite, si lowid = 0, on est en mode suppression de tout
// TODO A virer quand sera gere par l'appelant // TODO A virer quand sera gere par l'appelant
//if (substr($rid,-1,1) == 0) $wherefordel="module='$module'"; //if (substr($rid,-1,1) == 0) $wherefordel="module='$module'";
} else { } else {
// Add permission of the list $wherefordel // Add permission of the list $wherefordel
if (!empty($allmodule)) if (!empty($allmodule)) {
{ if ($allmodule == 'allmodules') {
if ($allmodule == 'allmodules')
{
$wherefordel = 'allmodules'; $wherefordel = 'allmodules';
} else { } else {
$wherefordel = "module='".$this->db->escape($allmodule)."'"; $wherefordel = "module='".$this->db->escape($allmodule)."'";
if (!empty($allperms)) $wherefordel .= " AND perms='".$this->db->escape($allperms)."'"; if (!empty($allperms)) {
$wherefordel .= " AND perms='".$this->db->escape($allperms)."'";
}
} }
} }
} }
// Suppression des droits de la liste wherefordel // Suppression des droits de la liste wherefordel
if (!empty($wherefordel)) if (!empty($wherefordel)) {
{
//print "$module-$perms-$subperms"; //print "$module-$perms-$subperms";
$sql = "SELECT id"; $sql = "SELECT id";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def";
@ -485,12 +492,10 @@ class UserGroup extends CommonObject
} }
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$nid = 0; $nid = 0;
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -501,7 +506,9 @@ class UserGroup extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights";
$sql .= " WHERE fk_usergroup = $this->id AND fk_id=".$nid; $sql .= " WHERE fk_usergroup = $this->id AND fk_id=".$nid;
$sql .= " AND entity = ".$entity; $sql .= " AND entity = ".$entity;
if (!$this->db->query($sql)) $error++; if (!$this->db->query($sql)) {
$error++;
}
$i++; $i++;
} }
@ -510,14 +517,15 @@ class UserGroup extends CommonObject
dol_print_error($this->db); dol_print_error($this->db);
} }
if (!$error) if (!$error) {
{
$langs->load("other"); $langs->load("other");
$this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); $this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : ''));
// Call trigger // Call trigger
$result = $this->call_trigger('USERGROUP_MODIFY', $user); $result = $this->call_trigger('USERGROUP_MODIFY', $user);
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
// End call triggers // End call triggers
} }
} }
@ -542,14 +550,12 @@ class UserGroup extends CommonObject
{ {
global $conf; global $conf;
if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag]) if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag]) {
{
// Rights for this module are already loaded, so we leave // Rights for this module are already loaded, so we leave
return; return;
} }
if (!empty($this->all_permissions_are_loaded)) if (!empty($this->all_permissions_are_loaded)) {
{
// We already loaded all rights for this group, so we leave // We already loaded all rights for this group, so we leave
return; return;
} }
@ -564,16 +570,16 @@ class UserGroup extends CommonObject
$sql .= " AND u.entity = ".$conf->entity; $sql .= " AND u.entity = ".$conf->entity;
$sql .= " AND u.fk_usergroup = ".$this->id; $sql .= " AND u.fk_usergroup = ".$this->id;
$sql .= " AND r.perms IS NOT NULL"; $sql .= " AND r.perms IS NOT NULL";
if ($moduletag) $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; if ($moduletag) {
$sql .= " AND r.module = '".$this->db->escape($moduletag)."'";
}
dol_syslog(get_class($this).'::getrights', LOG_DEBUG); dol_syslog(get_class($this).'::getrights', LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) { if ($obj) {
@ -581,17 +587,25 @@ class UserGroup extends CommonObject
$perms = $obj->perms; $perms = $obj->perms;
$subperms = $obj->subperms; $subperms = $obj->subperms;
if ($perms) if ($perms) {
{ if (!isset($this->rights)) {
if (!isset($this->rights)) $this->rights = new stdClass(); // For avoid error $this->rights = new stdClass(); // For avoid error
if (!isset($this->rights->$module) || !is_object($this->rights->$module)) $this->rights->$module = new stdClass(); }
if ($subperms) if (!isset($this->rights->$module) || !is_object($this->rights->$module)) {
{ $this->rights->$module = new stdClass();
if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass(); }
if (empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; if ($subperms) {
if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) {
$this->rights->$module->$perms = new stdClass();
}
if (empty($this->rights->$module->$perms->$subperms)) {
$this->nb_rights++;
}
$this->rights->$module->$perms->$subperms = 1; $this->rights->$module->$perms->$subperms = 1;
} else { } else {
if (empty($this->rights->$module->$perms)) $this->nb_rights++; if (empty($this->rights->$module->$perms)) {
$this->nb_rights++;
}
$this->rights->$module->$perms = 1; $this->rights->$module->$perms = 1;
} }
} }
@ -602,8 +616,7 @@ class UserGroup extends CommonObject
$this->db->free($resql); $this->db->free($resql);
} }
if ($moduletag == '') if ($moduletag == '') {
{
// Si module etait non defini, alors on a tout charge, on peut donc considerer // Si module etait non defini, alors on a tout charge, on peut donc considerer
// que les droits sont en cache (car tous charges) pour cet instance de group // que les droits sont en cache (car tous charges) pour cet instance de group
$this->all_permissions_are_loaded = 1; $this->all_permissions_are_loaded = 1;
@ -641,7 +654,9 @@ class UserGroup extends CommonObject
$this->nom = $this->name; // Field for 'name' is called 'nom' in database $this->nom = $this->name; // Field for 'name' is called 'nom' in database
} }
if (!isset($this->entity)) $this->entity = $conf->entity; // If not defined, we use default value if (!isset($this->entity)) {
$this->entity = $conf->entity; // If not defined, we use default value
}
return $this->createCommon($user, $notrigger); return $this->createCommon($user, $notrigger);
} }
@ -708,7 +723,9 @@ class UserGroup extends CommonObject
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager; global $menumanager;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto = 0; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) {
$withpicto = 0;
}
$result = ''; $label = ''; $result = ''; $label = '';
@ -720,19 +737,20 @@ class UserGroup extends CommonObject
$url = DOL_URL_ROOT.'/user/group/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/user/group/card.php?id='.$this->id;
if ($option != 'nolink') if ($option != 'nolink') {
{
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; $add_save_lastsearch_values = 1;
}
if ($add_save_lastsearch_values) {
$url .= '&save_lastsearch_values=1';
}
} }
$linkclose = ""; $linkclose = "";
if (empty($notooltip)) if (empty($notooltip)) {
{ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$langs->load("users"); $langs->load("users");
$label = $langs->trans("ShowGroup"); $label = $langs->trans("ShowGroup");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"';
@ -753,16 +771,23 @@ class UserGroup extends CommonObject
$linkend = '</a>'; $linkend = '</a>';
$result = $linkstart; $result = $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto) {
if ($withpicto != 2) $result .= $this->name; $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->name;
}
$result .= $linkend; $result .= $linkend;
global $action; global $action;
$hookmanager->initHooks(array('groupdao')); $hookmanager->initHooks(array('groupdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result); $parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint; if ($reshook > 0) {
else $result .= $hookmanager->resPrint; $result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result; return $result;
} }
@ -783,9 +808,15 @@ class UserGroup extends CommonObject
// phpcs:enable // phpcs:enable
global $conf; global $conf;
$dn = ''; $dn = '';
if ($mode == 0) $dn = $conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS].",".$conf->global->LDAP_GROUP_DN; if ($mode == 0) {
if ($mode == 1) $dn = $conf->global->LDAP_GROUP_DN; $dn = $conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS].",".$conf->global->LDAP_GROUP_DN;
if ($mode == 2) $dn = $conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS]; }
if ($mode == 1) {
$dn = $conf->global->LDAP_GROUP_DN;
}
if ($mode == 2) {
$dn = $conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS];
}
return $dn; return $dn;
} }
@ -808,14 +839,16 @@ class UserGroup extends CommonObject
$info["objectclass"] = explode(',', $conf->global->LDAP_GROUP_OBJECT_CLASS); $info["objectclass"] = explode(',', $conf->global->LDAP_GROUP_OBJECT_CLASS);
// Champs // Champs
if ($this->name && !empty($conf->global->LDAP_GROUP_FIELD_FULLNAME)) $info[$conf->global->LDAP_GROUP_FIELD_FULLNAME] = $this->name; if ($this->name && !empty($conf->global->LDAP_GROUP_FIELD_FULLNAME)) {
$info[$conf->global->LDAP_GROUP_FIELD_FULLNAME] = $this->name;
}
//if ($this->name && ! empty($conf->global->LDAP_GROUP_FIELD_NAME)) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->name; //if ($this->name && ! empty($conf->global->LDAP_GROUP_FIELD_NAME)) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->name;
if ($this->note && !empty($conf->global->LDAP_GROUP_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 2); if ($this->note && !empty($conf->global->LDAP_GROUP_FIELD_DESCRIPTION)) {
if (!empty($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)) $info[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 2);
{ }
if (!empty($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)) {
$valueofldapfield = array(); $valueofldapfield = array();
foreach ($this->members as $key=>$val) // This is array of users for group into dolibarr database. foreach ($this->members as $key => $val) { // This is array of users for group into dolibarr database.
{
$muser = new User($this->db); $muser = new User($this->db);
$muser->fetch($val->id); $muser->fetch($val->id);
$info2 = $muser->_load_ldap_info(); $info2 = $muser->_load_ldap_info();
@ -875,10 +908,8 @@ class UserGroup extends CommonObject
$langs->load("user"); $langs->load("user");
// Positionne le modele sur le nom du modele a utiliser // Positionne le modele sur le nom du modele a utiliser
if (!dol_strlen($modele)) if (!dol_strlen($modele)) {
{ if (!empty($conf->global->USERGROUP_ADDON_PDF)) {
if (!empty($conf->global->USERGROUP_ADDON_PDF))
{
$modele = $conf->global->USERGROUP_ADDON_PDF; $modele = $conf->global->USERGROUP_ADDON_PDF;
} else { } else {
$modele = 'grass'; $modele = 'grass';

View File

@ -33,7 +33,9 @@ $id = (int) GETPOST('id', 'int');
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
@ -47,7 +49,9 @@ $hookmanager->initHooks(array('usercard', 'globalcard'));
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
if ($action == 'update' && !GETPOST('cancel', 'alpha')) { if ($action == 'update' && !GETPOST('cancel', 'alpha')) {
@ -76,8 +80,7 @@ $form = new Form($db);
llxHeader("", "ClickToDial"); llxHeader("", "ClickToDial");
if ($id > 0) if ($id > 0) {
{
$object = new User($db); $object = new User($db);
$object->fetch($id, '', '', 1); $object->fetch($id, '', '', 1);
$object->getrights(); $object->getrights();
@ -107,17 +110,14 @@ if ($id > 0)
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
// Edit mode // Edit mode
if ($action == 'edit') if ($action == 'edit') {
{
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if ($user->admin) if ($user->admin) {
{
print '<tr><td class="titlefield fieldrequired">ClickToDial URL</td>'; print '<tr><td class="titlefield fieldrequired">ClickToDial URL</td>';
print '<td class="valeur">'; print '<td class="valeur">';
print '<input name="url" value="'.(!empty($object->clicktodial_url) ? $object->clicktodial_url : '').'" size="92">'; print '<input name="url" value="'.(!empty($object->clicktodial_url) ? $object->clicktodial_url : '').'" size="92">';
if (empty($conf->global->CLICKTODIAL_URL) && empty($object->clicktodial_url)) if (empty($conf->global->CLICKTODIAL_URL) && empty($object->clicktodial_url)) {
{
$langs->load("errors"); $langs->load("errors");
print '<font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).'</font>'; print '<font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).'</font>';
} else { } else {
@ -147,14 +147,14 @@ if ($id > 0)
{ {
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
if (!empty($user->admin)) if (!empty($user->admin)) {
{
print '<tr><td class="titlefield">ClickToDial URL</td>'; print '<tr><td class="titlefield">ClickToDial URL</td>';
print '<td class="valeur">'; print '<td class="valeur">';
$url = $conf->global->CLICKTODIAL_URL; $url = $conf->global->CLICKTODIAL_URL;
if (!empty($object->clicktodial_url)) $url = $object->clicktodial_url; if (!empty($object->clicktodial_url)) {
if (empty($url)) $url = $object->clicktodial_url;
{ }
if (empty($url)) {
$langs->load("errors"); $langs->load("errors");
print '<font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).'</font>'; print '<font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).'</font>';
} else { } else {
@ -181,8 +181,7 @@ if ($id > 0)
print dol_get_fiche_end(); print dol_get_fiche_end();
if ($action == 'edit') if ($action == 'edit') {
{
print '<br>'; print '<br>';
print '<div class="center"><input class="button button-save" type="submit" value="'.$langs->trans("Save").'">'; print '<div class="center"><input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@ -194,12 +193,11 @@ if ($id > 0)
print '</form>'; print '</form>';
/* /*
* Barre d'actions * Barre d'actions
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (!empty($user->admin) && $action <> 'edit') if (!empty($user->admin) && $action <> 'edit') {
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
} }

View File

@ -47,14 +47,12 @@ $canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer); $candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
$canreadgroup = $canreaduser; $canreadgroup = $canreaduser;
$caneditgroup = $canedituser; $caneditgroup = $canedituser;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{
$canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read); $canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
$caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write); $caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
} }
// Define value to know what current user can do on properties of edited user // Define value to know what current user can do on properties of edited user
if ($id) if ($id) {
{
// $user est le user qui edite, $id est l'id de l'utilisateur edite // $user est le user qui edite, $id est l'id de l'utilisateur edite
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer) $caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|| (($user->id != $id) && $user->rights->user->user->creer)); || (($user->id != $id) && $user->rights->user->user->creer));
@ -64,28 +62,37 @@ if ($id)
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = 'user'; $feature2 = 'user';
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id <> $id && !$canreaduser) accessforbidden(); if ($user->id <> $id && !$canreaduser) {
accessforbidden();
}
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } if (empty($page) || $page == -1) {
$page = 0;
}
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) {
if (!$sortfield) $sortfield = "position_name"; $sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "position_name";
}
$object = new User($db); $object = new User($db);
if ($id > 0 || !empty($ref)) if ($id > 0 || !empty($ref)) {
{
$result = $object->fetch($id, $ref, '', 1); $result = $object->fetch($id, $ref, '', 1);
$object->getrights(); $object->getrights();
//$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ; //$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ;
@ -103,7 +110,9 @@ $hookmanager->initHooks(array('usercard', 'userdoc', 'globalcard'));
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
@ -118,12 +127,13 @@ $form = new Form($db);
llxHeader('', $langs->trans("UserCard").' - '.$langs->trans("Files")); llxHeader('', $langs->trans("UserCard").' - '.$langs->trans("Files"));
if ($object->id) if ($object->id) {
{
/* /*
* Affichage onglets * Affichage onglets
*/ */
if (!empty($conf->notification->enabled)) $langs->load("mails"); if (!empty($conf->notification->enabled)) {
$langs->load("mails");
}
$head = user_prepare_head($object); $head = user_prepare_head($object);
$form = new Form($db); $form = new Form($db);
@ -143,8 +153,7 @@ if ($object->id)
// Build file list // Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0; $totalsize = 0;
foreach ($filearray as $key => $file) foreach ($filearray as $key => $file) {
{
$totalsize += $file['size']; $totalsize += $file['size'];
} }

View File

@ -38,8 +38,7 @@ $candisableperms = ($user->admin || $user->rights->user->user->supprimer);
$feature2 = 'user'; $feature2 = 'user';
// Advanced permissions // Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{
$canreadperms = ($user->admin || $user->rights->user->group_advance->read); $canreadperms = ($user->admin || $user->rights->user->group_advance->read);
$caneditperms = ($user->admin || $user->rights->user->group_advance->write); $caneditperms = ($user->admin || $user->rights->user->group_advance->write);
$candisableperms = ($user->admin || $user->rights->user->group_advance->delete); $candisableperms = ($user->admin || $user->rights->user->group_advance->delete);
@ -62,8 +61,7 @@ $userid = GETPOST('user', 'int');
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2); $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2);
// Users/Groups management only in master entity if transverse mode // Users/Groups management only in master entity if transverse mode
if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
{
accessforbidden(); accessforbidden();
} }
@ -87,29 +85,31 @@ $hookmanager->initHooks(array('groupcard', 'globalcard'));
$parameters = array('id' => $id, 'userid' => $userid, 'caneditperms' => $caneditperms); $parameters = array('id' => $id, 'userid' => $userid, 'caneditperms' => $caneditperms);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/user/group/list.php'; $backurlforlist = DOL_URL_ROOT.'/user/group/list.php';
if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
else $backtopage = dol_buildpath('/user/group/card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); $backtopage = $backurlforlist;
} else {
$backtopage = dol_buildpath('/user/group/card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
} }
} }
if ($cancel) if ($cancel) {
{
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
// Action remove group // Action remove group
if ($action == 'confirm_delete' && $confirm == "yes") if ($action == 'confirm_delete' && $confirm == "yes") {
{ if ($caneditperms) {
if ($caneditperms)
{
$object->fetch($id); $object->fetch($id);
$object->delete($user); $object->delete($user);
header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1"); header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1");
@ -121,10 +121,8 @@ if (empty($reshook)) {
} }
// Action add group // Action add group
if ($action == 'add') if ($action == 'add') {
{ if ($caneditperms) {
if ($caneditperms)
{
if (!GETPOST("nom", "nohtml")) { if (!GETPOST("nom", "nohtml")) {
setEventMessages($langs->trans("NameNotDefined"), null, 'errors'); setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
$action = "create"; // Go back to create page $action = "create"; // Go back to create page
@ -134,17 +132,21 @@ if (empty($reshook)) {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
else $object->entity = $_POST["entity"]; $object->entity = 0;
} else {
$object->entity = $_POST["entity"];
}
$db->begin(); $db->begin();
$id = $object->create(); $id = $object->create();
if ($id > 0) if ($id > 0) {
{
$db->commit(); $db->commit();
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@ -164,22 +166,22 @@ if (empty($reshook)) {
} }
// Add/Remove user into group // Add/Remove user into group
if ($action == 'adduser' || $action == 'removeuser') if ($action == 'adduser' || $action == 'removeuser') {
{ if ($caneditperms) {
if ($caneditperms) if ($userid > 0) {
{
if ($userid > 0)
{
$object->fetch($id); $object->fetch($id);
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$edituser = new User($db); $edituser = new User($db);
$edituser->fetch($userid); $edituser->fetch($userid);
if ($action == 'adduser') $result = $edituser->SetInGroup($object->id, $object->entity); if ($action == 'adduser') {
if ($action == 'removeuser') $result = $edituser->RemoveFromGroup($object->id, $object->entity); $result = $edituser->SetInGroup($object->id, $object->entity);
}
if ($action == 'removeuser') {
$result = $edituser->RemoveFromGroup($object->id, $object->entity);
}
if ($result > 0) if ($result > 0) {
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} else { } else {
@ -193,10 +195,8 @@ if (empty($reshook)) {
} }
if ($action == 'update') if ($action == 'update') {
{ if ($caneditperms) {
if ($caneditperms)
{
$db->begin(); $db->begin();
$object->fetch($id); $object->fetch($id);
@ -208,15 +208,19 @@ if (empty($reshook)) {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
else $object->entity = $_POST["entity"]; $object->entity = 0;
} else {
$object->entity = $_POST["entity"];
}
$ret = $object->update(); $ret = $object->update();
if ($ret >= 0 && !count($object->errors)) if ($ret >= 0 && !count($object->errors)) {
{
setEventMessages($langs->trans("GroupModified"), null, 'mesgs'); setEventMessages($langs->trans("GroupModified"), null, 'mesgs');
$db->commit(); $db->commit();
} else { } else {
@ -247,8 +251,7 @@ $fuserstatic = new User($db);
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
if ($action == 'create') if ($action == 'create') {
{
print load_fiche_titre($langs->trans("NewGroup"), '', 'object_group'); print load_fiche_titre($langs->trans("NewGroup"), '', 'object_group');
print dol_set_focus('#nom'); print dol_set_focus('#nom');
@ -263,10 +266,8 @@ if ($action == 'create')
print '<table class="border centpercent tableforfieldcreate">'; print '<table class="border centpercent tableforfieldcreate">';
// Multicompany // Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc)) {
{ if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity)
{
print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>'; print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
print "<td>".$mc->select_entities($conf->entity); print "<td>".$mc->select_entities($conf->entity);
print "</td></tr>\n"; print "</td></tr>\n";
@ -292,17 +293,13 @@ if ($action == 'create')
print '</div>'; print '</div>';
print "</form>"; print "</form>";
} } else {
/* ************************************************************************** */
/* */
/* ************************************************************************** */ /* Visu et edition */
/* */ /* */
/* Visu et edition */ /* ************************************************************************** */
/* */ if ($id) {
/* ************************************************************************** */
else {
if ($id)
{
$res = $object->fetch_optionals(); $res = $object->fetch_optionals();
$head = group_prepare_head($object); $head = group_prepare_head($object);
@ -311,8 +308,7 @@ else {
/* /*
* Confirmation suppression * Confirmation suppression
*/ */
if ($action == 'delete') if ($action == 'delete') {
{
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("DeleteAGroup"), $langs->trans("ConfirmDeleteGroup", $object->name), "confirm_delete", '', 0, 1); print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("DeleteAGroup"), $langs->trans("ConfirmDeleteGroup", $object->name), "confirm_delete", '', 0, 1);
} }
@ -320,8 +316,7 @@ else {
* Fiche en mode visu * Fiche en mode visu
*/ */
if ($action != 'edit') if ($action != 'edit') {
{
print dol_get_fiche_head($head, 'group', $title, -1, 'group'); print dol_get_fiche_head($head, 'group', $title, -1, 'group');
$linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -335,20 +330,17 @@ else {
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
if (!empty($conf->mutlicompany->enabled)) if (!empty($conf->mutlicompany->enabled)) {
{
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td class="valeur">'.dol_escape_htmltag($object->name); print '<td class="valeur">'.dol_escape_htmltag($object->name);
if (empty($object->entity)) if (empty($object->entity)) {
{
print img_picto($langs->trans("GlobalGroup"), 'redstar'); print img_picto($langs->trans("GlobalGroup"), 'redstar');
} }
print "</td></tr>\n"; print "</td></tr>\n";
} }
// Multicompany // Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
{
$mc->getInfo($object->entity); $mc->getInfo($object->entity);
print "<tr>".'<td class="titlefield">'.$langs->trans("Entity").'</td>'; print "<tr>".'<td class="titlefield">'.$langs->trans("Entity").'</td>';
print '<td class="valeur">'.dol_escape_htmltag($mc->label); print '<td class="valeur">'.dol_escape_htmltag($mc->label);
@ -381,15 +373,15 @@ else {
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($caneditperms) if ($caneditperms) {
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit&amp;token='.newToken().'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit&amp;token='.newToken().'">'.$langs->trans("Modify").'</a>';
} }
if ($candisableperms) if ($candisableperms) {
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&amp;id='.$object->id.'&amp;token='.newToken().'">'.$langs->trans("DeleteGroup").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&amp;id='.$object->id.'&amp;token='.newToken().'">'.$langs->trans("DeleteGroup").'</a>';
} }
@ -402,10 +394,8 @@ else {
// On selectionne les users qui ne sont pas deja dans le groupe // On selectionne les users qui ne sont pas deja dans le groupe
$exclude = array(); $exclude = array();
if (!empty($object->members)) if (!empty($object->members)) {
{ foreach ($object->members as $useringroup) {
foreach ($object->members as $useringroup)
{
$exclude[] = $useringroup->id; $exclude[] = $useringroup->id;
} }
} }
@ -415,10 +405,8 @@ else {
$reshook = $hookmanager->executeHooks('formAddUserToGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formAddUserToGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook)) {
{ if ($caneditperms) {
if ($caneditperms)
{
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n"; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="adduser">'; print '<input type="hidden" name="action" value="adduser">';
@ -447,10 +435,8 @@ else {
print '<td class="liste_titre right" width="5">&nbsp;</td>'; print '<td class="liste_titre right" width="5">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
if (!empty($object->members)) if (!empty($object->members)) {
{ foreach ($object->members as $useringroup) {
foreach ($object->members as $useringroup)
{
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login');
@ -484,8 +470,8 @@ else {
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
/* /*
* Documents generes * Documents generes
*/ */
$filename = dol_sanitizeFileName($object->ref); $filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->usergroup->dir_output."/".dol_sanitizeFileName($object->ref); $filedir = $conf->usergroup->dir_output."/".dol_sanitizeFileName($object->ref);
@ -510,11 +496,10 @@ else {
} }
/* /*
* Fiche en mode edition * Fiche en mode edition
*/ */
if ($action == 'edit' && $caneditperms) if ($action == 'edit' && $caneditperms) {
{
print '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="updategroup" enctype="multipart/form-data">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="updategroup" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@ -526,10 +511,8 @@ else {
print '<table class="border centpercent tableforfieldedit">'."\n"; print '<table class="border centpercent tableforfieldedit">'."\n";
// Multicompany // Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc)) {
{ if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity)
{
print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>'; print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
print "<td>".$mc->select_entities($object->entity); print "<td>".$mc->select_entities($object->entity);
print "</td></tr>\n"; print "</td></tr>\n";

View File

@ -34,14 +34,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
$langs->loadLangs(array('companies', 'ldap', 'users', 'admin')); $langs->loadLangs(array('companies', 'ldap', 'users', 'admin'));
// Users/Groups management only in master entity if transverse mode // Users/Groups management only in master entity if transverse mode
if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
{
accessforbidden(); accessforbidden();
} }
$canreadperms = true; $canreadperms = true;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{
$canreadperms = ($user->admin || $user->rights->user->group_advance->read); $canreadperms = ($user->admin || $user->rights->user->group_advance->read);
} }
@ -49,7 +47,9 @@ $id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$object = new Usergroup($db); $object = new Usergroup($db);
$object->fetch($id); $object->fetch($id);
@ -60,13 +60,11 @@ $object->getrights();
* Actions * Actions
*/ */
if ($action == 'dolibarr2ldap') if ($action == 'dolibarr2ldap') {
{
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
// Get a gid number for objectclass PosixGroup // Get a gid number for objectclass PosixGroup
@ -80,8 +78,7 @@ if ($action == 'dolibarr2ldap')
$result = $ldap->update($dn, $info, $user, $olddn); $result = $ldap->update($dn, $info, $user, $olddn);
} }
if ($result >= 0) if ($result >= 0) {
{
setEventMessages($langs->trans("GroupSynchronized"), null, 'mesgs'); setEventMessages($langs->trans("GroupSynchronized"), null, 'mesgs');
} else { } else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
@ -111,12 +108,10 @@ print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
if (!empty($conf->mutlicompany->enabled)) if (!empty($conf->mutlicompany->enabled)) {
{
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td class="valeur">'.$object->name; print '<td class="valeur">'.$object->name;
if (!$object->entity) if (!$object->entity) {
{
print img_picto($langs->trans("GlobalGroup"), 'redstar'); print img_picto($langs->trans("GlobalGroup"), 'redstar');
} }
print "</td></tr>\n"; print "</td></tr>\n";
@ -153,14 +148,15 @@ print dol_get_fiche_end();
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
} }
print "</div>\n"; print "</div>\n";
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') print "<br>\n"; if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
print "<br>\n";
}
@ -177,8 +173,7 @@ print '</tr>';
// Lecture LDAP // Lecture LDAP
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1); $dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
@ -188,10 +183,8 @@ if ($result > 0)
//var_dump($records); //var_dump($records);
// Show tree // Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
{ if (!is_array($records)) {
if (!is_array($records))
{
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} else { } else {
$result = show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);

View File

@ -28,15 +28,14 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{ if (!$user->rights->user->group_advance->read && !$user->admin) {
if (!$user->rights->user->group_advance->read && !$user->admin)
accessforbidden(); accessforbidden();
}
} }
// Users/Groups management only in master entity if transverse mode // Users/Groups management only in master entity if transverse mode
if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
{
accessforbidden(); accessforbidden();
} }
@ -50,8 +49,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
// Defini si peux lire/modifier utilisateurs et permisssions // Defini si peux lire/modifier utilisateurs et permisssions
$caneditperms = ($user->admin || $user->rights->user->user->creer); $caneditperms = ($user->admin || $user->rights->user->user->creer);
// Advanced permissions // Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{
$caneditperms = ($user->admin || $user->rights->user->group_advance->write); $caneditperms = ($user->admin || $user->rights->user->group_advance->write);
} }
@ -60,13 +58,19 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } if (empty($page) || $page == -1) {
$page = 0;
}
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (!$sortfield) $sortfield = "g.nom"; if (!$sortfield) {
if (!$sortorder) $sortorder = "ASC"; $sortfield = "g.nom";
}
if (!$sortorder) {
$sortorder = "ASC";
}
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
@ -79,21 +83,25 @@ $fieldstosearchall = array(
* Actions * Actions
*/ */
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (GETPOST('cancel', 'alpha')) {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; } $action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
$massaction = '';
}
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
{
$search_label = ""; $search_label = "";
$search_date_creation = ""; $search_date_creation = "";
$search_date_update = ""; $search_date_update = "";
@ -113,20 +121,22 @@ $sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, COUNT(DISTINCT
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
{
$sql .= " WHERE g.entity IS NOT NULL"; $sql .= " WHERE g.entity IS NOT NULL";
} else { } else {
$sql .= " WHERE g.entity IN (0,".$conf->entity.")"; $sql .= " WHERE g.entity IN (0,".$conf->entity.")";
} }
if (!empty($search_group)) natural_search(array("g.nom", "g.note"), $search_group); if (!empty($search_group)) {
if ($sall) $sql .= natural_search(array("g.nom", "g.note"), $sall); natural_search(array("g.nom", "g.note"), $search_group);
}
if ($sall) {
$sql .= natural_search(array("g.nom", "g.note"), $sall);
}
$sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec"; $sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec";
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$nbtotalofrecords = $num; $nbtotalofrecords = $num;
@ -134,18 +144,21 @@ if ($resql)
$i = 0; $i = 0;
$param = "&amp;search_group=".urlencode($search_group)."&amp;sall=".urlencode($sall); $param = "&amp;search_group=".urlencode($search_group)."&amp;sall=".urlencode($sall);
if ($optioncss != '') $param .= '&amp;optioncss='.$optioncss; if ($optioncss != '') {
$param .= '&amp;optioncss='.$optioncss;
}
$text = $langs->trans("ListOfGroups"); $text = $langs->trans("ListOfGroups");
$newcardbutton = ''; $newcardbutton = '';
if ($caneditperms) if ($caneditperms) {
{
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu='); $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=');
} }
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
@ -155,9 +168,10 @@ if ($resql)
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'object_group', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'object_group', 0, $newcardbutton, '', $limit, 0, 0, 1);
if ($sall) if ($sall) {
{ foreach ($fieldstosearchall as $key => $val) {
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
} }
@ -172,8 +186,7 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder);
//multicompany //multicompany
if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
{
print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center ');
} }
print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center '); print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center ');
@ -184,8 +197,7 @@ if ($resql)
$grouptemp = new UserGroup($db); $grouptemp = new UserGroup($db);
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$grouptemp->id = $obj->rowid; $grouptemp->id = $obj->rowid;
@ -195,14 +207,12 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $grouptemp->getNomUrl(1); print $grouptemp->getNomUrl(1);
if (!$obj->entity) if (!$obj->entity) {
{
print img_picto($langs->trans("GlobalGroup"), 'redstar'); print img_picto($langs->trans("GlobalGroup"), 'redstar');
} }
print "</td>"; print "</td>";
//multicompany //multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
{
$mc->getInfo($obj->entity); $mc->getInfo($obj->entity);
print '<td class="center">'.$mc->label.'</td>'; print '<td class="center">'.$mc->label.'</td>';
} }

View File

@ -47,14 +47,15 @@ $canreadperms = ($user->admin || $user->rights->user->user->lire);
$caneditperms = ($user->admin || $user->rights->user->user->creer); $caneditperms = ($user->admin || $user->rights->user->user->creer);
// Advanced permissions // Advanced permissions
$advancedpermsactive = false; $advancedpermsactive = false;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{
$advancedpermsactive = true; $advancedpermsactive = true;
$canreadperms = ($user->admin || ($user->rights->user->group_advance->read && $user->rights->user->group_advance->readperms)); $canreadperms = ($user->admin || ($user->rights->user->group_advance->read && $user->rights->user->group_advance->readperms));
$caneditperms = ($user->admin || $user->rights->user->group_advance->write); $caneditperms = ($user->admin || $user->rights->user->group_advance->write);
} }
if (!$canreadperms) accessforbidden(); if (!$canreadperms) {
accessforbidden();
}
$object = new Usergroup($db); $object = new Usergroup($db);
$object->fetch($id); $object->fetch($id);
@ -71,7 +72,9 @@ $hookmanager->initHooks(array('groupperms', 'globalcard'));
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
if ($action == 'addrights' && $caneditperms) { if ($action == 'addrights' && $caneditperms) {
@ -110,8 +113,7 @@ $form = new Form($db);
llxHeader('', $langs->trans("Permissions")); llxHeader('', $langs->trans("Permissions"));
if ($object->id > 0) if ($object->id > 0) {
{
/* /*
* Affichage onglets * Affichage onglets
*/ */
@ -127,32 +129,24 @@ if ($object->id > 0)
$db->begin(); $db->begin();
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir) {
{
$handle = @opendir(dol_osencode($dir)); $handle = @opendir(dol_osencode($dir));
if (is_resource($handle)) if (is_resource($handle)) {
{ while (($file = readdir($handle)) !== false) {
while (($file = readdir($handle)) !== false) if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10); $modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) if ($modName) {
{
include_once $dir.$file; include_once $dir.$file;
$objMod = new $modName($db); $objMod = new $modName($db);
// Load all lang files of module // Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
{ foreach ($objMod->langfiles as $domain) {
foreach ($objMod->langfiles as $domain)
{
$langs->load($domain); $langs->load($domain);
} }
} }
// Load all permissions // Load all permissions
if ($objMod->rights_class) if ($objMod->rights_class) {
{
$ret = $objMod->insert_permissions(0, $entity); $ret = $objMod->insert_permissions(0, $entity);
$modules[$objMod->rights_class] = $objMod; $modules[$objMod->rights_class] = $objMod;
} }
@ -176,15 +170,14 @@ if ($object->id > 0)
dol_syslog("get user perms", LOG_DEBUG); dol_syslog("get user perms", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
if (!isset($permsgroupbyentity[$obj->entity])) if (!isset($permsgroupbyentity[$obj->entity])) {
$permsgroupbyentity[$obj->entity] = array(); $permsgroupbyentity[$obj->entity] = array();
}
array_push($permsgroupbyentity[$obj->entity], $obj->id); array_push($permsgroupbyentity[$obj->entity], $obj->id);
$i++; $i++;
} }
@ -207,12 +200,10 @@ if ($object->id > 0)
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
if (!empty($conf->mutlicompany->enabled)) if (!empty($conf->mutlicompany->enabled)) {
{
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td colspan="2">'.$object->name.''; print '<td colspan="2">'.$object->name.'';
if (!$object->entity) if (!$object->entity) {
{
print img_picto($langs->trans("GlobalGroup"), 'redstar'); print img_picto($langs->trans("GlobalGroup"), 'redstar');
} }
print "</td></tr>\n"; print "</td></tr>\n";
@ -227,19 +218,22 @@ if ($object->id > 0)
print '</table><br>'; print '</table><br>';
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); if ($user->admin) {
print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
}
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
print "\n"; print "\n";
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Module").'</td>';
if ($caneditperms) if ($caneditperms) {
{
print '<td class="center nowrap">'; print '<td class="center nowrap">';
print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("All")."</a>"; print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("All")."</a>";
print '/'; print '/';
@ -248,36 +242,36 @@ if ($object->id > 0)
} }
print '<td class="center" width="24">&nbsp;</td>'; print '<td class="center" width="24">&nbsp;</td>';
print '<td>'.$langs->trans("Permissions").'</td>'; print '<td>'.$langs->trans("Permissions").'</td>';
if ($user->admin) print '<td class="right">'.$langs->trans("ID").'</td>'; if ($user->admin) {
print '<td class="right">'.$langs->trans("ID").'</td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
$sql = "SELECT r.id, r.libelle as label, r.module"; $sql = "SELECT r.id, r.libelle as label, r.module";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql .= " AND r.entity = ".$entity; $sql .= " AND r.entity = ".$entity;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
}
$sql .= " ORDER BY r.module, r.id"; $sql .= " ORDER BY r.module, r.id";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$oldmod = ''; $oldmod = '';
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it // If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it
if (empty($modules[$obj->module])) if (empty($modules[$obj->module])) {
{
$i++; $i++;
continue; continue;
} }
if ($oldmod <> $obj->module) if ($oldmod <> $obj->module) {
{
$oldmod = $obj->module; $oldmod = $obj->module;
// Break detected, we get objMod // Break detected, we get objMod
@ -290,8 +284,7 @@ if ($object->id > 0)
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName(); print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
print '<a name="'.$objMod->getName().'"></a>'; print '<a name="'.$objMod->getName().'"></a>';
print '</td>'; print '</td>';
if ($caneditperms) if ($caneditperms) {
{
print '<td class="center nowrap">'; print '<td class="center nowrap">';
print '<a class="reposition" title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("All")."</a>"; print '<a class="reposition" title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("All")."</a>";
print '/'; print '/';
@ -303,7 +296,9 @@ if ($object->id > 0)
print '<td colspan="2">&nbsp;</td>'; print '<td colspan="2">&nbsp;</td>';
// Permission id // Permission id
if ($user->admin) print '<td class="right"></td>'; if ($user->admin) {
print '<td class="right"></td>';
}
print '</tr>'; print '</tr>';
} }
@ -316,13 +311,10 @@ if ($object->id > 0)
//print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName(); //print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
print '</td>'; print '</td>';
if (is_array($permsgroupbyentity[$entity])) if (is_array($permsgroupbyentity[$entity])) {
{ if (in_array($obj->id, $permsgroupbyentity[$entity])) {
if (in_array($obj->id, $permsgroupbyentity[$entity]))
{
// Own permission by group // Own permission by group
if ($caneditperms) if ($caneditperms) {
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">';
//print img_edit_remove($langs->trans("Remove")); //print img_edit_remove($langs->trans("Remove"));
print img_picto($langs->trans("Remove"), 'switch_on'); print img_picto($langs->trans("Remove"), 'switch_on');
@ -333,8 +325,7 @@ if ($object->id > 0)
print '</td>'; print '</td>';
} else { } else {
// Do not own permission // Do not own permission
if ($caneditperms) if ($caneditperms) {
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">';
//print img_edit_add($langs->trans("Add")); //print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off'); print img_picto($langs->trans("Add"), 'switch_off');
@ -344,8 +335,7 @@ if ($object->id > 0)
} }
} else { } else {
// Do not own permission // Do not own permission
if ($caneditperms) if ($caneditperms) {
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">';
//print img_edit_add($langs->trans("Add")); //print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off'); print img_picto($langs->trans("Add"), 'switch_off');
@ -358,7 +348,9 @@ if ($object->id > 0)
print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>'; print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>';
// Permission id // Permission id
if ($user->admin) print '<td class="right"><span class="opacitymedium">'.$obj->id.'</span></td>'; if ($user->admin) {
print '<td class="right"><span class="opacitymedium">'.$obj->id.'</span></td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
@ -372,7 +364,9 @@ if ($object->id > 0)
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
print dol_get_fiche_end(); print dol_get_fiche_end();
} }

View File

@ -29,16 +29,18 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
if (!$user->rights->user->user->lire && !$user->admin) if (!$user->rights->user->user->lire && !$user->admin) {
accessforbidden(); accessforbidden();
}
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('users', 'companies')); $langs->loadLangs(array('users', 'companies'));
// Security check (for external users) // Security check (for external users)
$socid = 0; $socid = 0;
if ($user->socid > 0) if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
}
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_user = GETPOST('search_user', 'alpha'); $search_user = GETPOST('search_user', 'alpha');
@ -49,10 +51,11 @@ $mode = GETPOST("mode", 'alpha');
$userstatic = new User($db); $userstatic = new User($db);
$search_statut = GETPOST('search_statut', 'int'); $search_statut = GETPOST('search_statut', 'int');
if ($search_statut == '') $search_statut = '1'; if ($search_statut == '') {
$search_statut = '1';
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers
{
$search_statut = ""; $search_statut = "";
} }
@ -79,8 +82,7 @@ llxHeader('', $langs->trans("ListOfUsers").' - '.$langs->trans("HierarchicView")
// Load hierarchy of users // Load hierarchy of users
$user_arbo = $userstatic->get_full_tree(0, ($search_statut != '' && $search_statut >= 0) ? "statut = ".$search_statut : ''); $user_arbo = $userstatic->get_full_tree(0, ($search_statut != '' && $search_statut >= 0) ? "statut = ".$search_statut : '');
if (!is_array($user_arbo) && $user_arbo < 0) if (!is_array($user_arbo) && $user_arbo < 0) {
{
setEventMessages($userstatic->error, $userstatic->errors, 'warnings'); setEventMessages($userstatic->error, $userstatic->errors, 'warnings');
} else { } else {
// Define fulltree array // Define fulltree array
@ -89,8 +91,7 @@ if (!is_array($user_arbo) && $user_arbo < 0)
// Define data (format for treeview) // Define data (format for treeview)
$data = array(); $data = array();
$data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>''); $data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>'');
foreach ($fulltree as $key => $val) foreach ($fulltree as $key => $val) {
{
$userstatic->id = $val['id']; $userstatic->id = $val['id'];
$userstatic->ref = $val['label']; $userstatic->ref = $val['label'];
$userstatic->login = $val['login']; $userstatic->login = $val['login'];
@ -108,10 +109,8 @@ if (!is_array($user_arbo) && $user_arbo < 0)
$entitystring = ''; $entitystring = '';
// TODO Set of entitystring should be done with a hook // TODO Set of entitystring should be done with a hook
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc)) {
{ if (empty($entity)) {
if (empty($entity))
{
$entitystring = $langs->trans("AllEntities"); $entitystring = $langs->trans("AllEntities");
} else { } else {
$mc->getInfo($entity); $mc->getInfo($entity);
@ -120,11 +119,9 @@ if (!is_array($user_arbo) && $user_arbo < 0)
} }
$li = $userstatic->getNomUrl(-1, '', 0, 1); $li = $userstatic->getNomUrl(-1, '', 0, 1);
if (!empty($conf->multicompany->enabled) && $userstatic->admin && !$userstatic->entity) if (!empty($conf->multicompany->enabled) && $userstatic->admin && !$userstatic->entity) {
{
$li .= img_picto($langs->trans("SuperAdministrator"), 'redstar'); $li .= img_picto($langs->trans("SuperAdministrator"), 'redstar');
} elseif ($userstatic->admin) } elseif ($userstatic->admin) {
{
$li .= img_picto($langs->trans("Administrator"), 'star'); $li .= img_picto($langs->trans("Administrator"), 'star');
} }
$li .= ' ('.$val['login'].($entitystring ? ' - '.$entitystring : '').')'; $li .= ' ('.$val['login'].($entitystring ? ' - '.$entitystring : '').')';
@ -155,7 +152,9 @@ if (!is_array($user_arbo) && $user_arbo < 0)
print load_fiche_titre($title, $morehtmlright.' '.$newcardbutton, 'user'); print load_fiche_titre($title, $morehtmlright.' '.$newcardbutton, 'user');
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -188,8 +187,7 @@ if (!is_array($user_arbo) && $user_arbo < 0)
$nbofentries = (count($data) - 1); $nbofentries = (count($data) - 1);
if ($nbofentries > 0) if ($nbofentries > 0) {
{
print '<tr><td colspan="3">'; print '<tr><td colspan="3">';
tree_recur($data, $data[0], 0); tree_recur($data, $data[0], 0);
print '</td>'; print '</td>';

View File

@ -27,8 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userhome'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userhome'; // To manage different context of search
if (!$user->rights->user->user->lire && !$user->admin) if (!$user->rights->user->user->lire && !$user->admin) {
{
// Redirection vers la page de l'utilisateur // Redirection vers la page de l'utilisateur
header("Location: card.php?id=".$user->id); header("Location: card.php?id=".$user->id);
exit; exit;
@ -38,14 +37,15 @@ if (!$user->rights->user->user->lire && !$user->admin)
$langs->load("users"); $langs->load("users");
$canreadperms = true; $canreadperms = true;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{
$canreadperms = ($user->admin || $user->rights->user->group_advance->read); $canreadperms = ($user->admin || $user->rights->user->group_advance->read);
} }
// Security check (for external users) // Security check (for external users)
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$companystatic = new Societe($db); $companystatic = new Societe($db);
$fuserstatic = new User($db); $fuserstatic = new User($db);
@ -77,8 +77,7 @@ print '<tr><td>';
print $langs->trans("User").':</td><td><input class="flat inputsearch" type="text" name="search_user" size="18"></td></tr>'; print $langs->trans("User").':</td><td><input class="flat inputsearch" type="text" name="search_user" size="18"></td></tr>';
// Search Group // Search Group
if ($canreadperms) if ($canreadperms) {
{
print '<tr><td>'; print '<tr><td>';
print $langs->trans("Group").':</td><td><input class="flat inputsearch" type="text" name="search_group" size="18"></td></tr>'; print $langs->trans("Group").':</td><td><input class="flat inputsearch" type="text" name="search_group" size="18"></td></tr>';
} }
@ -115,13 +114,14 @@ if ($reshook > 0) {
} else { } else {
$sql .= " WHERE u.entity IN (".getEntity('user').")"; $sql .= " WHERE u.entity IN (".getEntity('user').")";
} }
if (!empty($socid)) $sql .= " AND u.fk_soc = ".$socid; if (!empty($socid)) {
$sql .= " AND u.fk_soc = ".$socid;
}
$sql .= $db->order("u.datec", "DESC"); $sql .= $db->order("u.datec", "DESC");
$sql .= $db->plimit($max); $sql .= $db->plimit($max);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -131,8 +131,7 @@ if ($resql)
print '</tr>'."\n"; print '</tr>'."\n";
$i = 0; $i = 0;
while ($i < $num && $i < $max) while ($i < $num && $i < $max) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$fuserstatic->id = $obj->rowid; $fuserstatic->id = $obj->rowid;
@ -153,34 +152,28 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowraponall">'; print '<td class="nowraponall">';
print $fuserstatic->getNomUrl(-1); print $fuserstatic->getNomUrl(-1);
if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) {
{
print img_picto($langs->trans("SuperAdministrator"), 'redstar'); print img_picto($langs->trans("SuperAdministrator"), 'redstar');
} elseif ($obj->admin) } elseif ($obj->admin) {
{
print img_picto($langs->trans("Administrator"), 'star'); print img_picto($langs->trans("Administrator"), 'star');
} }
print "</td>"; print "</td>";
print '<td>'.$obj->login.'</td>'; print '<td>'.$obj->login.'</td>';
print "<td>"; print "<td>";
if ($obj->fk_soc) if ($obj->fk_soc) {
{
print $companystatic->getNomUrl(1); print $companystatic->getNomUrl(1);
} else { } else {
print $langs->trans("InternalUser"); print $langs->trans("InternalUser");
} }
if ($obj->ldap_sid) if ($obj->ldap_sid) {
{
print ' ('.$langs->trans("DomainUser").')'; print ' ('.$langs->trans("DomainUser").')';
} }
$entity = $obj->entity; $entity = $obj->entity;
$entitystring = ''; $entitystring = '';
// TODO Set of entitystring should be done with a hook // TODO Set of entitystring should be done with a hook
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc)) {
{ if (empty($entity)) {
if (empty($entity))
{
$entitystring = $langs->trans("AllEntities"); $entitystring = $langs->trans("AllEntities");
} else { } else {
$mc->getInfo($entity); $mc->getInfo($entity);
@ -210,14 +203,12 @@ if ($resql)
/* /*
* Last groups created * Last groups created
*/ */
if ($canreadperms) if ($canreadperms) {
{
$max = 5; $max = 5;
$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec"; $sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
{
$sql .= " WHERE g.entity IS NOT NULL"; $sql .= " WHERE g.entity IS NOT NULL";
} else { } else {
$sql .= " WHERE g.entity IN (0,".$conf->entity.")"; $sql .= " WHERE g.entity IN (0,".$conf->entity.")";
@ -226,10 +217,11 @@ if ($canreadperms)
$sql .= $db->plimit($max); $sql .= $db->plimit($max);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$colspan = 1; $colspan = 1;
if (!empty($conf->multicompany->enabled)) $colspan++; if (!empty($conf->multicompany->enabled)) {
$colspan++;
}
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -241,8 +233,7 @@ if ($canreadperms)
$grouptemp = new UserGroup($db); $grouptemp = new UserGroup($db);
while ($i < $num && (!$max || $i < $max)) while ($i < $num && (!$max || $i < $max)) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$grouptemp->id = $obj->rowid; $grouptemp->id = $obj->rowid;
@ -252,13 +243,11 @@ if ($canreadperms)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $grouptemp->getNomUrl(1); print $grouptemp->getNomUrl(1);
if (!$obj->entity) if (!$obj->entity) {
{
print img_picto($langs->trans("GlobalGroup"), 'redstar'); print img_picto($langs->trans("GlobalGroup"), 'redstar');
} }
print "</td>"; print "</td>";
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc)) {
{
$mc->getInfo($obj->entity); $mc->getInfo($obj->entity);
print '<td>'; print '<td>';
print $mc->label; print $mc->label;

View File

@ -33,22 +33,24 @@ $langs->load("users");
// Security check // Security check
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$object = new User($db); $object = new User($db);
if ($id > 0 || !empty($ref)) if ($id > 0 || !empty($ref)) {
{
$result = $object->fetch($id, $ref, '', 1); $result = $object->fetch($id, $ref, '', 1);
$object->getrights(); $object->getrights();
} }
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
// If user is not user that read and no permission to read other users, we stop // If user is not user that read and no permission to read other users, we stop
if (($object->id != $user->id) && (!$user->rights->user->user->lire)) if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
accessforbidden(); accessforbidden();
}

View File

@ -35,7 +35,9 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'use
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
@ -55,17 +57,16 @@ $hookmanager->initHooks(array('usercard', 'userldap', 'globalcard'));
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{ if ($_GET["action"] == 'dolibarr2ldap') {
if ($_GET["action"] == 'dolibarr2ldap')
{
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info); $dn = $object->_load_ldap_dn($info);
$olddn = $dn; // We can say that old dn = dn as we force synchro $olddn = $dn; // We can say that old dn = dn as we force synchro
@ -109,20 +110,17 @@ print '<table class="border centpercent">';
// Login // Login
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
if ($object->ldap_sid) if ($object->ldap_sid) {
{
print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>'; print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
} else { } else {
print '<td>'.$object->login.'</td>'; print '<td>'.$object->login.'</td>';
} }
print '</tr>'; print '</tr>';
if ($conf->global->LDAP_SERVER_TYPE == "activedirectory") if ($conf->global->LDAP_SERVER_TYPE == "activedirectory") {
{
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$userSID = $ldap->getObjectSid($object->login); $userSID = $ldap->getObjectSid($object->login);
} }
print '<tr><td class="valigntop">'.$langs->trans("SID").'</td>'; print '<tr><td class="valigntop">'.$langs->trans("SID").'</td>';
@ -155,14 +153,15 @@ print dol_get_fiche_end();
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
} }
print "</div>\n"; print "</div>\n";
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') print "<br>\n"; if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
print "<br>\n";
}
@ -179,8 +178,7 @@ print '</tr>';
// Lecture LDAP // Lecture LDAP
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0) {
{
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1); $dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
@ -190,10 +188,8 @@ if ($result > 0)
//print_r($records); //print_r($records);
// Affichage arbre // Affichage arbre
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
{ if (!is_array($records)) {
if (!is_array($records))
{
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} else { } else {
$result = show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);

File diff suppressed because it is too large Load Diff

View File

@ -24,17 +24,24 @@
*/ */
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Uncomment creates pb to relogon after a disconnect //if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Uncomment creates pb to relogon after a disconnect
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREMENU')) {
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); }
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // We need company to get correct logo onto home page //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // We need company to get correct logo onto home page
if (!defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) define('EVEN_IF_ONLY_LOGIN_ALLOWED', '1'); if (!defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) {
define('EVEN_IF_ONLY_LOGIN_ALLOWED', '1');
}
require_once '../main.inc.php'; require_once '../main.inc.php';
// This can happen only with a bookmark or forged url call. // This can happen only with a bookmark or forged url call.
if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' || $_SESSION["dol_authmode"] == 'http')) if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' || $_SESSION["dol_authmode"] == 'http')) {
{
unset($_SESSION["dol_login"]); unset($_SESSION["dol_login"]);
die("Applicative disconnection should be useless when connection was made in mode ".$_SESSION["dol_authmode"]); die("Applicative disconnection should be useless when connection was made in mode ".$_SESSION["dol_authmode"]);
} }
@ -43,7 +50,9 @@ global $conf, $langs, $user;
// Call trigger // Call trigger
$result = $user->call_trigger('USER_LOGOUT', $user); $result = $user->call_trigger('USER_LOGOUT', $user);
if ($result < 0) $error++; if ($result < 0) {
$error++;
}
// End call triggers // End call triggers
// Hooks on logout // Hooks on logout
@ -51,26 +60,41 @@ $action = '';
$hookmanager->initHooks(array('logout')); $hookmanager->initHooks(array('logout'));
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('afterLogout', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('afterLogout', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) { $error++; } if ($reshook < 0) {
$error++;
}
// Define url to go after disconnect // Define url to go after disconnect
$urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"]; $urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"];
// Define url to go // Define url to go
$url = DOL_URL_ROOT."/index.php"; // By default go to login page $url = DOL_URL_ROOT."/index.php"; // By default go to login page
if ($urlfrom) $url = DOL_URL_ROOT.$urlfrom; if ($urlfrom) {
if (!empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url = $conf->global->MAIN_LOGOUT_GOTO_URL; $url = DOL_URL_ROOT.$urlfrom;
}
if (!empty($conf->global->MAIN_LOGOUT_GOTO_URL)) {
$url = $conf->global->MAIN_LOGOUT_GOTO_URL;
}
if (GETPOST('dol_hide_topmenu')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_hide_topmenu=1'; if (GETPOST('dol_hide_topmenu')) {
if (GETPOST('dol_hide_leftmenu')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_hide_leftmenu=1'; $url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_hide_topmenu=1';
if (GETPOST('dol_optimize_smallscreen')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_optimize_smallscreen=1'; }
if (GETPOST('dol_no_mouse_hover')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_no_mouse_hover=1'; if (GETPOST('dol_hide_leftmenu')) {
if (GETPOST('dol_use_jmobile')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_use_jmobile=1'; $url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_hide_leftmenu=1';
}
if (GETPOST('dol_optimize_smallscreen')) {
$url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_optimize_smallscreen=1';
}
if (GETPOST('dol_no_mouse_hover')) {
$url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_no_mouse_hover=1';
}
if (GETPOST('dol_use_jmobile')) {
$url .= (preg_match('/\?/', $url) ? '&' : '?').'dol_use_jmobile=1';
}
// Destroy session // Destroy session
dol_syslog("End of session ".session_id()); dol_syslog("End of session ".session_id());
if (session_status() === PHP_SESSION_ACTIVE) if (session_status() === PHP_SESSION_ACTIVE) {
{
session_destroy(); session_destroy();
} }
@ -80,5 +104,7 @@ unset($_SESSION['dol_login']);
unset($_SESSION['dol_entity']); unset($_SESSION['dol_entity']);
unset($_SESSION['urlfrom']); unset($_SESSION['urlfrom']);
if (GETPOST('noredirect')) return; if (GETPOST('noredirect')) {
return;
}
header("Location: ".$url); // Default behaviour is redirect to index.php page header("Location: ".$url); // Default behaviour is redirect to index.php page

View File

@ -39,11 +39,15 @@ $object->fetch($id, '', '', 1);
$object->getrights(); $object->getrights();
// If user is not user read and no permission to read other users, we stop // If user is not user read and no permission to read other users, we stop
if (($object->id != $user->id) && (!$user->rights->user->user->lire)) accessforbidden(); if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
accessforbidden();
}
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
@ -58,7 +62,9 @@ $hookmanager->initHooks(array('usercard', 'usernote', 'globalcard'));
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
if ($action == 'update' && $user->rights->user->user->creer && !$_POST["cancel"]) { if ($action == 'update' && $user->rights->user->user->creer && !$_POST["cancel"]) {
@ -83,8 +89,7 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
if ($id) if ($id) {
{
$head = user_prepare_head($object); $head = user_prepare_head($object);
$title = $langs->trans("User"); $title = $langs->trans("User");
@ -114,8 +119,7 @@ if ($id)
// Note // Note
print '<tr><td class="tdtop">'.$langs->trans("Note").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Note").'</td>';
print '<td class="'.($editenabled ? '' : 'sensiblehtmlcontent').'">'; print '<td class="'.($editenabled ? '' : 'sensiblehtmlcontent').'">';
if ($editenabled) if ($editenabled) {
{
print "<input type=\"hidden\" name=\"action\" value=\"update\">"; print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">"; print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
// Editeur wysiwyg // Editeur wysiwyg
@ -132,8 +136,7 @@ if ($id)
print dol_get_fiche_end(); print dol_get_fiche_end();
if ($action == 'edit') if ($action == 'edit') {
{
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button button-save" name="update" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button button-save" name="update" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@ -143,13 +146,12 @@ if ($id)
/* /*
* Actions * Actions
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->user->user->creer && $action != 'edit') if ($user->rights->user->user->creer && $action != 'edit') {
{
print "<a class=\"butAction\" href=\"note.php?id=".$object->id."&amp;action=edit\">".$langs->trans('Modify')."</a>"; print "<a class=\"butAction\" href=\"note.php?id=".$object->id."&amp;action=edit\">".$langs->trans('Modify')."</a>";
} }

View File

@ -39,16 +39,24 @@ $action = GETPOST('action', 'aZ09');
$actionid = GETPOST('actionid'); $actionid = GETPOST('actionid');
// Security check // Security check
if ($user->socid) $id = $user->socid; if ($user->socid) {
$id = $user->socid;
}
$result = restrictedArea($user, 'societe', '', ''); $result = restrictedArea($user, 'societe', '', '');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (!$sortorder) $sortorder = "DESC"; if (!$sortorder) {
if (!$sortfield) $sortfield = "n.daten"; $sortorder = "DESC";
if (empty($page) || $page == -1) { $page = 0; } }
if (!$sortfield) {
$sortfield = "n.daten";
}
if (empty($page) || $page == -1) {
$page = 0;
}
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -61,29 +69,24 @@ $now = dol_now();
*/ */
// Add a notification // Add a notification
if ($action == 'add') if ($action == 'add') {
{
$error = 0; $error = 0;
if ($actionid <= 0) if ($actionid <= 0) {
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Action")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Action")), null, 'errors');
$error++; $error++;
} }
if (!$error) if (!$error) {
{
$db->begin(); $db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
$sql .= " WHERE fk_user=".$id." AND fk_action=".$actionid; $sql .= " WHERE fk_user=".$id." AND fk_action=".$actionid;
if ($db->query($sql)) if ($db->query($sql)) {
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_action)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_action)";
$sql .= " VALUES ('".$db->idate($now)."',".$id.",".$actionid.")"; $sql .= " VALUES ('".$db->idate($now)."',".$id.",".$actionid.")";
if (!$db->query($sql)) if (!$db->query($sql)) {
{
$error++; $error++;
dol_print_error($db); dol_print_error($db);
} }
@ -91,8 +94,7 @@ if ($action == 'add')
dol_print_error($db); dol_print_error($db);
} }
if (!$error) if (!$error) {
{
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
@ -101,8 +103,7 @@ if ($action == 'add')
} }
// Remove a notification // Remove a notification
if ($action == 'delete') if ($action == 'delete') {
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".GETPOST("actid", "int"); $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".GETPOST("actid", "int");
$db->query($sql); $db->query($sql);
} }
@ -120,13 +121,14 @@ $result = $object->fetch($id, '', '', 1);
$object->getrights(); $object->getrights();
$title = $langs->trans("ThirdParty").' - '.$langs->trans("Notification"); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notification");
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name.' - '.$langs->trans("Notification"); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->name.' - '.$langs->trans("Notification");
}
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if ($result > 0) if ($result > 0) {
{
$langs->load("other"); $langs->load("other");
$head = user_prepare_head($object); $head = user_prepare_head($object);
@ -144,8 +146,7 @@ if ($result > 0)
// Login // Login
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
if (!empty($object->ldap_sid) && $object->statut == 0) if (!empty($object->ldap_sid) && $object->statut == 0) {
{
print '<td class="error">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>'; print '<td class="error">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
} else { } else {
print '<td>'.$object->login.'</td>'; print '<td>'.$object->login.'</td>';
@ -153,16 +154,16 @@ if ($result > 0)
print '</tr>'."\n"; print '</tr>'."\n";
/*print '<tr><td class="titlefield">'.$langs->trans("NbOfActiveNotifications").'</td>'; // Notification for this thirdparty /*print '<tr><td class="titlefield">'.$langs->trans("NbOfActiveNotifications").'</td>'; // Notification for this thirdparty
print '<td colspan="3">'; print '<td colspan="3">';
$nbofrecipientemails=0; $nbofrecipientemails=0;
$notify=new Notify($db); $notify=new Notify($db);
$tmparray = $notify->getNotificationsArray('', 0, null, $object->id, array('user')); $tmparray = $notify->getNotificationsArray('', 0, null, $object->id, array('user'));
foreach($tmparray as $tmpkey => $tmpval) foreach($tmparray as $tmpkey => $tmpval)
{ {
$nbofrecipientemails++; $nbofrecipientemails++;
} }
print $nbofrecipientemails; print $nbofrecipientemails;
print '</td></tr>';*/ print '</td></tr>';*/
print '</table>'; print '</table>';
@ -203,23 +204,20 @@ if ($result > 0)
// $listofemails=$object->thirdparty_and_contact_email_array(); // $listofemails=$object->thirdparty_and_contact_email_array();
if ($object->email) if ($object->email) {
{
$actions = array(); $actions = array();
// Load array of available notifications // Load array of available notifications
$notificationtrigger = new InterfaceNotification($db); $notificationtrigger = new InterfaceNotification($db);
$listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents();
foreach ($listofnotifiedevents as $notifiedevent) foreach ($listofnotifiedevents as $notifiedevent) {
{ $label = ($langs->trans("Notify_".$notifiedevent['code']) != "Notify_".$notifiedevent['code'] ? $langs->trans("Notify_".$notifiedevent['code']) : $notifiedevent['label']);
$label = ($langs->trans("Notify_".$notifiedevent['code']) != "Notify_".$notifiedevent['code'] ? $langs->trans("Notify_".$notifiedevent['code']) : $notifiedevent['label']);
$actions[$notifiedevent['rowid']] = $label; $actions[$notifiedevent['rowid']] = $label;
} }
print '<tr class="oddeven nohover"><td>'; print '<tr class="oddeven nohover"><td>';
print $object->getNomUrl(1); print $object->getNomUrl(1);
if (isValidEmail($object->email)) if (isValidEmail($object->email)) {
{
print ' &lt;'.$object->email.'&gt;'; print ' &lt;'.$object->email.'&gt;';
} else { } else {
$langs->load("errors"); $langs->load("errors");
@ -258,8 +256,7 @@ if ($result > 0)
$sql .= " AND c.rowid = ".$object->id; $sql .= " AND c.rowid = ".$object->id;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -280,24 +277,20 @@ if ($result > 0)
$langs->load("errors"); $langs->load("errors");
$langs->load("other"); $langs->load("other");
if ($num) if ($num) {
{
$i = 0; $i = 0;
$userstatic = new user($db); $userstatic = new user($db);
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$userstatic->id = $obj->userid; $userstatic->id = $obj->userid;
$userstatic->lastname = $obj->lastname; $userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname; $userstatic->firstname = $obj->firstname;
print '<tr class="oddeven"><td>'.$userstatic->getNomUrl(1); print '<tr class="oddeven"><td>'.$userstatic->getNomUrl(1);
if ($obj->type == 'email') if ($obj->type == 'email') {
{ if (isValidEmail($obj->email)) {
if (isValidEmail($obj->email))
{
print ' &lt;'.$obj->email.'&gt;'; print ' &lt;'.$obj->email.'&gt;';
} else { } else {
$langs->load("errors"); $langs->load("errors");
@ -310,8 +303,12 @@ if ($result > 0)
print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').$label; print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').$label;
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'email') {
if ($obj->type == 'sms') print $langs->trans("SMS"); print $langs->trans("Email");
}
if ($obj->type == 'sms') {
print $langs->trans("SMS");
}
print '</td>'; print '</td>';
print '<td class="right"><a href="card.php?id='.$id.'&amp;action=delete&amp;token='.newToken().'&amp;actid='.$obj->rowid.'">'.img_delete().'</a></td>'; print '<td class="right"><a href="card.php?id='.$id.'&amp;action=delete&amp;token='.newToken().'&amp;actid='.$obj->rowid.'">'.img_delete().'</a></td>';
print '</tr>'; print '</tr>';
@ -322,8 +319,8 @@ if ($result > 0)
// List of notifications enabled for fixed email // List of notifications enabled for fixed email
/* /*
foreach($conf->global as $key => $val) { foreach($conf->global as $key => $val) {
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue;
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
$listtmp=explode(',',$val); $listtmp=explode(',',$val);
$first=1; $first=1;
@ -332,7 +329,7 @@ if ($result > 0)
if (! $first) print ', '; if (! $first) print ', ';
$first=0; $first=0;
$valemail=trim($valemail); $valemail=trim($valemail);
//print $keyemail.' - '.$valemail.' - '.$reg[1].'<br>'; //print $keyemail.' - '.$valemail.' - '.$reg[1].'<br>';
if (isValidEmail($valemail, 1)) if (isValidEmail($valemail, 1))
{ {
if ($valemail == '__SUPERVISOREMAIL__') print $valemail; if ($valemail == '__SUPERVISOREMAIL__') print $valemail;
@ -359,14 +356,14 @@ if ($result > 0)
print '</td>'; print '</td>';
print '<td class="right">'.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'</td>'; print '<td class="right">'.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'</td>';
print '</tr>'; print '</tr>';
}*/ }*/
/*if ($user->admin) /*if ($user->admin)
{ {
$var = ! $var; $var = ! $var;
print '<tr class="oddeven"><td colspan="4">'; print '<tr class="oddeven"><td colspan="4">';
print '+ <a href="'.DOL_URL_ROOT.'/admin/notification.php">'.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'</a>'; print '+ <a href="'.DOL_URL_ROOT.'/admin/notification.php">'.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'</a>';
print '</td></tr>'; print '</td></tr>';
}*/ }*/
print '</table>'; print '</table>';
@ -387,12 +384,10 @@ if ($result > 0)
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
{
$result = $db->query($sql); $result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
@ -401,19 +396,24 @@ if ($result > 0)
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
$param = '&id='.$object->id; $param = '&id='.$object->id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; $param .= '&contextpage='.$contextpage;
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
@ -434,19 +434,16 @@ if ($result > 0)
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "n.daten", '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "n.daten", '', $param, '', $sortfield, $sortorder, 'right ');
print '</tr>'; print '</tr>';
if ($num) if ($num) {
{
$i = 0; $i = 0;
$userstatic = new User($db); $userstatic = new User($db);
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($obj->id > 0) if ($obj->id > 0) {
{
$userstatic->id = $obj->id; $userstatic->id = $obj->id;
$userstatic->lastname = $obj->lastname; $userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname; $userstatic->firstname = $obj->firstname;
@ -461,18 +458,22 @@ if ($result > 0)
print $label; print $label;
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'email') {
if ($obj->type == 'sms') print $langs->trans("Sms"); print $langs->trans("Email");
}
if ($obj->type == 'sms') {
print $langs->trans("Sms");
}
print '</td>'; print '</td>';
// TODO Add link to object here for other types // TODO Add link to object here for other types
/*print '<td>'; /*print '<td>';
if ($obj->object_type == 'order') if ($obj->object_type == 'order')
{ {
$orderstatic->id=$obj->object_id; $orderstatic->id=$obj->object_id;
$orderstatic->ref=... $orderstatic->ref=...
print $orderstatic->getNomUrl(1); print $orderstatic->getNomUrl(1);
} }
print '</td>';*/ print '</td>';*/
// print // print
print'<td class="right">'.dol_print_date($db->jdate($obj->daten), 'dayhour').'</td>'; print'<td class="right">'.dol_print_date($db->jdate($obj->daten), 'dayhour').'</td>';
print '</tr>'; print '</tr>';
@ -486,7 +487,9 @@ if ($result > 0)
print '</table>'; print '</table>';
print '</form>'; print '</form>';
} else dol_print_error('', 'RecordNotFound'); } else {
dol_print_error('', 'RecordNotFound');
}
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -38,8 +38,7 @@ $id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userihm'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userihm'; // To manage different context of search
if ($id) if ($id) {
{
// $user est le user qui edite, $id est l'id de l'utilisateur edite // $user est le user qui edite, $id est l'id de l'utilisateur edite
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer) $caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|| (($user->id != $id) && $user->rights->user->user->creer)); || (($user->id != $id) && $user->rights->user->user->creer));
@ -47,11 +46,15 @@ if ($id)
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id <> $id && !$canreaduser) accessforbidden(); if ($user->id <> $id && !$canreaduser) {
accessforbidden();
}
$dirtop = "../core/menus/standard"; $dirtop = "../core/menus/standard";
$dirleft = "../core/menus/standard"; $dirleft = "../core/menus/standard";
@ -81,7 +84,9 @@ $hookmanager->initHooks(array('usercard', 'userihm', 'globalcard'));
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
if ($action == 'update' && ($caneditfield || !empty($user->admin))) { if ($action == 'update' && ($caneditfield || !empty($user->admin))) {
@ -122,16 +127,20 @@ if (empty($reshook)) {
if ($val == '') { if ($val == '') {
$tabparam['THEME_ELDY_TOPMENU_BACK1'] = ''; $tabparam['THEME_ELDY_TOPMENU_BACK1'] = '';
} else { } else {
$tabparam['THEME_ELDY_TOPMENU_BACK1'] = join(',', $tabparam['THEME_ELDY_TOPMENU_BACK1'] = join(
colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array())); ',',
colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array())
);
} }
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array())))); $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array()))));
if ($val == '') { if ($val == '') {
$tabparam['THEME_ELDY_BACKTITLE1'] = ''; $tabparam['THEME_ELDY_BACKTITLE1'] = '';
} else { } else {
$tabparam['THEME_ELDY_BACKTITLE1'] = join(',', $tabparam['THEME_ELDY_BACKTITLE1'] = join(
colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array())); ',',
colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array())
);
} }
if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') { if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') {
@ -174,21 +183,36 @@ llxHeader();
// List of possible landing pages // List of possible landing pages
$tmparray = array('index.php'=>'Dashboard'); $tmparray = array('index.php'=>'Dashboard');
if (!empty($conf->societe->enabled)) $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = 'ThirdPartiesArea'; if (!empty($conf->societe->enabled)) {
if (!empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea'; $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = 'ThirdPartiesArea';
if (!empty($conf->holiday->enabled) || !empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea'; // TODO Complete list with first level of menus }
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea'; if (!empty($conf->projet->enabled)) {
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea'; $tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea';
if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea'; }
if (!empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea'; if (!empty($conf->holiday->enabled) || !empty($conf->expensereport->enabled)) {
if (!empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda'; $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea'; // TODO Complete list with first level of menus
}
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea';
}
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) {
$tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea';
}
if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) {
$tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea';
}
if (!empty($conf->adherent->enabled)) {
$tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea';
}
if (!empty($conf->agenda->enabled)) {
$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
}
$head = user_prepare_head($object); $head = user_prepare_head($object);
$title = $langs->trans("User"); $title = $langs->trans("User");
if ($action == 'edit') if ($action == 'edit') {
{
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@ -196,8 +220,7 @@ if ($action == 'edit')
} }
if ($action == 'edit') if ($action == 'edit') {
{
print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user'); print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
$linkback = ''; $linkback = '';
@ -208,22 +231,20 @@ if ($action == 'edit')
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
if (!empty($conf->use_javascript_ajax)) if (!empty($conf->use_javascript_ajax)) {/*
{/* print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript" language="javascript"> jQuery(document).ready(function() {
jQuery(document).ready(function() { $("#main_lang_default").change(function() {
$("#main_lang_default").change(function() { $("#check_MAIN_LANG_DEFAULT").prop("checked", true);
$("#check_MAIN_LANG_DEFAULT").prop("checked", true); });
}); $("#main_size_liste_limit").keyup(function() {
$("#main_size_liste_limit").keyup(function() { if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").prop("checked", true);
if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").prop("checked", true); else $("#check_SIZE_LISTE_LIMIT").prop("checked", false);
else $("#check_SIZE_LISTE_LIMIT").prop("checked", false); });
}); });
}); </script>';*/
</script>';*/
} }
if (!empty($conf->use_javascript_ajax)) if (!empty($conf->use_javascript_ajax)) {
{
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
function init_myfunc() function init_myfunc()
@ -357,10 +378,11 @@ if ($action == 'edit')
print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>'; print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>'; print '<td>';
if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
{
print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
} else print $object->conf->MAIN_LANDING_PAGE; } else {
print $object->conf->MAIN_LANDING_PAGE;
}
//print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1); //print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
print '</td></tr>'; print '</td></tr>';
@ -371,7 +393,9 @@ if ($action == 'edit')
print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>'; print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>'."\n"; print '<td>'."\n";
$tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); $tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1); if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
}
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Max size for lists // Max size for lists
@ -390,12 +414,10 @@ if ($action == 'edit')
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (empty($user->admin) && !empty($dolibarr_main_demo)) if (empty($user->admin) && !empty($dolibarr_main_demo)) {
{
print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>"; print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
} else { } else {
if ($caneditfield || !empty($user->admin)) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin if ($caneditfield || !empty($user->admin)) { // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
} else { } else {
print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>"; print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>";
@ -405,8 +427,7 @@ if ($action == 'edit')
print '</div>'; print '</div>';
} }
if ($action == 'edit') if ($action == 'edit') {
{
print '</form>'; print '</form>';
} }

View File

@ -29,21 +29,24 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (!empty($conf->ldap->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
}
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('errors', 'users', 'companies', 'ldap', 'other')); $langs->loadLangs(array('errors', 'users', 'companies', 'ldap', 'other'));
// Security check // Security check
if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) {
{
header("Location: ".DOL_URL_ROOT.'/'); header("Location: ".DOL_URL_ROOT.'/');
exit; exit;
} }
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$mode = $dolibarr_main_authentication; $mode = $dolibarr_main_authentication;
if (!$mode) $mode = 'http'; if (!$mode) {
$mode = 'http';
}
$username = GETPOST('username', 'alphanohtml'); $username = GETPOST('username', 'alphanohtml');
$passwordhash = GETPOST('passwordhash', 'alpha'); $passwordhash = GETPOST('passwordhash', 'alpha');
@ -53,11 +56,21 @@ $conf->entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : 1);
$hookmanager->initHooks(array('passwordforgottenpage')); $hookmanager->initHooks(array('passwordforgottenpage'));
if (GETPOST('dol_hide_leftmenu', 'alpha') || !empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu = 1; if (GETPOST('dol_hide_leftmenu', 'alpha') || !empty($_SESSION['dol_hide_leftmenu'])) {
if (GETPOST('dol_hide_topmenu', 'alpha') || !empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1;
if (GETPOST('dol_optimize_smallscreen', 'alpha') || !empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen = 1; }
if (GETPOST('dol_no_mouse_hover', 'alpha') || !empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover = 1; if (GETPOST('dol_hide_topmenu', 'alpha') || !empty($_SESSION['dol_hide_topmenu'])) {
if (GETPOST('dol_use_jmobile', 'alpha') || !empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile = 1; $conf->dol_hide_topmenu = 1;
}
if (GETPOST('dol_optimize_smallscreen', 'alpha') || !empty($_SESSION['dol_optimize_smallscreen'])) {
$conf->dol_optimize_smallscreen = 1;
}
if (GETPOST('dol_no_mouse_hover', 'alpha') || !empty($_SESSION['dol_no_mouse_hover'])) {
$conf->dol_no_mouse_hover = 1;
}
if (GETPOST('dol_use_jmobile', 'alpha') || !empty($_SESSION['dol_use_jmobile'])) {
$conf->dol_use_jmobile = 1;
}
/** /**
@ -67,96 +80,86 @@ if (GETPOST('dol_use_jmobile', 'alpha') || !empty($_SESSION['dol_use_jmobile']))
$parameters = array('username' => $username); $parameters = array('username' => $username);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
$message = $hookmanager->error; $message = $hookmanager->error;
} }
if (empty($reshook)) { if (empty($reshook)) {
// Validate new password // Validate new password
if ($action == 'validatenewpassword' && $username && $passwordhash) if ($action == 'validatenewpassword' && $username && $passwordhash) {
{ $edituser = new User($db);
$edituser = new User($db); $result = $edituser->fetch('', $_GET["username"]);
$result = $edituser->fetch('', $_GET["username"]); if ($result < 0) {
if ($result < 0) $message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'</div>';
{ } else {
$message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'</div>'; if (dol_verifyHash($edituser->pass_temp, $passwordhash)) {
} else { // Clear session
if (dol_verifyHash($edituser->pass_temp, $passwordhash)) unset($_SESSION['dol_login']);
{ $_SESSION['dol_loginmesg'] = $langs->trans('NewPasswordValidated'); // Save message for the session page
// Clear session
unset($_SESSION['dol_login']);
$_SESSION['dol_loginmesg'] = $langs->trans('NewPasswordValidated'); // Save message for the session page
$newpassword = $edituser->setPassword($user, $edituser->pass_temp, 0); $newpassword = $edituser->setPassword($user, $edituser->pass_temp, 0);
dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database"); dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
header("Location: ".DOL_URL_ROOT.'/'); header("Location: ".DOL_URL_ROOT.'/');
exit; exit;
} else { } else {
$langs->load("errors"); $langs->load("errors");
$message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>'; $message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>';
} }
} }
} }
// Action modif mot de passe // Action modif mot de passe
if ($action == 'buildnewpassword' && $username) if ($action == 'buildnewpassword' && $username) {
{ $sessionkey = 'dol_antispam_value';
$sessionkey = 'dol_antispam_value'; $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
$ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
// Verify code // Verify code
if (!$ok) if (!$ok) {
{ $message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
$message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>'; } else {
} else { $isanemail = preg_match('/@/', $username);
$isanemail = preg_match('/@/', $username);
$edituser = new User($db); $edituser = new User($db);
$result = $edituser->fetch('', $username, '', 1); $result = $edituser->fetch('', $username, '', 1);
if ($result == 0 && $isanemail) if ($result == 0 && $isanemail) {
{ $result = $edituser->fetch('', '', '', 1, -1, $username);
$result = $edituser->fetch('', '', '', 1, -1, $username); }
}
if ($result <= 0 && $edituser->error == 'USERNOTFOUND') if ($result <= 0 && $edituser->error == 'USERNOTFOUND') {
{ $message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">';
$message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">'; if (!$isanemail) {
if (!$isanemail) { $message .= $langs->trans("IfLoginExistPasswordRequestSent");
$message .= $langs->trans("IfLoginExistPasswordRequestSent"); } else {
} else { $message .= $langs->trans("IfEmailExistPasswordRequestSent");
$message .= $langs->trans("IfEmailExistPasswordRequestSent"); }
} $message .= '</div>';
$message .= '</div>'; $username = '';
$username = ''; } else {
} else { if (!$edituser->email) {
if (!$edituser->email) $message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>';
{ } else {
$message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>'; $newpassword = $edituser->setPassword($user, '', 1);
} else { if ($newpassword < 0) {
$newpassword = $edituser->setPassword($user, '', 1); // Failed
if ($newpassword < 0) $message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
{ } else {
// Failed // Success
$message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>'; if ($edituser->send_password($user, $newpassword, 1) > 0) {
} else { $message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">';
// Success if (!$isanemail) {
if ($edituser->send_password($user, $newpassword, 1) > 0) $message .= $langs->trans("IfLoginExistPasswordRequestSent");
{ } else {
$message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">'; $message .= $langs->trans("IfEmailExistPasswordRequestSent");
if (!$isanemail) { }
$message .= $langs->trans("IfLoginExistPasswordRequestSent"); //$message .= $langs->trans("PasswordChangeRequestSent", $edituser->login, dolObfuscateEmail($edituser->email));
} else { $message .= '</div>';
$message .= $langs->trans("IfEmailExistPasswordRequestSent"); $username = '';
} } else {
//$message .= $langs->trans("PasswordChangeRequestSent", $edituser->login, dolObfuscateEmail($edituser->email)); $message .= '<div class="error">'.$edituser->error.'</div>';
$message .= '</div>'; }
$username = ''; }
} else { }
$message .= '<div class="error">'.$edituser->error.'</div>'; }
} }
} }
}
}
}
}
} }
@ -168,46 +171,49 @@ $dol_url_root = DOL_URL_ROOT;
// Title // Title
$title = 'Dolibarr '.DOL_VERSION; $title = 'Dolibarr '.DOL_VERSION;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = $conf->global->MAIN_APPLICATION_TITLE; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$title = $conf->global->MAIN_APPLICATION_TITLE;
}
// Select templates // Select templates
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php")) if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php")) {
{
$template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/"; $template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
} else { } else {
$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
} }
if (!$username) $focus_element = 'username'; if (!$username) {
else $focus_element = 'password'; $focus_element = 'username';
} else {
$focus_element = 'password';
}
// Send password button enabled ? // Send password button enabled ?
$disabled = 'disabled'; $disabled = 'disabled';
if (preg_match('/dolibarr/i', $mode)) $disabled = ''; if (preg_match('/dolibarr/i', $mode)) {
if (!empty($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD)) $disabled = ''; // To force button enabled $disabled = '';
}
if (!empty($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD)) {
$disabled = ''; // To force button enabled
}
// Show logo (search in order: small company logo, large company logo, theme logo, common logo) // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width = 0; $width = 0;
$rowspan = 2; $rowspan = 2;
$urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
{
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small); $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
} elseif (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) } elseif (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
{
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo); $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
$width = 128; $width = 128;
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.svg')) } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.svg')) {
{
$urllogo = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.svg'; $urllogo = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.svg';
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
{
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
} }
// Security graphical code // Security graphical code
if (function_exists("imagecreatefrompng") && !$disabled) if (function_exists("imagecreatefrompng") && !$disabled) {
{
$captcha = 1; $captcha = 1;
$captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
} }

View File

@ -26,7 +26,9 @@
* \brief Page to set permission of a user record * \brief Page to set permission of a user record
*/ */
if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET if (!defined('CSRFCHECK_WITH_TOKEN')) {
define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
}
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
@ -43,15 +45,16 @@ $module = GETPOST('module', 'alpha');
$rights = GETPOST('rights', 'int'); $rights = GETPOST('rights', 'int');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userperms'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userperms'; // To manage different context of search
if (!isset($id) || empty($id)) accessforbidden(); if (!isset($id) || empty($id)) {
accessforbidden();
}
// Define if user can read permissions // Define if user can read permissions
$canreaduser = ($user->admin || $user->rights->user->user->lire); $canreaduser = ($user->admin || $user->rights->user->user->lire);
// Define if user can modify other users and permissions // Define if user can modify other users and permissions
$caneditperms = ($user->admin || $user->rights->user->user->creer); $caneditperms = ($user->admin || $user->rights->user->user->creer);
// Advanced permissions // Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
{
$canreaduser = ($user->admin || ($user->rights->user->user->lire && $user->rights->user->user_advance->readperms)); $canreaduser = ($user->admin || ($user->rights->user->user->lire && $user->rights->user->user_advance->readperms));
$caneditselfperms = ($user->id == $id && $user->rights->user->self_advance->writeperms); $caneditselfperms = ($user->id == $id && $user->rights->user->self_advance->writeperms);
$caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0); $caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
@ -59,16 +62,19 @@ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
// Security check // Security check
$socid = 0; $socid = 0;
if (isset($user->socid) && $user->socid > 0) $socid = $user->socid; if (isset($user->socid) && $user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
// A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin // A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin
if ($user->id == $id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms) && empty($user->admin))) if ($user->id == $id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms) && empty($user->admin))) {
{
accessforbidden(); accessforbidden();
} }
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id <> $id && !$canreaduser) accessforbidden(); if ($user->id <> $id && !$canreaduser) {
accessforbidden();
}
$object = new User($db); $object = new User($db);
$object->fetch($id, '', '', 1); $object->fetch($id, '', '', 1);
@ -86,15 +92,16 @@ $hookmanager->initHooks(array('usercard', 'userperms', 'globalcard'));
$parameters = array('id'=>$socid); $parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) { if (empty($reshook)) {
if ($action == 'addrights' && $caneditperms && $confirm == 'yes') { if ($action == 'addrights' && $caneditperms && $confirm == 'yes') {
$edituser = new User($db); $edituser = new User($db);
$edituser->fetch($object->id); $edituser->fetch($object->id);
$result = $edituser->addrights($rights, $module, '', $entity); $result = $edituser->addrights($rights, $module, '', $entity);
if ($result < 0) if ($result < 0) {
{
setEventMessages($edituser->error, $edituser->errors, 'errors'); setEventMessages($edituser->error, $edituser->errors, 'errors');
} }
@ -113,8 +120,7 @@ if (empty($reshook)) {
$edituser = new User($db); $edituser = new User($db);
$edituser->fetch($object->id); $edituser->fetch($object->id);
$result = $edituser->delrights($rights, $module, '', $entity); $result = $edituser->delrights($rights, $module, '', $entity);
if ($result < 0) if ($result < 0) {
{
setEventMessages($edituser->error, $edituser->errors, 'errors'); setEventMessages($edituser->error, $edituser->errors, 'errors');
} }
@ -151,33 +157,25 @@ $db->begin();
$modules = array(); $modules = array();
$modulesdir = dolGetModulesDirs(); $modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir) {
{
$handle = @opendir(dol_osencode($dir)); $handle = @opendir(dol_osencode($dir));
if (is_resource($handle)) if (is_resource($handle)) {
{ while (($file = readdir($handle)) !== false) {
while (($file = readdir($handle)) !== false) if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10); $modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) if ($modName) {
{
include_once $dir.$file; include_once $dir.$file;
$objMod = new $modName($db); $objMod = new $modName($db);
// Load all lang files of module // Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
{ foreach ($objMod->langfiles as $domain) {
foreach ($objMod->langfiles as $domain)
{
$langs->load($domain); $langs->load($domain);
} }
} }
// Load all permissions // Load all permissions
if ($objMod->rights_class) if ($objMod->rights_class) {
{
$ret = $objMod->insert_permissions(0, $entity); $ret = $objMod->insert_permissions(0, $entity);
$modules[$objMod->rights_class] = $objMod; $modules[$objMod->rights_class] = $objMod;
//print "modules[".$objMod->rights_class."]=$objMod;"; //print "modules[".$objMod->rights_class."]=$objMod;";
@ -200,12 +198,10 @@ $sql .= " AND ur.fk_user = ".$object->id;
dol_syslog("get user perms", LOG_DEBUG); dol_syslog("get user perms", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
array_push($permsuser, $obj->fk_id); array_push($permsuser, $obj->fk_id);
$i++; $i++;
@ -227,15 +223,14 @@ $sql .= " AND gu.fk_user = ".$object->id;
dol_syslog("get user perms", LOG_DEBUG); dol_syslog("get user perms", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
if (!isset($permsgroupbyentity[$obj->entity])) if (!isset($permsgroupbyentity[$obj->entity])) {
$permsgroupbyentity[$obj->entity] = array(); $permsgroupbyentity[$obj->entity] = array();
}
array_push($permsgroupbyentity[$obj->entity], $obj->fk_id); array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
$i++; $i++;
} }
@ -260,13 +255,19 @@ dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $use
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); if ($user->admin) {
print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
}
// Show warning about external users // Show warning about external users
if (empty($user->socid)) print info_admin(showModulesExludedForExternal($modules))."\n"; if (empty($user->socid)) {
print info_admin(showModulesExludedForExternal($modules))."\n";
}
$parameters = array('permsgroupbyentity'=>$permsgroupbyentity); $parameters = array('permsgroupbyentity'=>$permsgroupbyentity);
$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
print "\n"; print "\n";
@ -275,10 +276,8 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Module").'</td>';
if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
{ if ($caneditperms) {
if ($caneditperms)
{
print '<td class="center nowrap">'; print '<td class="center nowrap">';
print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules&amp;confirm=yes&amp;token='.newToken().'">'.$langs->trans("All")."</a>"; print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules&amp;confirm=yes&amp;token='.newToken().'">'.$langs->trans("All")."</a>";
print ' / '; print ' / ';
@ -288,7 +287,9 @@ if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->ad
print '<td class="center" width="24">&nbsp;</td>'; print '<td class="center" width="24">&nbsp;</td>';
} }
print '<td>'.$langs->trans("Permissions").'</td>'; print '<td>'.$langs->trans("Permissions").'</td>';
if ($user->admin) print '<td class="right">'.$langs->trans("ID").'</td>'; if ($user->admin) {
print '<td class="right">'.$langs->trans("ID").'</td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; //print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
@ -296,32 +297,29 @@ $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql .= " AND r.entity = ".$entity; $sql .= " AND r.entity = ".$entity;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
}
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id"; $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$oldmod = ''; $oldmod = '';
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it // If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it
if (empty($modules[$obj->module])) if (empty($modules[$obj->module])) {
{
$i++; $i++;
continue; continue;
} }
// Save field module_position in database if value is still zero // Save field module_position in database if value is still zero
if (empty($obj->module_position)) if (empty($obj->module_position)) {
{ if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0))
{
// TODO Define familyposition // TODO Define familyposition
$family = $modules[$obj->module]->family_position; $family = $modules[$obj->module]->family_position;
$familyposition = 0; $familyposition = 0;
@ -332,8 +330,7 @@ if ($result)
} }
} }
if (isset($obj->module) && ($oldmod <> $obj->module)) if (isset($obj->module) && ($oldmod <> $obj->module)) {
{
$oldmod = $obj->module; $oldmod = $obj->module;
// Break detected, we get objMod // Break detected, we get objMod
@ -346,10 +343,8 @@ if ($result)
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName(); print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
print '<a name="'.$objMod->getName().'"></a>'; print '<a name="'.$objMod->getName().'"></a>';
print '</td>'; print '</td>';
if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
{ if ($caneditperms) {
if ($caneditperms)
{
print '<td class="center nowrap">'; print '<td class="center nowrap">';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'&amp;confirm=yes&amp;token='.newToken().'">'.$langs->trans("All")."</a>"; print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'&amp;confirm=yes&amp;token='.newToken().'">'.$langs->trans("All")."</a>";
print ' / '; print ' / ';
@ -358,8 +353,7 @@ if ($result)
} }
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} else { } else {
if ($caneditperms) if ($caneditperms) {
{
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
@ -367,7 +361,9 @@ if ($result)
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
// Permission id // Permission id
if ($user->admin) print '<td class="right"></td>'; if ($user->admin) {
print '<td class="right"></td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
} }
@ -381,19 +377,15 @@ if ($result)
print '</td>'; print '</td>';
// Permission and tick // Permission and tick
if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) // Permission granted because admin if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin
{ if ($caneditperms) {
if ($caneditperms)
{
print '<td class="center">'.img_picto($langs->trans("Administrator"), 'star').'</td>'; print '<td class="center">'.img_picto($langs->trans("Administrator"), 'star').'</td>';
} }
print '<td class="center nowrap">'; print '<td class="center nowrap">';
print img_picto($langs->trans("Active"), 'tick'); print img_picto($langs->trans("Active"), 'tick');
print '</td>'; print '</td>';
} elseif (in_array($obj->id, $permsuser)) // Permission granted by user } elseif (in_array($obj->id, $permsuser)) { // Permission granted by user
{ if ($caneditperms) {
if ($caneditperms)
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">';
//print img_edit_remove($langs->trans("Remove")); //print img_edit_remove($langs->trans("Remove"));
print img_picto($langs->trans("Remove"), 'switch_on'); print img_picto($langs->trans("Remove"), 'switch_on');
@ -402,12 +394,9 @@ if ($result)
print '<td class="center nowrap">'; print '<td class="center nowrap">';
print img_picto($langs->trans("Active"), 'tick'); print img_picto($langs->trans("Active"), 'tick');
print '</td>'; print '</td>';
} elseif (is_array($permsgroupbyentity[$entity])) } elseif (is_array($permsgroupbyentity[$entity])) {
{ if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Permission granted by group
if (in_array($obj->id, $permsgroupbyentity[$entity])) // Permission granted by group if ($caneditperms) {
{
if ($caneditperms)
{
print '<td class="center">'; print '<td class="center">';
print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup")); print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));
print '</td>'; print '</td>';
@ -417,8 +406,7 @@ if ($result)
print '</td>'; print '</td>';
} else { } else {
// Do not own permission // Do not own permission
if ($caneditperms) if ($caneditperms) {
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">';
//print img_edit_add($langs->trans("Add")); //print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off'); print img_picto($langs->trans("Add"), 'switch_off');
@ -428,8 +416,7 @@ if ($result)
} }
} else { } else {
// Do not own permission // Do not own permission
if ($caneditperms) if ($caneditperms) {
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">';
//print img_edit_add($langs->trans("Add")); //print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off'); print img_picto($langs->trans("Add"), 'switch_off');
@ -450,19 +437,25 @@ if ($result)
print '</td>'; print '</td>';
// Permission id // Permission id
if ($user->admin) print '<td class="right"><span class="opacitymedium">'.$obj->id.'</span></td>'; if ($user->admin) {
print '<td class="right"><span class="opacitymedium">'.$obj->id.'</span></td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
$i++; $i++;
} }
} else dol_print_error($db); } else {
dol_print_error($db);
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
print dol_get_fiche_end(); print dol_get_fiche_end();

View File

@ -36,14 +36,15 @@ $id = GETPOST('id', 'int');
// Security check // Security check
$socid = 0; $socid = 0;
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = 'user'; $feature2 = 'user';
$result = restrictedArea($user, 'user', $id, 'user', $feature2); $result = restrictedArea($user, 'user', $id, 'user', $feature2);
$result = $user2->fetch($id); $result = $user2->fetch($id);
if ($result <= 0) if ($result <= 0) {
{
dol_print_error($user2->error); dol_print_error($user2->error);
exit; exit;
} }
@ -51,8 +52,7 @@ if ($result <= 0)
$physicalperson = 1; $physicalperson = 1;
$company = new Societe($db); $company = new Societe($db);
if ($user2->socid) if ($user2->socid) {
{
$result = $company->fetch($user2->socid); $result = $company->fetch($user2->socid);
} }
@ -79,33 +79,32 @@ $v->setNote($user2->note);
$v->setTitle($user2->poste); $v->setTitle($user2->poste);
// Data from linked company // Data from linked company
if ($company->id) if ($company->id) {
{
$v->setURL($company->url, "TYPE=WORK"); $v->setURL($company->url, "TYPE=WORK");
if (!$user2->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); if (!$user2->phone_pro) {
if (!$user2->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
if (!$user2->zip) $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL"); }
if (!$user2->fax) {
$v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
}
if (!$user2->zip) {
$v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
}
// when company e-mail is empty, use only user e-mail // when company e-mail is empty, use only user e-mail
if (empty(trim($company->email))) if (empty(trim($company->email))) {
{
// was set before, don't set twice // was set before, don't set twice
} } elseif (empty(trim($user2->email))) {
// when user e-mail is empty, use only company e-mail // when user e-mail is empty, use only company e-mail
elseif (empty(trim($user2->email)))
{
$v->setEmail($company->email); $v->setEmail($company->email);
} } elseif (strtolower(end(explode("@", $user2->email))) == strtolower(end(explode("@", $company->email)))) {
// when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second)
elseif (strtolower(end(explode("@", $user2->email))) == strtolower(end(explode("@", $company->email))))
{
$v->setEmail($user2->email); $v->setEmail($user2->email);
// support by Microsoft Outlook (2019 and possible earlier) // support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($company->email, 'INTERNET'); $v->setEmail($company->email, 'INTERNET');
} } else {
// when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second)
else {
$v->setEmail($company->email); $v->setEmail($company->email);
// support by Microsoft Outlook (2019 and possible earlier) // support by Microsoft Outlook (2019 and possible earlier)
@ -113,12 +112,16 @@ if ($company->id)
} }
// Si user lie a un tiers non de type "particulier" // Si user lie a un tiers non de type "particulier"
if ($user2->typent_code != 'TE_PRIVATE') $v->setOrg($company->name); if ($user2->typent_code != 'TE_PRIVATE') {
$v->setOrg($company->name);
}
} }
// Personal informations // Personal informations
$v->setPhoneNumber($user2->phone_perso, "TYPE=HOME;VOICE"); $v->setPhoneNumber($user2->phone_perso, "TYPE=HOME;VOICE");
if ($user2->birth) $v->setBirthday($user2->birth); if ($user2->birth) {
$v->setBirthday($user2->birth);
}
$db->close(); $db->close();

View File

@ -488,6 +488,8 @@ class ProductCombination
$child->price_autogen = $parent->price_autogen; $child->price_autogen = $parent->price_autogen;
$child->weight = $parent->weight; $child->weight = $parent->weight;
$child->status = $parent->status;
if ($this->variation_weight) { // If we must add a delta on weight if ($this->variation_weight) { // If we must add a delta on weight
$child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight; $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight;
} }