Fix : php 8.1 warnings ticket

This commit is contained in:
lmarcouiller 2022-08-02 15:03:28 +02:00 committed by Laurent Destailleur
parent bf2d3160db
commit c94b7ddd36
8 changed files with 25 additions and 20 deletions

View File

@ -119,7 +119,7 @@ class FormTicket
$this->action = 'add';
$this->withcompany = $conf->societe->enabled ? 1 : 0;
$this->withcompany = isModEnabled("societe");
$this->withfromsocid = 0;
$this->withfromcontactid = 0;
//$this->withreadid=0;
@ -169,7 +169,7 @@ class FormTicket
print dol_get_fiche_head(null, 'card', '', 0, '');
}
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.(!empty($this->param["returnurl"]) ? $this->param["returnurl"] : "").'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="'.$this->action.'">';
foreach ($this->param as $key => $value) {
@ -341,10 +341,12 @@ class FormTicket
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
print '</td></tr>';
} else {
if ($this->withreadid > 0) {
if (isset($this->withreadid) && $this->withreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.'';
} else {
$subject = GETPOST('subject', 'alpha');
}
print '<input class="text minwidth500" id="subject" name="subject" value="'.(GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject).'" autofocus />';
print '<input class="text minwidth500" id="subject" name="subject" value="'.$subject.'" autofocus />';
print '</td></tr>';
}
}
@ -643,7 +645,7 @@ class FormTicket
print '<br>';
print $form->buttonsSaveCancel((($this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
print $form->buttonsSaveCancel(((isset($this->withreadid) && $this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
/*
print '<div class="center">';

View File

@ -84,7 +84,7 @@ function ticket_prepare_head($object)
$head[$h][2] = 'tabTicket';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && $conf->societe->enabled) {
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && isModEnabled("societe")) {
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT.'/ticket/contact.php?track_id='.$object->track_id;
$head[$h][1] = $langs->trans('ContactsAddresses');

View File

@ -41,6 +41,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@ -80,7 +81,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
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 > 0 || !empty($ref)) {
$upload_dir = $conf->knowledgemanagement->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->knowledgemanagement->multidir_output[$object->entity]) ? $conf->knowledgemanagement->multidir_output[$object->entity] : $conf->knowledgemanagement->dir_output)."/".$object->id;
}
// Security check - Protection if external user

View File

@ -44,7 +44,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'knowledgerecordcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$lineid = GETPOST('lineid', 'int');
// Initialize technical objects
$object = new KnowledgeRecord($db);

View File

@ -49,7 +49,7 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $liste_limit * $page;
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {

View File

@ -51,6 +51,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'knowledgerecordlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'aZ09');
$id = GETPOST('id', 'int');

View File

@ -56,6 +56,7 @@ $projectid = GETPOST('projectid', 'int');
$cancel = GETPOST('cancel', 'alpha');
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('$backtopage', 'alpha');
$contactid = GETPOST('contactid', 'int');
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
@ -1038,7 +1039,7 @@ if ($action == 'create' || $action == 'presend') {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans("AssignedTo");
if ($object->fk_status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
if (isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
print '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&action=view&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>';
}
print '</td></tr></table>';
@ -1066,7 +1067,7 @@ if ($action == 'create' || $action == 'presend') {
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans('Progression').'</td><td class="left">';
print '</td>';
if ($action != 'progression' && $object->fk_status < $object::STATUS_CLOSED && !$user->socid) {
if ($action != 'progression' && isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && !$user->socid) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=progression&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
}
print '</tr></table>';
@ -1189,7 +1190,7 @@ if ($action == 'create' || $action == 'presend') {
print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
} else {
// Button to edit Properties
if ($object->fk_status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
if (isset($object->fk_status) && $object->fk_status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
print ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&action=view&set=properties">'.img_edit($langs->trans('Modify')).'</a>';
}
}
@ -1248,7 +1249,7 @@ if ($action == 'create' || $action == 'presend') {
// Display navbar with links to change ticket status
print '<!-- navbar with status -->';
if (!$user->socid && $user->rights->ticket->write && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
if (!$user->socid && $user->rights->ticket->write && isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
$actionobject->viewStatusActions($object);
}
@ -1384,16 +1385,16 @@ if ($action == 'create' || $action == 'presend') {
if (empty($reshook)) {
// Show link to add a message (if read and not closed)
if ($object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
if (isset($object->fk_status) && $object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
print dolGetButtonAction('', $langs->trans('TicketAddMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id, '');
}
// Link to create an intervention
// socid is needed otherwise fichinter ask it and forgot origin after form submit :\
if (!$object->fk_soc && $user->rights->ficheinter->creer) {
if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) {
print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
}
if ($object->fk_soc > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) {
if ($object->fk_soc > 0 && isset($object->fk_status) && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) {
print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, '');
}
@ -1404,17 +1405,17 @@ if ($action == 'create' || $action == 'presend') {
*/
// Close ticket if statut is read
if ($object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
if (isset($object->fk_status) && $object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, '');
}
// Abadon ticket if statut is read
if ($object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
if (isset($object->fk_status) && $object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
print dolGetButtonAction('', $langs->trans('AbandonTicket'), 'default', $_SERVER["PHP_SELF"].'?action=abandon&token='.newToken().'&track_id='.$object->track_id, '');
}
// Re-open ticket
if (!$user->socid && ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED) && !$user->socid) {
if (!$user->socid && (isset($object->fk_status) && ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED)) && !$user->socid) {
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&track_id='.$object->track_id, '');
}

View File

@ -284,7 +284,7 @@ foreach ($data as $val) {
print '<tr class="oddeven" height="24">';
print '<td class="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['nb_diff']).'</td>';
print '<td class="right" style="'.((isset($val['nb_diff']) && $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round(isset($val['nb_diff']) ? $val['nb_diff'] : 0).'</td>';
//print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
//print '<td class="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['total_diff']).'</td>';
//print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';