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)) $sql .=
" WHERE id=".(int) $id;
110 else $sql .=
" WHERE code='".$this->db->escape($id).
"'";
112 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
118 $obj = $this->
db->fetch_object(
$resql);
120 $this->
id = $obj->id;
121 $this->
code = $obj->code;
122 $this->
type = $obj->type;
123 $this->libelle = $obj->label;
124 $this->label = $obj->label;
125 $this->active = $obj->active;
126 $this->color = $obj->color;
135 $this->error = $this->
db->error();
152 public function liste_array($active =
'', $idorcode =
'id', $excludetype =
'', $onlyautoornot = 0, $morefilter =
'', $shortlabel = 0)
155 global $langs, $conf;
156 $langs->load(
"commercial");
161 $sql =
"SELECT id, code, libelle as label, module, type, color, picto";
162 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm";
163 $sql .=
" WHERE 1=1";
165 $sql .=
" AND active=".(int) $active;
167 if (!empty($excludetype)) $sql .=
" AND type <> '".$this->
db->escape($excludetype).
"'";
168 if ($morefilter) $sql .=
" AND ".$morefilter;
169 $sql .=
" ORDER BY module, position, type";
171 dol_syslog(get_class($this).
"::liste_array", LOG_DEBUG);
175 $nump = $this->
db->num_rows(
$resql);
181 $obj = $this->
db->fetch_object(
$resql);
186 if ($qualified && $onlyautoornot > 0 && preg_match(
'/^system/', $obj->type) && !preg_match(
'/^AC_OTH/', $obj->code)) $qualified = 0;
188 if ($qualified && $obj->module)
190 if ($obj->module ==
'invoice' && !$conf->facture->enabled) $qualified = 0;
191 if ($obj->module ==
'order' && !$conf->commande->enabled) $qualified = 0;
192 if ($obj->module ==
'propal' && !$conf->propal->enabled) $qualified = 0;
193 if ($obj->module ==
'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !$conf->supplier_invoice->enabled)) $qualified = 0;
194 if ($obj->module ==
'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !$conf->supplier_order->enabled)) $qualified = 0;
195 if ($obj->module ==
'shipping' && !$conf->expedition->enabled) $qualified = 0;
203 if ($onlyautoornot > 0 && $code ==
'AC_OTH') $code =
'AC_MANUAL';
204 if ($onlyautoornot > 0 && $code ==
'AC_OTH_AUTO') $code =
'AC_AUTO';
207 $keyfortrans =
"Action".$code.
'Short';
208 $transcode = $langs->trans($keyfortrans);
210 if (empty($keyfortrans) || $keyfortrans == $transcode)
212 $keyfortrans =
"Action".$code;
213 $transcode = $langs->trans($keyfortrans);
215 $label = (($transcode != $keyfortrans) ? $transcode : $langs->trans($obj->label));
216 if ($onlyautoornot == -1 && !empty($conf->global->AGENDA_USE_EVENT_TYPE) && !preg_match(
'/auto/i', $code))
218 $label =
' '.$label;
219 $repid[-99] = $langs->trans(
"ActionAC_MANUAL");
220 $repcode[
'AC_NON_AUTO'] = $langs->trans(
"ActionAC_MANUAL");
222 $repid[$obj->id] = $label;
223 $repcode[$obj->code] = $label;
224 if ($onlyautoornot > 0 && preg_match(
'/^module/', $obj->type) && $obj->module) $repcode[$obj->code] .=
' ('.$langs->trans(
"Module").
': '.$obj->module.
')';
229 if ($idorcode ==
'id') $this->
liste_array = $repid;
230 if ($idorcode ==
'code') $this->
liste_array = $repcode;
231 return $this->liste_array;
233 $this->error = $this->
db->lasterror();
250 $transcode = $langs->trans(
"Action".$this->
code);
251 if ($transcode !=
"Action".$this->
code)
return $transcode;
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)
if(!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'] country if(!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'] typent code
$conf db
API class for accounts.
__construct($db)
Constructor.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
fetch($id)
Load action type from database.
getNomUrl($withpicto=0)
Return name of action type as a label translated.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type