[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 64/151: Clean code
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 64/151: Clean code |
Date: |
Sat, 4 Feb 2017 17:14:28 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 2e02bc21bd37ca79b88a0968a6072f3952628939
Author: Dany De Bontridder <address@hidden>
Date: Sat Jul 30 00:01:59 2016 +0200
Clean code
---
include/compta_ach.inc.php | 48 +++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php
index f278c2e..b5a14ea 100644
--- a/include/compta_ach.inc.php
+++ b/include/compta_ach.inc.php
@@ -34,20 +34,22 @@ global $g_parameter;
$cn = Dossier::connect();
//menu = show a list of ledger
$str_dossier = dossier::get();
-$ac = "ac=" . $_REQUEST['ac'];
+$ac=HtmlInput::default_value_request("ac", "");
+$request_jrn=HtmlInput::default_value_request("p_jrn", "");
// Check privilege
-if (isset($_REQUEST['p_jrn']))
- if ($g_user->check_jrn($_REQUEST['p_jrn']) != 'W')
- {
- NoAccess();
- exit - 1;
- }
+if ($request_jrn !="" &&
+ $g_user->check_jrn($request_jrn) != 'W')
+{
+ NoAccess();
+ exit - 1;
+}
$p_msg="";
+$post_jrn=HtmlInput::default_value_post("p_jrn", "");
/* if a new invoice is encoded, we display a form for confirmation */
if (isset($_POST['view_invoice']))
{
- $Ledger = new Acc_Ledger_Purchase($cn, $_POST['p_jrn']);
+ $Ledger = new Acc_Ledger_Purchase($cn, $post_jrn);
try
{
$Ledger->verify($_POST);
@@ -75,7 +77,7 @@ if (isset($_POST['view_invoice']))
echo dossier::hidden();
echo $Ledger->confirm($_POST);
- echo HtmlInput::hidden('ac', $_REQUEST['ac']);
+ echo HtmlInput::hidden('ac', $ac);
?>
<div id="tab_id" >
<script>
@@ -117,8 +119,6 @@ show_tab(a_tab,'facturation_div_id');
<?php
echo '</div>';
return;
-
- return;
}
}
//------------------------------
@@ -127,7 +127,7 @@ show_tab(a_tab,'facturation_div_id');
if (isset($_POST['record']))
{
- $Ledger = new Acc_Ledger_Purchase($cn, $_POST['p_jrn']);
+ $Ledger = new Acc_Ledger_Purchase($cn, $post_jrn);
try
{
$Ledger->verify($_POST);
@@ -143,7 +143,7 @@ if (isset($_POST['record']))
{
echo '<div class="content">';
- $Ledger = new Acc_Ledger_Purchase($cn, $_POST['p_jrn']);
+ $Ledger = new Acc_Ledger_Purchase($cn, $post_jrn);
$internal = $Ledger->insert($_POST);
@@ -181,12 +181,13 @@ if (isset($_POST['record']))
{
$Ledger->reverse($p_date);
echo '<p>';
- echo _('Extourné au ').$p_date;
+ printf ( _('Extourné au %s'),$p_date);
echo '</p>';
}
catch (Exception $e)
{
- echo '<p class="notice">'._('Opération non
extournée').
+ echo '<p class="notice">'.
+ _('Opération non extournée').
$e->getMessage().
'</p>';
}
@@ -202,10 +203,10 @@ if (isset($_POST['record']))
return;
}
}
-// ------------------------------
+// ------------------------------------------------------------
/* Display a blank form or a form with predef operation */
/* or a form for correcting */
-// ------------------------------
+// -------------------------------------------------------------
echo '<div class="content">';
//
@@ -220,12 +221,12 @@ if (!isset($_REQUEST ['p_jrn']))
$def_ledger = $Ledger->get_first('ach',2);
if ( empty ($def_ledger))
{
- exit('Pas de journal disponible');
+ exit(_('Pas de journal disponible'));
}
$Ledger->id = $def_ledger['jrn_def_id'];
}
else
- $Ledger->id = $_REQUEST ['p_jrn'];
+ $Ledger->id = $request_jrn;
if (isset ($_REQUEST['p_jrn_predef'])){
$Ledger->id=$_REQUEST['p_jrn_predef'];
@@ -238,7 +239,7 @@ $op = new Pre_op_ach($cn);
$op->set('ledger', $Ledger->id);
$op->set('ledger_type', "ACH");
$op->set('direct', 'f');
-$url=http_build_query(array('p_jrn_predef'=>$Ledger->id,'ac'=>$_REQUEST['ac'],'gDossier'=>dossier::id()));
+$url=http_build_query(array('p_jrn_predef'=>$Ledger->id,'ac'=>$ac,'gDossier'=>dossier::id()));
echo $op->form_get('do.php?'.$url);
echo '</div>';
echo '</div>';
@@ -254,11 +255,12 @@ try
if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']) && !
isset($correct) )
{
// used a predefined operation
- //
+ $predef=HtmlInput::default_value_request("pre_def", "0");
+ $p_jrn_predef=HtmlInput::default_value_request("p_jrn_predef", "0");
$op=new Pre_op_ach($cn);
- $op->set_od_id($_REQUEST['pre_def']);
+ $op->set_od_id($predef);
$p_post=$op->compute_array();
- $Ledger->id=$_REQUEST ['p_jrn_predef'];
+ $Ledger->id=$p_jrn_predef;
$p_post['p_jrn']=$Ledger->id;
echo $Ledger->input($p_post);
echo '<div class="content">';
- [Noalyss-commit] [noalyss] 90/151: Improve Acc_Bilan::warning, (continued)
- [Noalyss-commit] [noalyss] 90/151: Improve Acc_Bilan::warning, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 87/151: Performance : improve VERIF , Improve Accounting check, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 92/151: Fix config.inc.php : add carriage return, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 106/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 85/151: Performance : improve VERIF , Affiche uniquement journaux incorrects, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 86/151: Performance : improve VERIF , Totaux Actif/Passif, Charge/Produit, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 102/151: Improve DOC for Scenario, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 108/151: Noalyss_SQL add function get_pk_value for getting the value of the PK, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 75/151: Scenario pour dév. de comptabilité analytique, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 70/151: sécurité Task #8 - Sécurité protection SQL, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 64/151: Clean code,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 79/151: PDF Operation ajout détail opération pour GrandLivre ANC , export des pièces avec tampon, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 81/151: syntax, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 88/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 93/151: Export PDF : check files properly, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 95/151: Problème htmlentities : charset par défaut différent entre version, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 91/151: Improve Performance Acc_Bilan::warning, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 104/151: Improve Noalyss_SQL : add set and get, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 107/151: Add Receipt number to detail operation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 118/151: correct typo, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 124/151: Test ManageTable ; fix parseXML function, Dany De Bontridder, 2017/02/04