PSR coding style

This commit is contained in:
Raphaël Doursenaud 2013-06-13 17:40:18 +02:00 committed by Cédric Salvador
parent f0243646df
commit 2f5f96dc13
2 changed files with 201 additions and 214 deletions

View File

@ -39,7 +39,8 @@ if ($user->societe_id) {
$result=restrictedArea($user,'produit|service'); $result=restrictedArea($user,'produit|service');
//checks if a product has been ordered //checks if a product has been ordered
function ordered($product_id) { function ordered($product_id)
{
global $db; global $db;
$sql = 'SELECT DISTINCT cfd.fk_product, SUM(cfd.qty) from '; $sql = 'SELECT DISTINCT cfd.fk_product, SUM(cfd.qty) from ';
$sql .= MAIN_DB_PREFIX . 'commande_fournisseurdet as cfd '; $sql .= MAIN_DB_PREFIX . 'commande_fournisseurdet as cfd ';
@ -53,16 +54,16 @@ function ordered($product_id) {
$exists = $db->num_rows($resql); $exists = $db->num_rows($resql);
if ($exists) { if ($exists) {
$obj = $db->fetch_array($resql); $obj = $db->fetch_array($resql);
return $obj['SUM(cfd.qty)'] . ' ' . img_picto('','tick'); return $obj['SUM(cfd.qty)'] . ' ' . img_picto('','tick');
} } else {
else {
return img_picto('', 'stcomm-1'); return img_picto('', 'stcomm-1');
} }
} } else {
else {
$error = $db->lasterror(); $error = $db->lasterror();
dol_print_error($db); dol_print_error($db);
dol_syslog('replenish.php: ' . $error, LOG_ERROR); dol_syslog('replenish.php: ' . $error, LOG_ERROR);
return $langs->trans('error'); return $langs->trans('error');
} }
} }
@ -125,8 +126,7 @@ if($action == 'order') {
$line->total_ttc = $line->total_ht + $line->total_tva; $line->total_ttc = $line->total_ht + $line->total_tva;
$line->ref_fourn = $obj->ref_fourn; $line->ref_fourn = $obj->ref_fourn;
$suppliers[$obj->fk_soc]['lines'][] = $line; $suppliers[$obj->fk_soc]['lines'][] = $line;
} } else {
else {
$error=$db->lasterror(); $error=$db->lasterror();
dol_print_error($db); dol_print_error($db);
dol_syslog('replenish.php: '.$error, LOG_ERROR); dol_syslog('replenish.php: '.$error, LOG_ERROR);
@ -190,8 +190,7 @@ if ($sall) {
if (dol_strlen($type)) { if (dol_strlen($type)) {
if ($type == 1) { if ($type == 1) {
$sql .= ' AND p.fk_product_type = 1'; $sql .= ' AND p.fk_product_type = 1';
} } else {
else {
$sql .= ' AND p.fk_product_type != 1'; $sql .= ' AND p.fk_product_type != 1';
} }
} }
@ -251,8 +250,7 @@ if ($resql) {
'', '',
$num $num
); );
} } else {
else {
$filters = '&sref=' . $sref . '&snom=' . $snom; $filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&fourn_id=' . $fourn_id; $filters .= '&fourn_id=' . $fourn_id;
$filters .= (isset($type)?'&type=' . $type:''); $filters .= (isset($type)?'&type=' . $type:'');
@ -323,8 +321,7 @@ if ($resql) {
); );
if ($conf->global->USE_VIRTUAL_STOCK) { if ($conf->global->USE_VIRTUAL_STOCK) {
$stocklabel = $langs->trans('VirtualStock'); $stocklabel = $langs->trans('VirtualStock');
} } else {
else {
$stocklabel = $langs->trans('PhysicalStock'); $stocklabel = $langs->trans('PhysicalStock');
} }
print_liste_field_titre($stocklabel, print_liste_field_titre($stocklabel,
@ -430,14 +427,11 @@ if ($resql) {
print '<td align="center">'; print '<td align="center">';
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) { if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
print $regs[1] . ' ' . $langs->trans('DurationYear'); print $regs[1] . ' ' . $langs->trans('DurationYear');
} } elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
else if(preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
print $regs[1] . ' ' . $langs->trans('DurationMonth'); print $regs[1] . ' ' . $langs->trans('DurationMonth');
} } elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
else if(preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
print $regs[1] . ' ' . $langs->trans('DurationDay'); print $regs[1] . ' ' . $langs->trans('DurationDay');
} } else {
else {
print $objp->duration; print $objp->duration;
} }
print '</td>'; print '</td>';
@ -461,8 +455,7 @@ if ($resql) {
} }
$stock_commande_fournisseur = $prod->stats_commande_fournisseur['qty']; $stock_commande_fournisseur = $prod->stats_commande_fournisseur['qty'];
$stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur; $stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur;
} } else {
else {
$stock = $objp->stock_physique; $stock = $objp->stock_physique;
} }
if ($objp->seuil_stock_alerte if ($objp->seuil_stock_alerte
@ -516,8 +509,7 @@ if ($resql) {
0, 0,
'' ''
); );
} } else {
else {
$filters = '&sref=' . $sref . '&snom=' . $snom; $filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&fourn_id=' . $fourn_id; $filters .= '&fourn_id=' . $fourn_id;
$filters .= (isset($type)? '&amp;type=' . $type : ''); $filters .= (isset($type)? '&amp;type=' . $type : '');
@ -537,11 +529,9 @@ if ($resql) {
$db->free($resql); $db->free($resql);
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -254,8 +254,7 @@ if($resql) {
if ($userstatic->id) { if ($userstatic->id) {
print $userstatic->getLoginUrl(1); print $userstatic->getLoginUrl(1);
} } else {
else {
print '&nbsp;'; print '&nbsp;';
} }
@ -268,8 +267,7 @@ if($resql) {
print '<td>'; print '<td>';
if ($obj->dc) { if ($obj->dc) {
print dol_print_date($db->jdate($obj->dc), 'day'); print dol_print_date($db->jdate($obj->dc), 'day');
} } else {
else {
print '-'; print '-';
} }
print '</td>'; print '</td>';
@ -288,4 +286,3 @@ if($resql) {
llxFooter(); llxFooter();
$db->close(); $db->close();
?>