45 public $errors = array();
64 public $table_element =
"c_price_global_variable";
84 public function create($user, $notrigger = 0)
91 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.$this->table_element.
" (";
92 $sql .=
"code, description, value";
94 $sql .=
" ".(isset($this->
code) ?
"'".$this->db->escape($this->
code).
"'" :
"''").
",";
96 $sql .=
" ".$this->value;
103 if (!
$resql) { $error++; $this->errors[] =
"Error ".$this->db->lasterror(); }
107 $this->
id = $this->
db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
124 foreach ($this->errors as $errmsg)
127 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
129 $this->
db->rollback();
146 $sql =
"SELECT code, description, value";
147 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element;
148 $sql .=
" WHERE rowid = ".$id;
154 $obj = $this->
db->fetch_object(
$resql);
158 $this->
code = $obj->code;
160 $this->value = $obj->value;
167 $this->error =
"Error ".$this->db->lasterror();
179 public function update($user = 0, $notrigger = 0)
186 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element.
" SET";
187 $sql .=
" code = ".(isset($this->
code) ?
"'".$this->db->escape($this->
code).
"'" :
"''").
",";
188 $sql .=
" description = ".(isset($this->
description) ?
"'".$this->db->escape($this->
description).
"'" :
"''").
",";
189 $sql .=
" value = ".$this->value;
190 $sql .=
" WHERE rowid = ".$this->id;
196 if (!
$resql) { $error++; $this->errors[] =
"Error ".$this->db->lasterror(); }
215 foreach ($this->errors as $errmsg)
218 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
220 $this->
db->rollback();
237 public function delete($rowid, $user, $notrigger = 0)
259 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
260 $sql .=
" WHERE rowid = ".$rowid;
264 if (!
$resql) { $error++; $this->errors[] =
"Error ".$this->db->lasterror(); }
270 foreach ($this->errors as $errmsg)
273 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
275 $this->
db->rollback();
305 if (isset($this->
code)) $this->
code = trim($this->
code);
309 if (empty($this->value) || !is_numeric($this->value)) $this->value = 0;
319 $sql =
"SELECT rowid, code, description, value";
320 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element;
321 $sql .=
" ORDER BY code";
329 while ($record = $this->
db->fetch_array(
$resql))
332 $variable_obj->id = $record[
"rowid"];
333 $variable_obj->code = $record[
"code"];
334 $variable_obj->description = $record[
"description"];
335 $variable_obj->value = $record[
"value"];
336 $variable_obj->checkParameters();
337 $retarray[] = $variable_obj;
343 $this->error = $this->
db->error();
create($user, $notrigger=0)
Create object into database.
update($user=0, $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
listGlobalVariables()
List all price global variables.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
__construct($db)
Constructor.
fetch($id)
Load object in memory from the database.
$conf db
API class for accounts.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
checkParameters()
Checks if all parameters are in 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) 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 for accesing price global variables table.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.