Merge branch 'dev-7201' into entreprise

* dev-7201:
  Bug 1786: Comptabilité analytique : TVA non déductible bloque
  http_input , trim on array is invalid
  Test : correct test for Acc_Ledger_Factory : payment status
  Bug in reconcile for bank amount: total_invoice is null for FIN and ODS
  Bug : search
  Bug #1783 : les nombres commençant par zéro ne sont pas supportés
  zero is considered as empty value
  http_input replace empty by a value
  export historic card csv : column wrong
  Remove direct access to $http
  Documentation + bug cosmetic about TVA_SIDED : total operation shown instead of total_invoice (VAT REVERSED)
  Fix cosmetic + export histo CSV with operation filter
  Round VAT
  add forgotten file
  Change logo
  warning about session_start
  Acc_Ledger_Search , fix small bug + Test file
  Documentation
  TEST fix bug in acc_balanceTest
This commit is contained in:
Dany De Bontridder 2020-01-17 20:27:49 +01:00
commit cb0a8491de
28 changed files with 319 additions and 75 deletions

View file

@ -31,7 +31,7 @@ PROJECT_NAME = noalyss
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = Version-7.1
PROJECT_NUMBER = Version-7.2
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

BIN
html/image/logo7200.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -183,7 +183,7 @@ BODY {
left:0px;
top:20px;
/*! height: 15%; */
height: 15%;
}
#login_frm {
position:absolute;
@ -203,7 +203,7 @@ BODY {
width: 20rem;
}
}
@media only screen and (max-width : 1100px) {
@media only screen and (min-width : 1100px) {
#alternate_browser {
position:absolute;
bottom: 30px;
@ -229,7 +229,7 @@ BODY {
}
#recover_link {
position:absolute;
/*! top:397px; */
top:397px;
left:539px;
background-color: white;
width:auto;
@ -259,10 +259,10 @@ BODY {
#logo_id {
z-index: -1;
position: absolute;
width: 148px;
width: 140px;
left: 5px;
top: 22px;
height: 155px;
height: 140px;
}
#login_frm {
position:absolute;
@ -274,11 +274,11 @@ BODY {
width: 24rem;
}
#recover_link {
position:fixed;
position:absolute;
top:55%;
left:55%;
background-color: white;
margin-top:0px;
bottom: 10px;
}
#recover_box {

View file

@ -191,7 +191,7 @@ if (isset ($_REQUEST['reconnect']) && isset ($_REQUEST['backurl'])) {
}
echo '
<IMG SRC="image/logo7100.png" id="logo_id" alt="NOALYSS">
<IMG SRC="image/logo7200.png" id="logo_id" alt="NOALYSS">
<form id="login_frm" action="login.php" method="post" name="loginform">'.
'<h1>Noalyss</h1>'.
$goto .

View file

@ -1,5 +1,5 @@
<?php
session_start();
@session_start();
?>
<!doctype html>
<HTML><HEAD>
@ -79,7 +79,7 @@ session_start();
</head>
<body>
<p align="center">
<IMG SRC="image/logo7100.png" style="width: 400px;z-index:-1;position:fixed;top:30px;rigth:50px;opacity: 0.2" alt="NOALYSS">
<IMG SRC="image/logo7200.png" style="width: 400px;z-index:-1;position:fixed;top:30px;rigth:50px;opacity: 0.2" alt="NOALYSS">
</p>
<h1>NOALYSS : comptabilité - accountancy </h1>

View file

@ -270,7 +270,7 @@ function compute_number(value)
retval = eval(value);
} catch (e)
{
return 0;
return parseFloat(value);
}
/*pour gérer les divisions par 0*/
if (retval == Infinity)

View file

@ -42,11 +42,12 @@ $base=basename($_SERVER['SCRIPT_NAME']);
$inside=false;
$tiers=$http->get("tiers", "string", "");
// With the amount id, we find the amount in a html elt
$http->set_empty(0);
if (isset($_GET['amount_id']))
{
put_global(array(
array("key"=>'amount_min', 'value'=>$_GET['amount_id']),
array("key"=>'amount_max', 'value'=>$_GET['amount_id'])
array("key"=>'amount_min', 'value'=>$http->get('amount_id',"number",0)),
array("key"=>'amount_max', 'value'=>$http->get('amount_id',"number",0))
));
}
$target=$http->get("target", "string", "");
@ -93,12 +94,14 @@ if (isset($_GET['viewsearch']))
// Navigation bar
$step=MAX_RECONCILE;
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
$page=$http->get("page","number",1);
$offset=$http->get("offset","number",0);
if (count($_GET)==0)
$array=null;
else
$array=$_GET;
$array['p_action']='ALL';
if (!isset($array['date_start'])||!isset($array['date_end']))
{

View file

@ -412,7 +412,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$p_acc_operation->poste = $dna;
$p_acc_operation->desc=$this->find_label($dna)." ND_TVA ".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE);
$j_id = $p_acc_operation->insert_jrnx();
if ( $g_parameter->MY_ANALYTIC != "nu" )
if ( $g_parameter->MY_ANALYTIC != "nu"
&& $g_parameter->match_analytic($p_fiche->strAttribut(ATTR_DEF_ACCOUNT))
)
{
$op=new Anc_Operation($this->db);
$op->oa_group=$p_group;
@ -451,7 +453,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger
if ($p_nd_amount->nd_ded_vat > 0)
$p_tot_debit = bcadd($p_tot_debit, $p_nd_amount->nd_ded_vat);
$j_id = $p_acc_operation->insert_jrnx();
if ( $g_parameter->MY_ANALYTIC != "nu" )
if ( $g_parameter->MY_ANALYTIC != "nu"
&& $g_parameter->match_analytic($p_fiche->strAttribut(ATTR_DEF_ACCOUNT))
)
{
$op=new Anc_Operation($this->db);
$op->oa_group=$p_group;

View file

@ -19,8 +19,7 @@
*/
// Copyright (2016) Author Dany De Bontridder <dany@alchimerys.be>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
// if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
/**
* @file
@ -36,8 +35,8 @@ class Acc_Ledger_Search
/**
* @brief return a HTML string with the form for the search
* @param $p_type if the type of ledger possible values=ALL,VEN,ACH,ODS,FIN
* @param $all_type_ledger
* @param $p_type if the type of ledger possible values=ALL,VEN,ACH,ODS,FIN: uppercase !
* @param $all_type_ledger
* values :
* - 1 means all the ledger of this type
* - 0 No have the "Tous les journaux" availables
@ -50,7 +49,7 @@ class Acc_Ledger_Search
function __construct($p_type, $p_all=1, $p_div="")
{
$this->cn=Dossier::connect();
$this->type=$p_type;
$this->set_type($p_type);
$this->all=$p_all;
$this->div=$p_div;
}
@ -72,6 +71,10 @@ class Acc_Ledger_Search
public function set_type($type)
{
if (! in_array($type, ["ALL","VEN","ACH","ODS","FIN"]))
{
throw new Exception ("ALS02 : type invalide $type",EXC_PARAM_VALUE);
}
$this->type=$type;
}
@ -265,7 +268,7 @@ class Acc_Ledger_Search
* @brief this function will create a sql stmt to use to create the list for
* the ledger,
* @param $p_array is usually the $_GET,
* @param $p_order the order of the row
* @param $p_order the order of the row --> not used
* @param $p_where is the sql condition if not null then the $p_array will not be used
* \note the p_action will be used to filter the ledger but gl means ALL
* struct array $p_array
@ -318,36 +321,81 @@ class Acc_Ledger_Search
case
when jrn_def_type='VEN' then
(select ad_value from fiche_detail where ad_id=1
and f_id=(select max(qs_client) from quant_sold join jrnx using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
and f_id=(select max(qs_client) from quant_sold join jrnx
using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt)
where e.jr_id=x.jr_id))
when jrn_def_type = 'ACH' then
(select ad_value from fiche_detail where ad_id=1
and f_id=(select max(qp_supplier) from quant_purchase join jrnx using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
(select ad_value
from fiche_detail
where ad_id=1
and f_id=(select max(qp_supplier) from quant_purchase
join jrnx using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
when jrn_def_type = 'FIN' then
(select ad_value from fiche_detail where ad_id=1
and f_id=(select qf_other from quant_fin where quant_fin.jr_id=x.jr_id))
end as name,
case
when jrn_def_type='VEN' then (select ad_value from fiche_detail where ad_id=32 and f_id=(select max(qs_client) from quant_sold join jrnx using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
when jrn_def_type = 'ACH' then (select ad_value from fiche_detail where ad_id=32 and f_id=(select max(qp_supplier) from quant_purchase join jrnx using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
when jrn_def_type = 'FIN' then (select ad_value from fiche_detail where ad_id=32 and f_id=(select qf_other from quant_fin where quant_fin.jr_id=x.jr_id))
when jrn_def_type='VEN' then
(select ad_value from fiche_detail
where ad_id=32
and f_id=(select max(qs_client)
from quant_sold
join jrnx using (j_id)
join jrn as e on (e.jr_grpt_id=j_grpt)
where e.jr_id=x.jr_id))
when jrn_def_type = 'ACH' then (select ad_value
from fiche_detail
where ad_id=32
and f_id=(select max(qp_supplier)
from quant_purchase
join jrnx using (j_id)
join jrn as e on (e.jr_grpt_id=j_grpt)
where e.jr_id=x.jr_id))
when jrn_def_type = 'FIN' then (select ad_value
from fiche_detail
where ad_id=32
and f_id=(select qf_other from quant_fin where quant_fin.jr_id=x.jr_id))
end as first_name,
case
when jrn_def_type='VEN' then (select ad_value from fiche_detail where ad_id=23 and f_id=(select max(qs_client) from quant_sold join jrnx using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
when jrn_def_type = 'ACH' then (select ad_value from fiche_detail where ad_id=23 and f_id=(select max(qp_supplier) from quant_purchase join jrnx using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
when jrn_def_type = 'FIN' then (select ad_value from fiche_detail where ad_id=23 and f_id=(select qf_other from quant_fin where quant_fin.jr_id=x.jr_id))
when jrn_def_type='VEN' then
(select ad_value
from fiche_detail
where ad_id=23
and f_id=(select max(qs_client)
from quant_sold
join jrnx using (j_id)
join jrn as e on (e.jr_grpt_id=j_grpt)
where e.jr_id=x.jr_id))
when jrn_def_type = 'ACH' then (select ad_value
from fiche_detail
where ad_id=23
and f_id=(select max(qp_supplier)
from quant_purchase
join jrnx using (j_id)
join jrn as e on (e.jr_grpt_id=j_grpt)
where e.jr_id=x.jr_id))
when jrn_def_type = 'FIN' then (select ad_value
from fiche_detail
where ad_id=23
and f_id=(select qf_other from quant_fin where quant_fin.jr_id=x.jr_id))
end as quick_code,
case
when jrn_def_type='VEN' then
(select sum(qs_price)+sum(vat) from
(select qs_internal,qs_price,case when qs_vat_sided<>0 then 0 else qs_vat end as vat from quant_sold where qs_internal=X.jr_internal) as ven_invoice
(select qs_internal,qs_price,case when qs_vat_sided<>0 then 0
else qs_vat end as vat
from quant_sold
where qs_internal=X.jr_internal) as ven_invoice
)
when jrn_def_type = 'ACH' then
(
select sum(qp_price)+sum(vat)+sum(qp_nd_tva)+sum(qp_nd_tva_recup)
from
(select qp_internal,qp_price,qp_nd_tva,qp_nd_tva_recup,qp_vat-qp_vat_sided as vat from quant_purchase where qp_internal=X.jr_internal) as invoice_purchase
(select qp_internal,qp_price,qp_nd_tva,qp_nd_tva_recup,qp_vat-qp_vat_sided as vat
from quant_purchase
where qp_internal=X.jr_internal) as invoice_purchase
)
else null
else jr_montant
end as total_invoice,
jr_date_paid,
to_char(jr_date_paid,'DD.MM.YY') as str_jr_date_paid,
@ -407,7 +455,7 @@ class Acc_Ledger_Search
$and='';
$g_user=new User($this->cn);
$p_action=$ledger_type;
$p_action=(isset ($ledger_type)) ? $ledger_type:$this->type;
if ($p_action=='')
$p_action='ALL';
if ($r_jrn==-1)
@ -571,6 +619,8 @@ class Acc_Ledger_Search
$where=$fil_ledger.$fil_amount.$fil_date.$fil_desc.$fil_sec.$fil_amount.
$fil_qcode.$fil_paid.$fil_account.$fil_date_paid.$fil_hide_operation;
$sql.=" where ".$where;
// Q?? Why do we return where if it is included in SQL ?
return array($sql, $where);
}
@ -583,6 +633,7 @@ class Acc_Ledger_Search
*/
function display_search_form()
{
$http=new HttpInput();
$r='';
$r.='<div id="search_form" style="display:none">';
$r.=HtmlInput::title_box(_('Recherche'), "search_form", "hide", "", "n");
@ -597,18 +648,18 @@ class Acc_Ledger_Search
$r.=HtmlInput::hidden('ac', $_REQUEST['ac']);
$r.=HtmlInput::hidden('ac', $http->request('ac'));
/* when called from commercial.php some hidden values are needed */
if (isset($_REQUEST['sa']))
$r.=HtmlInput::hidden("sa", $_REQUEST['sa']);
$r.=HtmlInput::hidden("sa", $http->request('sa'));
if (isset($_REQUEST['sb']))
$r.=HtmlInput::hidden("sb", $_REQUEST['sb']);
$r.=HtmlInput::hidden("sb", $http->request('sb'));
if (isset($_REQUEST['sc']))
$r.=HtmlInput::hidden("sc", $_REQUEST['sc']);
$r.=HtmlInput::hidden("sc", $http->request('sc'));
if (isset($_REQUEST['f_id']))
$r.=HtmlInput::hidden("f_id", $_REQUEST['f_id']);
$r.=HtmlInput::hidden("f_id", $http->request('f_id'));
@ -1063,7 +1114,7 @@ class Acc_Ledger_Search
}
$r.="<TD align=\"right\">";
$r.=( $positive!=0 )?"<font color=\"red\"> - ".nbm($row['jr_montant'])."</font>":nbm($row['jr_montant']);
$r.=( $positive!=0 )?"<font color=\"red\"> - ".nbm($row['total_invoice'])."</font>":nbm($row['total_invoice']);
$r.="</TD>";

View file

@ -361,6 +361,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$l = new Acc_Tva($this->db, $idx_tva);
$l->load();
$tva_item_currency = bcmul($amount, $l->get_parameter('rate'));
$tva_item=round($tva_item,2);
}
$tva_item=bcdiv($tva_item_currency,$p_currency_rate);
$tva_item=round($tva_item,2);

View file

@ -28,7 +28,7 @@ if (!defined('ALLOWED'))
*
*/
/**
* @class
* @class Anc_Account_Table
* @brief derived from Manage_Table_SQL ,
*/
require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
@ -90,4 +90,4 @@ class Anc_Account_Table extends Manage_Table_SQL
if ($is_error==0)return TRUE;
return FALSE;
}
}
}

View file

@ -32,7 +32,7 @@ require_once NOALYSS_INCLUDE.'/class/anc_print.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
/**
* @class
* @class Anc_Balance_Double
* @brief Print the crossed balance between 2 plan
*
*/

View file

@ -26,7 +26,7 @@
require_once NOALYSS_INCLUDE."/class/package_noalyss.class.php";
/**
* @class
* @class Package_Plugin
* @brief Manage the installation of plug
*/
class Package_Plugin extends Package_Noalyss

View file

@ -28,7 +28,7 @@ require_once NOALYSS_INCLUDE.'/database/fiche_def_ref_sql.class.php';
*/
/**
* @class
* @class Template_Card_Category
* @brief Manage the template of card category
*/
class Template_Card_Category extends Manage_Table_SQL

View file

@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE."/database/v_tva_rate_sql.class.php";
require_once NOALYSS_INCLUDE."/database/tva_rate_sql.class.php";
/**
* @class
* @class Tva_Rate_MTable
* @brief Configure the tva : code , rate, label ...
* When using Manage_Table_SQL
*/

View file

@ -181,13 +181,13 @@ else
if ($row['j_debit'] == 't')
{
$export->add($row['j_montant'],"number");
$export->add("");
$export->add(0,"number");
$amount_deb=bcadd($amount_deb,$row['j_montant']);
$prog = bcadd($prog, $row['j_montant']);
}
else
{
$export->add("");
$export->add(0,"number");
$export->add($row['j_montant'],"number");
$amount_cred=bcadd($amount_cred,$row['j_montant']);
$prog = bcsub($prog, $row['j_montant']);

View file

@ -30,6 +30,7 @@ require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
$gDossier=dossier::id();
$cn=Dossier::connect();
$http=new HttpInput();
require_once NOALYSS_INCLUDE.'/class/user.class.php';
@ -40,7 +41,7 @@ $export->send_header();
if ( isset ($_GET['fd_id']))
{
$fiche_def=new Fiche_Def($cn,$_GET ['fd_id']);
$fiche_def=new Fiche_Def($cn,$http->get('fd_id',"number"));
$fiche=new Fiche($cn);
$e=$fiche_def->get_by_type();
$o=0;

View file

@ -22,7 +22,7 @@
/*! \file
* \brief create GL comptes as CSV.
* Argument $_GET
* @code
@code
* Array
(
[gDossier] => 10104
@ -35,7 +35,7 @@
[from_poste] =>
[to_poste] =>
)
* @encode
@encode
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');

View file

@ -26,7 +26,10 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php';
$ledger=new Acc_Ledger_Search($cn,0);
$http=new HttpInput();
$ledger=new Acc_Ledger_Search($http->get("ledger_type"),0);
list($sql,$where)=$ledger->build_search_sql($_GET);
$order=" order by jr_date_order asc,substring(jr_pj_number,'[0-9]+$')::numeric asc ";

View file

@ -128,7 +128,8 @@ echo dossier::hidden();
list($count, $html) = $Ledger->list_operation($sql, $offset, $ask_pay);
echo $html;
echo $bar;
$r = HtmlInput::get_to_hidden(array('search_opnb_jrn',
$r = HtmlInput::get_to_hidden(array('search_opnb_jrn',
'operation_filter',
'search_opqcode',
'l',
'date_start',
@ -154,7 +155,7 @@ if (isset($_GET['r_jrn']))
}
if (isset($_GET['search_opr_jrn']))
{
$a_search_opr_jrn=$http->get('search_opr_jrn','array');
$a_search_opr_jrn=$http->get('search_opr_jrn');
foreach ($a_search_opr_jrn as $k => $v)
if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
}
@ -168,8 +169,8 @@ echo '</form>';
* Export to csv
*/
$r = HtmlInput::get_to_hidden(array('l', 'date_paid_start','date_paid_end',
'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode',
'accounting', 'unpaid', 'gDossier', 'ledger_type', 'p_action'));
'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode','operation_filter',
'accounting', 'unpaid', 'gDossier', 'ledger_type', 'p_action'));
if (isset($_GET['search_opr_jrn']))
{
foreach ($a_search_opr_jrn as $k => $v)

View file

@ -34,13 +34,36 @@ class HttpInput
{
private $array;
private $empty; //!< if empty that replace by $empty
function _construct()
{
$this->array=null;
$this->empty="";
}
public function get_array()
{
return $this->array;
}
/**
public function get_empty()
{
return $this->empty;
}
public function set_array($array)
{
$this->array=$array;
return $this;
}
// $empty replace the empty value
public function set_empty($empty)
{
$this->empty=$empty;
return $this;
}
/**
* Check the type of the value
* @param $p_name name of the variable
* @param $p_type type of the variable (number,string,date,array)
@ -53,10 +76,17 @@ class HttpInput
{
// no check on string
if ($p_type=="string")
{
return;
}
// Check if number
else if ($p_type=="number")
{
if (trim($this->array[$p_name]) == "")
{
$this->array[$p_name]=$this->empty;
}
if ( isNumber($this->array[$p_name])==0 )
{
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
@ -67,6 +97,10 @@ class HttpInput
// Check if date dd.mm.yyyy
else if ($p_type=="date")
{
if (trim($this->array[$p_name]) == "" )
{
$this->array[$p_name]=$this->empty;
}
if (isDate($this->array[$p_name]) <> $this->array[$p_name])
{
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
@ -76,6 +110,10 @@ class HttpInput
}
else if ($p_type=="array")
{
if ( empty($this->array[$p_name]) )
{
$this->array[$p_name]=$this->empty;
}
if (!is_array($this->array[$p_name]) ) {
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
, EXC_PARAM_TYPE);

View file

@ -25,7 +25,7 @@
* @brief Inplace_edit class for ajax update of HtmlInput object
*/
/**
* @class
* @class Inplace_Edit
* @brief Inplace_edit class for ajax update of HtmlInput object.
* You need an ajax to response and modify the data. Some parameters will be sent
* by default when you click on the element
@ -205,4 +205,4 @@ EOF;
function set_message($p_str) {
$this->message=$p_str;
}
}
}

View file

@ -27,11 +27,10 @@ require_once NOALYSS_INCLUDE.'/lib/idate.class.php';
require_once NOALYSS_INCLUDE.'/lib/icard.class.php';
require_once NOALYSS_INCLUDE.'/lib/ispan.class.php';
/*! MenuAdmin */
/* \brief show the menu for user/database management
/*
/* \return HTML code with the menu
*/
/*! MenuAdmin
* \brief show the menu for user/database management
* \return HTML code with the menu
*/
function MenuAdmin()
{
@ -142,4 +141,4 @@ function menu_acc_plan($p_start=1)
<div style="clear: both"></div>
<?php
}
?>
?>

View file

@ -0,0 +1,10 @@
begin;
alter table user_filter rename unpaid to operation_filter;
alter table user_filter alter column operation_filter type text;
update user_filter set operation_filter = 'paid' where operation_filter is not null;
update user_filter set operation_filter = 'all' where operation_filter is null;
comment on column user_filter.operation_filter is 'Status of the operation : paid, unpaid or all operation';
alter table user_filter alter operation_filter set not null;
insert into version (val,v_description) values (141,'Search filter with operation status');
commit ;

View file

@ -80,7 +80,7 @@ echo $f_accounting->input(); ?>
<tr>
<td style="text-align:right;width:30em">
<?php echo _('Statut')?>
<?php echo _('Etat')?>
</td>
<td>

View file

@ -32,7 +32,7 @@ echo Dossier::hidden();
global $cn, $g_user, $g_succeed, $g_failed;
$cn=Dossier::connect();
$ledger_history=Acc_Ledger_History::factory($cn, $ledger, $min, $max, "E");
$ledger_history=Acc_Ledger_History::factory($cn, $ledger, $min, $max, "E","all");
echo h1("Detailled Accounting");
echo h2(_("export detail html all ledgers result = Detailled Accounting from Acc_Ledger_History_Generic"));
$ledger_history->export_detail_html();
@ -42,7 +42,7 @@ $ledger_history->set_m_mode("D");
$ledger_history->export_html();
echo h1(_("Only VEN from Acc_Ledger_History_Sale"));
$ledger_history=Acc_Ledger_History::factory($cn, [2], $min , $max , "L");
$ledger_history=Acc_Ledger_History::factory($cn, [2], $min , $max , "L","all");
$ledger_history->export_detail_html();
echo h2(_("Only VEN one line"));
@ -61,13 +61,13 @@ $ledger_history->set_m_mode("E");
$ledger_history->export_html();
echo h2("VEN + ACH");
$ledger_history=Acc_Ledger_History::factory($cn, [3,2], $min, $max , "L");
$ledger_history=Acc_Ledger_History::factory($cn, [3,2], $min, $max , "L","all");
$ledger_history->export_oneline_html();
echo h1("ACH from Acc_Ledger_History_Purchase");
echo h2("Detailled accouting");
$ledger_history=new Acc_Ledger_History_Purchase($cn,[3],$max,$min,"A");
$ledger_history=new Acc_Ledger_History_Purchase($cn,[3],$max,$min,"A","all");
$ledger_history->export_html();
echo h2("Ach one line");
$ledger_history->set_m_mode("L");
@ -81,7 +81,7 @@ $ledger_history->export_html();
echo h1("FIN from Acc_Ledger_History_Financial");
echo h2("Detailled accouting");
$ledger_history=new Acc_Ledger_History_Financial($cn,[11,16],$min,$max,"A");
$ledger_history=new Acc_Ledger_History_Financial($cn,[11,16],$min,$max,"A","all");
$ledger_history->export_html();
echo h2("FIN one line");
$ledger_history->set_m_mode("L");

View file

@ -0,0 +1,133 @@
<?php
use PHPUnit\Framework\TestCase;
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
if ( ! defined("ALLOWED")) {
define('ALLOWED',1);
}
/**
* @file
* @brief concern acc_ledger_search
* @coversDefaultClass acc_ledger_search
*/
class Acc_Ledger_Test extends TestCase
{
/**
* @var
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
include 'global.php';
global $g_user;
$g_user->set_periode(119);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @covers ::build_search_sql
*/
function test_all_ledger()
{
global $g_connection;
// all legder
$ledger=new Acc_Ledger_Search('ALL');
$result=$ledger->build_search_sql(NULL);
$a_result=$g_connection->get_array($result[0]);
$this->assertEquals(4,count($a_result));
$this->assertEquals(" jrn_def_id in (3,83,1,35,4,2,36,-1) and jr_date >= to_date('02.01.2019','DD.MM.YYYY')".
" and jr_date <= to_date('31.01.2019','DD.MM.YYYY')",$result[1]);
// Expect exception
try {
$ledger=new Acc_Ledger_Search('ALL1');
$this->assertTrue(FALSE,"Exception not thrown with invalide type");
} catch (Exception $e) {
$this->assertEquals($e->getCode(),1005,"Exception is type invalide");
}
}
/**
* @covers ::display_search_form
*/
function test_display_search_form()
{
put_global(array(["key"=>"ac","value"=>"phpunit"]));
$ledger=new Acc_Ledger_Search('ALL');
$r=$ledger->display_search_form();
$this->assertEquals(9068,strlen($r),"Size of the html string for display_search_form");
}
/**
* @covers ::build_search_filter
*/
function test_build_search_filter()
{
$ledger=new Acc_Ledger_Search('ALL');
$ret = $ledger->build_search_filter();
$result=sprintf("manage_search_filter({'div':'','ledger_type':'ALL','all_type':1,'dossier':%d})"
,Dossier::id());
$this->assertEquals($ret,$result,"Build filter for ALL");
$ledger=new Acc_Ledger_Search('FIN');
$this->assertEquals($ret,$result);
$ret = $ledger->build_search_filter();
$result=sprintf("manage_search_filter({'div':'','ledger_type':'FIN','all_type':1,'dossier':%d})"
,Dossier::id());
$this->assertEquals($ret,$result,"Build filter for FIN");
$ledger=new Acc_Ledger_Search('VEN');
$this->assertEquals($ret,$result);
$ret = $ledger->build_search_filter();
$result=sprintf("manage_search_filter({'div':'','ledger_type':'VEN','all_type':1,'dossier':%d})"
,Dossier::id());
$this->assertEquals($ret,$result,"Build filter for VEN");
$ledger=new Acc_Ledger_Search('ACH');
$this->assertEquals($ret,$result);
$ret = $ledger->build_search_filter();
$result=sprintf("manage_search_filter({'div':'','ledger_type':'ACH','all_type':1,'dossier':%d})"
,Dossier::id());
$this->assertEquals($ret,$result,"Build filter for ACH");
$ledger=new Acc_Ledger_Search('ODS');
$this->assertEquals($ret,$result);
$ret = $ledger->build_search_filter();
$result=sprintf("manage_search_filter({'div':'','ledger_type':'ODS','all_type':1,'dossier':%d})"
,Dossier::id());
$this->assertEquals($ret,$result,"Build filter for ODS");
}
}

View file

@ -148,7 +148,7 @@ class Acc_Ledger_SoldTest extends TestCase
$array["mt"]="1572714478.3155";
$array['e_march1_tva_amount']="";
$this->object->insert($array);
$this->assertEquals(254.6250,$g_connection->get_value("select qs_vat ".$sql));
$this->assertEquals(254.63,$g_connection->get_value("select qs_vat ".$sql));
$this->clean_operation();
// Test space in e_march1_tva_amount instead of zero must be calculated