dolibarr  7.0.0-beta
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';
40  public $table_element = 'actioncomm_reminder';
44  public $ismultientitymanaged = 0;
48  public $picto = 'generic';
49 
50 
68  // BEGIN MODULEBUILDER PROPERTIES
72  public $fields=array(
73  'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
74  'dateremind' => array('type'=>'datetime', 'label'=>'DateRemind', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>1, 'index'=>1,),
75  'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",),
76  'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,),
77  'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,),
78  'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",),
79  'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')),
80  );
81  public $rowid;
82  public $dateremind;
83  public $typeremind;
84  public $fk_user;
85  public $offsetvalue;
86  public $offsetunit;
87  public $status;
88  // END MODULEBUILDER PROPERTIES
89 
90 
91 
97  public function __construct(DoliDB $db)
98  {
99  global $conf;
100 
101  $this->db = $db;
102 
103  if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
104  if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
105  }
106 
114  public function create(User $user, $notrigger = false)
115  {
116  return $this->createCommon($user, $notrigger);
117  }
118 
119 
127  public function fetch($id, $ref = null)
128  {
129  $result = $this->fetchCommon($id, $ref);
130  return $result;
131  }
132 
140  public function update(User $user, $notrigger = false)
141  {
142  return $this->updateCommon($user, $notrigger);
143  }
144 
152  public function delete(User $user, $notrigger = false)
153  {
154  return $this->deleteCommon($user, $notrigger);
155  }
156 
163  function getLibStatut($mode=0)
164  {
165  return $this->LibStatut($this->status,$mode);
166  }
167 
175  static function LibStatut($status,$mode=0)
176  {
177  global $langs;
178 
179  if ($mode == 0)
180  {
181  $prefix='';
182  if ($status == 1) return $langs->trans('Done');
183  if ($status == 0) return $langs->trans('ToDo');
184  }
185  if ($mode == 1)
186  {
187  if ($status == 1) return $langs->trans('Done');
188  if ($status == 0) return $langs->trans('ToDo');
189  }
190  if ($mode == 2)
191  {
192  if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
193  if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
194  }
195  if ($mode == 3)
196  {
197  if ($status == 1) return img_picto($langs->trans('Done'),'statut4');
198  if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5');
199  }
200  if ($mode == 4)
201  {
202  if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
203  if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
204  }
205  if ($mode == 5)
206  {
207  if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
208  if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
209  }
210  if ($mode == 6)
211  {
212  if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
213  if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
214  }
215  }
216 
223  public function initAsSpecimen()
224  {
225  $this->initAsSpecimenCommon();
226  }
227 
228 }
229 
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
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:39
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.
fetchCommon($id, $ref=null)
Load object in memory from the 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'un user (actif, inactif)
__construct(DoliDB $db)
Constructor.
deleteCommon(User $user, $notrigger=false)
Delete object in database.
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
update(User $user, $notrigger=false)
Update object into database.