-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy patheasycrmnotifiy.class.php
149 lines (133 loc) · 7.49 KB
/
easycrmnotifiy.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/* Copyright (C) 2023 EVARISK <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file class/easycrmnotify.class.php
* \ingroup easycrm
* \brief This file is a CRUD class file for EasycrmNotify (Create/Read/Update/Delete)
*/
// Load Saturne libraries.
require_once __DIR__ . '/../../saturne/class/saturneobject.class.php';
/**
* Class for EasycrmNotify
*/
class EasycrmNotify extends SaturneObject
{
/**
* @var string Module name
*/
public $module = 'easycrm';
/**
* @var string Element type of object
*/
public $element = 'easycrm_notify';
/**
* @var string Name of table without prefix where object is stored. This is also the key used for extrafields management
*/
public $table_element = 'notify_def';
/**
* 'type' field format:
* 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',
* 'select' (list of values are in 'options'),
* 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]',
* 'chkbxlst:...',
* 'varchar(x)',
* 'text', 'text:none', 'html',
* 'double(24,8)', 'real', 'price',
* 'date', 'datetime', 'timestamp', 'duration',
* 'boolean', 'checkbox', 'radio', 'array',
* 'mail', 'phone', 'url', 'password', 'ip'
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key.
* 'picto' is code of a picto to show before value in forms
* 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...)
* 'position' is the sort order of field.
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty '' or 0.
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
* 'default' is a default value for creation (can still be overwroted by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage)
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar'
* 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'validate' is 1 if you need to validate with $this->validateField()
* 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value)
* 'size' limit the length of a fields
*
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
*/
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = [
'rowid' => ['type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => 'Id'],
'tms' => ['type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 10, 'notnull' => 0, 'visible' => 0],
'datec' => ['type' => 'date', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 20, 'notnull' => 0, 'visible' => 0],
'fk_action' => ['type' => 'integer', 'label' => 'Action', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 0],
'fk_soc' => ['type' => 'integer', 'label' => 'Societe', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => 0],
'fk_contact' => ['type' => 'integer', 'label' => 'SocPeople', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 0],
'fk_user' => ['type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0],
'type' => ['type' => 'varchar(16)', 'label' => 'Type', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 0, 'default' => 'email'],
];
/**
* @var int ID
*/
public int $rowid;
/**
* @var int|string Timestamp
*/
public $tms;
/**
* @var int|string Creation date
*/
public $datec;
/**
* @var int Action trigger ID
*/
public int $fk_action;
/**
* @var int|null ThirdParty ID
*/
public ?int $fk_soc;
/**
* @var int|null SocPeople ID
*/
public ?int $fk_contact;
/**
* @var int|null User ID
*/
public ?int $fk_user;
/**
* @var string|null Notification type
*/
public ?string $type = 'email';
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
public function __construct(DoliDB $db)
{
parent::__construct($db, $this->module, $this->element);
}
}