[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 123/173: Improve Scenario Test
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 123/173: Improve Scenario Test |
Date: |
Mon, 22 Mar 2021 12:59:06 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 8ca0bc287bc0b2fb95935d57766f29ebe3f02907
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sat Oct 26 16:33:29 2019 +0200
Improve Scenario Test
---
html/test.php | 17 +++++++++++++++++
include/class/acc_ledger.class.php | 18 +++++++++++++-----
include/class/fiche.class.php | 4 ++--
scenario/FicheTest.php | 4 +---
scenario/historic-card.php | 3 +++
scenario/pdf_operation.php | 10 ++++++----
6 files changed, 42 insertions(+), 14 deletions(-)
diff --git a/html/test.php b/html/test.php
index ed9a957..d8b890a 100644
--- a/html/test.php
+++ b/html/test.php
@@ -65,6 +65,23 @@ if (!file_exists('authorized_debug'))
}
define('ALLOWED', 1);
html_page_start("Classic");
+/******************************************************************************************************************/
+/* Utilities
+/******************************************************************************************************************/
+
+/**
+ * Return the card this most activities
+ * @return integer (fiche.f_id)
+ */
+function get_card_with_activity() {
+ global $cn;
+ $card_count=$cn->get_array("select count(*),f_id ".
+ " from jrnx ".
+ " where ".
+ " f_id is not null ".
+ "group by f_id order by count(*) desc");
+ return $card_count[0]['f_id'];
+}
/*
* Loading of all scenario
diff --git a/include/class/acc_ledger.class.php
b/include/class/acc_ledger.class.php
index 1121207..b2a3921 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -59,7 +59,7 @@ require_once NOALYSS_INCLUDE.'/class/pre_op_ods.class.php';
/** @brief Class for jrn, class acc_ledger for manipulating the ledger
*
*/
-class Acc_Ledger extends jrn_def_sql
+class Acc_Ledger extends jrn_def_sql
{
var $id; /**< jrn_def.jrn_def_id */
@@ -105,7 +105,8 @@ class Acc_Ledger extends jrn_def_sql
$ret=$this->db->get_array("select last_value,is_called from
s_jrn_pj".$this->id);
$last=$ret[0]['last_value'];
/**
- * \note With PSQL sequence , the last_value column is 1 when
before AND after the first call, to make the difference between them
+ * \note With PSQL sequence , the last_value column is 1 when
before AND after the first call,
+ * to make the difference between them
* I have to check whether the sequence has been already called or
not */
if ($ret[0]['is_called']=='f')
$last--;
@@ -773,8 +774,11 @@ class Acc_Ledger extends jrn_def_sql
}
$ret.="</table>";
- if ($g_parameter->MY_ANALYTIC!='nu'&&$p_readonly==false)
- $ret.='<input type="button" class="button" value="'._('verifie
Imputation Analytique').'" onClick="verify_ca(\'\');">';
+ if ($g_parameter->MY_ANALYTIC!='nu'&&$p_readonly==false) {
+ $ret.='<input type="button" class="button" value="'._('verifie
Imputation Analytique').
+ '" onClick="verify_ca(\'\');">';
+
+ }
return $ret;
}
@@ -1031,7 +1035,11 @@ class Acc_Ledger extends jrn_def_sql
$ret.='<tr>';
$ret.='<td>'.$quick_code->input().$quick_code->search().$str_add_button.'</td>';
$ret.='<td>'.$poste->input().
- '<script>
document.getElementById(\'poste'.$i.'\').onblur=function(){ if
(trim(this.value) !=\'\')
{document.getElementById(\'qc_'.$i.'\').value="";}}</script>'.
+ '<script> '.
+
'document.getElementById(\'poste'.$i.'\').onblur=function(){'.
+ 'if (trim(this.value) !=\'\') '.
+ '{document.getElementById(\'qc_'.$i.'\').value="";}}'.
+ '</script>'.
'</td>';
$ret.='<td class="visible_gt800
visible_gt1155">'.$line_desc->input().'</td>';
$ret.='<td>'.$amount->input().'</td>';
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 6d8c5bd..3ee3461 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -1166,8 +1166,8 @@ class Fiche
where ad_id=1 and f_id=$1";
$Res=$this->cn->exec_sql($sql,array($this->id));
$r=Database::fetch_all($Res);
- if ( sizeof($r) == 0 )
- return 1;
+ if ( empty($r) )
+ throw new Exception (_("Fiche n'existe pas"), 1000);
return $r[0]['ad_value'];
}
diff --git a/scenario/FicheTest.php b/scenario/FicheTest.php
index 9267f61..f769c9b 100644
--- a/scenario/FicheTest.php
+++ b/scenario/FicheTest.php
@@ -48,9 +48,7 @@ $card_count=$cn->get_array("select count(*),f_id ".
" f_id is not null ".
"group by f_id order by count(*) desc");
$a=new Fiche($cn,$card_count[0]['f_id']);
-$min=$cn->get_value("select p_id from parm_periode order by p_start asc limit
1");
-$max=$cn->get_value("select p_id from parm_periode order by p_start desc limit
1");
-printf ("Max période %s Min période %s",$max,$min);
+
$result=$a->get_row($min,$max);
$result_date=$a->get_row_date('01.01.2010','01.01.2090');
diff --git a/scenario/historic-card.php b/scenario/historic-card.php
index 6dd7687..17bdbfd 100644
--- a/scenario/historic-card.php
+++ b/scenario/historic-card.php
@@ -13,4 +13,7 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
+
+
+ put_global([["key"=>'f_id',"value"=>get_card_with_activity()]]);
include 'ajax_misc.php';
diff --git a/scenario/pdf_operation.php b/scenario/pdf_operation.php
index 9a513f9..b0dcc53 100644
--- a/scenario/pdf_operation.php
+++ b/scenario/pdf_operation.php
@@ -20,15 +20,17 @@
require_once NOALYSS_INCLUDE."/class/pdf_operation.class.php";
+$a_operation_id=$cn->get_array("select jr_id from jrn limit 10");
-
-$pdf=new PDF_Operation ($cn,61);
+$pdf=new PDF_Operation ($cn,$a_operation_id[0]['jr_id']);
//$pdf=new PDF_Operation ($cn,47);
//$pdf=new PDF_Operation ($cn,4638);
$pdf->export_pdf(array("anc","acc"));
$a=$pdf->get_pdf();
-$a->Output("/tmp/t.pdf","F");
+$a->Output("/tmp/t.pdf","S");
+
-echo $pdf->get_pdf_filename();
\ No newline at end of file
+echo $pdf->get_pdf_filename();
+echo "File download to /tmp";
\ No newline at end of file
- [Noalyss-commit] [noalyss] 86/173: Cosmetic, (continued)
- [Noalyss-commit] [noalyss] 86/173: Cosmetic, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 103/173: Task #0001703: Faciliter effacement montants dans les filtres, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 104/173: Improve PHPUNIT Test for phpunit7 and phpunit8, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 105/173: documentation + traduction, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 117/173: Acc_Ledger : problem with acc_ledger::load(), Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 125/173: Merge branch 'dev-7200' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 130/173: fixup! Merge branch 'dev-7200' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 99/173: Merge branch 'Cosmetic-7100' into 'entreprise', Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 100/173: Merge branch 'entreprise' of gitlab.noalyss.eu:noalyss/noalyss into entreprise * index.css logo size, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 120/173: test : compute min et max periode, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 123/173: Improve Scenario Test,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 129/173: Merge branch 'dev-7200' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 132/173: Bug solde is rounded and doesn't have decimal, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 126/173: Use connection and not global, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 128/173: Merge branch 'dev7112' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 140/173: Cleanup + new logo, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 92/173: Merge branch 'accept7100' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 95/173: Merge branch 'accept7100' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 97/173: Merge branch 'accept7100' into entreprise, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 102/173: Task #0001698: Problème affichage historique fiches, Dany De Bontridder, 2021/03/22
- [Noalyss-commit] [noalyss] 141/173: Merge commit '3e075a0a1aa8b6e42c458571ef0380a9c38f18fa' into entreprise, Dany De Bontridder, 2021/03/22