34 public $element =
'events';
39 public $table_element =
'events';
91 public $prefix_session;
94 public $eventstolog = array(
95 array(
'id'=>
'USER_LOGIN',
'test'=>1),
96 array(
'id'=>
'USER_LOGIN_FAILED',
'test'=>1),
97 array(
'id'=>
'USER_LOGOUT',
'test'=>1),
98 array(
'id'=>
'USER_CREATE',
'test'=>1),
99 array(
'id'=>
'USER_MODIFY',
'test'=>1),
100 array(
'id'=>
'USER_NEW_PASSWORD',
'test'=>1),
101 array(
'id'=>
'USER_ENABLEDISABLE',
'test'=>1),
102 array(
'id'=>
'USER_DELETE',
'test'=>1),
103 array(
'id'=>
'USERGROUP_CREATE',
'test'=>1),
104 array(
'id'=>
'USERGROUP_MODIFY',
'test'=>1),
105 array(
'id'=>
'USERGROUP_DELETE',
'test'=>1),
113 public $fields = array(
114 'rowid' =>array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>1,
'visible'=>-2,
'noteditable'=>1,
'notnull'=> 1,
'index'=>1,
'position'=>1,
'comment'=>
'Id'),
115 'entity' =>array(
'type'=>
'integer',
'label'=>
'Entity',
'enabled'=>1,
'visible'=>0,
'notnull'=> 1,
'default'=>1,
'index'=>1,
'position'=>20),
116 'prefix_session'=>array(
'type'=>
'varchar(255)',
'label'=>
'PrefixSession',
'enabled'=>1,
'visible'=>-1,
'notnull'=>-1,
'index'=>0,
'position'=>1000),
117 'user_agent' =>array(
'type'=>
'varchar(255)',
'label'=>
'UserAgent',
'enabled'=>1,
'visible'=>-1,
'notnull'=> 1,
'default'=>0,
'index'=>1,
'position'=>1000),
144 if (empty($this->user_agent)) $this->user_agent = (empty(
$_SERVER[
'HTTP_USER_AGENT']) ?
'' :
$_SERVER[
'HTTP_USER_AGENT']);
147 if (empty($this->
description)) { $this->error =
'ErrorBadValueForParameterCreateEventDesc';
return -1; }
150 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"events(";
154 $sql .=
"user_agent,";
155 $sql .=
"dateevent,";
157 $sql .=
"description,";
158 $sql .=
"prefix_session";
159 $sql .=
") VALUES (";
160 $sql .=
" '".$this->db->escape($this->
type).
"',";
161 $sql .=
" ".$conf->entity.
",";
163 $sql .=
" ".($this->user_agent ?
"'".$this->db->escape(
dol_trunc($this->user_agent, 250)).
"'" :
'NULL').
",";
164 $sql .=
" '".$this->db->idate($this->dateevent).
"',";
165 $sql .=
" ".($user->id ?
"'".$this->db->escape($user->id).
"'" :
'NULL').
",";
167 $sql .=
" '".$this->db->escape(dol_getprefix()).
"'";
170 dol_syslog(get_class($this).
"::create", LOG_DEBUG);
174 $this->
id = $this->
db->last_insert_id(MAIN_DB_PREFIX.
"events");
177 $this->error =
"Error ".$this->db->lasterror();
190 public function update($user = null, $notrigger = 0)
193 $this->
id = (int) $this->
id;
201 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"events SET";
202 $sql .=
" type='".$this->db->escape($this->
type).
"',";
203 $sql .=
" dateevent='".$this->db->idate($this->dateevent).
"',";
204 $sql .=
" description='".$this->db->escape($this->
description).
"'";
205 $sql .=
" WHERE rowid=".$this->id;
207 dol_syslog(get_class($this).
"::update", LOG_DEBUG);
211 $this->error =
"Error ".$this->db->lasterror();
225 public function fetch($id, $user = null)
231 $sql .=
" t.entity,";
232 $sql .=
" t.dateevent,";
233 $sql .=
" t.description,";
235 $sql .=
" t.user_agent,";
236 $sql .=
" t.prefix_session";
237 $sql .=
" FROM ".MAIN_DB_PREFIX.
"events as t";
238 $sql .=
" WHERE t.rowid = ".$id;
240 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
246 $obj = $this->
db->fetch_object(
$resql);
248 $this->
id = $obj->rowid;
249 $this->tms = $this->
db->jdate($obj->tms);
250 $this->
type = $obj->type;
251 $this->entity = $obj->entity;
252 $this->dateevent = $this->
db->jdate($obj->dateevent);
254 $this->ip = $obj->ip;
255 $this->user_agent = $obj->user_agent;
256 $this->prefix_session = $obj->prefix_session;
262 $this->error =
"Error ".$this->db->lasterror();
274 public function delete($user)
276 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"events";
277 $sql .=
" WHERE rowid=".$this->id;
279 dol_syslog(get_class($this).
"::delete", LOG_DEBUG);
283 $this->error =
"Error ".$this->db->lasterror();
304 $this->dateevent = time();
306 $this->ip =
'1.2.3.4';
307 $this->user_agent =
'Mozilla specimen User Agent X.Y';
308 $this->prefix_session = dol_getprefix();
getUserRemoteIP()
Return the IP of remote user.
</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.
fetch($id, $user=null)
Load object in memory from database.
initAsSpecimen()
Initialise an instance with random values.
$conf db
API class for accounts.
__construct($db)
Constructor.
create($user)
Create in database.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
print $_SERVER["PHP_SELF"]
Edit parameters.
update($user=null, $notrigger=0)
Update 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.
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type