Skip to content

Commit

Permalink
Merge pull request #12 from halftrainedharry/patch-default-value
Browse files Browse the repository at this point in the history
Fix default value of 0
  • Loading branch information
Boshnik authored Sep 2, 2024
2 parents ada7279 + d6c0d93 commit 121cbf6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions core/components/extrafields/lexicon/en/field.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
$_lang['ef_field_type_hidden'] = 'Hidden Field';
$_lang['ef_field_type_xtype'] = 'Xtype field';

$_lang['ef_field_empty_type'] = 'You must select a field type.';
$_lang['ef_field_empty_class_name'] = 'You must select a table.';
$_lang['ef_field_empty_field_type'] = 'You must select a field type.';
$_lang['ef_field_err_name'] = 'You must provide a field name.';
$_lang['ef_field_err_ae'] = 'A field with the same name already exists.';
$_lang['ef_field_err_nf'] = 'Field not found.';
$_lang['ef_field_err_ns'] = 'The field is not specified.';
$_lang['ef_field_err_name_reserved'] = 'This field name is already taken in the resource table';
$_lang['ef_field_err_name_cyrillic'] = 'The field name must be in Latin';
$_lang['ef_field_err_remove'] = 'Error while deleting a field.';
$_lang['ef_field_err_save'] = 'Error saving field.';
$_lang['ef_field_err_save'] = 'Error saving field.';
$_lang['ef_field_default_error_combo'] = 'Possible values: 0 or 1';
$_lang['ef_field_default_error_numberfield'] = 'The value must be a number';
$_lang['ef_field_default_error_date'] = 'The value must be empty or in the format: YYYY-MM-DD';
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function getSQL($object, $mode = 'create')
$type .= "({$meta['precision']})";
}
$null = $object->field_null ? 'NULL' : 'NOT NULL';
$default = empty($object->field_default) ? "" : " DEFAULT '$object->field_default'";
$default = (empty($object->field_default) && $object->field_default !== '0') ? "" : " DEFAULT '$object->field_default'";

if (!empty($object->old_name) && $object->field_name !== $object->old_name) {
$mode = 'rename';
Expand Down

0 comments on commit 121cbf6

Please sign in to comment.