Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-05-11 18:02:37 +02:00
commit d98e046fbd
8 changed files with 40 additions and 27 deletions

View File

@ -2,7 +2,7 @@
/* Module descriptor for ticket system
* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -113,9 +113,6 @@ class box_last_modified_ticket extends ModeleBoxes
while ($i < $num) {
$objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec);
$dateterm = $this->db->jdate($objp->fin_validite);
$dateclose = $this->db->jdate($objp->date_cloture);
$late = '';
$ticket = new Ticket($this->db);
$ticket->id = $objp->id;
@ -162,7 +159,6 @@ class box_last_modified_ticket extends ModeleBoxes
);
$r++;
// Date creation
$this->info_box_contents[$i][$r] = array(
'td' => 'class="right"',

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -150,7 +150,7 @@ class box_task extends ModeleBoxes
}
$sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
$sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title";
$sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title, p.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
$sql .= " JOIN ".MAIN_DB_PREFIX."projet as p ON (pt.fk_projet = p.rowid)";

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -59,7 +60,7 @@ if ($reshook < 0) {
//var_dump($extrafields->attributes[$object->table_element]);
if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) {
if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label'])) {
$lastseparatorkeyfound = '';
$extrafields_collapse_num = '';
$extrafields_collapse_num_old = '';

View File

@ -1960,7 +1960,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
*/
function top_menu_user($hideloginname = 0, $urllogout = '')
{
global $langs, $conf, $db, $hookmanager, $user;
global $langs, $conf, $db, $hookmanager, $user, $mysoc;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
@ -1985,13 +1985,27 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$dropdownBody .= '<span id="topmenulogincompanyinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans("ShowCompanyInfos").'</span>';
$dropdownBody .= '<div id="topmenulogincompanyinfo" >';
if (!empty($conf->global->MAIN_INFO_SIREN)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).'</span>';
if (!empty($conf->global->MAIN_INFO_SIRET)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).'</span>';
if (!empty($conf->global->MAIN_INFO_APE)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).'</span>';
if (!empty($conf->global->MAIN_INFO_RCS)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).'</span>';
if (!empty($conf->global->MAIN_INFO_PROFID5)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).'</span>';
if (!empty($conf->global->MAIN_INFO_PROFID6)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).'</span>';
if (!empty($conf->global->MAIN_INFO_TVAINTRA)) $dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).'</span>';
if (!empty($conf->global->MAIN_INFO_SIREN)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).'</span>';
}
if (!empty($conf->global->MAIN_INFO_SIRET)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).'</span>';
}
if (!empty($conf->global->MAIN_INFO_APE)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).'</span>';
}
if (!empty($conf->global->MAIN_INFO_RCS)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).'</span>';
}
if (!empty($conf->global->MAIN_INFO_PROFID5)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).'</span>';
}
if (!empty($conf->global->MAIN_INFO_PROFID6)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).'</span>';
}
if (!empty($conf->global->MAIN_INFO_TVAINTRA)) {
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).'</span>';
}
$dropdownBody .= '</div>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -211,14 +212,14 @@ if (empty($reshook)) {
}
// Auto assign user
if ($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE) {
if (!empty($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE)) {
$result = $object->assignUser($user, $user->id, 1);
$object->add_contact($user->id, "SUPPORTTEC", 'internal');
}
// Auto assign contrat
$contractid = 0;
if ($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE) {
if (!empty($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE)) {
$contrat = new Contrat($db);
$contrat->socid = $object->fk_soc;
$list = $contrat->getListOfContracts();
@ -233,7 +234,7 @@ if (empty($reshook)) {
}
// Auto create fiche intervention
if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE) {
if (!empty($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)) {
$fichinter = new Fichinter($db);
$fichinter->socid = $object->fk_soc;
$fichinter->fk_project = $projectid;
@ -751,7 +752,7 @@ if ($action == 'create' || $action == 'presend') {
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
if ($res > 0) {
// or for unauthorized internals users
if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden('', 0, 1);
}
@ -853,7 +854,7 @@ if ($action == 'create' || $action == 'presend') {
print dol_get_fiche_end();
}
if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
@ -1030,7 +1031,7 @@ if ($action == 'create' || $action == 'presend') {
print '</tr>';
// Timing (Duration sum of linked fichinter)
if ($conf->fichinter->enabled) {
if ($conf->ficheinter->enabled) {
$object->fetchObjectLinked();
$num = count($object->linkedObjects);
$timing = 0;

View File

@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->loadLangs(array("companies", "other", "ticket", "mails"));
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
$track_id = GETPOST('track_id', 'alpha');
$action = GETPOST('action', 'alpha');
@ -104,7 +105,7 @@ if ($object->id) {
print dol_get_fiche_end();
}
if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";

View File

@ -118,7 +118,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
if ($val['searchall']) {
if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@ -340,7 +340,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/, $/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";

View File

@ -91,7 +91,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden();
}
@ -146,7 +146,7 @@ if ($socid > 0) {
print dol_get_fiche_end();
}
if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";