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

This commit is contained in:
Laurent Destailleur 2020-06-02 13:32:09 +02:00
commit 658e7a2f87
5 changed files with 18 additions and 10 deletions

View File

@ -1806,7 +1806,7 @@ abstract class CommonObject
} elseif ($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
elseif ($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
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape($fieldid=='rowid' ? $this->id : $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
if ($this->restrictiononfksoc == 2 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND (sc.fk_user = ".$user->id.' OR te.fk_soc IS NULL)';
if (!empty($filter))
@ -1858,7 +1858,7 @@ abstract class CommonObject
elseif ($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
elseif ($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
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($fieldid=='rowid' ? $this->id : $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
if ($this->restrictiononfksoc == 2 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND (sc.fk_user = ".$user->id.' OR te.fk_soc IS NULL)';
if (!empty($filter))
@ -6042,7 +6042,7 @@ abstract class CommonObject
// Several field into label (eq table:code|libelle:rowid)
$notrans = false;
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label))
if (count($fields_label) > 1)
{
$notrans = true;
foreach ($fields_label as $field_toshow)
@ -6204,7 +6204,7 @@ abstract class CommonObject
$notrans = false;
// Several field into label (eq table:code|libelle:rowid)
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) {
if (count($fields_label) > 1) {
$notrans = true;
foreach ($fields_label as $field_toshow) {
$labeltoshow .= $obj->$field_toshow.' ';
@ -7556,6 +7556,10 @@ abstract class CommonObject
{
if (is_null($value)) return 'NULL';
elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) return $this->db->escape("$value");
elseif ($fieldsentry['type'] == 'boolean') {
if ($value) return 'true';
else return 'false';
}
else return "'".$this->db->escape($value)."'";
}

View File

@ -56,7 +56,8 @@ foreach ($object->fields as $key => $val)
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none');
else $value = GETPOST($key, 'alpha');
print $object->showInputField($val, $key, $value, '', '', '', 0);
if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0);
else print $object->showInputField($val, $key, $value, '', '', '', 0);
print '</td>';
print '</tr>';
}

View File

@ -700,7 +700,9 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
$fieldname = $obj->Field;
// type
$type = $obj->Type;
if ($type == 'int(11)') $type = 'integer';
if ($type == 'int(11)') $type='integer';
if ($type == 'float') $type='real';
if (strstr($type, 'tinyint')) $type='integer';
if ($obj->Field == 'fk_soc') $type = 'integer:Societe:societe/class/societe.class.php';
if (preg_match('/^fk_proj/', $obj->Field)) $type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1';
if (preg_match('/^fk_prod/', $obj->Field)) $type = 'integer:Product:product/class/product.class.php:1';

View File

@ -299,7 +299,7 @@ class modMyModule extends DolibarrModules
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'List MyObject',
'titre'=>'List_MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject_list',
'url'=>'/mymodule/myobject_list.php',
@ -313,7 +313,7 @@ class modMyModule extends DolibarrModules
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'New MyObject',
'titre'=>'New_MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject_new',
'url'=>'/mymodule/myobject_card.php?action=create',
@ -325,7 +325,6 @@ class modMyModule extends DolibarrModules
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
END MODULEBUILDER LEFTMENU MYOBJECT */
// Exports profiles provided by this module
$r = 1;
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */

View File

@ -70,7 +70,9 @@ if ($object->element == 'product')
{
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td>';
print $formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
$ident = (GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ? GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
if (empty($ident) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE;
print $formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
print ' &nbsp; <select name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';