Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
This commit is contained in:
commit
f8d8c5c658
@ -48,7 +48,7 @@ class BookKeeping extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $table_element = 'accounting_bookkeeping';
|
public $table_element = 'accounting_bookkeeping';
|
||||||
|
|
||||||
public $entity = 1;
|
public $entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var BookKeepingLine[] Lines
|
* @var BookKeepingLine[] Lines
|
||||||
@ -295,7 +295,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
||||||
$sql .= "," . $this->db->escape($this->piece_num);
|
$sql .= "," . $this->db->escape($this->piece_num);
|
||||||
$sql .= ", " . (! isset($this->entity) ? '1' : $this->entity);
|
$sql .= ", " . (! isset($this->entity) ? $conf->entity : $this->entity);
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
||||||
@ -363,6 +363,8 @@ class BookKeeping extends CommonObject
|
|||||||
* @return int <0 if KO, Id of created object if OK
|
* @return int <0 if KO, Id of created object if OK
|
||||||
*/
|
*/
|
||||||
public function createStd(User $user, $notrigger = false, $mode='') {
|
public function createStd(User $user, $notrigger = false, $mode='') {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -486,7 +488,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
||||||
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
||||||
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
||||||
$sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity);
|
$sql .= ' ' . (! isset($this->entity) ? $conf->entity : $this->entity);
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -7,20 +7,22 @@ class Comment extends CommonObject
|
|||||||
public $element='comment'; //!< Id that identify managed objects
|
public $element='comment'; //!< Id that identify managed objects
|
||||||
public $table_element='comment'; //!< Name of table without prefix where object is stored
|
public $table_element='comment'; //!< Name of table without prefix where object is stored
|
||||||
|
|
||||||
var $fk_element;
|
public $fk_element;
|
||||||
var $element_type;
|
public $element_type;
|
||||||
|
|
||||||
var $description;
|
public $description;
|
||||||
|
|
||||||
var $tms;
|
public $tms;
|
||||||
|
|
||||||
var $datec;
|
public $datec;
|
||||||
|
|
||||||
var $fk_user_author;
|
public $fk_user_author;
|
||||||
|
|
||||||
var $entity;
|
public $entity;
|
||||||
|
|
||||||
var $import_key;
|
public $import_key;
|
||||||
|
|
||||||
|
public $comments = array();
|
||||||
|
|
||||||
public $oldcopy;
|
public $oldcopy;
|
||||||
|
|
||||||
@ -289,10 +291,10 @@ class Comment extends CommonObject
|
|||||||
* @param int $fk_element Id of element
|
* @param int $fk_element Id of element
|
||||||
* @return array Comment array
|
* @return array Comment array
|
||||||
*/
|
*/
|
||||||
public static function fetchAllFor($element_type, $fk_element)
|
public function fetchAllFor($element_type, $fk_element)
|
||||||
{
|
{
|
||||||
global $db,$conf;
|
global $db,$conf;
|
||||||
$TComments = array();
|
$this->comments = array();
|
||||||
if(!empty($element_type) && !empty($fk_element)) {
|
if(!empty($element_type) && !empty($fk_element)) {
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " c.rowid";
|
$sql.= " c.rowid";
|
||||||
@ -302,7 +304,7 @@ class Comment extends CommonObject
|
|||||||
$sql.= " AND c.entity = ".$conf->entity;
|
$sql.= " AND c.entity = ".$conf->entity;
|
||||||
$sql.= " ORDER BY c.tms DESC";
|
$sql.= " ORDER BY c.tms DESC";
|
||||||
|
|
||||||
dol_syslog("Comment::fetchAllFor", LOG_DEBUG);
|
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -313,12 +315,17 @@ class Comment extends CommonObject
|
|||||||
{
|
{
|
||||||
$comment = new self($db);
|
$comment = new self($db);
|
||||||
$comment->fetch($obj->rowid);
|
$comment->fetch($obj->rowid);
|
||||||
$TComments[] = $comment;
|
$this->comments[] = $comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
$error++; $this->errors[]="Error ".$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $TComments;
|
|
||||||
|
return count($this->comments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6528,8 +6528,14 @@ abstract class CommonObject
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php';
|
||||||
|
|
||||||
$comment = new Comment($this->db);
|
$comment = new Comment($this->db);
|
||||||
$this->comments = Comment::fetchAllFor($this->element, $this->id);
|
$result=$comment->fetchAllFor($this->element, $this->id);
|
||||||
return 1;
|
if ($result<0) {
|
||||||
|
$this->errors=array_merge($this->errors,$comment->errors);
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->comments = $comment->comments;
|
||||||
|
}
|
||||||
|
return count($this->comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -43,7 +43,7 @@ print '<td colspan="3">';
|
|||||||
|
|
||||||
$desc = GETPOST('comment_description');
|
$desc = GETPOST('comment_description');
|
||||||
|
|
||||||
$doleditor = new DolEditor('comment_description', $desc, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '100%');
|
$doleditor = new DolEditor('comment_description', $desc, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -97,7 +97,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($object->fetch($id,$ref) > 0)
|
if ($object->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
$res=$object->fetch_optionals($object->id,$extralabels);
|
$result=$object->fetchComments();
|
||||||
|
if ($result<0){
|
||||||
|
setEventMessages($object->error,$object->errors,'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|||||||
@ -2744,12 +2744,24 @@ class User extends CommonObject
|
|||||||
// Init $this->users array
|
// Init $this->users array
|
||||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates
|
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) || (! empty($user->admin) && empty($user->entity))))
|
// TODO add hook
|
||||||
{
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
$sql.= " WHERE u.entity IS NOT NULL";
|
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
}
|
if (! empty($user->admin) && empty($user->entity)) {
|
||||||
else
|
if ($conf->entity == 1) {
|
||||||
{
|
$sql.= " WHERE u.entity IS NOT NULL";
|
||||||
|
} else {
|
||||||
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
|
$sql.= " WHERE ug.fk_user = u.rowid";
|
||||||
|
$sql.= " AND ug.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
}
|
}
|
||||||
if ($filter) $sql.=" AND ".$filter;
|
if ($filter) $sql.=" AND ".$filter;
|
||||||
|
|||||||
@ -89,7 +89,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
|||||||
*/
|
*/
|
||||||
$max=10;
|
$max=10;
|
||||||
|
|
||||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_soc, u.datec, u.statut";
|
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_soc, u.datec, u.statut";
|
||||||
$sql.= ", u.entity";
|
$sql.= ", u.entity";
|
||||||
$sql.= ", u.ldap_sid";
|
$sql.= ", u.ldap_sid";
|
||||||
$sql.= ", u.photo";
|
$sql.= ", u.photo";
|
||||||
@ -101,13 +101,25 @@ $sql.= ", s.code_client";
|
|||||||
$sql.= ", s.canvas";
|
$sql.= ", s.canvas";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
|
||||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity)))
|
// TODO add hook
|
||||||
{
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
$sql.= " WHERE u.entity IS NOT NULL";
|
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
}
|
if (! empty($user->admin) && empty($user->entity)) {
|
||||||
else
|
if ($conf->entity == 1) {
|
||||||
{
|
$sql.= " WHERE u.entity IS NOT NULL";
|
||||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
} else {
|
||||||
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
|
$sql.= " WHERE ug.fk_user = u.rowid";
|
||||||
|
$sql.= " AND ug.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
}
|
}
|
||||||
if (!empty($socid)) $sql.= " AND u.fk_soc = ".$socid;
|
if (!empty($socid)) $sql.= " AND u.fk_soc = ".$socid;
|
||||||
$sql.= $db->order("u.datec","DESC");
|
$sql.= $db->order("u.datec","DESC");
|
||||||
|
|||||||
@ -175,7 +175,7 @@ $user2=new User($db);
|
|||||||
|
|
||||||
$buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : '').'" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("HierarchicView")).'"></form>';
|
$buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : '').'" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("HierarchicView")).'"></form>';
|
||||||
|
|
||||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.accountancy_code, u.gender, u.employee, u.photo,";
|
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.accountancy_code, u.gender, u.employee, u.photo,";
|
||||||
$sql.= " u.datelastlogin, u.datepreviouslogin,";
|
$sql.= " u.datelastlogin, u.datepreviouslogin,";
|
||||||
$sql.= " u.ldap_sid, u.statut, u.entity,";
|
$sql.= " u.ldap_sid, u.statut, u.entity,";
|
||||||
$sql.= " u.tms as date_update, u.datec as date_creation,";
|
$sql.= " u.tms as date_update, u.datec as date_creation,";
|
||||||
@ -191,12 +191,24 @@ $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
|||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user_extrafields as ef on (u.rowid = ef.fk_object)";
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user_extrafields as ef on (u.rowid = ef.fk_object)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid";
|
||||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) || (! empty($user->admin) && empty($user->entity))))
|
// TODO add hook
|
||||||
{
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
$sql.= " WHERE u.entity IS NOT NULL";
|
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
}
|
if (! empty($user->admin) && empty($user->entity)) {
|
||||||
else
|
if ($conf->entity == 1) {
|
||||||
{
|
$sql.= " WHERE u.entity IS NOT NULL";
|
||||||
|
} else {
|
||||||
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
|
$sql.= " WHERE ug.fk_user = u.rowid";
|
||||||
|
$sql.= " AND ug.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
}
|
}
|
||||||
if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid;
|
if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user