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';
56 public $fk_user_creat;
59 const STATUS_DISABLED = 0;
60 const STATUS_ENABLED = 1;
92 public $fields = array(
93 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'visible' => -1,
'enabled' => 1,
'position' => 1,
'notnull' => 1,
'index' => 1,
'comment' =>
'Id',),
94 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'visible' => -1,
'enabled' => 1,
'position' => 20,
'notnull' => 1,
'index' => 1,),
95 'label' => array(
'type' =>
'varchar(255)',
'label' =>
'Label',
'visible' => 1,
'enabled' => 1,
'position' => 30,
'notnull' => 1),
96 'email' => array(
'type' =>
'varchar(255)',
'label' =>
'Email',
'visible' => 1,
'enabled' => 1,
'position' => 40,
'notnull' => -1),
97 'private' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'User',
'visible' => 1,
'enabled' => 1,
'position' => 50,
'default' =>
'0',
'notnull' => 1),
98 'signature' => array(
'type' =>
'html',
'label' =>
'Signature',
'visible' => 3,
'enabled' => 1,
'position' => 400,
'notnull' => -1,
'index' => 1,),
99 'position' => array(
'type' =>
'integer',
'label' =>
'Position',
'visible' => 1,
'enabled' => 1,
'position' => 405,
'notnull' => -1,
'index' => 1,),
100 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'visible' => -1,
'enabled' => 1,
'position' => 500,
'notnull' => 1,),
101 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'visible' => -1,
'enabled' => 1,
'position' => 500,
'notnull' => 1,),
102 'active' => array(
'type' =>
'integer',
'label' =>
'Status',
'visible' => 1,
'enabled' => 1,
'default' => 1,
'position' => 1000,
'notnull' => 1,
'index' => 1,
'arrayofkeyval' => array(0 =>
'Disabled', 1 =>
'Enabled')),
155 $this->ismultientitymanaged = 1;
158 $this->fields[
'rowid'][
'visible'] = 0;
160 if (!isModEnabled(
'multicompany')) {
161 $this->fields[
'entity'][
'enabled'] = 0;
186 global $hookmanager, $langs;
203 $object->ref =
"copy_of_".$object->ref;
208 $object->context[
'createfromclone'] =
'createfromclone';
209 $result =
$object->createCommon($user);
213 $this->errors =
$object->errors;
216 unset(
$object->context[
'createfromclone']);
223 $this->db->rollback();
235 public function fetch($id, $ref =
null)
238 if ($result > 0 && !empty($this->table_element_line)) {
251 $this->lines = array();
255 return count($this->lines) ? 1 : 0;
277 public function delete(
User $user, $notrigger = 0)
290 global $db, $conf, $langs;
291 global $dolibarr_main_authentication, $dolibarr_main_demo;
297 $label = $this->label;
306 $result .= ($linkstart.img_object($label,
'label',
'class="classfortooltip"').$linkend);
307 if ($withpicto != 2) {
311 $result .= $linkstart.$this->label.$linkend;
323 return $this->
LibStatut($this->active, $mode);
339 $label = $labelshort = $langs->transnoentitiesnoconv(
'Enabled');
341 $label = $labelshort = $langs->transnoentitiesnoconv(
'Disabled');
344 $statusType =
'status'.$status;
345 if ($status == self::STATUS_ENABLED) {
346 $statusType =
'status4';
349 return dolGetStatus($label, $labelshort,
'', $statusType, $mode);
360 $sql =
"SELECT rowid, date_creation as datec, tms as datem";
361 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
362 $sql .=
" WHERE t.rowid = ".((int) $id);
363 $result = $this->db->query($sql);
365 if ($this->db->num_rows($result)) {
366 $obj = $this->db->fetch_object($result);
367 $this->
id = $obj->rowid;
369 $this->date_creation = $this->db->jdate($obj->datec);
370 $this->date_modification = $this->db->jdate($obj->datem);
373 $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.