fix: setfield clause

This commit is contained in:
jygaulier
2024-02-08 15:57:41 +01:00
parent 84f3df552a
commit 1d4df68c2d

View File

@@ -56,7 +56,7 @@ class RecordsActionsWorker implements WorkerInterface
else { else {
$sxSettings = simplexml_load_string($xmlSettings); $sxSettings = simplexml_load_string($xmlSettings);
if((string)$sxSettings['version'] !== "2") { if((string)$sxSettings['version'] !== "2") {
throw new JsonValidationException(sprintf("bad settings version (%s), should be \"2\"", (string)$sxml['version'])); throw new JsonValidationException(sprintf("bad settings version (%s), should be \"2\"", (string)$sxSettings['version']));
} }
$em = $this->repoWorker->getEntityManager(); $em = $this->repoWorker->getEntityManager();
$em->beginTransaction(); $em->beginTransaction();
@@ -256,7 +256,7 @@ class RecordsActionsWorker implements WorkerInterface
$js $js
)); ));
if(!$row|'dry') { if(!$row['dry']) {
$rec->setMetadatasByActions(json_decode($js, false)); // false: setMetadatasByActions expects object, not array ! $rec->setMetadatasByActions(json_decode($js, false)); // false: setMetadatasByActions expects object, not array !
} }
} }
@@ -470,7 +470,7 @@ class RecordsActionsWorker implements WorkerInterface
// action <compute_date direction="dir"...> // action <compute_date direction="dir"...>
foreach ($sxThen->compute_date as $x) { foreach ($sxThen->compute_date as $x) {
$this->add_THEN_ComputeDateClause($sqlBuilder, $databox, strtoupper(trim($x['direction'])), trim($x['field']), strtoupper(trim($x['delta'])), trim($x['computed'])); $this->add_THEN_ComputeDateClause($sqlBuilder, $databox, trim($x['field']), strtoupper(trim($x['delta'])), trim($x['computed']));
} }
// action <coll id="X" /> // action <coll id="X" />
@@ -776,7 +776,7 @@ class RecordsActionsWorker implements WorkerInterface
} }
} }
private function add_THEN_ComputeDateClause(SqlBuilder $sqlBuilder, databox $databox, string $dir, string $fieldName, string $delta, string $computedRefKey) private function add_THEN_ComputeDateClause(SqlBuilder $sqlBuilder, databox $databox, string $fieldName, string $delta, string $computedRefKey)
{ {
$this->checkComputedRefKey($computedRefKey); $this->checkComputedRefKey($computedRefKey);
@@ -804,15 +804,6 @@ class RecordsActionsWorker implements WorkerInterface
} }
} }
$dirop = "";
if (in_array($dir, array('BEFORE', 'AFTER'))) {
$dirop .= ($dir == 'BEFORE') ? '<' : '>=';
}
else {
// bad direction
throw new Exception(sprintf("bad direction (%s)\n", $dir));
}
switch ($fieldName) { switch ($fieldName) {
case '#moddate': case '#moddate':
case '#credate': case '#credate':