Fix ticket when module societe not enabled

This commit is contained in:
Maxime Kohlhaas 2021-05-16 18:48:18 +02:00
parent a9ddf2a5ad
commit d3ff549b21
3 changed files with 7 additions and 4 deletions

View File

@ -103,11 +103,13 @@ class FormTicket
*/
public function __construct($db)
{
global $conf;
$this->db = $db;
$this->action = 'add';
$this->withcompany = 1;
$this->withcompany = $conf->societe->enabled ? 1 : 0;
$this->withfromsocid = 0;
$this->withfromcontactid = 0;
//$this->withthreadid=0;

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)) {
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && $conf->societe->enabled) {
$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');
@ -157,7 +157,8 @@ function showDirectPublicLink($object)
$out = '';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
$out .= '<span class="opacitymedium">'.$langs->trans("PublicInterfaceNotEnabled").'</span>';
$langs->load('errors');
$out .= '<span class="opacitymedium">'.$langs->trans("ErrorPublicInterfaceNotEnabled").'</span>';
} else {
$out .= img_picto('', 'object_globe.png').' <span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span><br>';
if ($url) {

View File

@ -2917,7 +2917,7 @@ class Ticket extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
if (!$user->rights->societe->client->voir && !$user->socid) {
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".$user->id;
$clause = " AND";