diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 614ed7e282308bb1eff82029f42e674b6b5ed4fa..272e2d313b5ef1fd6aee61fb7ae6f67237d79037 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3002,7 +3002,8 @@ class Facture extends CommonInvoice $this->total_tva += $line->total_tva; $this->total_ttc += $line->total_ttc; } - + $this->revenuestamp = 0; + // Add a line "offered" $line=new FactureLigne($this->db); $line->desc=$langs->trans("Description")." (offered line)"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e1c4be9718468b96ae8f87b8f6f08cbbeb3d4819..124447bb81c1b571c2cffad9364c6762f5e0b9ea 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1413,7 +1413,12 @@ abstract class CommonObject dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR); return -1; } - + if (! in_array($suffix,array('','_public','_private'))) + { + dol_syslog(get_class($this)."::upate_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR); + return -2; + } + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); $sql.= " WHERE rowid =". $this->id; diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index 4ac21f0fec498500432a6c7cb7121e8b7da340b1..67cea036bae84702922c1e2f7cb844d6cc14aa1e 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -221,7 +221,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase $newlangs5=new Translate("",$conf); $newlangs5->setDefaultLang('ru_RU'); $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs); + $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs5); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; @@ -376,7 +376,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; - $conf->fichinter->dir_output.='/temp'; + $conf->ficheinter->dir_output.='/temp'; $localobject=new Fichinter($this->savdb); $localobject->initAsSpecimen(); diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index bac26a28485db6980e44d18d1a25e8bc3ee34634..844b36b311aa3d2fc1b4a18744eebadcd0a0da3e 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -210,9 +210,9 @@ class ContactTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Contact::update error'); - $result=$localobject->update_note_private($localobject->note_private); + $result=$localobject->update_note($localobject->note_private,'_private'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0, 'Contact::update_note_private error'); + $this->assertLessThan($result, 0, 'Contact::update_note error'); $result=$localobject->update_note_public($localobject->note_public); print __METHOD__." id=".$localobject->id." result=".$result."\n"; @@ -223,8 +223,8 @@ class ContactTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Contact::fetch error'); - print __METHOD__." old=".$localobject->note." new=".$newobject->note."\n"; - $this->assertEquals($localobject->note, $newobject->note); + print __METHOD__." old=".$localobject->note_private." new=".$newobject->note_private."\n"; + $this->assertEquals($localobject->note_private, $newobject->note_private); //print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n"; //$this->assertEquals($localobject->note_public, $newobject->note_public); print __METHOD__." old=".$localobject->lastname." new=".$newobject->lastname."\n"; diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index f87494c924d9c723a515144e32ff8fffaffc8902..858e096aa36dd955afb3a89d0a492feca71ac7e6 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -312,35 +312,35 @@ class FilesLibTest extends PHPUnit_Framework_TestCase $result=dol_copy($file, '/adir/that/does/not/exists/file.csv'); print __METHOD__." result=".$result."\n"; - $this->assertLessThan(0,$result); // We should have error + $this->assertLessThan(0,$result,'copy dir that does not exists'); // We should have error $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1); print __METHOD__." result=".$result."\n"; - $this->assertGreaterThanOrEqual(1,$result); // Should be 1 + $this->assertGreaterThanOrEqual(1,$result, 'copy into a dir that exists'); // Should be 1 // Again to test with overwriting=0 $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,0); print __METHOD__." result=".$result."\n"; - $this->assertEquals(0,$result); // Should be 0 + $this->assertEquals(0,$result, 'copy destination already exists, no overwrite'); // Should be 0 // Again to test with overwriting=1 $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1); print __METHOD__." result=".$result."\n"; - $this->assertGreaterThanOrEqual(1,$result); // Should be 1 + $this->assertGreaterThanOrEqual(1,$result,'copy destination already eists, overwrite'); // Should be 1 // Again to test with overwriting=1 $result=dol_move($conf->admin->dir_temp.'/file.csv',$conf->admin->dir_temp.'/file2.csv',0,1); print __METHOD__." result=".$result."\n"; - $this->assertTrue($result); + $this->assertTrue($result,'copy destination does not exists'); $result=dol_delete_file($conf->admin->dir_temp.'/file2.csv'); print __METHOD__." result=".$result."\n"; - $this->assertTrue($result); + $this->assertTrue($result,'delete file'); - // Again to test no erreor when deleteing a non existing file + // Again to test no error when deleteing a non existing file $result=dol_delete_file($conf->admin->dir_temp.'/file2.csv'); print __METHOD__." result=".$result."\n"; - $this->assertTrue($result); + $this->assertTrue($result,'delete file that does not exists'); } /** diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index f0bb254ce25405ce302cbf6da24f906fafc6d3c5..42800adc2a24708522b3f9efb9e4ccb372d4f62f 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -204,9 +204,9 @@ class HolidayTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update error'); - $result=$localobject->update_note_private($localobject->note_private); + $result=$localobject->update_note($localobject->note_private,'_private'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); + $this->assertLessThan($result, 0, 'Holiday::update_note error'); $result=$localobject->update_note_public($localobject->note_public); print __METHOD__." id=".$localobject->id." result=".$result."\n"; diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php index dd08b18ca073aa364591aee50e1376f7a4ce6a4a..c119f1a4ec63ae2cb20c544a0f7fd865aab61eaf 100755 --- a/test/phpunit/PdfDocTest.php +++ b/test/phpunit/PdfDocTest.php @@ -132,6 +132,7 @@ class PdfDocTest extends PHPUnit_Framework_TestCase $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->lines=array(); + $localobject->lines[0]=new FactureLigne($this->savdb); $localobject->lines[0]->fk_product=1; $localobject->lines[0]->label='Label 1'; $localobject->lines[0]->desc="This is a description with a é accent\n(Country of origin: France)"; diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 619bf98dbe752737e4f64ac6dab41b2f27d666f1..487f25c8ec93201e7371fdb8ae49093567485b73 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -210,7 +210,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - $result=$localobject->update_note_private($localobject->note_private); + $result=$localobject->update_note($localobject->note_private,'_private'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); @@ -223,7 +223,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - $this->assertEquals($localobject->note, $newobject->note); + $this->assertEquals($localobject->note_private, $newobject->note_private); //$this->assertEquals($localobject->note_public, $newobject->note_public); $this->assertEquals($localobject->name, $newobject->name); $this->assertEquals($localobject->address, $newobject->address);