Task #0002376: Numéro de pièce, remplissage avec des 0 code : renommage de set_pj par update_receipt
This commit is contained in:
parent
e3b7dc6506
commit
fd55fb8f35
13 changed files with 109 additions and 21 deletions
|
|
@ -263,7 +263,7 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->object->id=2;
|
||||
$array=$this->object->get_propertie();
|
||||
// there are 16 columns in jrn_def
|
||||
$this->assertEquals(count($array),21);
|
||||
$this->assertEquals(count($array),22);
|
||||
$this->object->id=0;
|
||||
$array=$this->object->get_propertie();
|
||||
$this->assertEquals(null,$array);
|
||||
|
|
@ -465,6 +465,7 @@ class Acc_LedgerTest extends TestCase
|
|||
"FIN_FICHE_DEF"=>[2,3,4],
|
||||
"defaultCurrency"=>0,
|
||||
"p_jrn_deb_max_line" => 10,
|
||||
"p_jrn_padding" => 10
|
||||
];
|
||||
// - update it
|
||||
$acc_ledger=new Acc_Ledger($g_connection,-1);
|
||||
|
|
@ -484,7 +485,8 @@ class Acc_LedgerTest extends TestCase
|
|||
"jrn_def_pj_seq" => 0,
|
||||
"jrn_enable" => 0,
|
||||
"FIN_FICHEDEB" =>array(2,3,4),
|
||||
"defaultCurrency"=>0
|
||||
"defaultCurrency"=>0,
|
||||
"p_jrn_padding" => 10
|
||||
);
|
||||
|
||||
$acc_ledger->update($update);
|
||||
|
|
@ -899,7 +901,7 @@ class Acc_LedgerTest extends TestCase
|
|||
ob_end_clean();
|
||||
\Noalyss\Facility::save_file(__DIR__."/file", "acc_ledger-input_new.html", $result);
|
||||
$size=filesize(__DIR__."/file/acc_ledger-input_new.html");
|
||||
$this->assertTrue($size == 15664 ," output input_new is not what it is expected");
|
||||
$this->assertTrue($size == 15948 ," output input_new is not what it is expected");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -919,6 +921,7 @@ class Acc_LedgerTest extends TestCase
|
|||
'min_row'=>5,
|
||||
'p_description'=>'LEDGER UNIT TEST',
|
||||
'negative_amount'=>0,
|
||||
"p_jrn_padding" => 10,
|
||||
'negative_warning'=>'Warning'];
|
||||
|
||||
// clean ledger if exists
|
||||
|
|
@ -952,6 +955,7 @@ class Acc_LedgerTest extends TestCase
|
|||
'min_row'=>5,
|
||||
'p_description'=>'LEDGER UNIT TEST',
|
||||
'negative_amount'=>0,
|
||||
"p_jrn_padding" => 10,
|
||||
'negative_warning'=>'Warning'];
|
||||
|
||||
$g_connection->exec_sql("delete from jrn_def where jrn_def_description=$1",['LEDGER UNIT TEST']);
|
||||
|
|
@ -980,6 +984,7 @@ class Acc_LedgerTest extends TestCase
|
|||
'min_row'=>5,
|
||||
'p_description'=>'LEDGER UNIT TEST',
|
||||
'negative_amount'=>0,
|
||||
"p_jrn_padding" => 10,
|
||||
'negative_warning'=>'Warning'];
|
||||
// clean ledger if exists
|
||||
$g_connection->exec_sql("delete from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
|
|
|
|||
|
|
@ -312,4 +312,53 @@ class Acc_OperationTest extends TestCase
|
|||
$result);
|
||||
}
|
||||
|
||||
function testUpdate_receipt() {
|
||||
global $g_connection;
|
||||
|
||||
$receipt=$g_connection->get_value("select jr_pj_number from jrn where jr_id=250");
|
||||
// $this->assertEquals('BP19-1',$receipt,'Receipt number incorrect');
|
||||
$acc_operation=new Acc_Operation($g_connection);
|
||||
$acc_operation->set_id(250);
|
||||
$this->pj="";
|
||||
$acc_operation->update_receipt();
|
||||
$new_receipt=$g_connection->get_value("select jr_pj_number from jrn where jr_id=250");
|
||||
$this->assertTrue($new_receipt== null,'receipt not set to null ');
|
||||
|
||||
$acc_operation->pj='BP-99';
|
||||
$acc_operation->update_receipt();
|
||||
$new_receipt=$g_connection->get_value("select jr_pj_number from jrn where jr_id=250");
|
||||
$this->assertTrue($new_receipt != null,'receipt not compute');
|
||||
$this->assertTrue($new_receipt =='BP-99',"[$new_receipt]".'receipt not set');
|
||||
|
||||
// padding 5
|
||||
$ledger=new \Acc_Ledger($g_connection, 83);
|
||||
$save_prop=$ledger->get_propertie();
|
||||
$g_connection->exec_sql('update jrn_def set jrn_def_pj_padding = 5 where jrn_def_id=83');
|
||||
$acc_operation->pj=$ledger->guess_pj();
|
||||
$acc_operation->update_receipt();
|
||||
$new_receipt=$g_connection->get_value("select jr_pj_number from jrn where jr_id=250");
|
||||
$this->assertTrue($new_receipt =='BP19-00003',"[$new_receipt] receipt not set");
|
||||
|
||||
// padding 3
|
||||
$g_connection->exec_sql('update jrn_def set jrn_def_pj_padding = 3 where jrn_def_id=83');
|
||||
$acc_operation->pj=$ledger->guess_pj();
|
||||
$acc_operation->update_receipt();
|
||||
$new_receipt=$g_connection->get_value("select jr_pj_number from jrn where jr_id=250");
|
||||
$this->assertTrue($new_receipt =='BP19-003',"[$new_receipt] receipt not set");
|
||||
|
||||
// default no padding
|
||||
$g_connection->exec_sql('update jrn_def set jrn_def_pj_padding = 0 where jrn_def_id=83');
|
||||
$acc_operation->pj=$ledger->guess_pj();
|
||||
$acc_operation->update_receipt();
|
||||
$new_receipt=$g_connection->get_value("select jr_pj_number from jrn where jr_id=250");
|
||||
$this->assertTrue($new_receipt =='BP19-3',"[$new_receipt] receipt not set");
|
||||
|
||||
// reset to original value
|
||||
$acc_operation->pj=$receipt;
|
||||
$acc_operation->update_receipt();
|
||||
$g_connection->exec_sql('update jrn_def set jrn_def_pj_padding = $1 where jrn_def_id=83',[$save_prop['jrn_def_pj_padding'] ]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue