]> git.agnieray.net Git - galette.git/commitdiff
Expecting null getting improbable date... fixes #902
authorJohan Cwiklinski <johan@x-tnd.be>
Fri, 6 Jan 2017 04:40:33 +0000 (05:40 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Fri, 6 Jan 2017 04:40:33 +0000 (05:40 +0100)
galette/lib/Galette/Entity/Contribution.php

index b042ed00737a5233f15ff3bc84333e914bea95d7..65547ac9f09a8dc93845c8d710edbcbd97b81b98 100644 (file)
@@ -497,8 +497,8 @@ class Contribution
             }
 
             $results = $this->zdb->execute($select);
-            $result = $results->current();
-            if ($result !== false) {
+            if ($results->count() > 0) {
+                $result = $results->current();
                 $d = new \DateTime($result->date_debut_cotis);
 
                 return _T("- Membership period overlaps period starting at ") .
@@ -767,8 +767,8 @@ class Contribution
             $result = $results->current();
             $due_date = $result->max_date;
 
-            //avoid bad dates in postgres
-            if ($due_date == '0001-01-01 BC') {
+            //avoid bad dates in postgres and bad mysql return from zenddb
+            if ($due_date == '0001-01-01 BC' || $due_date == '1901-01-01') {
                 $due_date = '';
             }
             return $due_date;