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 Nov 22, 2019
1 parent f86e397 commit b388c6b
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 126 deletions.
104 changes: 52 additions & 52 deletions htdocs/product/stock/replenishorders.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
$langs->loadLangs(array('products', 'stocks', 'orders'));

// Security check
if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'produit|service');

$sall = GETPOST('search_all', 'alphanohtml');
$sref = GETPOST('search_ref', 'alpha');
Expand All @@ -53,7 +53,7 @@
$search_dateday = GETPOST('search_dateday', 'int');
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);

$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (!$sortorder) $sortorder = 'DESC';
Expand All @@ -69,16 +69,16 @@

if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
{
$sall="";
$sref="";
$snom="";
$suser="";
$sttc="";
$search_date='';
$search_datemonth='';
$search_dateday='';
$search_dateyear='';
$sproduct=0;
$sall = "";
$sref = "";
$snom = "";
$suser = "";
$sttc = "";
$search_date = '';
$search_datemonth = '';
$search_dateday = '';
$search_dateyear = '';
$sproduct = 0;
}


Expand Down Expand Up @@ -109,40 +109,40 @@
$commandestatic = new CommandeFournisseur($db);

$sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,';
$sql.= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,';
$sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande_fournisseur as cf';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON cf.fk_user_author = u.rowid';
$sql .= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,';
$sql .= ' u.login';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande_fournisseur as cf';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON cf.fk_user_author = u.rowid';
if (!$user->rights->societe->client->voir && !$socid) {
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
$sql .= ', '.MAIN_DB_PREFIX.'societe_commerciaux as sc';
}
$sql.= ' WHERE cf.fk_soc = s.rowid ';
$sql.= ' AND cf.entity = ' . $conf->entity;
$sql .= ' WHERE cf.fk_soc = s.rowid ';
$sql .= ' AND cf.entity = '.$conf->entity;
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
$sql .= ' AND cf.fk_statut < 3';
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
} else {
$sql .= ' AND cf.fk_statut < 5';
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = '.$user->id;
}
if ($sref) $sql .= natural_search('cf.ref', $sref);
if ($snom) $sql .= natural_search('s.nom', $snom);
if ($suser) $sql .= natural_search('u.login', $suser);
if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
$sql.= dolSqlDateFilter('cf.date_creation', $search_dateday, $search_datemonth, $search_dateyear);
if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall);
if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid;
$sql .= dolSqlDateFilter('cf.date_creation', $search_dateday, $search_datemonth, $search_dateyear);
if ($sall) $sql .= natural_search(array('cf.ref', 'cf.note'), $sall);
if (!empty($socid)) $sql .= ' AND s.rowid = '.$socid;
if (GETPOST('statut', 'int')) {
$sql .= ' AND fk_statut = ' . GETPOST('statut', 'int');
$sql .= ' AND fk_statut = '.GETPOST('statut', 'int');
}
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= $db->order($sortfield, $sortorder);
if (! $sproduct) {
$sql .= $db->plimit($limit+1, $offset);
if (!$sproduct) {
$sql .= $db->plimit($limit + 1, $offset);
}

$resql = $db->query($sql);
Expand All @@ -155,17 +155,17 @@

print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');

$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sref) $param.='&search_ref='.urlencode($sref);
if ($snom) $param.='&search_nom='.urlencode($snom);
if ($suser) $param.='&search_user='.urlencode($suser);
if ($sttc) $param.='&search_ttc='.urlencode($sttc);
if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear);
if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth);
if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($sref) $param .= '&search_ref='.urlencode($sref);
if ($snom) $param .= '&search_nom='.urlencode($snom);
if ($suser) $param .= '&search_user='.urlencode($suser);
if ($sttc) $param .= '&search_ttc='.urlencode($sttc);
if ($search_dateyear) $param .= '&search_dateyear='.urlencode($search_dateyear);
if ($search_datemonth) $param .= '&search_datemonth='.urlencode($search_datemonth);
if ($search_dateday) $param .= '&search_dateday='.urlencode($search_dateday);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);


print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
Expand All @@ -174,16 +174,16 @@

print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ref" value="' . dol_escape_htmltag($sref) . '">'.
'<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($sref).'">'.
'</td>'.
'<td class="liste_titre">'.
'<input type="text" class="flat" name="search_nom" value="' . dol_escape_htmltag($snom) . '">'.
'<input type="text" class="flat" name="search_nom" value="'.dol_escape_htmltag($snom).'">'.
'</td>'.
'<td class="liste_titre">'.
'<input type="text" class="flat" name="search_user" value="' . dol_escape_htmltag($suser) . '">'.
'<input type="text" class="flat" name="search_user" value="'.dol_escape_htmltag($suser).'">'.
'</td>'.
'<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ttc" value="' . dol_escape_htmltag($sttc) . '">'.
'<input type="text" class="flat" name="search_ttc" value="'.dol_escape_htmltag($sttc).'">'.
'</td>'.
'<td class="liste_titre">'.
$form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, '').
Expand Down Expand Up @@ -260,7 +260,7 @@

$userstatic = new User($db);

while ($i < min($num, $sproduct?$num:$conf->liste_limit))
while ($i < min($num, $sproduct ? $num : $conf->liste_limit))
{
$obj = $db->fetch_object($resql);

Expand All @@ -276,29 +276,29 @@
print '</td>';

// Company
$href = DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid;
$href = DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid;
print '<td>'.
'<a href="' . $href .'">'.
img_object($langs->trans('ShowCompany'), 'company'). ' '.
$obj->name . '</a></td>';
'<a href="'.$href.'">'.
img_object($langs->trans('ShowCompany'), 'company').' '.
$obj->name.'</a></td>';

// Author
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
if ($userstatic->id) {
$txt = $userstatic->getLoginUrl(1);
} else {
$txt = '&nbsp;';
$txt = '&nbsp;';
}
print '<td>'.$txt.'</td>';
// Amount
print '<td>'.price($obj->total_ttc).'</td>';

// Date
if ($obj->dc) {
$date = dol_print_date($db->jdate($obj->dc), 'dayhour');
$date = dol_print_date($db->jdate($obj->dc), 'dayhour');
} else {
$date = '-';
$date = '-';
}
print '<td>'.$date.'</td>';
// Statut
Expand Down
56 changes: 28 additions & 28 deletions htdocs/product/stock/valo.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@
$langs->load("stocks");

// Security check
$result=restrictedArea($user, 'stock');
$result = restrictedArea($user, 'stock');

$sref=GETPOST("sref", 'alpha');
$snom=GETPOST("snom", 'alpha');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$sref = GETPOST("sref", 'alpha');
$snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));

$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (! $sortfield) $sortfield="e.ref";
if (! $sortorder) $sortorder="ASC";
if (!$sortfield) $sortfield = "e.ref";
if (!$sortorder) $sortorder = "ASC";
$page = $_GET["page"];
if ($page < 0) $page = 0;
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;

$year = strftime("%Y", time());
Expand All @@ -53,23 +53,23 @@
*/

$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
$sql.= " WHERE e.entity IN (".getEntity('stock').")";
if ($sref) $sql.= natural_search("e.ref", $sref);
$sql .= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
$sql .= " WHERE e.entity IN (".getEntity('stock').")";
if ($sref) $sql .= natural_search("e.ref", $sref);
if ($sall)
{
$sql.= " AND (e.ref LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.description LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.address LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.town LIKE '%".$db->escape($sall)."%')";
$sql .= " AND (e.ref LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.description LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.address LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.town LIKE '%".$db->escape($sall)."%')";
}
$sql.= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($limit + 1, $offset);
$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);

$result = $db->query($sql);
if ($result)
Expand All @@ -78,7 +78,7 @@

$i = 0;

$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
llxHeader("", $langs->trans("EnhancedValueOfWarehouses"), $help_url);

print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
Expand All @@ -94,9 +94,9 @@

if ($num)
{
$entrepot=new Entrepot($db);
$entrepot = new Entrepot($db);
$total = $totalsell = 0;
$var=false;
$var = false;
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
Expand Down Expand Up @@ -136,17 +136,17 @@

print '<br>';

$file='entrepot-'.$year.'.png';
$file = 'entrepot-'.$year.'.png';
if (file_exists($conf->stock->dir_temp.'/'.$file))
{
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
print '<img src="'.$url.'">';
}

$file='entrepot-'.($year-1).'.png';
$file = 'entrepot-'.($year - 1).'.png';
if (file_exists($conf->stock->dir_temp.'/'.$file))
{
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
print '<br><img src="'.$url.'">';
}
}
Expand Down
34 changes: 17 additions & 17 deletions htdocs/projet/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,34 @@
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');

$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "alpha");
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (! $sortfield) $sortfield="a.datep,a.id";
if (! $sortorder) $sortorder="DESC";
$offset = $limit * $page ;
if (!$sortfield) $sortfield = "a.datep,a.id";
if (!$sortorder) $sortorder = "DESC";
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

if (GETPOST('actioncode', 'array'))
{
$actioncode=GETPOST('actioncode', 'array', 3);
if (! count($actioncode)) $actioncode='0';
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0';
}
else
{
$actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label=GETPOST('search_agenda_label');
$search_agenda_label = GETPOST('search_agenda_label');

// Security check
$id = GETPOST("id", 'int');
$socid=0;
$socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result=restrictedArea($user, 'projet', $id, '');
$result = restrictedArea($user, 'projet', $id, '');

if (!$user->rights->projet->lire) accessforbidden();

Expand Down Expand Up @@ -149,20 +149,20 @@

// Actions buttons

$out='';
$permok=$user->rights->agenda->myactions->create;
$out = '';
$permok = $user->rights->agenda->myactions->create;
if ($permok)
{
$out.='&projectid='.$object->id;
$out .= '&projectid='.$object->id;
}


//print '<div class="tabsAction">';
$morehtmlcenter='';
if (! empty($conf->agenda->enabled))
$morehtmlcenter = '';
if (!empty($conf->agenda->enabled))
{
$addActionBtnRight = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create);
$morehtmlcenter.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
}

//print '</div>';
Expand Down
Loading

0 comments on commit b388c6b

Please sign in to comment.