Skip to content

Commit

Permalink
Merge pull request #8667 from grandoc/new_branch_23_04_2018
Browse files Browse the repository at this point in the history
clean code
  • Loading branch information
eldy committed Apr 27, 2018
2 parents 3301c99 + 502c837 commit cee4df9
Show file tree
Hide file tree
Showing 22 changed files with 36 additions and 135 deletions.
4 changes: 1 addition & 3 deletions htdocs/accountancy/admin/accountmodel.php
Expand Up @@ -4,7 +4,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
Expand Down Expand Up @@ -657,7 +657,6 @@
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;

$param = '&id='.$id;
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
Expand Down Expand Up @@ -1036,7 +1035,6 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='')
global $form;
global $region_id;
global $elementList,$sourceList;
global $bc;

$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
Expand Down
2 changes: 0 additions & 2 deletions htdocs/accountancy/admin/categories_list.php
Expand Up @@ -456,7 +456,6 @@
if ($tabname[$id])
{
$alabelisused=0;
$var=false;

$fieldlist=explode(',',$tabfield[$id]);

Expand Down Expand Up @@ -550,7 +549,6 @@
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;

$param = '&id='.$id;
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
Expand Down
2 changes: 0 additions & 2 deletions htdocs/accountancy/admin/journals_list.php
Expand Up @@ -417,7 +417,6 @@
if ($tabname[$id])
{
$alabelisused=0;
$var=false;

$fieldlist=explode(',',$tabfield[$id]);

Expand Down Expand Up @@ -497,7 +496,6 @@
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;

$param = '&id='.$id;
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
Expand Down
3 changes: 1 addition & 2 deletions htdocs/adherents/tpl/linkedobjectblock.tpl.php
Expand Up @@ -36,13 +36,12 @@
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("members");

$var=true;
$total=0;
foreach($linkedObjectBlock as $key => $objectlink)
{

?>
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
<tr class="oddeven" >
<td><?php echo $langs->trans("Subscription"); ?></td>
<td><?php echo $objectlink->getNomUrl(1); ?></td>
<td align="center"></td>
Expand Down
2 changes: 0 additions & 2 deletions htdocs/admin/agenda_extsites.php
Expand Up @@ -148,7 +148,6 @@
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;

$var=true;
print "<table class=\"noborder\" width=\"100%\">";

print "<tr class=\"liste_titre\">";
Expand Down Expand Up @@ -202,7 +201,6 @@
print "</tr>";

$i=1;
$var=true;
while ($i <= $MAXAGENDA)
{
$key=$i;
Expand Down
3 changes: 0 additions & 3 deletions htdocs/admin/barcode.php
Expand Up @@ -157,7 +157,6 @@
/*
* CHOIX ENCODAGE
*/
$var=true;

print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
Expand Down Expand Up @@ -185,7 +184,6 @@
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;

while ($i < $num)
{
Expand Down Expand Up @@ -277,7 +275,6 @@
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"update\">";

$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
Expand Down
15 changes: 3 additions & 12 deletions htdocs/admin/chequereceipts.php
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -31,11 +31,8 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';

$langs->load("admin");
$langs->load("companies");
$langs->load("bills");
$langs->load("other");
$langs->load("banks");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin","companies","bills","other","banks"));

if (!$user->admin)
accessforbidden();
Expand Down Expand Up @@ -133,8 +130,6 @@
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;

while (($file = readdir($handle))!==false)
{
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
Expand Down Expand Up @@ -166,7 +161,6 @@

if ($module->isEnabled())
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
Expand Down Expand Up @@ -254,9 +248,6 @@
print '<td align="center" width="60">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=true;

$var=! $var;

$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
Expand Down
2 changes: 0 additions & 2 deletions htdocs/admin/clicktodial.php
Expand Up @@ -72,8 +72,6 @@
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setvalue">';

$var=true;

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
Expand Down
4 changes: 0 additions & 4 deletions htdocs/admin/commande.php
Expand Up @@ -286,7 +286,6 @@
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;

while (($file = readdir($handle))!==false)
{
Expand Down Expand Up @@ -406,7 +405,6 @@

clearstatcache();

$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
Expand Down Expand Up @@ -537,15 +535,13 @@
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$var=true;

$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';

$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
Expand Down
12 changes: 3 additions & 9 deletions htdocs/admin/contract.php
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -28,9 +28,8 @@
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';

$langs->load("admin");
$langs->load("errors");
$langs->load("contracts");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin","errors","contracts"));

if (!$user->admin) accessforbidden();

Expand Down Expand Up @@ -220,7 +219,6 @@
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;

while (($file = readdir($handle))!==false)
{
Expand Down Expand Up @@ -339,7 +337,6 @@

clearstatcache();

$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
Expand Down Expand Up @@ -377,7 +374,6 @@

if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
Expand Down Expand Up @@ -472,15 +468,13 @@
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "</tr>\n";
$var=true;

$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';

$var=! $var;
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
print '<br>';
Expand Down
5 changes: 1 addition & 4 deletions htdocs/admin/delais.php
Expand Up @@ -144,7 +144,7 @@
$plus='';
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
// Update values
for($i=0;$i<4;$i++) {
for($i=0; $i<4; $i++) {
if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity);
}

Expand Down Expand Up @@ -172,7 +172,6 @@
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
$var=true;

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
Expand Down Expand Up @@ -215,7 +214,6 @@

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
$var=true;

foreach($modules as $module => $delays)
{
Expand All @@ -241,7 +239,6 @@
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';

$var=false;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';

Expand Down
1 change: 0 additions & 1 deletion htdocs/admin/ecm.php
Expand Up @@ -80,7 +80,6 @@
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '</tr>';

$var=true;
$form = new Form($db);

// Mail required for members
Expand Down
11 changes: 3 additions & 8 deletions htdocs/admin/events.php
Expand Up @@ -31,9 +31,8 @@
if (!$user->admin)
accessforbidden();

$langs->load("users");
$langs->load("admin");
$langs->load("other");
// Load traductions files requiredby by page
$langs->loadLangs(array("users","admin","other"));

$action=GETPOST('action','aZ09');

Expand All @@ -42,7 +41,6 @@
$eventstolog=$securityevent->eventstolog;



/*
* Actions
*/
Expand Down Expand Up @@ -88,8 +86,6 @@

dol_fiche_head($head, 'audit', $langs->trans("Security"), -1);


$var=true;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td colspan=\"2\">".$langs->trans("LogEvents")."</td>";
Expand All @@ -98,8 +94,7 @@
foreach ($eventstolog as $key => $arr)
{
if ($arr['id'])
{

{
print '<tr class="oddeven">';
print '<td>'.$arr['id'].'</td>';
print '<td>';
Expand Down
8 changes: 1 addition & 7 deletions htdocs/admin/expensereport.php
Expand Up @@ -6,7 +6,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -233,8 +233,6 @@
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;

while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file)-3, 3) == 'php')
Expand Down Expand Up @@ -351,7 +349,6 @@

clearstatcache();

$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/expensereport/doc");
Expand All @@ -376,7 +373,6 @@
if (file_exists($dir.'/'.$file))
{


$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);

Expand Down Expand Up @@ -480,15 +476,13 @@
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print "</tr>\n";
$var=true;

$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';

$var=! $var;
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='EXPENSEREPORT_FREE_TEXT';
Expand Down

0 comments on commit cee4df9

Please sign in to comment.