use $this->db in box

This commit is contained in:
Frédéric FRANCE 2019-10-07 20:27:51 +02:00
parent 16eeeecb9a
commit c68de09ba9
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 15 additions and 16 deletions

View File

@ -71,13 +71,11 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
*/
public function loadBox($max = 5)
{
global $user, $langs, $db, $conf;
$this->max = $max;
global $user, $langs, $conf;
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
$bookkeepingstatic = new BookKeeping($db);
$bookkeepingstatic = new BookKeeping($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastManualEntries", $max));
@ -92,17 +90,17 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
$sql.= " WHERE b.fk_doc = 0";
$sql.= " AND b.entity = ".$conf->entity;
$sql.= " ORDER BY b.piece_num DESC ";
$sql.= $db->plimit($max, 0);
$sql.= $this->db->plimit($max, 0);
$result = $db->query($sql);
$result = $this->db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $db->fetch_object($result);
$date = $db->jdate($objp->date_movement);
$objp = $this->db->fetch_object($result);
$date = $this->db->jdate($objp->date_movement);
$journal = $objp->code_journal;
$label = $objp->label_operation;
$amount = $objp->montant;
@ -144,12 +142,12 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedManualEntries"));
$db->free($result);
$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql),
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {

View File

@ -37,7 +37,7 @@ class box_accountancy_suspense_account extends ModeleBoxes
public $boxlabel="BoxSuspenseAccount";
public $depends = array("accounting");
/**
/**
* @var DoliDB Database handler.
*/
public $db;
@ -70,11 +70,11 @@ class box_accountancy_suspense_account extends ModeleBoxes
*/
public function loadBox()
{
global $user, $langs, $db, $conf;
global $user, $langs, $conf;
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
$bookkeepingstatic = new BookKeeping($db);
$bookkeepingstatic = new BookKeeping($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleSuspenseAccount"));
@ -88,10 +88,11 @@ class box_accountancy_suspense_account extends ModeleBoxes
$sql .= " WHERE b.numero_compte = ". $suspenseAccount;
$sql .= " AND b.entity = " . $conf->entity;
$result = $db->query($sql);
$result = $this->db->query($sql);
$nbSuspenseAccount = 0;
if ($result)
{
$obj=$db->fetch_object($result);
$obj=$this->db->fetch_object($result);
$nbSuspenseAccount = $obj->nb_suspense_account;
}