32 public $element =
'accounting_journal';
37 public $table_element =
'accounting_journal';
42 public $fk_element =
'';
47 public $ismultientitymanaged = 0;
52 public $picto =
'generic';
101 public function fetch($rowid = null, $journal_code = null)
105 if ($rowid || $journal_code)
107 $sql =
"SELECT rowid, code, label, nature, active";
108 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_journal";
111 $sql .=
" rowid = ".((int) $rowid);
112 } elseif ($journal_code)
114 $sql .=
" code = '".$this->db->escape($journal_code).
"'";
115 $sql .=
" AND entity = ".$conf->entity;
118 dol_syslog(get_class($this).
"::fetch sql=".$sql, LOG_DEBUG);
119 $result = $this->
db->query($sql);
122 $obj = $this->
db->fetch_object($result);
125 $this->
id = $obj->rowid;
126 $this->
rowid = $obj->rowid;
128 $this->
code = $obj->code;
129 $this->ref = $obj->code;
130 $this->label = $obj->label;
131 $this->nature = $obj->nature;
132 $this->active = $obj->active;
139 $this->error =
"Error ".$this->db->lasterror();
140 $this->errors[] =
"Error ".$this->db->lasterror();
158 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
160 $sql =
"SELECT rowid, code, label, nature, active";
161 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
164 if (count($filter) > 0) {
165 foreach ($filter as $key => $value) {
166 if ($key ==
't.code' || $key ==
't.label' || $key ==
't.nature') {
167 $sqlwhere[] = $key.
'\''.$this->
db->escape($value).
'\'';
168 } elseif ($key ==
't.rowid' || $key ==
't.active') {
169 $sqlwhere[] = $key.
'='.$value;
173 $sql .=
' WHERE 1 = 1';
174 $sql .=
" AND entity IN (".getEntity(
'accountancy').
")";
175 if (count($sqlwhere) > 0) {
176 $sql .=
' AND '.implode(
' '.$filtermode.
' ', $sqlwhere);
179 if (!empty($sortfield)) {
180 $sql .= $this->
db->order($sortfield, $sortorder);
182 if (!empty($limit)) {
183 $sql .=
' '.$this->db->plimit($limit + 1, $offset);
185 $this->lines = array();
187 dol_syslog(get_class($this).
"::fetch sql=".$sql, LOG_DEBUG);
192 while ($obj = $this->
db->fetch_object(
$resql)) {
193 $line =
new self($this->db);
195 $line->id = $obj->rowid;
196 $line->code = $obj->code;
197 $line->label = $obj->label;
198 $line->nature = $obj->nature;
199 $line->active = $obj->active;
201 $this->lines[] = $line;
208 $this->errors[] =
'Error '.$this->db->lasterror();
209 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
225 public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle =
'', $notooltip = 0)
227 global $langs, $conf, $user;
229 if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1;
233 $url = DOL_URL_ROOT.
'/accountancy/admin/journals_list.php?id=35';
235 $label =
'<u>'.$langs->trans(
"ShowAccountingJournal").
'</u>';
236 if (!empty($this->
code))
237 $label .=
'<br><b>'.$langs->trans(
'Code').
':</b> '.$this->code;
238 if (!empty($this->label))
239 $label .=
'<br><b>'.$langs->trans(
'Label').
':</b> '.$langs->transnoentities($this->label);
240 if ($moretitle) $label .=
' - '.$moretitle;
243 if (empty($notooltip))
245 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
247 $label = $langs->trans(
"ShowAccountingJournal");
248 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
250 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
251 $linkclose .=
' class="classfortooltip"';
254 $linkstart =
'<a href="'.$url.
'"';
255 $linkstart .= $linkclose.
'>';
265 $label_link = $this->code;
266 if ($withlabel) $label_link .=
' - '.($nourl ?
'<span class="opacitymedium">' :
'').$langs->transnoentities($this->label).($nourl ?
'</span>' :
'');
268 $result .= $linkstart;
269 if ($withpicto) $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
270 if ($withpicto != 2) $result .= $label_link;
284 return $this->
LibType($this->nature, $mode);
300 $langs->loadLangs(array(
"accountancy"));
305 if ($nature == 9)
return $langs->trans(
'AccountingJournalType9');
306 elseif ($nature == 5)
return $langs->trans(
'AccountingJournalType5');
307 elseif ($nature == 4)
return $langs->trans(
'AccountingJournalType4');
308 elseif ($nature == 3)
return $langs->trans(
'AccountingJournalType3');
309 elseif ($nature == 2)
return $langs->trans(
'AccountingJournalType2');
310 elseif ($nature == 1)
return $langs->trans(
'AccountingJournalType1');
311 } elseif ($mode == 1)
313 if ($nature == 9)
return $langs->trans(
'AccountingJournalType9');
314 elseif ($nature == 5)
return $langs->trans(
'AccountingJournalType5');
315 elseif ($nature == 4)
return $langs->trans(
'AccountingJournalType4');
316 elseif ($nature == 3)
return $langs->trans(
'AccountingJournalType3');
317 elseif ($nature == 2)
return $langs->trans(
'AccountingJournalType2');
318 elseif ($nature == 1)
return $langs->trans(
'AccountingJournalType1');
if(!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'] country if(!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'] typent code
getNomUrl($withpicto=0, $withlabel=0, $nourl=0, $moretitle= '', $notooltip=0)
Return clicable name (with picto eventually)
</td >< tdcolspan="3">< spanclass="opacitymedium"></span ></td ></tr >< trclass="liste_total"> CREANCES DETTES< tdcolspan="3"class="right"></td >< tdcolspan="3"class="right"></td ></tr > CREANCES DETTES RECETTES DEPENSES trips CREANCES DETTES Y m expensereport p date_valid Y m expensereport pe datep $db idate($date_start)."' AND $column < p rowid
$conf db
API class for accounts.
__construct($db)
Constructor.
getLibType($mode=0)
Retourne le libelle du statut d'un user (actif, inactif)
fetchAll($sortorder= '', $sortfield= '', $limit=0, $offset=0, array $filter=array(), $filtermode= 'AND')
Load object in memory from the database.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
LibType($nature, $mode=0)
Return type of an accounting journal.
fetch($rowid=null, $journal_code=null)
Load an object from database.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Class to manage accounting accounts.
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)