]> git.agnieray.net Git - galette.git/commitdiff
Do not store contribution if there are errors
authorJohan Cwiklinski <johan@x-tnd.be>
Fri, 16 Jun 2017 05:41:00 +0000 (07:41 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Fri, 16 Jun 2017 05:41:00 +0000 (07:41 +0200)
galette/lib/Galette/Entity/Contribution.php

index c13a0152d393702251d7732e1d0dbec646f1ca30..8fdd1c1a0e82d2ba01f6b3d6f1b47358bed21083 100644 (file)
@@ -541,6 +541,14 @@ class Contribution
     {
         global $hist;
 
+        if (count($this->errors) > 0) {
+            throw new \RuntimeException(
+                'Existing errors prevents storing contribution: ' .
+                print_r($this->errors, true)
+            );
+            return false;
+        }
+
         try {
             $this->zdb->connection->beginTransaction();
             $values = array();