2
0
forked from Wavyzz/dolibarr

Merge remote-tracking branch 'origin/3.7' into develop

This commit is contained in:
Laurent Destailleur
2015-01-16 10:44:41 +01:00
24 changed files with 247 additions and 214 deletions

View File

@@ -167,7 +167,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $result); // Can be deleted
$result=$localobject->is_erasable();
print __METHOD__." is_erasable=".$result."\n";
$this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent
$this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent)
// Now we try with a reset
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}';
@@ -502,7 +502,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$conf->global->SOCIETE_FISCAL_MONTH_START=6;
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@99}';
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}{mm}-{0000@99}';
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
@@ -512,7 +512,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
$this->assertEquals('198001-0001', $result); // counter must start to 1
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
@@ -522,7 +522,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
$this->assertEquals('198001-0002', $result); // counter must start to 2
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
@@ -532,7 +532,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
$this->assertEquals('198002-0001', $result); // counter must start to 1
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year
@@ -542,7 +542,28 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
$this->assertEquals('198101-0001', $result); // counter must start to 1
// Test with {t} tag
$conf->global->SOCIETE_FISCAL_MONTH_START=1;
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{t}{yyyy}{mm}-{0000}';
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{t}{yyyy}{mm}-{0000}';
$tmpthirdparty=new Societe($this->savdb);
$tmpthirdparty->initAsSpecimen();
$tmpthirdparty->typent_code = 'TE_ABC';
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year
$numbering=new mod_facture_mercure();
$result=$numbering->getNextValue($tmpthirdparty, $localobject);
$result2=$localobject->create($user,1);
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
$this->assertEquals('A198201-0001', $result); // counter must start to 1
return $result;
}