Code Cleaning : remove direct access to global , add Exception

This commit is contained in:
Dany De Bontridder 2019-11-02 00:54:35 +01:00
parent 56f613ffb9
commit 5bcea2bf57
4 changed files with 8 additions and 29 deletions

View file

@ -448,14 +448,5 @@ class Acc_Balance
$p_pdf->write_cell(10,6,$side);
$p_pdf->line_new();
}
static function test_me ()
{
require 'class/user.class.php';
global $g_user;
$cn=Dossier::connect();
$g_user=new User($cn);
$a=new Acc_Balance($cn);
$a->get_row(163, 175, 1);
var_dump($a);
}
}

View file

@ -1047,7 +1047,11 @@ class Acc_Ledger extends jrn_def_sql
*/
if ($this->check_periode()==false||!isset($p_array['period']))
{
$periode->find_periode($e_date);
try {
$periode->find_periode($e_date);
} catch (Exception $e) {
throw new Exception(_("Période inexistante"), 6, $e);
}
}
else
{
@ -2531,7 +2535,7 @@ class Acc_Ledger extends jrn_def_sql
/* Numbering (only FIN) */
$num_op=new ICheckBox('numb_operation');
echo dossier::hidden();
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('ac', $http->request('ac'));
echo $hidden;
$cn=$this->db;

View file

@ -199,20 +199,4 @@ class Acc_Ledger_Info
$this->insert();
}
}
static function test_me()
{
echo "Dossier = ".Dossier::id();
$cn=Dossier::connect();
$a=new Acc_Ledger_Info($cn);
$a->jr_id=3;
$a->id_type='BON_COMMANDE';
$a->ji_value='BON';
var_dump($a);
$a->insert();
$a->set_jrn_id(7);
$a->set_type('OTHER');
$a->set_value('Autre test');
$a->insert();
}
}

View file

@ -253,7 +253,7 @@ class PDF_Core extends TFPDF
parent::Ln($this->bigger);
$this->bigger=0;
}
/**
/**
* If the step is even then return 1 and set the backgroup color to blue , otherwise
* returns 0, and set the background color to white
* It is use to compute alternated colored row , it the parameter fill in write_cell and