From dc1ccbfae88c36c9a686225d0c77ae83ed168486 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Dec 2013 15:40:43 +0100 Subject: [PATCH] Fix: [ bug #1177 ] Error on create domiciliation --- htdocs/compta/facture/class/facture.class.php | 8 +++++--- test/phpunit/FactureTest.php | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6a6d2ad0fe5..2ad24721e46 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2914,13 +2914,15 @@ class Facture extends CommonInvoice $sql .= ",'".$bac->code_guichet."'"; $sql .= ",'".$bac->number."'"; $sql .= ",'".$bac->cle_rib."')"; - if ( $this->db->query($sql)) + + dol_syslog(get_class($this)."::demande_prelevement sql=".$sql); + if ($this->db->query($sql)) { return 1; } else - { - $this->error=$this->db->error(); + { + $this->error=$this->db->lasterror(); dol_syslog(get_class($this).'::demandeprelevement Erreur'); return -1; } diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 0301333f481..f0c6539ea8d 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -243,6 +243,10 @@ class FactureTest extends PHPUnit_Framework_TestCase print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n"; $this->assertNotEquals($localobject->date_creation, ''); + $result=$localobject->demande_prelevement($user); + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject->id; }