diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a8726bb66be..f93e63abcb5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5626,7 +5626,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', * @param int $totalnboflines Total number of records/lines for all pages (if known) * @param int $hideselectlimit Force to hide select limit * @param string $beforearrows HTML content to show before arrows. Must NOT contains '
  • ' tags. - * @param int $hidenavigation Force to hide the arrows and page for navigation + * @param int $hidenavigation Force to hide the switch mode view and the navigation tool (select limit, arrows $betweenarrows and $afterarrows but not $beforearrows) * @return void */ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $betweenarrows = '', $afterarrows = '', $limit = -1, $totalnboflines = 0, $hideselectlimit = 0, $beforearrows = '', $hidenavigation = 0) diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 81d8c93f240..2f503de107f 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -311,7 +311,7 @@ if ($object->id > 0) { print_barre_liste($langs->trans("ActionsOnMyObject").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); */ - print_barre_liste($langs->trans("ActionsOnMyObject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnMyObject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index a0840287c2a..df078354315 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -36,6 +36,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ09'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", "aZ09comma"); @@ -174,15 +175,15 @@ if (!empty($object->id)) { print '
    '; //print '
    '; - $morehtmlcenter = ''; + $morehtmlright = ''; // Show link to change view in message $messagingUrl = DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id; - $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); // Show link to change view in agenda $messagingUrl = DOL_URL_ROOT.'/projet/agenda.php?id='.$object->id; - $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); // // Show link to send an email (if read and not closed) @@ -198,7 +199,7 @@ if (!empty($object->id)) { // Show link to add event if (isModEnabled('agenda')) { $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create'); - $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); } $param = '&id='.$object->id; @@ -209,7 +210,7 @@ if (!empty($object->id)) { $param .= '&limit='.$limit; } - print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 845efbfb5e9..09e49c41c0f 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -209,7 +209,7 @@ if (!empty($object->id)) { $param .= '&limit='.$limit; } - print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index e79a28310f2..5451a990dbc 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -210,7 +210,7 @@ if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || $cachekey = 'count_events_thirdparty_'.$object->id; $nbEvent = dol_getcache($cachekey); - print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php index 3219be29232..483839e0a9e 100644 --- a/htdocs/societe/messaging.php +++ b/htdocs/societe/messaging.php @@ -201,7 +201,7 @@ if ($socid > 0) { $nbEvent = dol_getcache($cachekey); // print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, ''); - print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 81771003082..c6e4cff0b38 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -127,6 +127,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_agenda_label = ''; } +// Set parent company +if ($action == 'set_thirdparty' && $user->rights->ticket->write) { + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $result = $object->setCustomer(GETPOST('editcustomer', 'int')); + $url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + exit(); + } +} /* @@ -189,7 +198,7 @@ if ($object->fk_user_create > 0) { if (isModEnabled("societe")) { $morehtmlref .= '
    '; $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); - if ($action != 'editcustomer' && 0) { + if ($action != 'editcustomer' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); @@ -260,7 +269,7 @@ if (!empty($object->id)) { $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); - print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 08ffcc5cbb5..76d266eb760 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -512,7 +512,7 @@ if (empty($reshook)) { if ($action == 'set_thirdparty' && $user->rights->ticket->write) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $result = $object->setCustomer(GETPOST('editcustomer', 'int')); - $url = 'card.php?track_id='.GETPOST('track_id', 'alpha'); + $url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha'); header("Location: ".$url); exit(); } diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 3168e3dd01e..8af633dc140 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -62,9 +62,6 @@ $url_page_current = DOL_URL_ROOT.'/ticket/contact.php'; $object = new Ticket($db); - -$permissiontoadd = $user->rights->ticket->write; - // Security check $id = GETPOST("id", 'int'); if ($user->socid > 0) $socid = $user->socid; @@ -79,6 +76,8 @@ if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && accessforbidden(); } +$permissiontoadd = $user->rights->ticket->write; + /* * Actions @@ -119,7 +118,7 @@ if ($action == 'addcontact' && $user->rights->ticket->write) { } if ($result >= 0) { - Header("Location: ".$url_page_current."?id=".$object->id); + header("Location: ".$url_page_current."?id=".$object->id); exit; } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { @@ -162,6 +161,15 @@ if ($action == 'deletecontact' && $user->rights->ticket->write) { } } +// Set parent company +if ($action == 'set_thirdparty' && $user->rights->ticket->write) { + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $result = $object->setCustomer(GETPOST('editcustomer', 'int')); + $url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + exit(); + } +} /* @@ -219,7 +227,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { if (isModEnabled("societe")) { $morehtmlref .= '
    '; $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); - if ($action != 'editcustomer' && 0) { + if ($action != 'editcustomer' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 9c2208e9864..bb078104b05 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -79,8 +79,6 @@ if ($result < 0) { $upload_dir = $conf->ticket->dir_output."/".dol_sanitizeFileName($object->ref); } -$permissiontoadd = $user->rights->ticket->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles - // Security check - Protection if external user $result = restrictedArea($user, 'ticket', $object->id); @@ -93,6 +91,7 @@ if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $ accessforbidden(); } +$permissiontoadd = $user->rights->ticket->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles /* @@ -101,6 +100,15 @@ if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; +// Set parent company +if ($action == 'set_thirdparty' && $user->rights->ticket->write) { + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $result = $object->setCustomer(GETPOST('editcustomer', 'int')); + $url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + exit(); + } +} /* @@ -157,7 +165,7 @@ if ($object->id) { if (isModEnabled("societe")) { $morehtmlref .= '
    '; $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); - if ($action != 'editcustomer' && 0) { + if ($action != 'editcustomer' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index a1e912fd05f..85d4c600d6c 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -86,8 +86,6 @@ if (!$action) { $action = 'view'; } -$permissiontoadd = $user->rights->ticket->write; - // Security check $id = GETPOST("id", 'int'); if ($user->socid > 0) $socid = $user->socid; @@ -102,6 +100,8 @@ if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && accessforbidden(); } +$permissiontoadd = $user->rights->ticket->write; + /* * Actions @@ -124,6 +124,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_agenda_label = ''; } +// Set parent company +if ($action == 'set_thirdparty' && $user->rights->ticket->write) { + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $result = $object->setCustomer(GETPOST('editcustomer', 'int')); + $url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + exit(); + } +} /* @@ -185,7 +194,7 @@ if (isModEnabled("societe")) { if (isModEnabled("societe")) { $morehtmlref .= '
    '; $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); - if ($action != 'editcustomer' && 0) { + if ($action != 'editcustomer' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); @@ -257,7 +266,7 @@ if (!empty($object->id)) { $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); - print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); // List of all actions $filters = array();