Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
This commit is contained in:
commit
8da84af973
@ -47,8 +47,17 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
|
||||
// Set value to insert
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) $value = GETPOST($key,'none');
|
||||
else $value = GETPOST($key,'alpha');
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
|
||||
$value = GETPOST($key,'none');
|
||||
} elseif ($object->fields[$key]['type']=='date') {
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='price') {
|
||||
$value = price2num(GETPOST($key));
|
||||
} else {
|
||||
$value = GETPOST($key,'alpha');
|
||||
}
|
||||
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field
|
||||
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
|
||||
|
||||
@ -95,11 +104,12 @@ if ($action == 'update' && ! empty($permissiontoadd))
|
||||
// Set value to update
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
|
||||
$value = GETPOST($key,'none');
|
||||
}
|
||||
elseif ($object->fields[$key]['type']=='date') {
|
||||
} elseif ($object->fields[$key]['type']=='date') {
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='price') {
|
||||
$value = price2num(GETPOST($key));
|
||||
} else {
|
||||
$value = GETPOST($key,'alpha');
|
||||
}
|
||||
|
||||
@ -5293,7 +5293,8 @@ class Form
|
||||
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t";
|
||||
if ($objecttmp->ismultientitymanaged == 2)
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE t.entity IN (".getEntity($objecttmp->table_element).")";
|
||||
$sql.= " WHERE 1=1";
|
||||
if(! empty($objecttmp->ismultientitymanaged)) $sql.= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
||||
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->societe_id))
|
||||
{
|
||||
if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->societe_id;
|
||||
|
||||
@ -63,7 +63,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
return -2;
|
||||
}
|
||||
if (! preg_match('/^(integer|date|timestamp|varchar|double)/', $addfieldentry['type']))
|
||||
if (! preg_match('/^(integer|date|timestamp|varchar|double|html|price)/', $addfieldentry['type']))
|
||||
{
|
||||
setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors');
|
||||
return -2;
|
||||
@ -257,6 +257,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
$type = $val['type'];
|
||||
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
|
||||
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
|
||||
if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
|
||||
$texttoinsert.= "\t".$key." ".$type;
|
||||
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user