[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 12/151: Clean code
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 12/151: Clean code |
Date: |
Sat, 4 Feb 2017 17:14:24 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit ba721411109511fde66a4745eb87c1acbe450f4f
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] 16/151: Merge branch 'master' of ns3:/srv/git/noalyss, (continued)
- [Noalyss-commit] [noalyss] 16/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 19/151: sécurité Task #8 - Sécurité protection SQL, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 24/151: Scenario pour dév. de comptabilité analytique, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 17/151: add newline at the end of file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 20/151: Database Ajout d'une fonction pour retirer une seule ligne, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 23/151: Export en PDF d'operation : PDF_Operation::print_section Task #10 - PDF_Operation : ajout titre Analytique, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 26/151: Scenario test pour PDF_Operation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 30/151: syntax, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 29/151: Export Detail Operation Analytique + Document, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 25/151: Ajout options Task #9 - PDF_Operation : ajout des options, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 12/151: Clean code,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 28/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] 31/151: Remove useless file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 33/151: Performance : improve VERIF , change query pour fiche utilisé avec 2 postes, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 42/151: Export PDF : check files properly, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 41/151: Fix config.inc.php : add carriage return, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 38/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 32/151: Performance : improve VERIF, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 27/151: Scenario test pour PDF_Operation Task #9 - PDF_Operation : ajout des options, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 46/151: update of the config.inc.example file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 36/151: Performance : improve VERIF , Improve Accounting check, Dany De Bontridder, 2017/02/04