30require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
41 public $element =
'emailsenderprofile';
46 public $table_element =
'c_email_senderprofile';
51 public $picto =
'emailsenderprofile';
53 public $fk_user_creat;
56 const STATUS_DISABLED = 0;
57 const STATUS_ENABLED = 1;
89 public $fields = array(
90 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'visible' => -1,
'enabled' => 1,
'position' => 1,
'notnull' => 1,
'index' => 1,
'comment' =>
'Id',),
91 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'visible' => -1,
'enabled' => 1,
'position' => 20,
'notnull' => 1,
'index' => 1,),
92 'label' => array(
'type' =>
'varchar(255)',
'label' =>
'Label',
'visible' => 1,
'enabled' => 1,
'position' => 30,
'notnull' => 1),
93 'email' => array(
'type' =>
'varchar(255)',
'label' =>
'Email',
'visible' => 1,
'enabled' => 1,
'position' => 40,
'notnull' => -1),
94 'private' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'User',
'visible' => 1,
'enabled' => 1,
'position' => 50,
'default' =>
'0',
'notnull' => 1),
95 'signature' => array(
'type' =>
'html',
'label' =>
'Signature',
'visible' => 3,
'enabled' => 1,
'position' => 400,
'notnull' => -1,
'index' => 1,),
96 'position' => array(
'type' =>
'integer',
'label' =>
'Position',
'visible' => 1,
'enabled' => 1,
'position' => 405,
'notnull' => -1,
'index' => 1,),
97 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'visible' => -1,
'enabled' => 1,
'position' => 500,
'notnull' => 1,),
98 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'visible' => -1,
'enabled' => 1,
'position' => 500,
'notnull' => 1,),
99 'active' => array(
'type' =>
'integer',
'label' =>
'Status',
'visible' => 1,
'enabled' => 1,
'default' => 1,
'position' => 1000,
'notnull' => 1,
'index' => 1,
'arrayofkeyval' => array(0 =>
'Disabled', 1 =>
'Enabled')),
137 $this->ismultientitymanaged = 1;
140 $this->fields[
'rowid'][
'visible'] = 0;
142 if (!isModEnabled(
'multicompany')) {
143 $this->fields[
'entity'][
'enabled'] = 0;
168 global $hookmanager, $langs;
185 $object->ref =
"copy_of_".$object->ref;
190 $object->context[
'createfromclone'] =
'createfromclone';
191 $result =
$object->createCommon($user);
195 $this->errors =
$object->errors;
198 unset(
$object->context[
'createfromclone']);
205 $this->db->rollback();
217 public function fetch($id, $ref =
null)
220 if ($result > 0 && !empty($this->table_element_line)) {
233 $this->lines = array();
237 return count($this->lines) ? 1 : 0;
259 public function delete(
User $user, $notrigger = 0)
272 global $db, $conf, $langs;
273 global $dolibarr_main_authentication, $dolibarr_main_demo;
279 $label = $this->label;
288 $result .= ($linkstart.img_object($label,
'label',
'class="classfortooltip"').$linkend);
289 if ($withpicto != 2) {
293 $result .= $linkstart.$this->label.$linkend;
305 return $this->
LibStatut($this->active, $mode);
321 $label = $labelshort = $langs->transnoentitiesnoconv(
'Enabled');
323 $label = $labelshort = $langs->transnoentitiesnoconv(
'Disabled');
326 $statusType =
'status'.$status;
327 if ($status == self::STATUS_ENABLED) {
328 $statusType =
'status4';
331 return dolGetStatus($label, $labelshort,
'', $statusType, $mode);
342 $sql =
"SELECT rowid, date_creation as datec, tms as datem";
343 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
344 $sql .=
" WHERE t.rowid = ".((int) $id);
345 $result = $this->db->query($sql);
347 if ($this->db->num_rows($result)) {
348 $obj = $this->db->fetch_object($result);
349 $this->
id = $obj->rowid;
351 $this->date_creation = $this->db->jdate($obj->datec);
352 $this->date_modification = $this->db->jdate($obj->datem);
355 $this->db->free($result);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Parent class of all other business classes (invoices, contracts, proposals, orders,...
createCommon(User $user, $notrigger=0)
Create object in the database.
updateCommon(User $user, $notrigger=0)
Update object into database.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
fetchCommon($id, $ref=null, $morewhere='', $noextrafields=0)
Load object in memory from the database.
deleteCommon(User $user, $notrigger=0, $forcechilddeletion=0)
Delete object in database.
Class to manage Dolibarr database access.
Class for EmailSenderProfile.
fetchLines()
Load object lines in memory from the database.
getLibStatut($mode=0)
Return the label of a given status.
update(User $user, $notrigger=0)
Update object into database.
getNomUrl($withpicto=0)
Return a link to the object card (with optionally the picto)
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
fetch($id, $ref=null)
Load object in memory from the database.
info($id)
Charge les information d'ordre info dans l'objet commande.
static LibStatut($status, $mode=0)
Return the label of a given status.
createFromClone(User $user, $fromid)
Clone and object into another one.
create(User $user, $notrigger=0)
Create object into database.
__construct(DoliDB $db)
Constructor.
Class to manage Dolibarr users.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.