dolibarr  9.0.0
actioncommreminder.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
24 // Put here all includes required by your class file
25 require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
26 
27 
32 {
36  public $element = 'actioncomm_reminder';
37 
41  public $table_element = 'actioncomm_reminder';
42 
46  public $ismultientitymanaged = 0;
47 
51  public $picto = 'generic';
52 
53 
71  // BEGIN MODULEBUILDER PROPERTIES
75  public $fields=array(
76  'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
77  'dateremind' => array('type'=>'datetime', 'label'=>'DateRemind', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>1, 'index'=>1,),
78  'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",),
79  'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,),
80  'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,),
81  'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",),
82  'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')),
83  );
84 
88  public $rowid;
89 
90  public $dateremind;
91  public $typeremind;
92 
96  public $fk_user;
97 
98  public $offsetvalue;
99  public $offsetunit;
100 
104  public $status;
105 
106  // END MODULEBUILDER PROPERTIES
107 
108 
109 
115  public function __construct(DoliDB $db)
116  {
117  global $conf;
118 
119  $this->db = $db;
120 
121  if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
122  if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
123  }
124 
132  public function create(User $user, $notrigger = false)
133  {
134  return $this->createCommon($user, $notrigger);
135  }
136 
137 
145  public function fetch($id, $ref = null)
146  {
147  $result = $this->fetchCommon($id, $ref);
148  return $result;
149  }
150 
158  public function update(User $user, $notrigger = false)
159  {
160  return $this->updateCommon($user, $notrigger);
161  }
162 
170  public function delete(User $user, $notrigger = false)
171  {
172  return $this->deleteCommon($user, $notrigger);
173  }
174 
181  function getLibStatut($mode=0)
182  {
183  return $this->LibStatut($this->status,$mode);
184  }
185 
186  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
194  static function LibStatut($status,$mode=0)
195  {
196  // phpcs:enable
197  global $langs;
198 
199  if ($mode == 0 || $mode == 1)
200  {
201  if ($status == 1) return $langs->trans('Done');
202  elseif ($status == 0) return $langs->trans('ToDo');
203  }
204  elseif ($mode == 2)
205  {
206  if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
207  elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
208  }
209  elseif ($mode == 3)
210  {
211  if ($status == 1) return img_picto($langs->trans('Done'),'statut4');
212  elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5');
213  }
214  elseif ($mode == 4)
215  {
216  if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
217  elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
218  }
219  elseif ($mode == 5)
220  {
221  if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
222  elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
223  }
224  elseif ($mode == 6)
225  {
226  if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
227  elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
228  }
229  }
230 
237  public function initAsSpecimen()
238  {
239  $this->initAsSpecimenCommon();
240  }
241 }
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
fetchCommon($id, $ref=null, $morewhere='')
Load object in memory from the database.
Class for ActionCommReminder.
create(User $user, $notrigger=false)
Create object into database.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
Class to manage Dolibarr users.
Definition: user.class.php:41
Class to manage Dolibarr database access.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
createCommon(User $user, $notrigger=false)
Create object into database.
static LibStatut($status, $mode=0)
Return the status.
updateCommon(User $user, $notrigger=false)
Update object into database.
fetch($id, $ref=null)
Load object in memory from the database.
getLibStatut($mode=0)
Retourne le libelle du status d&#39;un user (actif, inactif)
__construct(DoliDB $db)
Constructor.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it&#39;s its name (generic function)
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
update(User $user, $notrigger=false)
Update object into database.