mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Try to fix phpunit
This commit is contained in:
parent
4c90e1c10d
commit
8794e54eba
|
|
@ -3380,10 +3380,10 @@ class Facture extends CommonInvoice
|
|||
{
|
||||
global $conf;
|
||||
|
||||
// on verifie si la facture est en numerotation provisoire
|
||||
$facref = substr($this->ref, 1, 4);
|
||||
// we check if invoice is a temporary number (PROVxxxx)
|
||||
$tmppart = substr($this->ref, 1, 4);
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // If draft invoice and ref not yet defined
|
||||
if ($this->statut == self::STATUS_DRAFT && $tmppart == 'PROV') // If draft invoice and ref not yet defined
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -3395,7 +3395,7 @@ class Facture extends CommonInvoice
|
|||
// ...
|
||||
|
||||
// If not a draft invoice and not temporary invoice
|
||||
if ($facref != 'PROV')
|
||||
if ($tmppart !== 'PROV')
|
||||
{
|
||||
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
||||
$ventilExportCompta = $this->getVentilExportCompta();
|
||||
|
|
|
|||
|
|
@ -284,27 +284,27 @@ class FactureTest extends PHPUnit_Framework_TestCase
|
|||
$result=$localobject2->initAsSpecimen();
|
||||
$result=$localobject2->create($user);
|
||||
$result=$localobject2->validate($user);
|
||||
print 'Invoice localobject ref = '.$localobject->ref."\n";
|
||||
print 'Invoice $localobject ref = '.$localobject->ref."\n";
|
||||
print 'Invoice $localobject2 created with ref = '.$localobject2->ref."\n";
|
||||
|
||||
$conf->global->INVOICE_CAN_NEVER_BE_REMOVED = 1;
|
||||
|
||||
$result=$localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n";
|
||||
$this->assertEquals(0, $result, 'Deletion should fail, option INVOICE_CAN_NEVER_BE_REMOVED is on');
|
||||
|
||||
unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED);
|
||||
|
||||
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n";
|
||||
$this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice');
|
||||
|
||||
$result=$localobject2->delete($user); // Deletion is OK, it is last invoice
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n";
|
||||
$this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice');
|
||||
|
||||
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n";
|
||||
$this->assertGreaterThan(0, $result, 'Deletion should work, it is again last invoice');
|
||||
|
||||
return $result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user