diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 5d4ebf26b..4ed267dc8 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -30,7 +30,7 @@
* dsp_tva fill a ipopup with a choice of possible VAT
* - if code is set then fill the field code
* - if compute is set then add event to call clean_tva and compute_ledger
- @see Acc_Ledger_Sold::input
+ @see Acc_Ledger_Sale::input
* Part 2
* dl : display form to modify, add and delete lettering for a given operation
*
diff --git a/html/js/managetable.js b/html/js/managetable.js
index 75ddacfa8..f97955349 100644
--- a/html/js/managetable.js
+++ b/html/js/managetable.js
@@ -18,13 +18,12 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**
- *@file
- *@brief Javascript object to manage ajax calls to
+ *@class ManageTable Javascript object to manage ajax calls to
* save , input or delete data row.
- *@details The callback must
+ * The callback must
respond with a XML file , the tag status for the result
and data the HTML code to display
- *@param p_table_name the data table on which we're working
+ *@param {string} p_table_name the data table on which we're working
in javascript , to create an object to manipulate the table
version.
@@ -76,12 +75,6 @@
@endcode
*/
-/**
- * @class ManageTable
- * @param string p_table_name name of the table and schema
- */
-
-
var ManageTable = function (p_table_name)
{
this.callback = "ajax.php"; //!< File to call
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 15a9c60e0..965ba5a1a 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -3859,7 +3859,7 @@ function uncheck_other(p_click,p_name)
p_click.checked=true;
}
/**
- * Manage the tag with operations
+ * @class operation Tag Manage the tag with operations
* @returns {undefined}
*/
var operation_tag = function (p_div)
@@ -3909,11 +3909,11 @@ var operation_tag = function (p_div)
};
/**
- * @brief Add the current tag to the current ag_id
- * @param {type} p_dossier
- * @param {type} ag_id
+ * Add the current tag to the current ag_id
+ * @param {int} p_dossier
+ * @param int ag_id
* @param p_isgroup g it is a group , t is a single tag
- * @returns {undefined}
+ * @returns void
*/
this.add = function (p_dossier, p_jrn_id, t_id, p_isgroup)
{
@@ -3949,10 +3949,10 @@ var operation_tag = function (p_div)
}
};
/**
- * @brief remove the current tag to the current ag_id
- * @param {type} p_dossier
- * @param {type} ag_id
- * @returns {undefined}
+ * remove the current tag to the current ag_id
+ * @param {int} p_dossier
+ * @param {int} ag_id
+ * @returns void
*/
this.remove = function (p_dossier, p_jrn_id, t_id)
{
diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php
index 81d520ff0..1a1a79d58 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -296,7 +296,7 @@ class Acc_Ledger extends jrn_def_sql
jrnx
where j_id=$6 returning j_id";
$Res=$this->db->exec_sql($sql,
- array($p_date, $grp_new, $p_internal, $g_user->id, $per->p_id,
+ array($p_date, $grp_new, $p_internal, $g_user->login, $per->p_id,
$row));
// Check return code
if ($Res==false)
diff --git a/include/class/acc_ledger_sold.class.php b/include/class/acc_ledger_sale.class.php
similarity index 99%
rename from include/class/acc_ledger_sold.class.php
rename to include/class/acc_ledger_sale.class.php
index 4c93c0df8..8740bc433 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sale.class.php
@@ -33,7 +33,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
* @exception throw an exception is something is wrong
*/
-class Acc_Ledger_Sold extends Acc_Ledger {
+class Acc_Ledger_Sale extends Acc_Ledger {
function __construct($p_cn, $p_init) {
parent::__construct($p_cn, $p_init);
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 1bc787426..cb5365382 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -86,7 +86,7 @@ class Fiche
return $this;
}
- /**
+ /**
*@brief used with a usort function, to sort an array of Fiche on the name
*/
static function cmp_name(Fiche $o1,Fiche $o2)
@@ -407,50 +407,28 @@ class Fiche
}
return $return;
}
- /**
- * @brief make an array of attributes of the category of card (FICHE_DEF.FD_ID)
- *The array can be used with the function insert, it will return a struct like this :
- * in the first key (av_textX), X is the ATTR_DEF::AD_ID
- \verbatim
- Example
- Array
- (
- [av_text1] => Nom
- [av_text12] => Personne de contact
- [av_text5] => Poste Comptable
- [av_text13] => numéro de tva
- [av_text14] => Adresse
- [av_text15] => code postal
- [av_text24] => Ville
- [av_text16] => pays
- [av_text17] => téléphone
- [av_text18] => email
- [av_text23] => Quick Code
- )
-
- \endverbatim
- *\param $pfd_id FICHE_DEF::FD_ID
- *\return an array of attribute
- *\exception Exception if the cat of card doesn't exist, Exception.getCode()=1
- *\see fiche::insert()
+ /*!
+ * \brief turn a card into an array , then it can be saved thanks update or insert
+ * \see Fiche::insert , Fiche::update
+ *
*/
- function to_array($pfd_id)
+ function to_array()
{
- $sql="select 'av_text'||to_char(ad_id,'9999') as key,".
- " ad_text ".
- " from fiche_def join jnt_fic_attr using (fd_id)".
- " join attr_def using (ad_id) ".
- " where fd_id=$1 order by jnt_order";
- $ret=$this->cn->get_array($sql,array($pfd_id));
- if ( empty($ret)) throw new Exception(_('Cette categorie de card n\'existe pas').' '.$pfd_id,1);
- $array=array();
- foreach($ret as $idx=>$val)
- {
- $a=str_replace(' ','',$val['key']);
- $array[$a]=$val['ad_text'];
+ $array=$this->cn->get_array("select 'av_text'||fd.ad_id::text \"key\", ad_value
+ from fiche_detail fd
+ join fiche f using (f_id)
+ join jnt_fic_attr jfa using (fd_id,ad_id)
+ where
+ f.f_id=$1
+ order by jfa.jnt_order",[$this->id]);
+ if ( empty ($array) ) return array();
+ $a_return=[];
+ foreach ($array as $row) {
+ $key=$row['key'];$value=$row['ad_value'];
+ $a_return[$key]=$value;
}
- return $array;
-
+ $a_return['f_enable']=$this->get_f_enable();
+ return $a_return;
}
/*!
* \brief insert a new record
@@ -1019,7 +997,8 @@ class Fiche
return;
}
- /*!\brief update a card
+ /*!
+ * \brief update a card with an array
*/
function update($p_array=null)
{
diff --git a/include/class/fiche_def.class.php b/include/class/fiche_def.class.php
index 82f46ce4e..e92d3a27d 100644
--- a/include/class/fiche_def.class.php
+++ b/include/class/fiche_def.class.php
@@ -807,6 +807,51 @@ $order
echo HtmlInput::submit("add_modele" ,_("Sauve"));
echo '';
}
+ /**
+ * @brief make an array of attributes of the category of card (FICHE_DEF.FD_ID)
+ *The array can be used with the function insert, it will return a struct like this :
+ * in the first key (av_textX), X is the ATTR_DEF::AD_ID
+ \verbatim
+ Example
+ Array
+ (
+ [av_text1] => Nom
+ [av_text12] => Personne de contact
+ [av_text5] => Poste Comptable
+ [av_text13] => numéro de tva
+ [av_text14] => Adresse
+ [av_text15] => code postal
+ [av_text24] => Ville
+ [av_text16] => pays
+ [av_text17] => téléphone
+ [av_text18] => email
+ [av_text23] => Quick Code
+ )
+
+ \endverbatim
+ *\param $pfd_id FICHE_DEF::FD_ID
+ *\return an array of attribute
+ *\exception Exception if the cat of card doesn't exist, Exception.getCode()=1
+ *\see fiche::insert()
+ */
+ function to_array()
+ {
+ $sql="select 'av_text'||to_char(ad_id,'9999') as key,".
+ " ad_text ".
+ " from fiche_def join jnt_fic_attr using (fd_id)".
+ " join attr_def using (ad_id) ".
+ " where fd_id=$1 order by jnt_order";
+ $ret=$this->cn->get_array($sql,array($this->id));
+ if ( empty($ret)) throw new Exception(_('Cette categorie de card n\'existe pas').' '.$this->id,1);
+ $array=array();
+ foreach($ret as $idx=>$val)
+ {
+ $a=str_replace(' ','',$val['key']);
+ $array[$a]=$val['ad_text'];
+ }
+ return $array;
+
+ }
}
?>
diff --git a/include/class/pre_op_ven.class.php b/include/class/pre_op_ven.class.php
index 0386654d4..8190dd76d 100644
--- a/include/class/pre_op_ven.class.php
+++ b/include/class/pre_op_ven.class.php
@@ -163,7 +163,7 @@ class Pre_op_ven extends Pre_operation_detail
{
global $g_parameter,$g_user;
- $ledger=new Acc_Ledger_Sold($this->db,$p_array['p_jrn']);
+ $ledger=new Acc_Ledger_Sale($this->db,$p_array['p_jrn']);
$flag_tva=$g_parameter->MY_TVA_USE;
/* Add button */
$f_add_button=new IButton('add_card');
diff --git a/include/class/print_ledger_detail_item.class.php b/include/class/print_ledger_detail_item.class.php
index bb3f602c1..8dc07f251 100644
--- a/include/class/print_ledger_detail_item.class.php
+++ b/include/class/print_ledger_detail_item.class.php
@@ -90,7 +90,7 @@ class Print_Ledger_Detail_Item extends Print_Ledger
switch ($jrn_type)
{
case 'VEN':
- $ledger=new Acc_Ledger_Sold($this->cn, $this->get_ledger()->jrn_def_id);
+ $ledger=new Acc_Ledger_Sale($this->cn, $this->get_ledger()->jrn_def_id);
$ret_detail=$ledger->get_detail_sale($this->get_from(),$this->get_to(), $this->filter_operation);
break;
case 'ACH':
diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php
index 0e301ab70..b9795c3fd 100644
--- a/include/compta_ven.inc.php
+++ b/include/compta_ven.inc.php
@@ -39,7 +39,7 @@ $post_jrn=$http->post("p_jrn", "string","");
// empty form for encoding
//----------------------------------------------------------------------
- $Ledger=new Acc_Ledger_Sold($cn,0);
+ $Ledger=new Acc_Ledger_Sale($cn,0);
// Check privilege
if ( isset($_REQUEST['p_jrn']) &&
@@ -54,7 +54,7 @@ $post_jrn=$http->post("p_jrn", "string","");
if ( isset ($_POST['view_invoice'] ) )
{
$p_jrn=$http->post("p_jrn","number");
- $Ledger=new Acc_Ledger_Sold($cn,$p_jrn);
+ $Ledger=new Acc_Ledger_Sale($cn,$p_jrn);
try
{
$Ledger->verify_operation($_POST);
@@ -103,7 +103,7 @@ $post_jrn=$http->post("p_jrn", "string","");
exit -1;
}
- $Ledger=new Acc_Ledger_Sold($cn,$post_jrn);
+ $Ledger=new Acc_Ledger_Sale($cn,$post_jrn);
try
{
$Ledger->verify_operation($_POST);
@@ -121,7 +121,7 @@ $post_jrn=$http->post("p_jrn", "string","");
else
echo '
';
- $Ledger=new Acc_Ledger_Sold($cn,$_POST['p_jrn']);
+ $Ledger=new Acc_Ledger_Sale($cn,$_POST['p_jrn']);
$internal=$Ledger->insert($_POST);
/* Save the predefined operation */
@@ -197,7 +197,7 @@ $post_jrn=$http->post("p_jrn", "string","");
// ------------------------------
$array=(isset($_POST['correct'])||isset ($correct))?$_POST:null;
-$Ledger=new Acc_Ledger_Sold($cn,0);
+$Ledger=new Acc_Ledger_Sale($cn,0);
//
// pre defined operation
//
diff --git a/include/constant.php b/include/constant.php
index 884f5f72f..fccfb18cc 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -383,7 +383,7 @@ function noalyss_class_autoloader($class) {
"acc_ledger_info" => "class/acc_ledger_info.class.php",
"acc_ledger_purchase" => "class/acc_ledger_purchase.class.php",
"acc_ledger_search" => "class/acc_ledger_search.class.php",
- "acc_ledger_sold" => "class/acc_ledger_sold.class.php",
+ "acc_ledger_sale" => "class/acc_ledger_sale.class.php",
"acc_operation" => "class/acc_operation.class.php",
"acc_detail" => "class/acc_operation.class.php",
"acc_sold" => "class/acc_operation.class.php",
diff --git a/include/export/export_ledger_csv.php b/include/export/export_ledger_csv.php
index 1d0a6455f..51deda383 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -112,10 +112,10 @@ if ( $get_option=="E")
switch ($jrn_type)
{
case 'VEN':
- $ledger=new Acc_Ledger_Sold($cn, $get_jrn);
+ $ledger=new Acc_Ledger_Sale($cn, $get_jrn);
$ret_detail=$ledger->get_detail_sale($get_from_periode,
$get_to_periode,$filter_operation);
- $a_heading=Acc_Ledger_Sold::heading_detail_sale();
+ $a_heading=Acc_Ledger_Sale::heading_detail_sale();
break;
case 'ACH':
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index b51eeb07d..64cbb55b5 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1352,7 +1352,7 @@ function get_array_column($p_array,$key)
*/
function factory_Ledger(Database &$p_cn, $ledger_id)
{
- include_once NOALYSS_INCLUDE.'/class/acc_ledger_sold.class.php';
+ include_once NOALYSS_INCLUDE.'/class/acc_ledger_sale.class.php';
include_once NOALYSS_INCLUDE.'/class/acc_ledger_purchase.class.php';
include_once NOALYSS_INCLUDE.'/class/acc_ledger_fin.class.php';
@@ -1362,7 +1362,7 @@ function factory_Ledger(Database &$p_cn, $ledger_id)
switch ($type)
{
case 'VEN':
- $obj=new Acc_Ledger_Sold($p_cn, $ledger_id);
+ $obj=new Acc_Ledger_Sale($p_cn, $ledger_id);
break;
case 'ACH':
$obj=new Acc_Ledger_Purchase($p_cn, $ledger_id);
diff --git a/scenario/FicheTest.php b/scenario/FicheTest.php
index f769c9bf0..0978d1c1b 100644
--- a/scenario/FicheTest.php
+++ b/scenario/FicheTest.php
@@ -21,8 +21,8 @@
/**
* @file
- * @brief
- * @param type $name Descriptionara
+ * @brief Test , experiment the class Fiche
+ * @see Fiche
*/
$_GET=array (
@@ -47,10 +47,10 @@ $card_count=$cn->get_array("select count(*),f_id ".
" where ".
" f_id is not null ".
"group by f_id order by count(*) desc");
-$a=new Fiche($cn,$card_count[0]['f_id']);
+$fiche=new Fiche($cn,$card_count[0]['f_id']);
-$result=$a->get_row($min,$max);
-$result_date=$a->get_row_date('01.01.2010','01.01.2090');
+$result=$fiche->get_row($min,$max);
+$result_date=$fiche->get_row_date('01.01.2010','01.01.2090');
if ( count($result_date) != count($result)) {
echo "Erreur";
@@ -63,3 +63,5 @@ echo h1("Fiche->get_row_date");
var_dump($result_date);
+echo h1("to_array");
+var_dump($fiche->to_array());
diff --git a/unit-test/create-dossier-test.sh b/unit-test/create-dossier-test.sh
index a213c1fee..4a61cba3c 100755
--- a/unit-test/create-dossier-test.sh
+++ b/unit-test/create-dossier-test.sh
@@ -2,9 +2,14 @@
export PGCLUSTER=10/main
DOSSIER_TEST=rel70dossier25
-FILE_TEST=dossiertest210607-1503.sql
+FILE_TEST=dossiertest210620-1111.sql
dropdb $DOSSIER_TEST
+if [ $? -ne 0 ] ; then
+ echo cannot drop $DOSSIER_TEST
+ exit 1
+fi
+
createdb $DOSSIER_TEST
psql -X $DOSSIER_TEST < db/$FILE_TEST
diff --git a/unit-test/global.php b/unit-test/global.php
index 96911f43d..2b956abd3 100644
--- a/unit-test/global.php
+++ b/unit-test/global.php
@@ -37,6 +37,7 @@ $_SESSION[SESSION_KEY.'g_pagesize']='50';
$_SESSION[SESSION_KEY.'csv_fieldsep']='0';
$_SESSION[SESSION_KEY.'csv_decimal']='1';
$_SESSION[SESSION_KEY.'csv_encoding']='utf8';
+$_SESSION[SESSION_KEY.'access_mode']='PC';
$g_user=new User($g_connection);
require_once __DIR__.'/facility.class.php';
diff --git a/unit-test/include/class/acc_ledger_purchase.Test.php b/unit-test/include/class/acc_ledger_purchase.Test.php
index 499a003c9..cab33bfba 100644
--- a/unit-test/include/class/acc_ledger_purchase.Test.php
+++ b/unit-test/include/class/acc_ledger_purchase.Test.php
@@ -5,6 +5,7 @@ use PHPUnit\Framework\TestCase;
/**
* @backupGlobals enabled
* @coversDefaultClass Acc_Ledger_Purchase
+ * @covers Fiche
*
*/
class Acc_Ledger_PurchaseTest extends TestCase
@@ -120,11 +121,13 @@ class Acc_Ledger_PurchaseTest extends TestCase
$this->clean_operation();
$this->assertEquals(0,
- $g_connection->get_value ("select count(*) from jrn where jr_mt=$1",["1572704002.1732"]));
+ $g_connection->get_value ("select count(*) from jrn where jr_mt=$1",["1572704002.1732"]),
+ "avant les test verifie operation n'existe pas");
$this->object->insert($array);
$this->assertEquals(1,
- $g_connection->get_value ("select count(*) from jrn where jr_mt=$1",["1572704002.1732"]));
+ $g_connection->get_value ("select count(*) from jrn where jr_mt=$1",["1572704002.1732"]),
+ "Operation Achat sauvée");
$this->clean_operation();
// If some data are corruptes
@@ -155,7 +158,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
"tvac_march1"=>22.08));
$this->object->insert($array);
- $this->assertEquals(0,$g_connection->get_value("select count(*) ".$sql));
+ $this->assertEquals(0,$g_connection->get_value("select count(*) ".$sql),"Quantite == 0 pas d'enregistrement");
$this->clean_operation();
// Test space in e_march0_price instead of zero must be
@@ -178,7 +181,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
"tva_march1"=>3.83,
"tvac_march1"=>22.08));
$this->object->insert($array);
- $this->assertEquals(3.83,$g_connection->get_value("select qp_vat ".$sql));
+ $this->assertEquals(3.83,$g_connection->get_value("select qp_vat ".$sql),"Calcul TVA en EUR");
$this->clean_operation();
// Test space in e_march0_tva_amount instead of zero must be calculated
@@ -201,13 +204,85 @@ class Acc_Ledger_PurchaseTest extends TestCase
$this->object->insert($array);
// en USD , 22.08 = 20.26€ * 1.09
- $this->assertEquals(20.26,$g_connection->get_value("select qp_vat ".$sql));
+ $this->assertEquals(20.26,$g_connection->get_value("select qp_vat ".$sql),"Calcul TVA en USD");
$this->clean_operation();
+
+ }
+
+ /**
+ * @covers Acc_Ledger_Purchase::insert
+ * @covers Fiche_Def::insertAttribut
+ * @covers Fiche_Def::removeAttribut
+ */
+ public function testInsertPurchase_No_Ded()
+ {
+ global $g_connection;
+ // modify attribute for card category , add VAT non ded, Tax non ded , VAT completely non ded 0%
+ // category Misc Services & goods (5)
+ $fiche_def=new Fiche_Def($g_connection,5);
+ // prepare test , clean
+ $fiche_def->RemoveAttribut([20,21,22,51,52,53]);
+ $this->assertEquals(35,$g_connection->get_value("select count(*) from fiche_detail join fiche using (f_id)
+ where fd_id=5"),"Efface 6 attributs");
+ // percent deductible
+ $fiche_def->InsertAttribut(20);
+ $fiche_def->InsertAttribut(21);
+ $fiche_def->InsertAttribut(22);
+
+ // accouting for not deductible
+ $fiche_def->InsertAttribut(51);
+ $fiche_def->InsertAttribut(52);
+ $fiche_def->InsertAttribut(53);
+
+ // check that all card has these attributes
+ $this->assertEquals(77,$g_connection->get_value("select count(*) from fiche_detail join fiche using (f_id)
+ where fd_id=5"),"Ajout 6 attributs");
+
+
+
+
+ //-- modify card 29 : ELECTR
+ $fiche=new Fiche($g_connection,29);
+ $fiche->set_f_enable("1");
+ $a_attribut=$fiche->to_array();
+ $a_attribut['av_text20']= "33.33";
+ $this->assertEquals($a_attribut['av_text20'],33.33,"Attribut 20 set to 33%");
+
+ $fiche->update($a_attribut);
+
+ $this->assertEquals("33.33",$g_connection->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=$2",[29,20]),"Attribut ad_id 20 inserted");
+ $array=$this->array;
+
+ $array['e_march0']='ELECTR';
+ $array['e_march0_tva_id']='1';
+ $array['tva_march0']=bcmul($array['e_march0_tva_amount'],0.21,2);
+ $array['tvac_march0']=bcmul ($array['htva_march0'],1.21,2);
+ $array['mt']='no-ded-33';
+ $this->clean_operation($array['mt']);
+
+ $this->object->insert($array);
+
+ $row_quant=$g_connection->get_row("select * from quant_purchase where qp_internal in
+ ( select jr_internal from jrn where jr_mt=$1)",[$array["mt"]]);
+ $this->assertFalse(empty($row_quant)," row inserted in quant_fin");
+
+ // unit price not rounded
+ $this->assertEquals(603.8990,$row_quant['qp_unit']);
+
+ // rounded to 2 decimal
+ $this->assertEquals(603.9000,$row_quant['qp_price']);
+
+ $this->assertEquals(201.2800,$row_quant['qp_nd_amount']);
+
+ $this->clean_operation($array['mt']);
+ // end test clean
+ // $fiche_def->RemoveAttribut([20,21,22,51,52,53]);
+
}
/**
- * @covers Acc_Ledger_Purchase::input
+ * @covers Acc_Ledger_Purchase::input
*/
public function testInput()
{
@@ -240,13 +315,13 @@ class Acc_Ledger_PurchaseTest extends TestCase
$this->assertContains('NAME="e_quant0" VALUE="1">',$ret);
}
- private function clean_operation()
+ private function clean_operation($p_internal='1572704002.1732')
{
global $g_connection;
$g_connection->exec_sql("delete from quant_purchase where j_id in ("
. " select j_id from jrnx join jrn on (jr_grpt_id = j_grpt) where "
- . " jr_mt=$1 ) ", ["1572704002.1732"]);
- $g_connection->exec_sql("delete from jrn where jr_mt=$1", ["1572704002.1732"]);
+ . " jr_mt=$1 ) ", [$p_internal]);
+ $g_connection->exec_sql("delete from jrn where jr_mt=$1", [$p_internal]);
$g_connection->exec_sql("delete from jrnx where j_grpt not in (select jr_grpt_id from jrn)");
$g_connection->exec_sql("alter sequence s_jrn_pj3 restart with 52");
diff --git a/unit-test/include/class/acc_ledger_sold.Test.php b/unit-test/include/class/acc_ledger_sale.Test.php
similarity index 92%
rename from unit-test/include/class/acc_ledger_sold.Test.php
rename to unit-test/include/class/acc_ledger_sale.Test.php
index d516bbe14..92771de7c 100644
--- a/unit-test/include/class/acc_ledger_sold.Test.php
+++ b/unit-test/include/class/acc_ledger_sale.Test.php
@@ -4,13 +4,13 @@ use PHPUnit\Framework\TestCase;
/**
* @backupGlobals enabled
- * @coversDefaultClass Acc_Ledger_Sold
+ * @coversDefaultClass Acc_Ledger_Sale
*/
-class Acc_Ledger_SoldTest extends TestCase
+class Acc_Ledger_SaleTest extends TestCase
{
/**
- * @var Acc_Ledger_Sold
+ * @var Acc_Ledger_Sale
*/
protected $object;
@@ -27,7 +27,7 @@ class Acc_Ledger_SoldTest extends TestCase
protected function setUp()
{
include 'global.php';
- $this->object=new Acc_Ledger_Sold($g_connection, 2);
+ $this->object=new Acc_Ledger_Sale($g_connection, 2);
$this->array=array(
"ledger_type"=>"VEN",
"ac"=>"COMPTA/VENMENU/VEN",
@@ -88,7 +88,7 @@ class Acc_Ledger_SoldTest extends TestCase
$g_connection->exec_sql("alter sequence s_jrn_pj2 restart with 40");
}
/**
- * @covers Acc_Ledger_Sold::verify
+ * @covers Acc_Ledger_Sale::verify
*/
public function testVerify()
{
@@ -97,7 +97,7 @@ class Acc_Ledger_SoldTest extends TestCase
}
/**
- * @covers Acc_Ledger_Sold::insert
+ * @covers Acc_Ledger_Sale::insert
*/
public function testInsert()
{
@@ -169,14 +169,14 @@ class Acc_Ledger_SoldTest extends TestCase
}
/**
- * @covers Acc_Ledger_Sold::confirm
+ * @covers Acc_Ledger_Sale::confirm
*/
public function testConfirm()
{
$array=$this->array;
$res=$this->object->confirm($array);
\Noalyss\Facility::save_file(__DIR__."/file"
- , "acc_ledger_sold_confirm.html"
+ , "Acc_Ledger_Sale_confirm.html"
, \Noalyss\Facility::page_start().$res);
$this->assertContains(
'',
@@ -188,14 +188,14 @@ class Acc_Ledger_SoldTest extends TestCase
/**
- * @covers Acc_Ledger_Sold::input
+ * @covers Acc_Ledger_Sale::input
* @todo Implement testInput().
*/
public function testInput()
{
global $g_connection;
$_REQUEST['ac']='VEN';
- $object=new Acc_Ledger_Sold($g_connection, 2);
+ $object=new Acc_Ledger_Sale($g_connection, 2);
$info=$object->input($this->array);
// var_dump($info);
@@ -203,7 +203,7 @@ class Acc_Ledger_SoldTest extends TestCase
{
$this->assertTrue(FALSE);
}
- \Noalyss\Facility::save_file(__DIR__."/file", "acc_ledger_sold_input.html",
+ \Noalyss\Facility::save_file(__DIR__."/file", "Acc_Ledger_Sale_input.html",
\Noalyss\Facility::page_start().
$info);
$this->assertContains(
@@ -216,7 +216,7 @@ class Acc_Ledger_SoldTest extends TestCase
/**
- * @covers Acc_Ledger_Sold::heading_detail_sale
+ * @covers Acc_Ledger_Sale::heading_detail_sale
* @todo Implement testHeading_detail_sale().
*/
public function testHeading_detail_sale()
@@ -225,7 +225,7 @@ class Acc_Ledger_SoldTest extends TestCase
$this->assertEquals(32,count($a));
}
/**
- * @covers Acc_Ledger_Sold::get_detail_sale
+ * @covers Acc_Ledger_Sale::get_detail_sale
*/
public function testget_detail_sale()
{
diff --git a/unit-test/include/class/print_LedgerTest.php b/unit-test/include/class/print_LedgerTest.php
index 9286dc1af..e6e676296 100644
--- a/unit-test/include/class/print_LedgerTest.php
+++ b/unit-test/include/class/print_LedgerTest.php
@@ -61,7 +61,7 @@ class print_LedgerTest extends TestCase
function testFactory()
{
global $g_connection;
- $ledger_sale=new Acc_Ledger_Sold($g_connection,2);
+ $ledger_sale=new Acc_Ledger_Sale($g_connection,2);
$p_from=$this->from;
$p_to=$this->to;
diff --git a/unit-test/include/class/print_ledger_detail_item.classTest.php b/unit-test/include/class/print_ledger_detail_item.classTest.php
index 56cbd24f0..ff5b96324 100644
--- a/unit-test/include/class/print_ledger_detail_item.classTest.php
+++ b/unit-test/include/class/print_ledger_detail_item.classTest.php
@@ -112,7 +112,7 @@ class Print_Ledger_Detail_ItemTest extends TestCase
//-------------------------------------------------------------------------------------------------------------
// Sale
//-------------------------------------------------------------------------------------------------------------
- $ledger_sale=new Acc_Ledger_Sold($g_connection,2);
+ $ledger_sale=new Acc_Ledger_Sale($g_connection,2);
// Paid
//-----------------
diff --git a/unit-test/include/class/print_ledger_simple.classTest.php b/unit-test/include/class/print_ledger_simple.classTest.php
index 1cf71058b..68779775a 100644
--- a/unit-test/include/class/print_ledger_simple.classTest.php
+++ b/unit-test/include/class/print_ledger_simple.classTest.php
@@ -116,7 +116,7 @@ class print_ledger_simpleTest extends TestCase
//-------------------------------------------------------------------------------------------------------------
// Sale
//-------------------------------------------------------------------------------------------------------------
- $ledger_sale=new Acc_Ledger_Sold($g_connection, 2);
+ $ledger_sale=new Acc_Ledger_Sale($g_connection, 2);
// Paid
//-----------------
diff --git a/unit-test/include/class/print_ledger_simple_without_vat.classTest.php b/unit-test/include/class/print_ledger_simple_without_vat.classTest.php
index 865aa804b..2081766b5 100644
--- a/unit-test/include/class/print_ledger_simple_without_vat.classTest.php
+++ b/unit-test/include/class/print_ledger_simple_without_vat.classTest.php
@@ -114,7 +114,7 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
//-------------------------------------------------------------------------------------------------------------
// Sale
//-------------------------------------------------------------------------------------------------------------
- $ledger_sale=new Acc_Ledger_Sold($g_connection, 2);
+ $ledger_sale=new Acc_Ledger_Sale($g_connection, 2);
// Paid
//-----------------
diff --git a/unit-test/test-file.sh b/unit-test/test-file.sh
index ef2be52bc..a312089dd 100755
--- a/unit-test/test-file.sh
+++ b/unit-test/test-file.sh
@@ -43,6 +43,6 @@ else
# $PHPUNIT --bootstrap bootstrap.php --whitelist $FILETOTEST --coverage-text=${FILETOTEST%.php}.txt --color $FILETOTEST
# $PHPUNIT --bootstrap $CUR_DIR/bootstrap.php --whitelist=$CUR_DIR/../include/class --coverage-html=coverage --color $FILETOTEST
- $PHPUNIT --bootstrap bootstrap.php $FILETOTEST --testdox-html ${FILETOTEST%.php}-testdox.html --color $FILETOTEST
+ $PHPUNIT --bootstrap bootstrap.php --whitelist=../include --coverage-html=coverage $FILETOTEST --testdox-html ${FILETOTEST%.php}-testdox.html --color $FILETOTEST
fi