FIX Management of default value in extrafields when default is '0'
This commit is contained in:
parent
a4d3e48773
commit
c6cbf2345d
@ -660,7 +660,7 @@ class ExtraFields
|
||||
$sql.= " '".$param."',";
|
||||
$sql.= " ".$list.", ";
|
||||
$sql.= " ".$ishidden.", ";
|
||||
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
|
||||
$sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").",";
|
||||
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= " " . $user->id . ",";
|
||||
|
||||
@ -776,7 +776,7 @@ class DoliDBMysqli extends DoliDB
|
||||
{
|
||||
$sql = "ALTER TABLE ".$table;
|
||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||
$sql.="(".$field_desc['value'].")";
|
||||
}
|
||||
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL')
|
||||
@ -796,9 +796,9 @@ class DoliDBMysqli extends DoliDB
|
||||
$sql.=" NOT NULL";
|
||||
}
|
||||
|
||||
if ($field_desc['default'])
|
||||
if ($field_desc['default'] != '')
|
||||
{
|
||||
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']);
|
||||
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']);
|
||||
elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields
|
||||
}
|
||||
|
||||
|
||||
@ -1084,7 +1084,7 @@ class DoliDBPgsql extends DoliDB
|
||||
{
|
||||
$sql = "ALTER TABLE ".$table;
|
||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||
$sql.="(".$field_desc['value'].")";
|
||||
}
|
||||
|
||||
@ -1103,9 +1103,9 @@ class DoliDBPgsql extends DoliDB
|
||||
}
|
||||
}
|
||||
|
||||
if ($field_desc['default'])
|
||||
if ($field_desc['default'] != '')
|
||||
{
|
||||
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']);
|
||||
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']);
|
||||
elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields
|
||||
}
|
||||
|
||||
|
||||
@ -31,9 +31,11 @@ NewContract=New contract
|
||||
NewContractSubscription=New contract/subscription
|
||||
AddContract=Create contract
|
||||
DeleteAContract=Delete a contract
|
||||
ActivateAllOnContract=Activate all services
|
||||
CloseAContract=Close a contract
|
||||
ConfirmDeleteAContract=Are you sure you want to delete this contract and all its services?
|
||||
ConfirmValidateContract=Are you sure you want to validate this contract under name <b>%s</b>?
|
||||
ConfirmActivateAllOnContract=This will open all services (not yet active). Are you sure you want to open all services?
|
||||
ConfirmCloseContract=This will close all services (active or not). Are you sure you want to close this contract?
|
||||
ConfirmCloseService=Are you sure you want to close this service with date <b>%s</b>?
|
||||
ValidateAContract=Validate a contract
|
||||
@ -67,6 +69,7 @@ BoardRunningServices=Expired running services
|
||||
ServiceStatus=Status of service
|
||||
DraftContracts=Drafts contracts
|
||||
CloseRefusedBecauseOneServiceActive=Contract can't be closed as ther is at least one open service on it
|
||||
ActivateAllContracts=Activate all contract lines
|
||||
CloseAllContracts=Close all contract lines
|
||||
DeleteContractLine=Delete a contract line
|
||||
ConfirmDeleteContractLine=Are you sure you want to delete this contract line?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user