42 public $errors = array();
52 public $code_departement;
89 public function create($user, $notrigger = 0)
95 if (isset($this->code_departement)) $this->code_departement = trim($this->code_departement);
96 if (isset($this->
nom)) $this->
nom = trim($this->
nom);
97 if (isset($this->active)) $this->active = trim($this->active);
103 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"c_departements(";
105 $sql .=
"code_departement,";
108 $sql .=
") VALUES (";
109 $sql .=
" ".(!isset($this->
rowid) ?
'NULL' :
"'".$this->db->escape($this->
rowid).
"'").
",";
110 $sql .=
" ".(!isset($this->code_departement) ?
'NULL' :
"'".$this->db->escape($this->code_departement).
"'").
",";
111 $sql .=
" ".(!isset($this->
nom) ?
'NULL' :
"'".$this->db->escape($this->
nom).
"'").
",";
112 $sql .=
" ".(!isset($this->active) ?
'NULL' :
"'".$this->db->escape($this->active).
"'").
"";
117 dol_syslog(get_class($this).
"::create", LOG_DEBUG);
119 if (!
$resql) { $error++; $this->errors[] =
"Error ".$this->db->lasterror(); }
122 $this->
id = $this->
db->last_insert_id(MAIN_DB_PREFIX.
"c_departements");
128 foreach ($this->errors as $errmsg)
130 dol_syslog(get_class($this).
"::create ".$errmsg, LOG_ERR);
131 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
133 $this->
db->rollback();
149 public function fetch($id, $code =
'')
154 $sql .=
" t.code_departement,";
157 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_departements as t";
158 if ($id) $sql .=
" WHERE t.rowid = ".$id;
159 elseif ($code) $sql .=
" WHERE t.code_departement = '".$this->db->escape($code).
"'";
161 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
167 $obj = $this->
db->fetch_object(
$resql);
169 $this->
id = $obj->rowid;
170 $this->code_departement = $obj->code_departement;
171 $this->
code = $obj->code_departement;
172 $this->
nom = $obj->nom;
173 $this->
name = $obj->nom;
174 $this->active = $obj->active;
180 $this->error =
"Error ".$this->db->lasterror();
193 public function update($user = null, $notrigger = 0)
195 global $conf, $langs;
199 if (isset($this->code_departement)) $this->code_departement = trim($this->code_departement);
200 if (isset($this->
nom)) $this->
nom = trim($this->
nom);
201 if (isset($this->active)) $this->active = trim($this->active);
208 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"c_departements SET";
209 $sql .=
" code_departement=".(isset($this->code_departement) ?
"'".$this->db->escape($this->code_departement).
"'" :
"null").
",";
210 $sql .=
" nom=".(isset($this->
nom) ?
"'".$this->db->escape($this->
nom).
"'" :
"null").
",";
211 $sql .=
" active=".(isset($this->active) ? $this->active :
"null").
"";
212 $sql .=
" WHERE rowid=".$this->id;
216 dol_syslog(get_class($this).
"::update", LOG_DEBUG);
218 if (!
$resql) { $error++; $this->errors[] =
"Error ".$this->db->lasterror(); }
222 foreach ($this->errors as $errmsg) {
223 dol_syslog(get_class($this).
"::update ".$errmsg, LOG_ERR);
224 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
226 $this->
db->rollback();
241 public function delete($user, $notrigger = 0)
243 global $conf, $langs;
246 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"c_departements";
247 $sql .=
" WHERE rowid=".$this->id;
251 dol_syslog(get_class($this).
"::delete", LOG_DEBUG);
253 if (!
$resql) { $error++; $this->errors[] =
"Error ".$this->db->lasterror(); }
258 foreach ($this->errors as $errmsg)
260 dol_syslog(get_class($this).
"::delete ".$errmsg, LOG_ERR);
261 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
263 $this->
db->rollback();
update($user=null, $notrigger=0)
Update object into database.
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
</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
Class to manage dictionary States (used by imports)
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
create($user, $notrigger=0)
Create object into database.
if(!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'] s nom
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
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.
__construct($db)
Constructor.
fetch($id, $code= '')
Load object in memory from database.