27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
35 public $boxcode =
"accountancy_suspense_account";
36 public $boximg =
"object_invoice";
37 public $boxlabel =
"BoxSuspenseAccount";
38 public $depends = array(
"accounting");
47 public $info_box_head = array();
48 public $info_box_contents = array();
63 $this->hidden = !($user->rights->accounting->mouvements->lire);
73 global $user, $langs, $conf;
75 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
79 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleSuspenseAccount"));
81 if ($user->rights->accounting->mouvements->lire)
83 $suspenseAccount = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
84 if (!empty($suspenseAccount) && $suspenseAccount > 0)
86 $sql =
"SELECT COUNT(*) as nb_suspense_account";
87 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as b";
88 $sql .=
" WHERE b.numero_compte = ".$suspenseAccount;
89 $sql .=
" AND b.entity = ".$conf->entity;
91 $result = $this->
db->query($sql);
92 $nbSuspenseAccount = 0;
95 $obj = $this->
db->fetch_object($result);
96 $nbSuspenseAccount = $obj->nb_suspense_account;
99 $this->info_box_contents[0][0] = array(
101 'text' => $langs->trans(
"NumberOfLinesInSuspenseAccount").
':'
104 $this->info_box_contents[0][1] = array(
105 'td' =>
'class="right"',
106 'text' =>
'<a href="'.DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?search_accountancy_code_start='.urlencode($suspenseAccount).
'&search_accountancy_code_end='.urlencode($suspenseAccount).
'">'.$nbSuspenseAccount.
'</a>',
110 $this->info_box_contents[0][0] = array(
111 'td' =>
'class="nohover"',
112 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"SuspenseAccountNotDefined").
'</span>'
116 $this->info_box_contents[0][0] = array(
117 'td' =>
'class="nohover"',
118 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'
131 public function showBox($head = null, $contents = null, $nooutput = 0)
133 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
loadBox()
Load data for box to show them later.
__construct($db, $param)
Constructor.
$conf db
API class for accounts.
Class to manage the box to show suspense account.