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

develop

Conflicts:
	htdocs/projet/class/project.class.php
This commit is contained in:
Laurent Destailleur 2020-11-05 09:42:07 +01:00
commit f27508cf2f
4 changed files with 88 additions and 26 deletions

View File

@ -5009,7 +5009,7 @@ abstract class CommonObject
{
$value_arr = GETPOST($postfieldkey, 'array'); // check if an array
if (!empty($value_arr)) {
$value_key = implode($value_arr, ',');
$value_key = implode(',', $value_arr);
} else {
$value_key = '';
}
@ -5801,7 +5801,7 @@ abstract class CommonObject
*
* @param array $val Array of properties for field to show (used only if ->fields not defined)
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string|array $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array)
* @param string $moreparam To add more parameters on html input tag
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)

View File

@ -243,6 +243,23 @@ if (!file_exists($fullpath_original_file_osencoded))
exit;
}
// Hooks
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('document'));
$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been
if ($reshook < 0) {
$errors = $hookmanager->error . (is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '') . join($separator, $hookmanager->errors) : '');
dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : " . $errors);
print "ErrorDownloadDocumentHooks: " . $errors;
exit;
}
// Permissions are ok and file found, so we return it
top_httphead($type);
header('Content-Description: File Transfer');

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -108,8 +108,13 @@ class Ticket extends CommonObject
/**
* @var int Ticket statut
* @deprecated
*/
public $fk_statut;
/**
* @var int Ticket status
*/
public $fk_statut; // deprecated
public $status;
/**
@ -188,7 +193,7 @@ class Ticket extends CommonObject
public $cache_category_tickets;
/**
* @var int Notify tiers at create
* @var int Notify thirdparty at create
*/
public $notify_tiers_at_create;
@ -279,8 +284,26 @@ class Ticket extends CommonObject
{
$this->db = $db;
$this->statuts_short = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled');
$this->statuts = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled');
$this->statuts_short = array(
self::STATUS_NOT_READ => 'Unread',
self::STATUS_READ => 'Read',
self::STATUS_ASSIGNED => 'Assigned',
self::STATUS_IN_PROGRESS => 'InProgress',
self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation',
self::STATUS_WAITING => 'Suspended',
self::STATUS_CLOSED => 'Closed',
self::STATUS_CANCELED => 'Canceled'
);
$this->statuts = array(
self::STATUS_NOT_READ => 'Unread',
self::STATUS_READ => 'Read',
self::STATUS_ASSIGNED => 'Assigned',
self::STATUS_IN_PROGRESS => 'InProgress',
self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation',
self::STATUS_WAITING => 'Suspended',
self::STATUS_CLOSED => 'Closed',
self::STATUS_CANCELED => 'Canceled'
);
}
/**
@ -1058,7 +1081,7 @@ class Ticket extends CommonObject
public function initAsSpecimen()
{
$this->id = 0;
$this->entity = 1;
$this->ref = 'TI0501-001';
$this->track_id = 'XXXXaaaa';
$this->origin_email = 'email@email.com';
@ -1067,7 +1090,7 @@ class Ticket extends CommonObject
$this->fk_user_assign = 1;
$this->subject = 'Subject of ticket';
$this->message = 'Message of ticket';
$this->fk_statut = 0;
$this->status = 0;
$this->resolution = '1';
$this->progress = '10';
$this->timing = '30';

View File

@ -64,6 +64,9 @@ class User extends CommonObject
*/
public $ismultientitymanaged = 1;
/**
* @var string picto
*/
public $picto = 'user';
public $id = 0;
@ -73,7 +76,15 @@ class User extends CommonObject
public $employee;
public $gender;
public $birth;
/**
* @var string email
*/
public $email;
/**
* @var string personal email
*/
public $personal_email;
@ -90,7 +101,14 @@ class User extends CommonObject
*/
public $address;
/**
* @var string zip code
*/
public $zip;
/**
* @var string town
*/
public $town;
public $state_id; // The state/department
public $state_code;
@ -108,11 +126,19 @@ class User extends CommonObject
*/
public $entity;
//! Clear password in memory
/**
* @var string Clear password in memory
*/
public $pass;
//! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
/**
* @var string Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
*/
public $pass_indatabase;
//! Encrypted password in database (always defined)
/**
* @var string Encrypted password in database (always defined)
*/
public $pass_indatabase_crypted;
/**
@ -285,29 +311,25 @@ class User extends CommonObject
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid";
if ($entity < 0)
{
if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity)))
{
if ($entity < 0) {
if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity))) {
$sql .= " WHERE u.entity IN (0,".$conf->entity.")";
} else {
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
}
} else // The fetch was forced on an entity
{
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
} else {// The fetch was forced on an entity
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
else $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter
} else {
$sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter
}
}
if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba
{
if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba
$sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1";
} elseif ($login)
{
} elseif ($login) {
$sql .= " AND u.login = '".$this->db->escape($login)."'";
} elseif ($email)
{
} elseif ($email) {
$sql .= " AND u.email = '".$this->db->escape($email)."'";
} else {
$sql .= " AND u.rowid = ".$id;