2
0
forked from Wavyzz/dolibarr

Debug v18

This commit is contained in:
Laurent Destailleur
2023-05-04 22:17:06 +02:00
parent 0be8d2555e
commit ad195f53f0
11 changed files with 60 additions and 25 deletions

View File

@@ -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 $totalnboflines Total number of records/lines for all pages (if known)
* @param int $hideselectlimit Force to hide select limit * @param int $hideselectlimit Force to hide select limit
* @param string $beforearrows HTML content to show before arrows. Must NOT contains '<li> </li>' tags. * @param string $beforearrows HTML content to show before arrows. Must NOT contains '<li> </li>' 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 * @return void
*/ */
function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $betweenarrows = '', $afterarrows = '', $limit = -1, $totalnboflines = 0, $hideselectlimit = 0, $beforearrows = '', $hidenavigation = 0) function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $betweenarrows = '', $afterarrows = '', $limit = -1, $totalnboflines = 0, $hideselectlimit = 0, $beforearrows = '', $hidenavigation = 0)

View File

@@ -311,7 +311,7 @@ if ($object->id > 0) {
print_barre_liste($langs->trans("ActionsOnMyObject").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); print_barre_liste($langs->trans("ActionsOnMyObject").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 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 // List of all actions
$filters = array(); $filters = array();

View File

@@ -36,6 +36,7 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "aZ09comma"); $sortfield = GETPOST("sortfield", "aZ09comma");
@@ -174,15 +175,15 @@ if (!empty($object->id)) {
print '<br>'; print '<br>';
//print '<div class="tabsAction">'; //print '<div class="tabsAction">';
$morehtmlcenter = ''; $morehtmlright = '';
// Show link to change view in message // Show link to change view in message
$messagingUrl = DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id; $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 // Show link to change view in agenda
$messagingUrl = DOL_URL_ROOT.'/projet/agenda.php?id='.$object->id; $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) // // Show link to send an email (if read and not closed)
@@ -198,7 +199,7 @@ if (!empty($object->id)) {
// Show link to add event // Show link to add event
if (isModEnabled('agenda')) { if (isModEnabled('agenda')) {
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create'); $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; $param = '&id='.$object->id;
@@ -209,7 +210,7 @@ if (!empty($object->id)) {
$param .= '&limit='.$limit; $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 // List of all actions
$filters = array(); $filters = array();

View File

@@ -209,7 +209,7 @@ if (!empty($object->id)) {
$param .= '&limit='.$limit; $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 // List of all actions
$filters = array(); $filters = array();

View File

@@ -210,7 +210,7 @@ if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) ||
$cachekey = 'count_events_thirdparty_'.$object->id; $cachekey = 'count_events_thirdparty_'.$object->id;
$nbEvent = dol_getcache($cachekey); $nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);
// List of all actions // List of all actions
$filters = array(); $filters = array();

View File

@@ -201,7 +201,7 @@ if ($socid > 0) {
$nbEvent = dol_getcache($cachekey); $nbEvent = dol_getcache($cachekey);
// print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, ''); // print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);
// List of all actions // List of all actions
$filters = array(); $filters = array();

View File

@@ -127,6 +127,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_agenda_label = ''; $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")) { if (isModEnabled("societe")) {
$morehtmlref .= '<br>'; $morehtmlref .= '<br>';
$morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
if ($action != 'editcustomer' && 0) { if ($action != 'editcustomer' && $permissiontoadd) {
$morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> '; $morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
} }
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); $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); $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); $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 // List of all actions
$filters = array(); $filters = array();

View File

@@ -512,7 +512,7 @@ if (empty($reshook)) {
if ($action == 'set_thirdparty' && $user->rights->ticket->write) { if ($action == 'set_thirdparty' && $user->rights->ticket->write) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int')); $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); header("Location: ".$url);
exit(); exit();
} }

View File

@@ -62,9 +62,6 @@ $url_page_current = DOL_URL_ROOT.'/ticket/contact.php';
$object = new Ticket($db); $object = new Ticket($db);
$permissiontoadd = $user->rights->ticket->write;
// Security check // Security check
$id = GETPOST("id", 'int'); $id = GETPOST("id", 'int');
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) $socid = $user->socid;
@@ -79,6 +76,8 @@ if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) &&
accessforbidden(); accessforbidden();
} }
$permissiontoadd = $user->rights->ticket->write;
/* /*
* Actions * Actions
@@ -119,7 +118,7 @@ if ($action == 'addcontact' && $user->rights->ticket->write) {
} }
if ($result >= 0) { if ($result >= 0) {
Header("Location: ".$url_page_current."?id=".$object->id); header("Location: ".$url_page_current."?id=".$object->id);
exit; exit;
} else { } else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { 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")) { if (isModEnabled("societe")) {
$morehtmlref .= '<br>'; $morehtmlref .= '<br>';
$morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
if ($action != 'editcustomer' && 0) { if ($action != 'editcustomer' && $permissiontoadd) {
$morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> '; $morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
} }
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1);

View File

@@ -79,8 +79,6 @@ if ($result < 0) {
$upload_dir = $conf->ticket->dir_output."/".dol_sanitizeFileName($object->ref); $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 // Security check - Protection if external user
$result = restrictedArea($user, 'ticket', $object->id); $result = restrictedArea($user, 'ticket', $object->id);
@@ -93,6 +91,7 @@ if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $
accessforbidden(); 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'; 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")) { if (isModEnabled("societe")) {
$morehtmlref .= '<br>'; $morehtmlref .= '<br>';
$morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
if ($action != 'editcustomer' && 0) { if ($action != 'editcustomer' && $permissiontoadd) {
$morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> '; $morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
} }
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1);

View File

@@ -86,8 +86,6 @@ if (!$action) {
$action = 'view'; $action = 'view';
} }
$permissiontoadd = $user->rights->ticket->write;
// Security check // Security check
$id = GETPOST("id", 'int'); $id = GETPOST("id", 'int');
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) $socid = $user->socid;
@@ -102,6 +100,8 @@ if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) &&
accessforbidden(); accessforbidden();
} }
$permissiontoadd = $user->rights->ticket->write;
/* /*
* Actions * Actions
@@ -124,6 +124,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_agenda_label = ''; $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")) { if (isModEnabled("societe")) {
$morehtmlref .= '<br>'; $morehtmlref .= '<br>';
$morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
if ($action != 'editcustomer' && 0) { if ($action != 'editcustomer' && $permissiontoadd) {
$morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> '; $morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
} }
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); $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); $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 // List of all actions
$filters = array(); $filters = array();