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; }