From e7243ee6398028664889e0b41ccdbfc00bab8045 Mon Sep 17 00:00:00 2001
From: Jaap Jansma <jaap@edeveloper.nl>
Date: Thu, 10 Sep 2015 13:27:45 +0200
Subject: [PATCH] fixed minor issues causing civirules to break

---
 CRM/Civirules/Delay/XWeekDay.php                 | 2 +-
 CRM/CivirulesConditions/FieldValueComparison.php | 2 +-
 CRM/CivirulesConditions/Utils/Period.php         | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/CRM/Civirules/Delay/XWeekDay.php b/CRM/Civirules/Delay/XWeekDay.php
index 5f7ea10..643e374 100644
--- a/CRM/Civirules/Delay/XWeekDay.php
+++ b/CRM/Civirules/Delay/XWeekDay.php
@@ -13,7 +13,7 @@ class CRM_Civirules_Delay_XWeekDay extends CRM_Civirules_Delay_Delay {
   public function delayTo(DateTime $date) {
     $d = clone $date;
     $d->modify('-30 minutes');
-    $mod = $this->day.' of this week';
+    $mod = $this->day.' this week';
     $date->modify($mod);
     $date->setTime((int) $this->time_hour, (int) $this->time_minute);
     if ($date <= $d) {
diff --git a/CRM/CivirulesConditions/FieldValueComparison.php b/CRM/CivirulesConditions/FieldValueComparison.php
index a8b8c02..6099917 100644
--- a/CRM/CivirulesConditions/FieldValueComparison.php
+++ b/CRM/CivirulesConditions/FieldValueComparison.php
@@ -37,7 +37,7 @@ class CRM_CivirulesConditions_FieldValueComparison extends CRM_CivirulesConditio
   }
 
   protected function normalizeValue($value) {
-    if (value === null) {
+    if ($value === null) {
       return null;
     }
 
diff --git a/CRM/CivirulesConditions/Utils/Period.php b/CRM/CivirulesConditions/Utils/Period.php
index b6e8559..f6fc8f5 100644
--- a/CRM/CivirulesConditions/Utils/Period.php
+++ b/CRM/CivirulesConditions/Utils/Period.php
@@ -252,7 +252,7 @@ class CRM_CivirulesConditions_Utils_Period {
    */
   public static function convertPeriodToStartDate($condition_params) {
     $period = $condition_params['period'];
-    $replaceParameters = $condition_params['replaceParameters'];
+    $replaceParameters = isset($condition_params['replaceParameters']) ? $condition_params['replaceParameters'] : array();
     $date = new DateTime();
     switch ($period) {
       case 'this month':
@@ -317,7 +317,7 @@ class CRM_CivirulesConditions_Utils_Period {
    */
   public static function convertPeriodToEndDate($condition_params) {
     $period = $condition_params['period'];
-    $replaceParameters = $condition_params['replaceParameters'];
+    $replaceParameters = isset($condition_params['replaceParameters']) ? $condition_params['replaceParameters'] : array();
     $date = new DateTime();
     switch ($period) {
       case 'this month':
-- 
GitLab