Skip to content

Commit

Permalink
Scrutinizer Auto-Fixes
Browse files Browse the repository at this point in the history
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
  • Loading branch information
scrutinizer-auto-fixer committed Dec 18, 2019
1 parent 2de16c3 commit 455178f
Show file tree
Hide file tree
Showing 34 changed files with 2,628 additions and 2,628 deletions.
16 changes: 8 additions & 8 deletions htdocs/admin/bank_extrafields.php
Expand Up @@ -37,13 +37,13 @@
$form = new Form($db);

// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);

$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='bank_account'; //Must be the $element of the class that manage extrafield
$action = GETPOST('action', 'alpha');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'bank_account'; //Must be the $element of the class that manage extrafield

if (!$user->admin) accessforbidden();

Expand All @@ -65,7 +65,7 @@
llxHeader('', $langs->trans("BankSetupModule"), $help_url);


$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'title_setup');


Expand Down Expand Up @@ -101,7 +101,7 @@
/*
* Edition of an optional field
*/
if ($action == 'edit' && ! empty($attrname))
if ($action == 'edit' && !empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/system/filecheck.php
Expand Up @@ -215,7 +215,7 @@

// Defined qualified files (must be same than into generate_filelist_xml.php)
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);

// Fill file_list with files in signature, new files, modified files
Expand Down
40 changes: 20 additions & 20 deletions htdocs/api/class/api_setup.class.php
Expand Up @@ -67,21 +67,21 @@ public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $lim
$list = array();

$sql = "SELECT rowid, code, libelle as label, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_input_method as t";
$sql.= " WHERE t.active = ".$active;
$sql .= " FROM ".MAIN_DB_PREFIX."c_input_method as t";
$sql .= " WHERE t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}


$sql.= $this->db->order($sortfield, $sortorder);
$sql .= $this->db->order($sortfield, $sortorder);

if ($limit) {
if ($page < 0) {
Expand Down Expand Up @@ -453,21 +453,21 @@ public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC
{
$list = array();
$sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking";
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql.= " WHERE t.active = ".$active;
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql .= " WHERE t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}


$sql.= $this->db->order($sortfield, $sortorder);
$sql .= $this->db->order($sortfield, $sortorder);

if ($limit) {
if ($page < 0) {
Expand Down Expand Up @@ -1104,22 +1104,22 @@ public function getListOfsocialNetworks($sortfield = "rowid", $sortorder = 'ASC'
$list = array();
//TODO link with multicurrency module
$sql = "SELECT t.rowid, t.entity, t.code, t.label, t.url, t.icon, t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_socialnetworks as t";
$sql.= " WHERE t.entity IN (".getEntity('c_socialnetworks').")";
$sql.= " AND t.active = ".$active;
$sql .= " FROM ".MAIN_DB_PREFIX."c_socialnetworks as t";
$sql .= " WHERE t.entity IN (".getEntity('c_socialnetworks').")";
$sql .= " AND t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}


$sql.= $this->db->order($sortfield, $sortorder);
$sql .= $this->db->order($sortfield, $sortorder);

if ($limit) {
if ($page < 0) {
Expand Down Expand Up @@ -1474,7 +1474,7 @@ public function getCheckIntegrity($target)

// Defined qualified files (must be same than into generate_filelist_xml.php)
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude = '('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);

// Fill file_list with files in signature, new files, modified files
Expand Down
96 changes: 48 additions & 48 deletions htdocs/comm/action/index.php
Expand Up @@ -36,89 +36,89 @@
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->projet->enabled)) {
if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}

if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3;

if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;

$filter = GETPOST("search_filter", 'alpha', 3)?GETPOST("search_filter", 'alpha', 3):GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3)?GETPOST("search_filtert", "int", 3):GETPOST("filtert", "int", 3);
$usergroup = GETPOST("search_usergroup", "int", 3)?GETPOST("search_usergroup", "int", 3):GETPOST("usergroup", "int", 3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday", "int"):1;
$filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ?GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
$usergroup = GETPOST("search_usergroup", "int", 3) ?GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
$showbirthday = empty($conf->use_javascript_ajax) ?GETPOST("showbirthday", "int") : 1;

// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user.
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
{
$filtert=$user->id;
$filtert = $user->id;
}

$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", "int");
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec";
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "a.datec";

// Security check
$socid = GETPOST("search_socid", "int")?GETPOST("search_socid", "int"):GETPOST("socid", "int");
if ($user->socid) $socid=$user->socid;
$socid = GETPOST("search_socid", "int") ?GETPOST("search_socid", "int") : GETPOST("socid", "int");
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
if ($socid < 0) $socid = '';

$canedit=1;
if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
$canedit = 1;
if (!$user->rights->agenda->myactions->read) accessforbidden();
if (!$user->rights->agenda->allactions->read) $canedit = 0;
if (!$user->rights->agenda->allactions->read || $filter == 'mine') // If no permission to see all, we show only affected to me
{
$filtert=$user->id;
$filtert = $user->id;
}

$action=GETPOST('action', 'alpha');
$resourceid=GETPOST("search_resourceid", "int");
$year=GETPOST("year", "int")?GETPOST("year", "int"):date("Y");
$month=GETPOST("month", "int")?GETPOST("month", "int"):date("m");
$week=GETPOST("week", "int")?GETPOST("week", "int"):date("W");
$day=GETPOST("day", "int")?GETPOST("day", "int"):date("d");
$pid=GETPOST("search_projectid", "int", 3)?GETPOST("search_projectid", "int", 3):GETPOST("projectid", "int", 3);
$status=GETPOST("search_status", 'aZ09')?GETPOST("search_status", 'aZ09'):GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
$type=GETPOST("search_type", 'aZ09')?GETPOST("search_type", 'aZ09'):GETPOST("type", 'aZ09');
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$action = GETPOST('action', 'alpha');
$resourceid = GETPOST("search_resourceid", "int");
$year = GETPOST("year", "int") ?GETPOST("year", "int") : date("Y");
$month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m");
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$pid = GETPOST("search_projectid", "int", 3) ?GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
$status = GETPOST("search_status", 'aZ09') ?GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
$type = GETPOST("search_type", 'aZ09') ?GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$maxprint = (isset($_GET["maxprint"]) ?GETPOST("maxprint") : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// 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 (! count($actioncode)) $actioncode='0';
$actioncode = GETPOST('search_actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0';
}
else
{
$actioncode=GETPOST("search_actioncode", "alpha", 3)?GETPOST("search_actioncode", "alpha", 3):(GETPOST("search_actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);

if ($status == '' && ! GETPOSTISSET('search_status')) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if ($status == '' && !GETPOSTISSET('search_status')) $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);

$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
$defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW);
if (empty($action) && ! GETPOSTISSET('action')) $action=$defaultview;
if (empty($action) && !GETPOSTISSET('action')) $action = $defaultview;
if ($action == 'default') // When action is default, we want a calendar view and not the list
{
$action = (($defaultview != 'show_list') ? $defaultview : 'show_month');
}
if (GETPOST('viewcal', 'none') && GETPOST('action', 'alpha') != 'show_day' && GETPOST('action', 'alpha') != 'show_week') {
$action='show_month'; $day='';
if (GETPOST('viewcal', 'none') && GETPOST('action', 'alpha') != 'show_day' && GETPOST('action', 'alpha') != 'show_week') {
$action = 'show_month'; $day = '';
} // View by month
if (GETPOST('viewweek', 'none') || GETPOST('action', 'alpha') == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
$action = 'show_week'; $week = ($week ? $week : date("W")); $day = ($day ? $day : date("d"));
} // View by week
if (GETPOST('viewday', 'none') || GETPOST('action', 'alpha') == 'show_day') {
$action='show_day'; $day=($day?$day:date("d"));
if (GETPOST('viewday', 'none') || GETPOST('action', 'alpha') == 'show_day') {
$action = 'show_day'; $day = ($day ? $day : date("d"));
} // View by day

// Load translation files required by the page
Expand Down Expand Up @@ -1482,7 +1482,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
//var_dump($event->userassigned);
//var_dump($event->transparency);
print '<table class="centpercent cal_event';
print (empty($event->transparency)?' cal_event_notbusy':' cal_event_busy');
print (empty($event->transparency) ? ' cal_event_notbusy' : ' cal_event_busy');
//if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) print ' opacitymedium'; // Not busy
print '" style="'.$h;
$colortouse = $color;
Expand Down Expand Up @@ -1664,12 +1664,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
else
{
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year;
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
print ($filtert?'&search_filtert='.$filtert:'');
print ($usergroup?'&search_usergroup='.$usergroup:'');
print ($actioncode!=''?'&search_actioncode='.$actioncode:'');
print ($status ? '&status='.$status : '').($filter ? '&filter='.$filter : '');
print ($filtert ? '&search_filtert='.$filtert : '');
print ($usergroup ? '&search_usergroup='.$usergroup : '');
print ($actioncode != '' ? '&search_actioncode='.$actioncode : '');
print '">'.img_picto("all", "1downarrow_selected.png").' ...';
print ' +'.(count($eventarray[$daykey])-$maxprint);
print ' +'.(count($eventarray[$daykey]) - $maxprint);
print '</a>';
break;
//$ok=false; // To avoid to show twice the link
Expand Down

0 comments on commit 455178f

Please sign in to comment.