PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.2 3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 All 139 releases
← All changes | includes/Core/WorkFlow/ConditionalLogic.php +34 -1 3.3.1 → V3.3.2 View file →
@@ -21,8 +21,10 @@
21 21 $fieldValue = !empty($this->_data[$this->_workflow_condition->field]['value']) ? $this->_data[$this->_workflow_condition->field]['value'] : [];
22 22 if (is_string($fieldValue)) {
23 23 if ('[' === $fieldValue[0] && ']' === $fieldValue[strlen($fieldValue) - 1]) {
24 24 $fieldValue = json_decode($fieldValue);
25 + } elseif (false !== strpos($fieldValue, BITFORMS_BF_SEPARATOR)) {
26 + $fieldValue = explode(BITFORMS_BF_SEPARATOR, $fieldValue);
25 27 } else {
26 28 $fieldValue = explode(',', $fieldValue);
27 29 }
28 30 }
@@ -296,9 +298,11 @@
296 298 }
297 299 }
298 300 return (bool) $conditionStatus;
299 301 } else {
300 - $this->_workflow_condition->val = Helper::replaceFieldWithValue($this->_workflow_condition->val, $this->_data);
302 + // A month value (2026-01) passes the math evaluator's checks and would come back as 2025.
303 + $evalMathExpr = null === $this->dateFieldType();
304 + $this->_workflow_condition->val = Helper::replaceFieldWithValue($this->_workflow_condition->val, $this->_data, $evalMathExpr);
301 305
302 306 return $this->isLogicMatch($this->_workflow_condition->logic);
303 307 }
304 308 }
@@ -311,8 +315,24 @@
311 315
312 316 if (!isset($this->_data[$this->_workflow_condition->field])) {
313 317 return false;
314 318 }
319 +
320 + $dateType = $this->dateFieldType();
321 + if (null !== $dateType) {
322 + $fieldEntry = $this->_data[$this->_workflow_condition->field];
323 + $dateResult = DateConditionComparator::compare(
324 + $logic,
325 + isset($fieldEntry['value']) ? $fieldEntry['value'] : '',
326 + isset($this->_workflow_condition->val) ? $this->_workflow_condition->val : '',
327 + $dateType,
328 + isset($fieldEntry['dateFormat']) ? $fieldEntry['dateFormat'] : ''
329 + );
330 + if (null !== $dateResult) {
331 + return $dateResult;
332 + }
333 + }
334 +
315 335 switch (strtolower($logic)) {
316 336 case 'equal':
317 337 return self::isEqual();
318 338
@@ -357,6 +377,19 @@
357 377
358 378 default:
359 379 return false;
360 380 }
381 + }
382 +
383 + /**
384 + * @return string|null the condition field's type when it is date-like
385 + */
386 + private function dateFieldType()
387 + {
388 + $field = isset($this->_workflow_condition->field) ? $this->_workflow_condition->field : null;
389 + if (!is_string($field) || !isset($this->_data[$field]['type'])) {
390 + return null;
391 + }
392 + $type = $this->_data[$field]['type'];
393 + return DateConditionComparator::isDateType($type) ? $type : null;
361 394 }
362 395 }