mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 17:13:03 +01:00
Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -1500,7 +1500,7 @@ abstract class CommonObject
|
||||
*/
|
||||
function load_previous_next_ref($filter, $fieldid, $nodbprefix=0)
|
||||
{
|
||||
global $user;
|
||||
global $conf, $user;
|
||||
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@@ -1520,6 +1520,9 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
@@ -1534,7 +1537,18 @@ abstract class CommonObject
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql.= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql.= " AND ug.fk_user = te.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
}
|
||||
} else {
|
||||
$sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
}
|
||||
}
|
||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql.= ' AND te.fk_soc = ' . $socid;
|
||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql.= ' AND (te.fk_soc = ' . $socid.' OR te.fk_soc IS NULL)';
|
||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql.= ' AND te.rowid = ' . $socid;
|
||||
@@ -1552,6 +1566,9 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
@@ -1566,7 +1583,18 @@ abstract class CommonObject
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql.= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql.= " AND ug.fk_user = te.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
}
|
||||
} else {
|
||||
$sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
}
|
||||
}
|
||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql.= ' AND te.fk_soc = ' . $socid;
|
||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql.= ' AND (te.fk_soc = ' . $socid.' OR te.fk_soc IS NULL)';
|
||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql.= ' AND te.rowid = ' . $socid;
|
||||
@@ -3838,7 +3866,7 @@ abstract class CommonObject
|
||||
{
|
||||
global $conf,$langs,$user,$object,$hookmanager;
|
||||
global $form,$bc,$bcdd;
|
||||
global $object_rights, $disableedit, $disablemove; // TODO We should not use global var for this !
|
||||
global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
|
||||
|
||||
$object_rights = $this->getRights();
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ class Form
|
||||
$out='';
|
||||
|
||||
// Check parameters
|
||||
if ($inputType == 'textarea') $value = dol_nl2br($value);
|
||||
if (preg_match('/^text/',$inputType)) $value = dol_nl2br($value);
|
||||
else if (preg_match('/^numeric/',$inputType)) $value = price($value);
|
||||
else if ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day');
|
||||
|
||||
@@ -6024,6 +6024,7 @@ class Form
|
||||
// Bypass the default method
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
$parameters=array(
|
||||
'morehtmlright' => $morehtmlright,
|
||||
'compatibleImportElementsList' =>& $compatibleImportElementsList,
|
||||
);
|
||||
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@@ -6197,7 +6198,7 @@ class Form
|
||||
|
||||
// Can complete the possiblelink array
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
$parameters=array();
|
||||
$parameters=array('listofidcompanytoscan' => $listofidcompanytoscan);
|
||||
$reshook=$hookmanager->executeHooks('showLinkToObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
@@ -6245,7 +6246,7 @@ class Form
|
||||
print '</tr>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlorderlist);
|
||||
$objp = $this->db->fetch_object($resqllist);
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc [$var] . '>';
|
||||
|
||||
Reference in New Issue
Block a user