fix: Filter event in agenda par Type (#35287)
* fix filter event per Type * fix filter event per Type * fix: php code sniffer * fix: php code sniffer * fix: php code sniffer * fix: php code sniffer
This commit is contained in:
parent
f4fe07b98a
commit
644a9ea179
3 changed files with 25 additions and 26 deletions
|
|
@ -798,22 +798,22 @@ $sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual v
|
|||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||
if ($actioncode == 'AC_NON_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode == 'AC_NON_AUTO') {
|
||||
$sql .= " AND ca.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
} elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode == 'AC_ALL_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
} else {
|
||||
if ($actioncode == 'AC_OTH') {
|
||||
if ((is_array($actioncode) && in_array('AC_OTH', $actioncode)) || $actioncode == 'AC_OTH') {
|
||||
$sql .= " AND ca.type != 'systemauto'";
|
||||
}
|
||||
if ($actioncode == 'AC_OTH_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_OTH_AUTO', $actioncode)) || $actioncode == 'AC_OTH_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($actioncode === 'AC_NON_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode === 'AC_NON_AUTO') {
|
||||
$sql .= " AND ca.type != 'systemauto'";
|
||||
} elseif ($actioncode === 'AC_ALL_AUTO') {
|
||||
} elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
} else {
|
||||
if (is_array($actioncode)) {
|
||||
|
|
|
|||
|
|
@ -72,10 +72,9 @@ $type = GETPOST('search_type', 'alphanohtml') ? GETPOST('search_type', 'alphanoh
|
|||
$year = GETPOSTINT("year");
|
||||
$month = GETPOSTINT("month");
|
||||
$day = GETPOSTINT("day");
|
||||
|
||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||
if (GETPOST('search_actioncode', 'array')) {
|
||||
$actioncode = GETPOST('search_actioncode', 'array', 3);
|
||||
if (GETPOST('search_actioncode', 'array:aZ09')) {
|
||||
$actioncode = GETPOST('search_actioncode', 'array:aZ09', 3);
|
||||
if (!count($actioncode)) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
|
|
@ -484,22 +483,22 @@ $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual
|
|||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||
if ($actioncode == 'AC_NON_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode == 'AC_NON_AUTO') {
|
||||
$sql .= " AND c.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
} elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode == 'AC_ALL_AUTO') {
|
||||
$sql .= " AND c.type = 'systemauto'";
|
||||
} else {
|
||||
if ($actioncode == 'AC_OTH') {
|
||||
if ((is_array($actioncode) && in_array('AC_OTH', $actioncode)) || $actioncode == 'AC_OTH') {
|
||||
$sql .= " AND c.type != 'systemauto'";
|
||||
}
|
||||
if ($actioncode == 'AC_OTH_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_OTH_AUTO', $actioncode)) || $actioncode == 'AC_OTH_AUTO') {
|
||||
$sql .= " AND c.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($actioncode === 'AC_NON_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode === 'AC_NON_AUTO') {
|
||||
$sql .= " AND c.type != 'systemauto'";
|
||||
} elseif ($actioncode === 'AC_ALL_AUTO') {
|
||||
} elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') {
|
||||
$sql .= " AND c.type = 'systemauto'";
|
||||
} else {
|
||||
if (is_array($actioncode)) {
|
||||
|
|
|
|||
|
|
@ -714,24 +714,24 @@ $sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual v
|
|||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||
if ($actioncode == 'AC_NON_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode == 'AC_NON_AUTO') {
|
||||
$sql .= " AND ca.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
} elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode == 'AC_ALL_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
} else {
|
||||
if ($actioncode == 'AC_OTH') {
|
||||
if ((is_array($actioncode) && in_array('AC_OTH', $actioncode)) || $actioncode == 'AC_OTH') {
|
||||
$sql .= " AND ca.type != 'systemauto'";
|
||||
}
|
||||
if ($actioncode == 'AC_OTH_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_OTH_AUTO', $actioncode)) || $actioncode == 'AC_OTH_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($actioncode == 'AC_NON_AUTO') {
|
||||
if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode === 'AC_NON_AUTO') {
|
||||
$sql .= " AND ca.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
} elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
} elseif ($actioncode !== '-1' && $actioncode !== '-3') {
|
||||
} elseif ((is_array($actioncode) && !in_array('-1', $actioncode) && !in_array('-3', $actioncode)) || ($actioncode !== '-1' && $actioncode !== '-3')) {
|
||||
if (is_array($actioncode)) {
|
||||
foreach ($actioncode as $key => $val) {
|
||||
if ($val == '-1' || $val == '-2') {
|
||||
|
|
@ -2297,7 +2297,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
if ($ev['busy']) {
|
||||
$style1 = 'onclickopenref peruser_busy';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
if (!empty($ev['css'])) {
|
||||
$style1 .= ' '.$ev['css'];
|
||||
}
|
||||
}
|
||||
|
|
@ -2317,7 +2317,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
if ($ev['busy']) {
|
||||
$style2 = 'onclickopenref peruser_busy';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
if (!empty($ev['css'])) {
|
||||
$style2 .= ' '.$ev['css'];
|
||||
}
|
||||
}
|
||||
|
|
@ -2337,7 +2337,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
if ($ev['busy']) {
|
||||
$style3 = 'onclickopenref peruser_busy';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
if (!empty($ev['css'])) {
|
||||
$style3 .= ' '.$ev['css'];
|
||||
}
|
||||
}
|
||||
|
|
@ -2357,7 +2357,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
if ($ev['busy']) {
|
||||
$style4 = 'onclickopenref peruser_busy';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
if (!empty($ev['css'])) {
|
||||
$style4 .= ' '.$ev['css'];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue