Fixing style errors.

This commit is contained in:
stickler-ci 2020-06-08 14:00:57 +00:00
parent 3dd7c81f54
commit b4dd11ec98

View File

@ -1399,7 +1399,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
} }
} }
if(! empty($search_start) && ! empty($search_end)) { if (! empty($search_start) && ! empty($search_end)) {
$sql .= " AND ((a.datep BETWEEN '$search_start' AND '$search_end') OR (a.datep2 BETWEEN '$search_start' AND '$search_end'))"; $sql .= " AND ((a.datep BETWEEN '$search_start' AND '$search_end') OR (a.datep2 BETWEEN '$search_start' AND '$search_end'))";
} }
elseif (empty($search_start) && ! empty($search_end)) { elseif (empty($search_start) && ! empty($search_end)) {
@ -1409,20 +1409,19 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= " AND ((a.datep >= '$search_start') OR (a.datep2 >= '$search_start'))"; $sql .= " AND ((a.datep >= '$search_start') OR (a.datep2 >= '$search_start'))";
} }
if(is_array($actioncode) && ! empty($actioncode)) { if (is_array($actioncode) && ! empty($actioncode)) {
$sql .= ' AND ('; $sql .= ' AND (';
foreach($actioncode as $key => $code) { foreach ($actioncode as $key => $code) {
if($key != 0) $sql .= "OR ("; if ($key != 0) $sql .= "OR (";
if(! empty($code)) addEventTypeSQL($sql, $code, $donetodo, $now, $filters, ""); if (! empty($code)) addEventTypeSQL($sql, $code, $donetodo, $now, $filters, "");
if($key != 0) $sql .= ")"; if ($key != 0) $sql .= ")";
} }
$sql .= ')'; $sql .= ')';
} }
elseif (! empty($actioncode)) addEventTypeSQL($sql, $actioncode, $donetodo, $now, $filters); elseif (! empty($actioncode)) addEventTypeSQL($sql, $actioncode, $donetodo, $now, $filters);
if(is_array($actioncode)) { if (is_array($actioncode)) {
foreach ($actioncode as $code) {
foreach($actioncode as $code) {
$sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj);
if (! empty($sql2)) { if (! empty($sql2)) {
if (! empty($sql)) $sql = $sql." UNION ".$sql2; if (! empty($sql)) $sql = $sql." UNION ".$sql2;
@ -1855,7 +1854,8 @@ function show_subsidiaries($conf, $langs, $db, $object)
* @param string $sqlANDOR "AND", "OR" or "" * @param string $sqlANDOR "AND", "OR" or ""
* @return void * @return void
*/ */
function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND") { function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND")
{
global $conf, $db; global $conf, $db;
// Condition on actioncode // Condition on actioncode
@ -1863,14 +1863,12 @@ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDO
{ {
if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'";
elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'";
else else {
{
if ($actioncode == 'AC_OTH') $sql .= " $sqlANDOR c.type != 'systemauto'"; if ($actioncode == 'AC_OTH') $sql .= " $sqlANDOR c.type != 'systemauto'";
elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'";
} }
} }
else else {
{
if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'";
elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'";
else $sql .= " $sqlANDOR c.code = '".$db->escape($actioncode)."'"; else $sql .= " $sqlANDOR c.code = '".$db->escape($actioncode)."'";
@ -1889,7 +1887,8 @@ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDO
* @param Object $filterobj * @param Object $filterobj
* @return string * @return string
*/ */
function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) { function addMailingEventTypeSQL($actioncode, $objcon, $filterobj)
{
global $conf, $langs, $db; global $conf, $langs, $db;
// Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
if (!empty($conf->mailing->enabled) && !empty($objcon->email) if (!empty($conf->mailing->enabled) && !empty($objcon->email)
@ -1900,11 +1899,11 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) {
$sql2 .= ", '' as fk_element, '' as elementtype, '' as contact_id"; $sql2 .= ", '' as fk_element, '' as elementtype, '' as contact_id";
$sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
$sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action
if(is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname"; if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname";
else if(is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname"; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname";
else if(is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref";
else if(is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref";
else if(is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref";
$sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u"; $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
$sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email. $sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
$sql2 .= " AND mc.statut = 1"; $sql2 .= " AND mc.statut = 1";
@ -1912,5 +1911,4 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) {
$sql2 .= " AND mc.fk_mailing=m.rowid"; $sql2 .= " AND mc.fk_mailing=m.rowid";
return $sql2; return $sql2;
} }
} }