86 public $type_actions = array();
107 $sql =
"SELECT id, code, type, libelle as label, color, active, picto";
108 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm";
109 if (is_numeric($id)) {
110 $sql .=
" WHERE id=".(int) $id;
112 $sql .=
" WHERE code='".$this->db->escape($id).
"'";
115 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
119 $obj = $this->
db->fetch_object(
$resql);
121 $this->
id = $obj->id;
122 $this->
code = $obj->code;
123 $this->
type = $obj->type;
124 $this->libelle = $obj->label;
125 $this->label = $obj->label;
126 $this->active = $obj->active;
127 $this->color = $obj->color;
136 $this->error = $this->
db->error();
153 public function liste_array($active =
'', $idorcode =
'id', $excludetype =
'', $onlyautoornot = 0, $morefilter =
'', $shortlabel = 0)
156 global $langs, $conf, $user;
157 $langs->load(
"commercial");
163 $sql =
"SELECT id, code, libelle as label, module, type, color, picto";
164 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm";
165 $sql .=
" WHERE 1=1";
167 $sql .=
" AND active=".(int) $active;
169 if (!empty($excludetype)) {
170 $sql .=
" AND type <> '".$this->db->escape($excludetype).
"'";
173 $sql .=
" AND ".$morefilter;
175 $sql .=
" ORDER BY type, position, module";
177 dol_syslog(get_class($this).
"::liste_array", LOG_DEBUG);
180 $nump = $this->
db->num_rows(
$resql);
182 $idforallfornewmodule = 97;
185 $obj = $this->
db->fetch_object(
$resql);
193 if ($qualified && $onlyautoornot > 0 && preg_match(
'/^system/', $obj->type) && !preg_match(
'/^AC_OTH/', $obj->code)) {
197 if ($qualified && !empty($obj->module)) {
201 if ($obj->module ==
'invoice' &&
isModEnabled(
'facture') && !empty($user->rights->facture->lire)) {
204 if ($obj->module ==
'order' &&
isModEnabled(
'commande') && empty($user->rights->commande->lire)) {
207 if ($obj->module ==
'propal' &&
isModEnabled(
"propal") && !empty($user->rights->propal->lire)) {
210 if ($obj->module ==
'invoice_supplier' && ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->facture->lire)) || (
isModEnabled(
'supplier_invoice') && !empty($user->rights->supplier_invoice->lire)))) {
213 if ($obj->module ==
'order_supplier' && ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->commande->lire)) || (!
isModEnabled(
'supplier_order') && !empty($user->rights->supplier_order->lire)))) {
216 if ($obj->module ==
'shipping' &&
isModEnabled(
"expedition") && !empty($user->rights->expedition->lire)) {
220 $tmparray = explode(
"@", $obj->module);
221 if (count($tmparray) > 1 && $tmparray[1] ==
'eventorganization' &&
isModEnabled(
'eventorganization')) {
226 if (preg_match(
'/^module/', $obj->type)) {
227 if (preg_match(
'/^(.+)@(.+)$/', $obj->module, $regs)) {
228 $tmpobject = $regs[1];
229 $tmpmodule = $regs[2];
231 if ($tmpmodule && isset($conf->$tmpmodule) &&
isModEnabled($tmpmodule) && (!empty($user->rights->$tmpmodule->read) || !empty($user->rights->$tmpmodule->lire) || !empty($user->rights->$tmpmodule->$tmpobject->read) || !empty($user->rights->$tmpmodule->$tmpobject->lire))) {
237 if (! in_array($obj->type, array(
'system',
'systemauto',
'module',
'moduleauto'))) {
238 $tmpmodule = $obj->module;
240 if ($tmpmodule && isset($conf->$tmpmodule) &&
isModEnabled($tmpmodule)) {
250 $typecalendar = $obj->type;
252 if ($onlyautoornot > 0 && $typecalendar ==
'system') {
254 } elseif ($onlyautoornot > 0 && $typecalendar ==
'systemauto') {
256 } elseif ($onlyautoornot > 0) {
257 $code =
'AC_'.strtoupper($obj->module);
261 $keyfortrans =
"Action".$code.
'Short';
262 $transcode = $langs->trans($keyfortrans);
264 if (empty($keyfortrans) || $keyfortrans == $transcode) {
265 $keyfortrans =
"Action".$code;
266 $transcode = $langs->trans($keyfortrans);
268 $label = (($transcode != $keyfortrans) ? $transcode : $langs->trans($obj->label));
269 if (($onlyautoornot == -1 || $onlyautoornot == -2) && !empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
270 if ($typecalendar ==
'system') {
271 $label =
' '.$label;
272 $repid[-99] = $langs->trans(
"ActionAC_MANUAL");
273 $repcode[
'AC_NON_AUTO'] =
'-- '.$langs->trans(
"ActionAC_MANUAL");
275 if ($typecalendar ==
'systemauto') {
276 $label =
' '.$label;
277 $repid[-98] = $langs->trans(
"ActionAC_AUTO");
278 $repcode[
'AC_ALL_AUTO'] =
'-- '.$langs->trans(
"ActionAC_AUTO");
280 if ($typecalendar ==
'module') {
282 if (preg_match(
'/@/', $obj->module)) {
283 $module = explode(
'@', $obj->module)[1];
285 $module = $obj->module;
287 $label =
' '.$label;
288 if (!isset($repcode[
'AC_ALL_'.strtoupper($module)])) {
289 $idforallfornewmodule--;
291 $repid[$idforallfornewmodule] = $langs->trans(
"ActionAC_ALL_".strtoupper($module));
292 $repcode[
'AC_ALL_'.strtoupper($module)] =
'-- '.$langs->trans(
"Module").
' '.ucfirst($module);
295 $repid[$obj->id] = $label;
296 $repcode[$obj->code] = $label;
297 $repall[$obj->code] = array(
'id' => $label,
'label' => $label,
'type' => $typecalendar,
'color' => $obj->color,
'picto' => $obj->picto);
298 if ($onlyautoornot > 0 && preg_match(
'/^module/', $obj->type) && $obj->module) {
299 $repcode[$obj->code] .=
' ('.$langs->trans(
"Module").
': '.$obj->module.
')';
300 $repall[$obj->code][
'label'] .=
' ('.$langs->trans(
"Module").
': '.$obj->module.
')';
307 if ($idorcode ==
'id') {
309 } elseif ($idorcode ==
'code') {
315 return $this->liste_array;
317 $this->error = $this->
db->lasterror();
334 $transcode = $langs->trans(
"Action".$this->
code);
335 if ($transcode !=
"Action".$this->
code) {
Class to manage different types of events.
liste_array($active='', $idorcode='id', $excludetype='', $onlyautoornot=0, $morefilter='', $shortlabel=0)
Return list of event types: array(id=>label) or array(code=>label)
fetch($id)
Load action type from database.
__construct($db)
Constructor.
getNomUrl($withpicto=0)
Return name of action type as a label translated.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db
API class for accounts.
print *****$script_file(".$version.") pid code
! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge,...