Skip to content

Commit 1ae3f9d

Browse files
AnaelMobiliaorthagh
authored andcommitted
Migration - addField() fix array content checks (glpi-project#1561)
* Issue glpi-project#1476 - fix bad display of attachment's date in a ticket * Revert "Issue glpi-project#1476 - fix bad display of attachment's date in a ticket" This reverts commit 2efd34c. * Fix 'FIRST' is added as it haven't been requested + clearly check if array case have content or not (isset not required are we create theses cases inside the function)
1 parent 592e02b commit 1ae3f9d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

inc/migration.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,13 @@ function addField($table, $field, $type, $options=array()) {
331331

332332
$format = $this->fieldFormat($type, $params['value'], $params['nodefault']);
333333

334-
if ($params['comment']) {
334+
if (!empty($params['comment'])) {
335335
$params['comment'] = " COMMENT '".addslashes($params['comment'])."'";
336336
}
337337

338-
if ($params['after']) {
338+
if (!empty($params['after'])) {
339339
$params['after'] = " AFTER `".$params['after']."`";
340-
} else if (isset($params['first'])) {
340+
} else if (!empty($params['first'])) {
341341
$params['first'] = " FIRST ";
342342
}
343343

@@ -346,7 +346,7 @@ function addField($table, $field, $type, $options=array()) {
346346
$this->change[$table][] = "ADD `$field` $format ".$params['comment'] ." ".
347347
$params['first'].$params['after']."";
348348

349-
if (isset($params['update']) && strlen($params['update'])) {
349+
if (!empty($params['update'])) {
350350
$this->migrationOneTable($table);
351351
$query = "UPDATE `$table`
352352
SET `$field` = ".$params['update']." ".

0 commit comments

Comments
 (0)