29require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
 
   42  public $element = 
'emailsenderprofile';
 
   47  public $table_element = 
'c_email_senderprofile';
 
   52  public $ismultientitymanaged = 1;
 
   57  public $picto = 
'emailsenderprofile';
 
   59  public $fk_user_creat;
 
   62  const STATUS_DISABLED = 0;
 
   63  const STATUS_ENABLED = 1;
 
   95  public $fields = array(
 
   96    'rowid' => array(
'type'=>
'integer', 
'label'=>
'TechnicalID', 
'visible'=>-1, 
'enabled'=>1, 
'position'=>1, 
'notnull'=>1, 
'index'=>1, 
'comment'=>
'Id',),
 
   97    'entity' => array(
'type'=>
'integer', 
'label'=>
'Entity', 
'visible'=>-1, 
'enabled'=>1, 
'position'=>20, 
'notnull'=>1, 
'index'=>1,),
 
   98    'label' => array(
'type'=>
'varchar(255)', 
'label'=>
'Label', 
'visible'=>1, 
'enabled'=>1, 
'position'=>30, 
'notnull'=>1),
 
   99    'email' => array(
'type'=>
'varchar(255)', 
'label'=>
'Email', 
'visible'=>1, 
'enabled'=>1, 
'position'=>40, 
'notnull'=>-1),
 
  100    'private' => array(
'type'=>
'integer:User:user/class/user.class.php', 
'label'=>
'User', 
'visible'=>-1, 
'enabled'=>1, 
'position'=>50, 
'default'=>
'0', 
'notnull'=>1),
 
  101    'signature' => array(
'type'=>
'html', 
'label'=>
'Signature', 
'visible'=>3, 
'enabled'=>1, 
'position'=>400, 
'notnull'=>-1, 
'index'=>1,),
 
  102    'position' => array(
'type'=>
'integer', 
'label'=>
'Position', 
'visible'=>1, 
'enabled'=>1, 
'position'=>405, 
'notnull'=>-1, 
'index'=>1,),
 
  103    'date_creation' => array(
'type'=>
'datetime', 
'label'=>
'DateCreation', 
'visible'=>-1, 
'enabled'=>1, 
'position'=>500, 
'notnull'=>1,),
 
  104    'tms' => array(
'type'=>
'timestamp', 
'label'=>
'DateModification', 
'visible'=>-1, 
'enabled'=>1, 
'position'=>500, 
'notnull'=>1,),
 
  105    'active' => array(
'type'=>
'integer', 
'label'=>
'Status', 
'visible'=>1, 
'enabled'=>1, 
'default'=>1, 
'position'=>1000, 
'notnull'=>1, 
'index'=>1, 
'arrayofkeyval'=>array(0=>
'Disabled', 1=>
'Enabled')),
 
  128  public $date_creation;
 
  149    if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
 
  150      $this->fields[
'rowid'][
'visible'] = 0;
 
  152    if (!isModEnabled(
'multicompany')) {
 
  153      $this->fields[
'entity'][
'enabled'] = 0;
 
 
  178    global $hookmanager, $langs;
 
  183    $object = 
new self($this->db);
 
  188    $object->fetchCommon($fromid);
 
  191    unset($object->fk_user_creat);
 
  192    unset($object->import_key);
 
  195    $object->ref = 
"copy_of_".$object->ref;
 
  196    $object->title = $langs->trans(
"CopyOf").
" ".$object->title;
 
  200    $object->context[
'createfromclone'] = 
'createfromclone';
 
  201    $result = $object->createCommon($user);
 
  204      $this->error = $object->error;
 
  205      $this->errors = $object->errors;
 
  208    unset($object->context[
'createfromclone']);
 
  215      $this->db->rollback();
 
 
  227  public function fetch($id, $ref = 
null)
 
  230    if ($result > 0 && !empty($this->table_element_line)) {
 
 
  243    $this->lines = array();
 
  247    return count($this->lines) ? 1 : 0;
 
 
  269  public function delete(
User $user, $notrigger = 
false)
 
 
  282    global $db, $conf, $langs;
 
  283    global $dolibarr_main_authentication, $dolibarr_main_demo;
 
  289    $label = $this->label;
 
  298      $result .= ($linkstart.img_object($label, 
'label', 
'class="classfortooltip"').$linkend);
 
  299      if ($withpicto != 2) {
 
  303    $result .= $linkstart.$this->label.$linkend;
 
 
  315    return $this->
LibStatut($this->active, $mode);
 
 
  331      $label = $labelshort = $langs->transnoentitiesnoconv(
'Enabled');
 
  333      $label = $labelshort = $langs->transnoentitiesnoconv(
'Disabled');
 
  336    $statusType = 
'status'.$status;
 
  337    if ($status == self::STATUS_ENABLED) {
 
  338      $statusType = 
'status4';
 
  341    return dolGetStatus($label, $labelshort, 
'', $statusType, $mode);
 
 
  352    $sql = 
"SELECT rowid, date_creation as datec, tms as datem";
 
  353    $sql .= 
" FROM ".$this->db->prefix().$this->table_element.
" as t";
 
  354    $sql .= 
" WHERE t.rowid = ".((int) $id);
 
  355    $result = $this->db->query($sql);
 
  357      if ($this->db->num_rows($result)) {
 
  358        $obj = $this->db->fetch_object($result);
 
  359        $this->
id = $obj->rowid;
 
  361        $this->date_creation     = $this->db->jdate($obj->datec);
 
  362        $this->date_modification = $this->db->jdate($obj->datem);
 
  365      $this->db->free($result);
 
 
 
Parent class of all other business classes (invoices, contracts, proposals, orders,...
fetchCommon($id, $ref=null, $morewhere='')
Load object in memory from the database.
createCommon(User $user, $notrigger=false)
Create object into database.
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
updateCommon(User $user, $notrigger=false)
Update object into database.
Class to manage Dolibarr database access.
Class for EmailSenderProfile.
fetchLines()
Load object lines in memory from the database.
update(User $user, $notrigger=false)
Update object into database.
getLibStatut($mode=0)
Return the label of a given status.
getNomUrl($withpicto=0)
Return a link to the object card (with optionaly 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 informations 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.
__construct(DoliDB $db)
Constructor.
create(User $user, $notrigger=false)
Create object into database.
Class to manage Dolibarr users.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.