diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index 31607e01b28..28f4e33e4d4 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -96,8 +96,10 @@ $permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft); +if (!isModEnabled('hrm')) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); @@ -155,7 +157,7 @@ if ($object->id > 0) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); @@ -196,21 +198,25 @@ if ($object->id > 0) { //$out.=""; } + $morehtmlright = ''; - print '
'; + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } } - print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { - $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : ''); + print '
'; + + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -218,8 +224,8 @@ if ($object->id > 0) { $param .= '&limit='.urlencode($limit); } - - //print load_fiche_titre($langs->trans("ActionsOnEvaluation"), '', ''); + //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); + print_barre_liste($langs->trans("Actions"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 8f513d654f3..e59ba7db462 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -407,7 +407,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index c96f562afc7..ff41c152080 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -142,7 +142,7 @@ if ($object->id) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 7935ea7602c..a707913c3c3 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -135,7 +135,7 @@ if ($object->id) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 1164a9642b1..ba0ec02d616 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -110,7 +110,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 475e11131f4..b31df5ee605 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -46,7 +46,7 @@ NewEval=New evaluation ValidateEvaluation=Validate evaluation ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with reference %s? EvaluationCard=Evaluation card -RequiredRank=Required rank for this job +RequiredRank=Required rank for the job profile EmployeeRank=Employee rank for this skill EmployeePosition=Employee position EmployeePositions=Employee positions diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index d7b84707b95..5cdcc27eade 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -276,20 +276,25 @@ if ($object->id > 0) { //$out.=""; } + $morehtmlright = ''; - print '
'; + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } } - print '
'; if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + print '
'; + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); @@ -298,8 +303,8 @@ if ($object->id > 0) { $param .= '&limit='.urlencode($limit); } - //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); + print_barre_liste($langs->trans("ActionsOnMyObject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 9e6c10a0ccd..b5d01422782 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -32,6 +32,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Load translation files required by the page $langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); @@ -48,13 +50,6 @@ if (GETPOST('actioncode', 'array')) { $search_agenda_label = GETPOST('search_agenda_label'); -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'societe', $socid, '&societe'); - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -72,9 +67,19 @@ if (!$sortorder) { $sortorder = 'DESC,DESC'; } +// Initialize technical objects +$object = new Societe($db); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendathirdparty')); +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'societe', $socid, '&societe'); + /* * Actions @@ -109,28 +114,28 @@ if (empty($reshook)) { $form = new Form($db); if ($socid > 0) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - - $object = new Societe($db); $result = $object->fetch($socid); $title = $langs->trans("Agenda"); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->name." - ".$title; } - llxHeader('', $title); + $help_url = ''; + llxHeader('', $title, $help_url); if (isModEnabled('notification')) { $langs->load("mails"); } $head = societe_prepare_head($object); - print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company'); + + print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + $morehtmlref = ''; + + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref); print '
'; @@ -202,7 +207,7 @@ if ($socid > 0) { $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module); } }