27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
35 public $boxcode =
"accountancy_suspense_account";
36 public $boximg =
"accounting";
37 public $boxlabel =
"BoxSuspenseAccount";
38 public $depends = array(
"accounting");
47 public $info_box_head = array();
48 public $info_box_contents = array();
63 $this->hidden = empty($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) {
82 $suspenseAccount = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
83 if (!empty($suspenseAccount) && $suspenseAccount > 0) {
84 $sql =
"SELECT COUNT(*) as nb_suspense_account";
85 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as b";
86 $sql .=
" WHERE b.numero_compte = '".$this->db->escape($suspenseAccount).
"'";
87 $sql .=
" AND b.entity = ".$conf->entity;
89 $result = $this->
db->query($sql);
90 $nbSuspenseAccount = 0;
92 $obj = $this->
db->fetch_object($result);
93 $nbSuspenseAccount = $obj->nb_suspense_account;
96 $this->info_box_contents[0][0] = array(
98 'text' => $langs->trans(
"NumberOfLinesInSuspenseAccount").
':'
101 $this->info_box_contents[0][1] = array(
102 'td' =>
'class="right"',
103 'text' =>
'<a href="'.DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?search_accountancy_code_start='.urlencode($suspenseAccount).
'&search_accountancy_code_end='.urlencode($suspenseAccount).
'">'.$nbSuspenseAccount.
'</a>',
107 $this->info_box_contents[0][0] = array(
108 'td' =>
'class="nohover"',
109 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"SuspenseAccountNotDefined").
'</span>'
113 $this->info_box_contents[0][0] = array(
114 'td' =>
'class="nohover"',
115 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'
128 public function showBox($head =
null, $contents =
null, $nooutput = 0)
130 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
Class to manage the box to show suspense account.
__construct($db, $param)
Constructor.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
loadBox()
Load data for box to show them later.
$conf db
API class for accounts.