Merge branch 'unstable' into pre-stable
* unstable: Code documentation improve record_log : add info in default syslog Improve Exception for accountancy ACH, VEN, ODS, FIN Bug #2400: TVA Non déductible et TVA autoliquidation improve : HtmlInput::filter_table filtre instead of Recherche Cosmetic : hightlight element in follow-up and plugin Fix : wrong file shown in description
This commit is contained in:
commit
090fe0e05b
21 changed files with 266 additions and 120 deletions
|
|
@ -518,6 +518,16 @@ tr.highlight {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* highlight a small element (span)
|
||||
*/
|
||||
.cell.highlight {
|
||||
color: darkred !important;
|
||||
background-color: lightgoldenrodyellow;
|
||||
color: antiquewhite !important;
|
||||
background-color: lightskyblue;
|
||||
padding: 2px 10px 2px 10px;
|
||||
}
|
||||
|
||||
td.odd{
|
||||
background-color:#DDE6FF;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ $nb_profile=count($a_profile);
|
|||
</td>
|
||||
<td>
|
||||
<?php echo h($a_plugin[$e]->me_description);?>
|
||||
<span style="display:block">
|
||||
<span style="display:block; font-style: italic">
|
||||
<?php
|
||||
printf(_("Installé par défaut dans %s"),$a_plugin[$e]->depend);
|
||||
printf(_("Installé par défaut dans le menu <span class=\" cell highlight\">AD: %s </span>"),$a_plugin[$e]->depend);
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
'nd_vat_rate'=>'nd_vat_rate',
|
||||
'amount_perso'=>'amount_perso',
|
||||
'amount_perso_rate'=>'amount_perso_rate' );
|
||||
* 'autoreverse'=>'autoreverse'
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -68,7 +69,8 @@ class Acc_Compute
|
|||
'amount_perso_rate'=>'amount_perso_rate',
|
||||
'amount_currency'=>'amount_currency',
|
||||
'amount_vat_currency'=>'amount_vat_currency',
|
||||
'currency_rate'=>'currency_rate'
|
||||
'currency_rate'=>'currency_rate',
|
||||
'autoreverse'=>'autoreverse'
|
||||
);
|
||||
|
||||
private $order; // check that the compute
|
||||
|
|
@ -196,7 +198,7 @@ class Acc_Compute
|
|||
|
||||
}
|
||||
|
||||
/**!
|
||||
/*!
|
||||
* \brief verify that all the amount are positive or null
|
||||
* otherwise throw a exception and the sum of amount + vat must
|
||||
* equal to the sum of all the amount of the current object
|
||||
|
|
|
|||
|
|
@ -1644,11 +1644,9 @@ class Acc_Ledger extends jrn_def_sql
|
|||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
record_log($e);
|
||||
record_log($e);
|
||||
$this->db->rollback();
|
||||
echo _('OPERATION ANNULEE ');
|
||||
echo '<hr>';
|
||||
echo __FILE__.__LINE__.$e->getMessage();
|
||||
echo_warning(_('OPERATION ANNULEE voir log'));
|
||||
exit();
|
||||
}
|
||||
$this->db->commit();
|
||||
|
|
|
|||
|
|
@ -979,6 +979,9 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
$acc_operation->pj=$e_pj;
|
||||
|
||||
$jr_id=$acc_operation->insert_jrn();
|
||||
if ( $jr_id == false )
|
||||
throw new Exception (_("Erreur de balance"),EXC_BALANCE);
|
||||
|
||||
// $acc_operation->update_receipt();
|
||||
$this->db->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($acc_operation->pj, $jr_id));
|
||||
$internal=$this->compute_internal_code($seq);
|
||||
|
|
@ -1096,13 +1099,10 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$r='<span class="error">'.
|
||||
'Erreur dans l\'enregistrement '.
|
||||
__FILE__.':'.__LINE__.' '.
|
||||
$e->getMessage();
|
||||
|
||||
$this->db->rollback();
|
||||
record_log($e);
|
||||
throw new Exception($r);
|
||||
throw $e;
|
||||
}
|
||||
$this->db->commit();
|
||||
if ($acc_currency->get_id()==0)
|
||||
|
|
|
|||
|
|
@ -556,22 +556,18 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
bcscale(4);
|
||||
// variable : $tot_amount float : total amount of the purchase (debit)
|
||||
$tot_amount=0;
|
||||
|
||||
// variable : $tot_tva float : total amount of the VAT
|
||||
$tot_tva=0;
|
||||
|
||||
// variable: $tot_debit float : amount on debit side
|
||||
$tot_debit=0;
|
||||
|
||||
$this->db->start();
|
||||
// variable : $tot_nd float total not Deductible
|
||||
$tot_nd=0;
|
||||
// variable : $tot_perso float total private amount
|
||||
$tot_perso=0;
|
||||
// variable : $tot_tva_nd float total vat not deductible
|
||||
$tot_tva_nd=0;
|
||||
|
||||
// variable : $tot_tva_ndded float total vat not deductible - deductible via another tax
|
||||
$tot_tva_ndded=0;
|
||||
|
||||
$tot_tva_reversed=0; //@todo to remove
|
||||
// variable: $tot_tva_reversed float total VAT autoreverse, to deduce from supplier's amount
|
||||
$tot_tva_reversed=0;
|
||||
|
||||
// variable : $tva array that will contain all the VAT Amount
|
||||
$tva=array();
|
||||
|
|
@ -579,6 +575,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
// variable : $tva_reverse array that contain all the VAT autoreverse AND negative
|
||||
$tva_reverse = array();
|
||||
|
||||
// variable : $tva_reverse_credit array that contain all the VAT autoreverse for credit
|
||||
$tva_reverse_credit = array();
|
||||
|
||||
// variable : $tot_amount_cur : total amount in currency
|
||||
$tot_amount_cur=0;
|
||||
|
||||
|
|
@ -600,7 +599,6 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
if ($g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$idx_tva=trim(${'e_march'.$i.'_tva_id'});
|
||||
\Noalyss\Dbg::echo_var(1," idx_tva [$idx_tva]",);
|
||||
$oTva=Acc_Tva::build($this->db,$idx_tva);
|
||||
|
||||
$oTva->load();
|
||||
|
|
@ -650,13 +648,16 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
|
||||
|
||||
/* compute ND */
|
||||
// variable: $save_amount_vat total float amount of VAT before changing due to NOT DEDUCTIBLE
|
||||
$save_amount_vat=$acc_amount->amount_vat;
|
||||
$this->compute_no_deductible($acc_amount, $fiche);
|
||||
$acc_amount->correct();
|
||||
// TVA which avoid
|
||||
$acc_amount->amount_unpaid=($tva_both == 1 ) ? $save_amount_vat :0 ;
|
||||
$tot_tva_reversed=bcadd($tot_tva_reversed,$acc_amount->amount_unpaid);
|
||||
|
||||
// TVA which avoid
|
||||
if ( $tva_both == 1 ) {
|
||||
$acc_amount->autoreverse=$save_amount_vat;
|
||||
$tot_tva_reversed=bcadd($tot_tva_reversed,$save_amount_vat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$tot_amount=round(bcadd($tot_amount,$acc_amount->amount),2);
|
||||
|
|
@ -700,13 +701,16 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
$tva_item=$acc_amount->amount_vat;
|
||||
$tva[$idx_tva]=(isset( $tva[$idx_tva]))? $tva[$idx_tva]:0;
|
||||
if ($tva_both == 0 || $tva_item >= 0){
|
||||
|
||||
if ($tva_both == 0 ){
|
||||
$tva[$idx_tva]=(isset( $tva[$idx_tva]))? $tva[$idx_tva]:0;
|
||||
$tva[$idx_tva]=bcadd($tva[$idx_tva], $tva_item);
|
||||
}else {
|
||||
// $tva_item < 0 && $tva_both == 1
|
||||
$tva_reverse[$idx_tva]=(isset($tva_reverse[$idx_tva]))?$tva_reverse[$idx_tva]:0;
|
||||
$tva_reverse[$idx_tva]=bcadd($tva_item,$tva_reverse[$idx_tva]);
|
||||
$tva_reverse_credit[$idx_tva]=(isset($tva_reverse_credit[$idx_tva]))?$tva_reverse_credit[$idx_tva]:0;
|
||||
$tva_reverse_credit[$idx_tva]=bcadd($save_amount_vat,$tva_reverse_credit[$idx_tva]);
|
||||
}
|
||||
}
|
||||
/* Save the stock */
|
||||
|
|
@ -760,7 +764,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
,$acc_amount->nd_ded_vat /* 10 */
|
||||
,$acc_amount->amount_perso /* 11 */
|
||||
,$e_client /* 12 */
|
||||
, $acc_amount->amount_unpaid /*13*/
|
||||
, $acc_amount->autoreverse /*13*/
|
||||
,$price_euro /* 14 */
|
||||
));
|
||||
|
||||
|
|
@ -783,7 +787,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
,$acc_amount->nd_ded_vat /* 10 */
|
||||
,$acc_amount->amount_perso /* 11 */
|
||||
,$e_client /* 12 */
|
||||
, $acc_amount->amount_unpaid /*13*/
|
||||
, $acc_amount->autoreverse /*13*/
|
||||
,$price_euro /* 14 */
|
||||
));
|
||||
}
|
||||
|
|
@ -890,30 +894,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$acc_operation->type='d';
|
||||
$acc_operation->periode=$tperiode;
|
||||
if ( $value > 0 ) $tot_debit=bcadd($tot_debit,abs($value));
|
||||
if ( $oTva->get_parameter("both_side") == 1 && $value ==0 ) continue;
|
||||
$acc_operation->insert_jrnx();
|
||||
// if TVA is on both side, we deduce it immediately
|
||||
|
||||
if ( $oTva->get_parameter("both_side")==1 )
|
||||
{
|
||||
// $x temp variable is the tva_reverse_account and will be used to check $poste_vat
|
||||
$x=$oTva->get_parameter("tva_reverse_account");
|
||||
$poste_vat =(trim($x??"")=="")? $oTva->get_side('c'):$x;
|
||||
if ( $poste_vat == '#')
|
||||
{
|
||||
$poste_vat=$oTva->get_side('d');
|
||||
}
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
$acc_operation->poste=$poste_vat;
|
||||
$acc_operation->amount=$value;
|
||||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
$acc_operation->type='c';
|
||||
$acc_operation->periode=$tperiode;
|
||||
$acc_operation->insert_jrnx();
|
||||
//if ( $value < 0 ) $tot_debit=bcadd($tot_debit,abs($value));
|
||||
}
|
||||
|
||||
} // LOOP : foreach $tva
|
||||
foreach ($tva_reverse as $i => $value) {
|
||||
|
|
@ -936,7 +917,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$acc_operation->insert_jrnx();
|
||||
|
||||
// if TVA is on both side, we deduce it immediately
|
||||
$poste_vat = $oTva->get_side('c');
|
||||
// $x temp variable is the tva_reverse_account and will be used to check $poste_vat
|
||||
$x=$oTva->get_parameter("tva_reverse_account");
|
||||
$poste_vat =(trim($x??"")=="")? $oTva->get_side('c'):$x;
|
||||
|
||||
if ( $poste_vat == '#')
|
||||
{
|
||||
$poste_vat=$oTva->get_side('d');
|
||||
|
|
@ -944,7 +928,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$acc_operation = new Acc_Operation($this->db);
|
||||
$acc_operation->date = $e_date;
|
||||
$acc_operation->poste = $poste_vat;
|
||||
$acc_operation->amount = $value;
|
||||
$acc_operation->amount = $tva_reverse_credit[$i];
|
||||
$acc_operation->grpt = $seq;
|
||||
$acc_operation->jrn = $p_jrn;
|
||||
$acc_operation->type = 'c';
|
||||
|
|
@ -952,7 +936,6 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$acc_operation->insert_jrnx();
|
||||
$tot_debit = bcadd($tot_debit, $value);
|
||||
$tot_debit = round($tot_debit, 2);
|
||||
$n_both = $value;
|
||||
} //LOOP: foreach $tva_reverse
|
||||
}
|
||||
|
||||
|
|
@ -963,10 +946,6 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
// Total DEB
|
||||
$acc_operation->amount=$this->db->get_value("select sum(j_montant) from jrnx where j_grpt = $1 and j_debit='t'",
|
||||
array($seq));
|
||||
if ( DEBUGNOALYSS > 1 ) {
|
||||
echo __LINE__." amount ".$acc_operation->amount."<br>";
|
||||
|
||||
}
|
||||
$acc_operation->desc=$e_comm;
|
||||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
|
|
@ -978,7 +957,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$acc_operation->currency_rate_ref=$currency_rate_ref->get_rate();
|
||||
|
||||
if ( ! $this->jr_id=$acc_operation->insert_jrn() ) {
|
||||
throw new Exception (_("Erreur de balance"));
|
||||
throw new Exception (_("Erreur de balance"),EXC_BALANCE);
|
||||
}
|
||||
$this->pj=$acc_operation->update_receipt();
|
||||
|
||||
|
|
@ -1162,14 +1141,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
}//end try
|
||||
catch (Exception $e)
|
||||
{
|
||||
record_log($e);
|
||||
echo '<span class="error">'.
|
||||
'Erreur dans l\'enregistrement '.
|
||||
__FILE__.':'.__LINE__.' '.
|
||||
$e->getMessage().$e->getMessage();
|
||||
record_log($e->getMessage());
|
||||
record_log($e);
|
||||
$this->db->rollback();
|
||||
throw new Exception($e);
|
||||
throw $e;
|
||||
}
|
||||
$this->db->commit();
|
||||
return $internal;
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ class Acc_Ledger_Sale extends Acc_Ledger {
|
|||
$acc_operation->currency_rate_ref=$currency_rate_ref->get_rate();
|
||||
|
||||
if ( ! $this->jr_id=$acc_operation->insert_jrn() ) {
|
||||
throw new Exception (_("Erreur de balance"));
|
||||
throw new Exception (_("Erreur de balance"),EXC_BALANCE);
|
||||
}
|
||||
|
||||
$this->pj = $acc_operation->update_receipt();
|
||||
|
|
@ -856,15 +856,9 @@ class Acc_Ledger_Sale extends Acc_Ledger {
|
|||
$acc_operation_note->save();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
record_log($e);
|
||||
echo '<span class="error">' .
|
||||
'Erreur dans l\'enregistrement ' .
|
||||
__FILE__ . ':' . __LINE__ . ' ' .
|
||||
$e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
|
||||
record_log($e);
|
||||
$this->db->rollback();
|
||||
throw new Exception ($e);
|
||||
throw $e;
|
||||
}
|
||||
$this->db->commit();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
/* !
|
||||
/*!
|
||||
* \file
|
||||
* \brief Manage the company setting : address, vat number, Check period, VAT,
|
||||
* CA ....
|
||||
|
|
|
|||
|
|
@ -105,7 +105,16 @@ if (isset($_POST['record']))
|
|||
echo '<div class="content">';
|
||||
|
||||
$Ledger = new Acc_Ledger_Purchase($cn, $post_jrn);
|
||||
$internal = $Ledger->insert($_POST);
|
||||
|
||||
try {
|
||||
$internal = $Ledger->insert($_POST);
|
||||
} catch (\Exception $e) {
|
||||
if ( $e->getCode()==EXC_BALANCE)
|
||||
echo_warning(_("enregistrement annulé: balance , voyer le fichier log"));
|
||||
else
|
||||
echo_warning($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Save the predefined operation */
|
||||
|
|
|
|||
|
|
@ -116,7 +116,16 @@ if ( isset($_POST['confirm']))
|
|||
echo '</div>';
|
||||
|
||||
echo '<div class="content">';
|
||||
$a= $Ledger->insert($_POST);
|
||||
try {
|
||||
$a= $Ledger->insert($_POST);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if ( $e->getCode()==EXC_BALANCE)
|
||||
echo_warning(_("enregistrement annulé: balance , voyer le fichier log"));
|
||||
else
|
||||
echo_warning($e->getMessage());
|
||||
return;
|
||||
}
|
||||
echo '<h1>'._('Enregistrement').' </h1>';
|
||||
echo '<div class="content">';
|
||||
echo $a;
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@
|
|||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/* * \file
|
||||
*
|
||||
*
|
||||
/**
|
||||
* \file
|
||||
* \brief show bank saldo
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -122,7 +122,18 @@ if ( isset($_POST['record']) )
|
|||
echo '<div class="content">';
|
||||
|
||||
$Ledger=new Acc_Ledger_Sale($cn,$_POST['p_jrn']);
|
||||
$internal=$Ledger->insert($_POST);
|
||||
try {
|
||||
$internal=$Ledger->insert($_POST);
|
||||
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
if ( $e->getCode()==EXC_BALANCE)
|
||||
echo_warning(_("enregistrement annulé: balance , voyer le fichier log"));
|
||||
else
|
||||
echo_warning($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Save the predefined operation */
|
||||
if ( isset($_POST['opd_name']) && trim($_POST['opd_name']) != "" )
|
||||
|
|
|
|||
|
|
@ -113,9 +113,6 @@ if (!defined('LOGINPUT')) {
|
|||
define("LOGINPUT", false);
|
||||
}
|
||||
|
||||
if (!defined('DEBUGNOALYSS')) {
|
||||
define('DEBUGNOALYSS', 0);
|
||||
}
|
||||
$version_noalyss = NOALYSS_VERSION;
|
||||
|
||||
// If you don't want to be notified of the update
|
||||
|
|
@ -158,6 +155,7 @@ if (DEBUGNOALYSS == 0) {
|
|||
ini_set("html_errors", 0);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('log_errors_max_len', 0);
|
||||
if(function_exists('xdebug_disable')) { xdebug_disable(); }
|
||||
} elseif (DEBUGNOALYSS == 1) {
|
||||
/* DEVELOPPEMENT : display all errors warning notice deprecated ...*/
|
||||
error_reporting(2147483647);
|
||||
|
|
@ -347,6 +345,8 @@ define('EXC_PARAM_TYPE', 1006);
|
|||
define('EXC_DUPLICATE', 1200);
|
||||
define('EXC_INVALID', 1400);
|
||||
define('EXC_FORBIDDEN', 1500);
|
||||
// exception when balance is incorrect when saving an operation
|
||||
define('EXC_BALANCE', 1501);
|
||||
define("UNPINDG", "");
|
||||
define("PINDG", "");
|
||||
|
||||
|
|
|
|||
|
|
@ -1335,22 +1335,63 @@ function is_msie()
|
|||
return $is_msie;
|
||||
}
|
||||
/**
|
||||
*@brief Record an error message into the log file of the server.
|
||||
*@brief Record an error message into the log file of the server or in the log folder of NOALYSS
|
||||
* Record also the GET and POST data
|
||||
* @param string $p_message
|
||||
* @param $p_message string message to display
|
||||
*/
|
||||
function record_log($p_message)
|
||||
{
|
||||
if ( gettype ($p_message) == "object" && method_exists($p_message,"getTraceAsString") == 1) {
|
||||
$date=date('d.m.y');
|
||||
// variable: $handle_log resource on log file ,
|
||||
$handle_log=fopen(NOALYSS_BASE."/log/noalyss-{$date}.log","a+");
|
||||
|
||||
error_log("noalyss exception ".$p_message->getMessage(),0);
|
||||
error_log("noalyss exception".$p_message->getTraceAsString(),0);
|
||||
if ($handle_log == false )
|
||||
{
|
||||
|
||||
if ( gettype ($p_message) == "object" && method_exists($p_message,"getTraceAsString") == 1) {
|
||||
|
||||
error_log("noalyss exception ".$p_message->getMessage(),0);
|
||||
error_log("noalyss exception".$p_message->getTraceAsString(),0);
|
||||
} else {
|
||||
error_log("noalyss".var_export($p_message,true),0);
|
||||
|
||||
}
|
||||
error_log("noalyss GET [".json_encode($_GET,0,10)."]");
|
||||
error_log("_POST [".json_encode($_POST,0,10)."]",0);
|
||||
} else {
|
||||
error_log("noalyss".var_export($p_message,true),0);
|
||||
if ( gettype ($p_message) == "object" && method_exists($p_message,"getTraceAsString") == 1) {
|
||||
|
||||
error_log("noalyss exception ".$p_message->getMessage(),0);
|
||||
error_log("noalyss exception".$p_message->getTraceAsString(),0);
|
||||
} else {
|
||||
error_log("noalyss".var_export($p_message,true),0);
|
||||
|
||||
}
|
||||
|
||||
$now=date('y-m-d H:i');
|
||||
fwrite ($handle_log,str_repeat("=", 80)."\n");
|
||||
fwrite ($handle_log,"ERROR: {$now}\n");
|
||||
fwrite($handle_log,"noalyss GET [".var_export($_GET,true)."]");
|
||||
fwrite ($handle_log,"\n");
|
||||
fwrite($handle_log,"_POST [".var_export($_POST,true)."]");
|
||||
fwrite ($handle_log,"\n");
|
||||
if ( gettype ($p_message) == "object" && method_exists($p_message,"getTraceAsString") == 1) {
|
||||
|
||||
fwrite($handle_log,"noalyss exception ".$p_message->getMessage());
|
||||
fwrite ($handle_log,"\n");
|
||||
fwrite($handle_log,"noalyss exception".$p_message->getTraceAsString());
|
||||
fwrite ($handle_log,"\n");
|
||||
} else {
|
||||
fwrite($handle_log,"noalyss".var_export($p_message,true));
|
||||
fwrite ($handle_log,"\n");
|
||||
|
||||
}
|
||||
|
||||
fwrite ($handle_log,str_repeat("=", 80)."\n");
|
||||
|
||||
|
||||
}
|
||||
error_log("noalyss GET [".json_encode($_GET,0,10)."]");
|
||||
error_log("_POST [".json_encode($_POST,0,10)."]",0);
|
||||
|
||||
}
|
||||
if(!function_exists('tracedebug')) {
|
||||
function tracedebug($file,$var, $label = NULL) {
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,7 @@ class HtmlInput
|
|||
$r="
|
||||
<span>
|
||||
<span class=\"icon\" ></span>
|
||||
<input id=\"lk_".$p_table_id."\" name=\"$p_name\" value=\"$p_old_value\"autocomplete=\"off\" class=\"input_text\" name=\"filter\" onkeyup=\"filter_table(this, '$p_table_id','$p_col',$start_row )\" type=\"text\" placeholder=\""._("Recherche")."\">
|
||||
<input id=\"lk_".$p_table_id."\" name=\"$p_name\" value=\"$p_old_value\"autocomplete=\"off\" class=\"input_text\" name=\"filter\" onkeyup=\"filter_table(this, '$p_table_id','$p_col',$start_row )\" type=\"text\" placeholder=\""._("Filtre rapide")."\">
|
||||
<input type=\"button\" class=\"smallbutton\" onclick=\"$('lk_".$p_table_id."').value='';filter_table($('lk_".$p_table_id."'), '$p_table_id','$p_col',$start_row );\" value=\"X\">
|
||||
</span>
|
||||
";
|
||||
|
|
@ -1041,7 +1041,7 @@ class HtmlInput
|
|||
<span>
|
||||
<span class=\"icon\" ></span>
|
||||
|
||||
<input id=\"lk_".$p_table_id."\" autocomplete=\"off\" class=\"input_text\" name=\"filter\" onkeyup=\"filter_table(this, '$p_table_id','$p_col',$start_row )\" type=\"text\" placeholder=\""._("Recherche")."\">
|
||||
<input id=\"lk_".$p_table_id."\" autocomplete=\"off\" class=\"input_text\" name=\"filter\" onkeyup=\"filter_table(this, '$p_table_id','$p_col',$start_row )\" type=\"text\" placeholder=\""._("Filtre rapide")."\">
|
||||
<input type=\"button\" class=\"smallbutton\" onclick=\"$('lk_".$p_table_id."').value='';filter_table($('lk_".$p_table_id."'), '$p_table_id','$p_col',$start_row );\" value=\"X\">
|
||||
</span>
|
||||
";
|
||||
|
|
|
|||
|
|
@ -4,6 +4,39 @@
|
|||
//see licence.txt
|
||||
$uniq=uniqid("tab",TRUE);
|
||||
$dossier_id=Dossier::id();
|
||||
/**
|
||||
* @var $str_ag_ref string reference of Action inherited Follow_Up::display
|
||||
* @var $str_doc_type string type of document (DOCUMENT_TYPE) inherited Follow_Up::display
|
||||
* @var $w ICard concerned tiers inherited Follow_Up::display
|
||||
* @var $sp ISpan concerned tiers' name inherited Follow_Up::display
|
||||
* @var $g_user Noalyss_User connected user : global variable
|
||||
* @var $ag_contact ICard card of contacts inherited Follow_Up::display
|
||||
* @var $spcontact ISpan contact's name inherited Follow_Up::display
|
||||
* @var $ag_id Number Follow_Up::ag_id inherited Follow_Up::display
|
||||
* @var $p_view string mode : READ NEW UPD inherited Follow_Up::display
|
||||
* @var $str_add_button string for adding event inherited Follow_Up::display
|
||||
* @var $date IDate inherited Follow_Up::display
|
||||
* @var $str_ag_hour string Hour inherited Follow_Up::display
|
||||
* @var $remind_date IDate inherited Follow_Up::display
|
||||
* @var $str_state string status event inherited Follow_Up::display
|
||||
* @var $str_ag_priority string priority event inherited Follow_Up::display
|
||||
* @var $str_ag_dest string group event inherited Follow_Up::display
|
||||
* @var $this Follow_Up inherited Follow_Up::display
|
||||
* @var $operation array table ACTION_GESTION_OPERATION inherited Follow_Up::display
|
||||
* @var $iaction array IRelated_Action inherited Follow_Up::display
|
||||
* @var $p_base string ac parameter inherited Follow_Up::display
|
||||
* @var $acomment array comment of event inherited Follow_Up::display
|
||||
* @var $iconcerned IConcerned concerned operation inherited Follow_Up::display
|
||||
* @var $title string title action inherited Follow_Up::display
|
||||
* @var $desc string description of action inherited Follow_Up::display
|
||||
* @var $upload IFiles file to upkiad
|
||||
* @var $str_select_doc
|
||||
* @var $aAttachedFile
|
||||
* @var $str_submit_generate
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
|
|
@ -306,6 +339,8 @@ function small(p_id_textarea){
|
|||
$has_description = false;
|
||||
//---------------------------------- Description -------------------------------------------------------------------
|
||||
// if there are comments then the first one is the description
|
||||
// variable: $acomment[0]
|
||||
//
|
||||
if ( count($acomment)> 0) {
|
||||
$has_description = true;
|
||||
$editable_description = Document_Option::is_enable_editable_description($this->dt_id);
|
||||
|
|
@ -352,8 +387,8 @@ function small(p_id_textarea){
|
|||
// link to files to download
|
||||
$aFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype
|
||||
from action_comment_document
|
||||
join document on (d_id=document_id) where action_gestion_comment_id=$1'
|
||||
, array($this->ag_id));
|
||||
join document on (d_id=document_id) where ag_id=$1'
|
||||
, array($acomment[0]['agc_id']));
|
||||
if ( ! empty ($aFile)) {
|
||||
echo '<div style="left:10%">';
|
||||
echo _("Fichiers :");
|
||||
|
|
@ -362,7 +397,7 @@ function small(p_id_textarea){
|
|||
$url="export.php?".http_build_query(array("act"=>'RAW:document'
|
||||
,"gDossier"=>$dossier_id
|
||||
,"d_id"=>$file["d_id"]));
|
||||
printf('<a class="print_line" href="%s">%s</a>',
|
||||
printf('<a class="print_line" href="%s" download>%s</a>',
|
||||
$url,h($file['d_filename']));
|
||||
|
||||
}
|
||||
|
|
@ -550,8 +585,10 @@ catch(exception) { alert('<?php echo j(_('Je ne peux pas ajouter de fichier'))?>
|
|||
<div id="div_action_attached_doc">
|
||||
<h2 class="h-section">
|
||||
<?php
|
||||
echo _('Pièces attachées');
|
||||
printf("(%s)",count($aAttachedFile));
|
||||
$a= _('Pièces attachées');
|
||||
// variable: color if files
|
||||
$class=( count($aAttachedFile)>0)?"cell highlight":"";
|
||||
printf('%s <span class="%s"> (%s)</span>',$a,$class,count($aAttachedFile));
|
||||
?>
|
||||
</h2>
|
||||
<div class="noprint">
|
||||
|
|
|
|||
3
log/.htaccess
Normal file
3
log/.htaccess
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
order deny,allow
|
||||
deny from all
|
||||
|
||||
1
log/index.html
Normal file
1
log/index.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<h1>LOGFILE</h1>
|
||||
|
|
@ -189,7 +189,7 @@ class Acc_ComputeTest extends TestCase
|
|||
$result=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->assertStringStartsWith("key amount Description amount value is 0<br>key amount_vat Description amount_vat value is 0<br>",$result);
|
||||
$this->assertStringEndsWith("<br>key amount_vat_currency Description amount_vat_currency value is 0<br>key currency_rate Description currency_rate value is 0<br>",$result);
|
||||
$this->assertStringEndsWith("<br>key amount_vat_currency Description amount_vat_currency value is 0<br>key currency_rate Description currency_rate value is 0<br>key autoreverse Description autoreverse value is 0<br>",$result);
|
||||
}
|
||||
|
||||
public function testCompute()
|
||||
|
|
|
|||
|
|
@ -448,10 +448,11 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
/**
|
||||
* @testdox Purchase not deductible : VAT , TAX , PRIVATE fee
|
||||
* @dataProvider data_no_deductible
|
||||
* Parameters : $p_attribut if the no deductible attribute, the $p_value is the % not deductible, $p_amount
|
||||
* is the corresponding column in quant_purchase and $p_accounting is the counterpart
|
||||
* for this not deductible fee($p_counterpart)
|
||||
*/
|
||||
* @parameter $p_attribut int ATTR_DEF.AD_ID $p_attribut if the no deductible attribute,
|
||||
* @parameter $p_value int is the % not deductible,
|
||||
* @parameter $p_amount float the corresponding column in quant_purchase
|
||||
* @parameter $p_accounting string is the accounting counterpart for this not deductible fee($p_counterpart)
|
||||
*/
|
||||
public function testInsertPurchase_No_Ded($p_attribut , $p_value,$p_column,$p_amount,$p_counterpart,$p_accounting)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -497,7 +498,63 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox Purchase not deductible + autoreverse: VAT , TAX , PRIVATE fee with VAT autoreverse
|
||||
* @dataProvider data_no_deductible
|
||||
* @parameter $p_attribut int ATTR_DEF.AD_ID $p_attribut if the no deductible attribute,
|
||||
* @parameter $p_value int is the % not deductible,
|
||||
* @parameter $p_amount float the corresponding column in quant_purchase
|
||||
* @parameter $p_accounting string is the accounting counterpart for this not deductible fee($p_counterpart)
|
||||
*/
|
||||
public function testInsertPurchase_No_Ded_reverse($p_attribut , $p_value,$p_column,$p_amount,$p_counterpart,$p_accounting)
|
||||
{
|
||||
global $g_connection;
|
||||
|
||||
static $scenario=0;
|
||||
$scenario++;
|
||||
|
||||
//-- modify card 29 : ELECTR
|
||||
$fiche=new Fiche($g_connection,29);
|
||||
$fiche->set_f_enable("1");
|
||||
$fiche->setAttribut($p_attribut,$p_value);
|
||||
$fiche->setAttribut($p_counterpart,$p_accounting);
|
||||
$a_attribut=$fiche->to_array();
|
||||
$this->assertEquals($a_attribut['av_text'.$p_attribut],$p_value,"Attribut $p_attribut not set to $p_value%");
|
||||
|
||||
$fiche->update($a_attribut);
|
||||
|
||||
$this->assertEquals($p_value,
|
||||
$g_connection->get_value("select ad_value
|
||||
from fiche_detail
|
||||
where f_id=$1 and ad_id=$2",[29,$p_attribut]),
|
||||
"Attribut ad_id $p_attribut not inserted");
|
||||
|
||||
$array=$this->array;
|
||||
$array['e_comm']="scenario [$scenario]";
|
||||
$array['e_march0']='ELECTR';
|
||||
$array['e_march0_tva_id']='5';
|
||||
$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'.$scenario;
|
||||
$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 not inserted in quant_purchase");
|
||||
|
||||
// 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($p_amount,$row_quant[$p_column]);
|
||||
|
||||
$this->clean_operation($array['mt']);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::input
|
||||
*/
|
||||
|
|
@ -706,22 +763,22 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
select count(*)
|
||||
from jrnx j1 join jrn j2 on (j1.j_grpt=j2.jr_grpt_id)
|
||||
where
|
||||
j2.jr_mt ='1572704002.1732'
|
||||
j2.jr_mt = $1
|
||||
and j1.j_poste ='4119999'
|
||||
and j1.j_debit ='f'
|
||||
";
|
||||
$this->assertEquals(1, $g_connection->get_value($sql),'fails : reversed account credit is wrong');
|
||||
$this->assertEquals(1, $g_connection->get_value($sql,[$array["mt"]]),'fails : reversed account credit is wrong');
|
||||
|
||||
// check that the accounting for reverse VAT is only 45142
|
||||
$sql="
|
||||
select count(*)
|
||||
from jrnx j1 join jrn j2 on (j1.j_grpt=j2.jr_grpt_id)
|
||||
where
|
||||
j2.jr_mt ='1572704002.1732'
|
||||
j2.jr_mt = $1
|
||||
and j1.j_poste ='41142'
|
||||
and j1.j_debit ='t'
|
||||
";
|
||||
$this->assertEquals(1, $g_connection->get_value($sql),'fails : reversed account credit is wrong');
|
||||
$this->assertEquals(1, $g_connection->get_value($sql,[$array["mt"]]),'fails : reversed account credit is wrong');
|
||||
|
||||
$this->clean_operation();
|
||||
|
||||
|
|
@ -735,12 +792,13 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
function testInsertReverseVAT4() {
|
||||
global $g_connection;
|
||||
$array=$this->array1;
|
||||
$array['mt']='testInsertReverseVAT4';
|
||||
$old_autoreverse=$g_connection->get_value("select tva_both_side from tva_rate where tva_id=3 ");
|
||||
// set autoreverse to 1
|
||||
$g_connection->get_value("update tva_rate set tva_both_side = 1 where tva_id=3 ");
|
||||
|
||||
// clean
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[1734717784.385]);
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[ $array['mt'] ]);
|
||||
$this->object->insert($array);
|
||||
|
||||
$accounting=new \Acc_Operation($g_connection);
|
||||
|
|
@ -768,7 +826,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
|
||||
// cancel change
|
||||
$g_connection->get_value("update tva_rate set tva_both_side = $1 where tva_id=3 ",[$old_autoreverse]);
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[1734717784.385]);
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[$array['mt']]);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -782,22 +840,23 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
$array=$this->array1;
|
||||
|
||||
$array['e_march1_tva_id']=5;
|
||||
$array['mt']='testInsertReverseVAT5';
|
||||
|
||||
// clean
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[1734717784.385]);
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[ $array['mt'] ]);
|
||||
$this->object->insert($array);
|
||||
|
||||
$accounting=new \Acc_Operation($g_connection);
|
||||
$accounting->jr_id=$this->object->jr_id;
|
||||
$aResult=$accounting->get_jrnx_detail();
|
||||
|
||||
$this->assertTrue(count($aResult)==7, 'Number of rows is '.count($aResult)."instead of 7");
|
||||
$this->assertTrue(count($aResult)==5, 'Number of rows is '.count($aResult)."instead of 5");
|
||||
|
||||
foreach($aResult as $result) {
|
||||
switch ($result['j_poste']) {
|
||||
case '41142':
|
||||
if ( $result['debit']=='D')
|
||||
$this->assertEquals(25.20, $result['j_montant'],"erreur account {$result['j_poste']}");
|
||||
$this->assertEquals(23.10, $result['j_montant'],"erreur account {$result['j_poste']}");
|
||||
else
|
||||
$this->assertEquals(2.1, $result['j_montant'],"erreur account {$result['j_poste']}");
|
||||
break;
|
||||
|
|
@ -814,8 +873,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
}
|
||||
|
||||
// cancel change
|
||||
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[1734717784.385]);
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[ $array['mt'] ]);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class FollowupTest extends TestCase
|
|||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->assertStringContainsString("BONDEC3-1", $content);
|
||||
$this->assertTrue(mb_strlen($content)==1613,"error result not valid $content size = ".mb_strlen($content));
|
||||
$this->assertTrue(mb_strlen($content)==1620,"error result not valid $content size = ".mb_strlen($content));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue