Skip to content

Commit

Permalink
Dev: Code formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanJard committed Nov 12, 2024
1 parent 9dd6aaf commit 0f81161
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
52 changes: 26 additions & 26 deletions Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1890,18 +1890,16 @@ private function _ssp_filter($query, $http)
});
}

/*
foreach ($this->_fields as $field) {
// Don't reselect a pkey column if it was already added
if ( in_array( $field->dbField(), $this->_pkey ) ) {
continue;
}
if ( $field->apply('get') && $field->getValue() === null ) {
$query->get( $field->dbField() );
}
}
*/
// foreach ($this->_fields as $field) {
// // Don't reselect a pkey column if it was already added
// if ( in_array( $field->dbField(), $this->_pkey ) ) {
// continue;
// }

// if ( $field->apply('get') && $field->getValue() === null ) {
// $query->get( $field->dbField() );
// }
// }

if (isset($http['searchPanes'])) {
// Set the database from editor
Expand All @@ -1919,14 +1917,18 @@ private function _ssp_filter($query, $http)
$q->left_join($this->_leftJoin);

// ... where the selected option is present...
$r = $q
->where(
if (isset($http['searchPanes_null'][$field->name()][$i]) && $http['searchPanes_null'][$field->name()][$i] === 'true') {
$q->where($field->dbField(), null, '=');
}
else {
$q->where(
$field->dbField(),
isset($http['searchPanes_null'][$field->name()][$i]) && $http['searchPanes_null'][$field->name()][$i] === 'true'
? null
: $http['searchPanes'][$field->name()][$i],
$http['searchPanes'][$field->name()][$i],
'='
)
);
}

$r = $q
->exec()
->fetchAll();

Expand All @@ -1942,8 +1944,8 @@ private function _ssp_filter($query, $http)
$q->or_where(
$field->dbField(),
isset($http['searchPanes_null'][$field->name()][$j]) && $http['searchPanes_null'][$field->name()][$j] === 'true'
? null
: $http['searchPanes'][$field->name()][$j],
? null
: $http['searchPanes'][$field->name()][$j],
'='
);
}
Expand Down Expand Up @@ -2073,9 +2075,7 @@ private function _insert_or_update($id, $values)
$res = $this->_insert_or_update_table(
$this->_table[$i],
$values,
$id !== null ?
$this->pkeyToArray($id, true) :
null
$id !== null ? $this->pkeyToArray($id, true) : null
);

// If we don't have an id yet, then the first insert will return
Expand Down Expand Up @@ -2244,17 +2244,17 @@ private function _options($refresh)

if ($options) {

Check failure on line 2245 in Editor.php

View workflow job for this annotation

GitHub Actions / Unit (latest, StaticAnalysis)

If condition is always true.
$opts = $options($this->_db, $refresh);

if ($opts !== false) {
if (!isset($this->_out['options'])) {
$this->_out['options'] = [];
}

$this->_out['options'][$field->name()] = $opts;
}
}

if (! $refresh) {
if (!$refresh) {
// SearchPanes options
$spOpts = $field->searchPaneOptionsExec($field, $this, $this->_processData, $this->_fields, $this->_leftJoin);

Expand Down
6 changes: 4 additions & 2 deletions Editor/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,13 @@ public function apply($action, $data = null)
// Note that validation must be done on input data before we get here

// Create or edit action, are we configured to use this field
if ($action === 'create'
if (
$action === 'create'
&& ($this->_set === Field::SET_NONE || $this->_set === Field::SET_EDIT)
) {
return false;
} elseif ($action === 'edit'
} elseif (
$action === 'edit'
&& ($this->_set === Field::SET_NONE || $this->_set === Field::SET_CREATE)
) {
return false;
Expand Down

0 comments on commit 0f81161

Please sign in to comment.