From 5f9ef61d32f5787925b7722cb259372dd9bb6c9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 May 2022 09:36:47 +0200 Subject: [PATCH] Debug v16 --- htdocs/admin/resource.php | 21 +++---- htdocs/comm/action/card.php | 4 +- htdocs/core/modules/modAgenda.class.php | 4 +- htdocs/core/modules/modResource.class.php | 2 +- htdocs/hrm/lib/hrm_job.lib.php | 6 +- htdocs/hrm/skill_tab.php | 71 ++++++++++++++++++++--- htdocs/langs/en_US/admin.lang | 2 +- htdocs/resource/element_resource.php | 4 +- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- htdocs/user/agenda_extsites.php | 4 +- htdocs/user/class/user.class.php | 4 +- htdocs/user/param_ihm.php | 4 ++ htdocs/user/perms.php | 29 +++++++++ 14 files changed, 124 insertions(+), 35 deletions(-) diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index ebd1269f74a..1d3e29c9cd4 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -78,7 +78,7 @@ print '
'; print ''; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''; @@ -106,6 +106,15 @@ if (empty($conf->use_javascript_ajax)) { print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +/* print ''; print ''; print ''; print ''; print ''; - - -print ''; -print ''; -print ''; -print ''; -print ''; +*/ print '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Value").'
'.$langs->trans('EnableResourceUsedInEventCheck').''; +echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK'); +print '
'.$langs->trans('DisabledResourceLinkUser').''; @@ -122,15 +131,7 @@ echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY'); print '
'.$langs->trans('EnableResourceUsedInEventCheck').''; -echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK'); -print '
'; print '
'; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index aa513e07794..8e7005a3994 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -674,7 +674,7 @@ if (empty($reshook) && $action == 'update') { $object->errors[] = $object->error; } else { if ($db->num_rows($resql) > 0) { - // already in use + // Resource already in use $error++; $object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; while ($obj = $db->fetch_object($resql)) { @@ -853,7 +853,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { $object->errors[] = $object->error; } else { if ($db->num_rows($resql) > 0) { - // already in use + // Resource already in use $error++; $object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; while ($obj = $db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index ffd8fde5f1d..cac9047e56e 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -211,8 +211,8 @@ class modAgenda extends DolibarrModules 'url'=>'/comm/action/index.php', 'langs'=>'agenda', 'position'=>86, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', + 'perms'=>'$user->rights->agenda->myactions->read || $user->rights->resource->read', + 'enabled'=>'$conf->agenda->enabled || $conf->resource->enabled', 'target'=>'', 'user'=>2, ); diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index b43ead29e7f..2c59b6b3172 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -91,7 +91,7 @@ class modResource extends DolibarrModules // Dependencies // List of modules id that must be enabled if this module is enabled - $this->depends = array(); + $this->depends = array('modResource'); // List of modules id to disable if this one is disabled $this->requiredby = array('modPlace'); // Minimum version of PHP required by module diff --git a/htdocs/hrm/lib/hrm_job.lib.php b/htdocs/hrm/lib/hrm_job.lib.php index f465d934b0f..723aaf14af5 100644 --- a/htdocs/hrm/lib/hrm_job.lib.php +++ b/htdocs/hrm/lib/hrm_job.lib.php @@ -39,17 +39,17 @@ function jobPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/hrm/job_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT."/hrm/job_card.php?id=".$object->id; $head[$h][1] = $langs->trans("JobCard"); $head[$h][2] = 'job_card'; $h++; - $head[$h][0] = dol_buildpath("/hrm/skill_tab.php", 1).'?id='.$object->id.'&objecttype=job'; + $head[$h][0] = DOL_URL_ROOT."/hrm/skill_tab.php?id=".$object->id.'&objecttype=job'; $head[$h][1] = $langs->trans("RequiredSkills"); $head[$h][2] = 'skill_tab'; $h++; - $head[$h][0] = dol_buildpath("/hrm/position.php", 1).'?fk_job='.$object->id; + $head[$h][0] = DOL_URL_ROOT."/hrm/position.php?fk_job=".$object->id; $head[$h][1] = $langs->trans("EmployeesInThisPosition"); $head[$h][2] = 'position'; $h++; diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index 0bbc039152c..faa8fa57f8e 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -120,10 +120,10 @@ if (empty($reshook)) { $skillAdded->fk_object = $id; $skillAdded->objecttype = $objecttype; $ret = $skillAdded->create($user); - if ($ret < 0) setEventMessage($skillAdded->error, 'errors'); + if ($ret < 0) setEventMessages($skillAdded->error, null, 'errors'); //else unset($TSkillsToAdd); } - if ($ret > 0) setEventMessage($langs->trans("SaveAddSkill")); + if ($ret > 0) setEventMessages($langs->trans("SaveAddSkill"), null); } } elseif ($action == 'saveSkill') { if (!empty($TNote)) { @@ -136,14 +136,14 @@ if (empty($reshook)) { } } } - setEventMessage($langs->trans("SaveLevelSkill")); - header("Location: " . dol_buildpath('/hrm/skill_tab.php', 1) . '?id=' . $id. '&objecttype=job'); + setEventMessages($langs->trans("SaveLevelSkill"), null); + header("Location: " . DOL_URL_ROOT.'/hrm/skill_tab.php?id=' . $id. '&objecttype=job'); exit; } } elseif ($action == 'confirm_deleteskill' && $confirm == 'yes') { $skillToDelete = new SkillRank($db); $ret = $skillToDelete->fetch($lineid); - setEventMessage($langs->trans("DeleteSkill")); + setEventMessages($langs->trans("DeleteSkill"), null); if ($ret > 0) { $skillToDelete->delete($user); } @@ -247,12 +247,67 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'; + print '
'; - print '' . "\n"; + print '
'; + + // Login + print ''; + if (!empty($object->ldap_sid) && $object->statut == 0) { + print ''; + } else { + print ''; + } + print ''."\n"; + $object->fields['label']['visible']=0; // Already in banner - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + $object->fields['firstname']['visible']=0; // Already in banner + $object->fields['lastname']['visible']=0; // Already in banner + //include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + + // Ref employee + print ''; + print ''; + print ''."\n"; + + // National Registration Number + print ''; + print ''; + print ''."\n"; + + /*print ''; // Notification for this thirdparty + print '';*/ + print '
'.$langs->trans("Login").''; + print $langs->trans("LoginAccountDisableInDolibarr"); + print ''; + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + } + print showValueWithClipboardCPButton($object->login).$addadmin; + print '
'.$langs->trans("RefEmployee").''; + print showValueWithClipboardCPButton($object->ref_employee); + print '
'.$langs->trans("NationalRegistrationNumber").''; + print showValueWithClipboardCPButton($object->national_registration_number); + print '
'.$langs->trans("NbOfActiveNotifications").''; + $nbofrecipientemails=0; + $notify=new Notify($db); + $tmparray = $notify->getNotificationsArray('', 0, null, $object->id, array('user')); + foreach($tmparray as $tmpkey => $tmpval) + { + $nbofrecipientemails++; + } + print $nbofrecipientemails; + print '
'; + print '
'; + print '
'; + print '

'; @@ -296,7 +351,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; if (!is_array($TSkillsJob) || empty($TSkillsJob)) { - print '' . $langs->trans("NoRecordFound") . ''; + print '' . $langs->trans("NoRecordFound") . ''; } else { $sk = new Skill($db); foreach ($TSkillsJob as $skillElement) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8dcd1f9f93d..d122e9ca7d1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2112,7 +2112,7 @@ ResourceSetup=Configuration of Resource module UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list). DisabledResourceLinkUser=Disable feature to link a resource to users DisabledResourceLinkContact=Disable feature to link a resource to contacts -EnableResourceUsedInEventCheck=Enable feature to check if a resource is in use in an event +EnableResourceUsedInEventCheck=Prohibit the use of the same resource at the same time in the agenda ConfirmUnactivation=Confirm module reset OnMobileOnly=On small screen (smartphone) only DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be "Prospect" or "Customer", but can't be both) diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index f4c6f3d3856..6926983915b 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -165,7 +165,7 @@ if (empty($reshook)) { $objstat->errors[] = $objstat->error; } else { if ($db->num_rows($resql) > 0) { - // already in use + // Resource already in use $error++; $objstat->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; while ($obj = $db->fetch_object($resql)) { @@ -241,7 +241,7 @@ if (empty($reshook)) { $object->errors[] = $object->error; } else { if ($db->num_rows($resql) > 0) { - // already in use + // Resource already in use $error++; $object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; while ($obj = $db->fetch_object($resql)) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ac7d0fbe8f8..fcdb2b64710 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1573,7 +1573,7 @@ table[summary="list_of_modules"] .fa-cog { .minheight30 { min-height: 30px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } -.titlefield { /* width: 25%; */ min-width: 250px; } +.titlefield { /* width: 25%; */ min-width: 250px; width: 25%; } .titlefieldmiddle { width: 45%; } .titlefieldmax45 { max-width: 45%; } .imgmaxwidth180 { max-width: 180px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index bddb2dd5392..29349ce9858 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1662,7 +1662,7 @@ tr.nobottom td { .minheight30 { min-height: 30px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } -.titlefield { /* width: 25%; */ min-width: 250px; } +.titlefield { /* width: 25%; */ min-width: 250px; width: 25%; } .titlefieldmiddle { width: 50%; } .imgmaxwidth180 { max-width: 180px; } .imgmaxheight50 { max-height: 50px; } diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 5921f7d84cd..b7d66d2677c 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -209,9 +209,9 @@ while ($i <= $MAXAGENDA) { print ''; // URL $src_value = (GETPOST('AGENDA_EXT_SRC_'.$id.'_'.$key) ?GETPOST('AGENDA_EXT_SRC_'.$id.'_'.$key) : (empty($object->conf->$src) ? '' : $object->conf->$src)); - print ''; + print ''; // Offset TZ - $offsettz_value = (GETPOST('AGENDA_EXT_OFFSETTZ_'.$id.'_'.$key) ? GETPOST('AGENDA_EXT_OFFSETTZ_'.$id.'_'.$key) : (empty($object->conf->$offsettz) ? 0 : $object->conf->$offsettz)); + $offsettz_value = (GETPOST('AGENDA_EXT_OFFSETTZ_'.$id.'_'.$key) ? GETPOST('AGENDA_EXT_OFFSETTZ_'.$id.'_'.$key) : (empty($object->conf->$offsettz) ? '' : $object->conf->$offsettz)); print ''; // Color (Possible colors are limited by Google) print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 57b5c11e853..cb76b25cc5a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -365,8 +365,8 @@ class User extends CommonObject 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'lastname'=>array('type'=>'varchar(50)', 'label'=>'LastName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1), 'firstname'=>array('type'=>'varchar(50)', 'label'=>'FirstName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), - 'ref_employee'=>array('type'=>'varchar(50)', 'label'=>'ref_employee', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30, 'searchall'=>1), - 'national_registration_number'=>array('type'=>'varchar(50)', 'label'=>'national_registration_number', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40, 'searchall'=>1) + 'ref_employee'=>array('type'=>'varchar(50)', 'label'=>'RefEmployee', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30, 'searchall'=>1), + 'national_registration_number'=>array('type'=>'varchar(50)', 'label'=>'NationalRegistrationNumber', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40, 'searchall'=>1) ); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index bb1320ecd0b..f92afe53a4f 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -234,6 +234,8 @@ if ($action == 'edit') { dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + print '
'; + print dol_get_fiche_end(); @@ -339,6 +341,8 @@ if ($action == 'edit') { dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + print '
'; + print dol_get_fiche_end(); diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 6e28a77b5bc..889599e2fa9 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -253,7 +253,36 @@ if ($user->rights->user->user->lire || $user->admin) { dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); +print '
'; + print '
'; +print ''; + +// Login +print ''; +if (!empty($object->ldap_sid) && $object->statut == 0) { + print ''; +} else { + print ''; +} +print ''."\n"; + +print '
'.$langs->trans("Login").''; + print $langs->trans("LoginAccountDisableInDolibarr"); + print ''; + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + } + print showValueWithClipboardCPButton($object->login).$addadmin; + print '
'; + +print '
'; + if ($user->admin) { print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));