CRM-15770 fixes issue of empty date processing into membership page for offline
authorpratikshad <pratiksha.dubey@webaccess.co.in>
Fri, 2 Jan 2015 04:27:35 +0000 (09:57 +0530)
committerpratikshad <pratiksha.dubey@webaccess.co.in>
Fri, 2 Jan 2015 04:27:35 +0000 (09:57 +0530)
----------------------------------------
* CRM-15770: if $dateString is 'null' make no attempt to format it
  https://issues.civicrm.org/jira/browse/CRM-15770

CRM/Member/Form/Membership.php
CRM/Utils/Date.php

index 2acf18d710241d7b49c911468900e41080bc9620..3f7ddfc4f7620d8ce8b0f4a0a63435a6c10b8c62 100644 (file)
@@ -1815,7 +1815,9 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
 
     if (empty($lineItem)) {
       $form->assign('mem_start_date', CRM_Utils_Date::customFormat($membership->start_date, '%B %E%f, %Y'));
-      $form->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date, '%B %E%f, %Y'));
+      if (!CRM_Utils_System::isNull($membership->end_date)) {
+        $form->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date, '%B %E%f, %Y'));
+      }
       $form->assign('membership_name', CRM_Member_PseudoConstant::membershipType($membership->membership_type_id));
     }
 
index 41e03a1d47a38f831cd9b4b5c6f1d4ba751d6b49..92aaa5c0ae87f6e52ba57982a9f3be390e65dabc 100644 (file)
@@ -342,7 +342,7 @@ class CRM_Utils_Date {
       }
     }
 
-    if ($dateString) {
+    if (!CRM_Utils_System::isNull($dateString)) {
       if (strpos($dateString, '-')) {
         $year  = (int) substr($dateString, 0, 4);
         $month = (int) substr($dateString, 5, 2);