Commit fcb2f433 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Comments removed. Brackets for IF() inserted.

parent feaee8cf
...@@ -200,12 +200,6 @@ abstract class AbstractBuildForm { ...@@ -200,12 +200,6 @@ abstract class AbstractBuildForm {
$htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse, $mode); $htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse, $mode);
if ($mode === FORM_SAVE && $recordId != 0) { if ($mode === FORM_SAVE && $recordId != 0) {
// $json[] = [API_ELEMENT_UPDATE => [DIRTY_RECORD_HASH_MD5 => [API_ELEMENT_ATTRIBUTE => ['value' => $newMd5]]]];
// $json[] = [API_ELEMENT_UPDATE => [DIRTY_RECORD_HASH_MD5 => ['value' => $newMd5]]];
// element-update: with 'content'
// $inputMd5 = $this->buildInputRecordHashMd5(false);
// $json[][API_ELEMENT_UPDATE][DIRTY_RECORD_HASH_MD5_SPAN][API_ELEMENT_CONTENT] = $inputMd5;
// element-update: with 'value' // element-update: with 'value'
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP . STORE_ZERO); $recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP . STORE_ZERO);
...@@ -213,10 +207,6 @@ abstract class AbstractBuildForm { ...@@ -213,10 +207,6 @@ abstract class AbstractBuildForm {
// Via 'element-update' // Via 'element-update'
$json[][API_ELEMENT_UPDATE][DIRTY_RECORD_HASH_MD5][API_ELEMENT_ATTRIBUTE]['value'] = $md5; $json[][API_ELEMENT_UPDATE][DIRTY_RECORD_HASH_MD5][API_ELEMENT_ATTRIBUTE]['value'] = $md5;
// Via 'form-update'
// $json[] = [API_FORM_UPDATE_FORM_ELEMENT => DIRTY_RECORD_HASH_MD5, API_FORM_UPDATE_VALUE => $md5,
// API_FORM_UPDATE_DISABLED => false, API_FORM_UPDATE_REQUIRED => false ];
} }
} }
...@@ -2321,15 +2311,12 @@ abstract class AbstractBuildForm { ...@@ -2321,15 +2311,12 @@ abstract class AbstractBuildForm {
} }
$json = $this->getFormElementForJson($htmlFormElementName, $jsonValues, $formElement); $json = $this->getFormElementForJson($htmlFormElementName, $jsonValues, $formElement);
$formElement = HelperFormElement::prepareExtraButton($formElement, false); $formElement = HelperFormElement::prepareExtraButton($formElement, false);
$attribute .= $this->getAttributeFeMode($formElement[FE_MODE]); $attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
$html = '<select ' . $attribute . '>' . $option . '</select>'; $html = '<select ' . $attribute . '>' . $option . '</select>';
$html = $html . $this->getHelpBlock() . $formElement[FE_TMP_EXTRA_BUTTON_HTML]; $html = $html . $this->getHelpBlock() . $formElement[FE_TMP_EXTRA_BUTTON_HTML];
// if ($formElement[FE_INPUT_EXTRA_BUTTON_INFO] !== '' && $formElement[FE_INPUT_EXTRA_BUTTON_INFO] !== '') {
// $html = Support::wrapTag('<div class="input-group">', $html);
// }
return $html . $formElement[FE_INPUT_EXTRA_BUTTON_INFO]; return $html . $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
} }
......
...@@ -173,30 +173,33 @@ class Database { ...@@ -173,30 +173,33 @@ class Database {
$result = $this->fetchAll($mode, $keys); $result = $this->fetchAll($mode, $keys);
break; break;
case ROW_EXPECT_0: case ROW_EXPECT_0:
if ($count === 0) if ($count === 0) {
$result = array(); $result = array();
else } else {
throw new DbException($specificMessage . "Expected none record, got $count rows: $sql", ERROR_DB_TOO_MANY_ROWS); throw new DbException($specificMessage . "Expected none record, got $count rows: $sql", ERROR_DB_TOO_MANY_ROWS);
}
break; break;
case ROW_EXPECT_1: case ROW_EXPECT_1:
if ($count === 1) if ($count === 1) {
$result = $this->fetchAll($mode)[0]; $result = $this->fetchAll($mode)[0];
else } else {
throw new DbException($specificMessage . "Expected one record, got $count: $sql", ERROR_DB_COUNT_DO_NOT_MATCH); throw new DbException($specificMessage . "Expected one record, got $count: $sql", ERROR_DB_COUNT_DO_NOT_MATCH);
}
break; break;
case ROW_EXPECT_0_1: case ROW_EXPECT_0_1:
if ($count === 1) if ($count === 1) {
$result = $this->fetchAll($mode)[0]; $result = $this->fetchAll($mode)[0];
elseif ($count === 0) } elseif ($count === 0) {
$result = array(); $result = array();
else } else
throw new DbException($specificMessage . "Expected no record, got $count rows: $sql", ERROR_DB_TOO_MANY_ROWS); throw new DbException($specificMessage . "Expected no record, got $count rows: $sql", ERROR_DB_TOO_MANY_ROWS);
break; break;
case ROW_EXPECT_GE_1: case ROW_EXPECT_GE_1:
if ($count > 0) if ($count > 0) {
$result = $this->fetchAll($mode); $result = $this->fetchAll($mode);
else } else {
throw new DbException($specificMessage . "Expected at least one record, got nothing: $sql", ERROR_DB_TOO_FEW_ROWS); throw new DbException($specificMessage . "Expected at least one record, got nothing: $sql", ERROR_DB_TOO_FEW_ROWS);
}
break; break;
default: default:
...@@ -226,8 +229,9 @@ class Database { ...@@ -226,8 +229,9 @@ class Database {
if ($this->mysqli_stmt !== null && $this->mysqli_stmt !== false) { if ($this->mysqli_stmt !== null && $this->mysqli_stmt !== false) {
$this->mysqli_stmt->free_result(); $this->mysqli_stmt->free_result();
if (!$this->mysqli_stmt->close()) if (!$this->mysqli_stmt->close()) {
throw new DbException('Error closing mysqli_stmt' . ERROR_DB_CLOSE_MYSQLI_STMT); throw new DbException('Error closing mysqli_stmt' . ERROR_DB_CLOSE_MYSQLI_STMT);
}
} }
$this->mysqli_stmt = null; $this->mysqli_stmt = null;
$this->mysqli_result = null; $this->mysqli_result = null;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment