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')),
122 public $date_creation;
142 $this->ismultientitymanaged = 1;
145 $this->fields[
'rowid'][
'visible'] = 0;
147 if (!isModEnabled(
'multicompany')) {
148 $this->fields[
'entity'][
'enabled'] = 0;
173 global $hookmanager, $langs;
190 $object->ref =
"copy_of_".$object->ref;
195 $object->context[
'createfromclone'] =
'createfromclone';
196 $result =
$object->createCommon($user);
200 $this->errors =
$object->errors;
203 unset(
$object->context[
'createfromclone']);
210 $this->db->rollback();
222 public function fetch($id, $ref =
null)
225 if ($result > 0 && !empty($this->table_element_line)) {
238 $this->lines = array();
242 return count($this->lines) ? 1 : 0;
264 public function delete(
User $user, $notrigger = 0)
277 global $db, $conf, $langs;
278 global $dolibarr_main_authentication, $dolibarr_main_demo;
284 $label = $this->label;
293 $result .= ($linkstart.img_object($label,
'label',
'class="classfortooltip"').$linkend);
294 if ($withpicto != 2) {
298 $result .= $linkstart.$this->label.$linkend;
310 return $this->
LibStatut($this->active, $mode);
326 $label = $labelshort = $langs->transnoentitiesnoconv(
'Enabled');
328 $label = $labelshort = $langs->transnoentitiesnoconv(
'Disabled');
331 $statusType =
'status'.$status;
332 if ($status == self::STATUS_ENABLED) {
333 $statusType =
'status4';
336 return dolGetStatus($label, $labelshort,
'', $statusType, $mode);
347 $sql =
"SELECT rowid, date_creation as datec, tms as datem";
348 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
349 $sql .=
" WHERE t.rowid = ".((int) $id);
350 $result = $this->db->query($sql);
352 if ($this->db->num_rows($result)) {
353 $obj = $this->db->fetch_object($result);
354 $this->
id = $obj->rowid;
356 $this->date_creation = $this->db->jdate($obj->datec);
357 $this->date_modification = $this->db->jdate($obj->datem);
360 $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 dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.