fix event type select

This commit is contained in:
Florian HENRY 2021-02-27 14:13:42 +01:00
parent bf04a8cf1b
commit eb17ae5fe2
4 changed files with 30 additions and 19 deletions

View File

@ -153,7 +153,7 @@ class CActionComm
public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0)
{
// phpcs:enable
global $langs, $conf;
global $langs, $conf, $user;
$langs->load("commercial");
$repid = array();
@ -191,29 +191,29 @@ class CActionComm
$qualified = 0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
}
if ($qualified && $obj->module) {
if ($obj->module == 'invoice' && !$conf->facture->enabled) {
if ($qualified && !empty($obj->module)) {
if ($obj->module == 'invoice' && empty($conf->facture->enabled) && empty($user->facture->lire)) {
$qualified = 0;
}
if ($obj->module == 'order' && !$conf->commande->enabled) {
if ($obj->module == 'order' && empty($conf->commande->enabled) && empty($user->commande->lire)) {
$qualified = 0;
}
if ($obj->module == 'propal' && !$conf->propal->enabled) {
if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) {
$qualified = 0;
}
if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !$conf->supplier_invoice->enabled)) {
if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled)) && empty($user->fournisseur->facture->lire)) {
$qualified = 0;
}
if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !$conf->supplier_order->enabled)) {
if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled)) && empty($user->fournisseur->commande->lire)) {
$qualified = 0;
}
if ($obj->module == 'shipping' && !$conf->expedition->enabled) {
if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) {
$qualified = 0;
}
if ($obj->module == 'eventorganization' && !$conf->eventorganization->enabled) {
if ($obj->module == 'eventorganization' && empty($conf->eventorganization->enabled) && empty($user->eventorganization->read)) {
$qualified = 0;
}
if (!empty($obj->module) && preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && isset($conf->{$obj->module}->enabled) && !$conf->{$obj->module}->enabled) {
if (!preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && empty($conf->{$obj->module}->enabled)) {
$qualified = 0;
}
}
@ -252,6 +252,14 @@ class CActionComm
$repid[-98] = $langs->trans("ActionAC_AUTO");
$repcode['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO");
}
if (preg_match('/^system@/', $typecalendar)) {
$label = '   '.$label;
if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module
$idforallfornewmodule--;
}
$repid[$idforallfornewmodule] = $langs->trans("ActionAC_".strtoupper($obj->module));
$repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module);
}
if ($typecalendar == 'module') {
$label = '   '.$label;
if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module
@ -260,6 +268,7 @@ class CActionComm
$repid[$idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($obj->module));
$repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module);
}
}
$repid[$obj->id] = $label;
$repcode[$obj->code] = $label;

View File

@ -48,7 +48,9 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position)
-- Code used from 3.3+ when type of event is not used
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL, 1, 20);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 50,'AC_OTH','system','Other (manually inserted events)',NULL, 1, 5);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','conference','Online/Virtual conference','eventorganization', 1, 60);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','conference','Indoor conference','eventorganization', 1, 61);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','booth','Online/Virtual booth','eventorganization', 1, 62);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','booth','Indoor booth','eventorganization', 1, 63);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','system@conference','Online/Virtual conference','eventorganization', 1, 60);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','system@conference','Indoor conference','eventorganization', 1, 61);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','system@booth','Online/Virtual booth','eventorganization', 1, 62);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','system@booth','Indoor booth','eventorganization', 1, 63);

View File

@ -188,11 +188,10 @@ ALTER TABLE llx_projet ADD COLUMN price_booth double(24,8);
ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL;
ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL;
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','conference','Online/Virtual conference','eventorganization', 1, 60);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','conference','Indoor conference','eventorganization', 1, 61);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','booth','Online/Virtual booth','eventorganization', 1, 62);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','booth','Indoor booth','eventorganization', 1, 63);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','system@conference','Online/Virtual conference','eventorganization', 1, 60);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','system@conference','Indoor conference','eventorganization', 1, 61);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','system@booth','Online/Virtual booth','eventorganization', 1, 62);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','system@booth','Indoor booth','eventorganization', 1, 63);
-- Code enhanced - Standardize field name
ALTER TABLE llx_commande CHANGE COLUMN tva total_tva double(24,8) default 0;
ALTER TABLE llx_supplier_proposal CHANGE COLUMN tva total_tva double(24,8) default 0;

View File

@ -68,6 +68,7 @@ ActionAC_OTH_AUTO=Other auto
ActionAC_MANUAL=Manually inserted events
ActionAC_AUTO=Automatically inserted events
ActionAC_OTH_AUTOShort=Other
ActionAC_EVENTORGANIZATION=Event organization events
Stats=Sales statistics
StatusProsp=Prospect status
DraftPropals=Draft commercial proposals