Checkstyle

This commit is contained in:
Laurent Destailleur 2013-09-10 13:45:39 +02:00
parent ee65a193c2
commit 72557437ef
9 changed files with 350 additions and 347 deletions

View File

@ -219,7 +219,7 @@
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- some phpcs have a typo error in rule, so we add it too --> <!-- some phpcs have a typo error in rule, so we add it too -->
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial"> <rule ref="PEAR.NamingConventions.ValidClassName.StartWithCaptial">
<severity>0</severity> <severity>0</severity>
</rule> </rule>

View File

@ -287,7 +287,6 @@ class Propal extends CommonObject
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
* *
* @param int $propalid Id de la propale
* @param string $desc Description de la ligne * @param string $desc Description de la ligne
* @param double $pu_ht Prix unitaire * @param double $pu_ht Prix unitaire
* @param double $qty Quantite * @param double $qty Quantite
@ -1603,9 +1602,7 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_statut = ".$this->statut.","; $sql.= " SET fk_statut = ".$this->statut.",";
if (! empty ( $note )) { if (! empty($note)) $sql.= " note_private = '".$this->db->escape($note)."',";
$sql .= " note_private = '" . $this->db->escape ( $note ) . "',";
}
$sql.= " date_cloture=NULL, fk_user_cloture=NULL"; $sql.= " date_cloture=NULL, fk_user_cloture=NULL";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;

View File

@ -576,8 +576,8 @@ class BonPrelevement extends CommonObject
/** /**
* Get invoice list * Get invoice list
* *
* @param $amounts If you want to get the amount of the order for each invoice * @param int $amounts If you want to get the amount of the order for each invoice
* @return array id of invoices * @return array Id of invoices
*/ */
private function getListInvoices($amounts=0) private function getListInvoices($amounts=0)
{ {

View File

@ -906,21 +906,16 @@ class Contact extends CommonObject
} }
/** /**
* Retourne le libelle du statut du contact * Return label of contact status
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle * @return string Label of contact status
*/ */
function getLibStatut($mode) function getLibStatut($mode)
{ {
return $this->LibStatut($this->statut,$mode); return $this->LibStatut($this->statut,$mode);
} }
function getLibStatutcontact()
{
return $this->LibStatutcontact($this->statut);
}
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@ -928,7 +923,7 @@ class Contact extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle * @return string Libelle
*/ */
function LibStatut($statut) function LibStatut($statut,$mode)
{ {
global $langs; global $langs;
@ -977,12 +972,7 @@ class Contact extends CommonObject
} }
function LibStatutcontact($statut)
{
global $langs;
if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('StatusContactDraftShort'),'statut0');
else return '<span class="hideonsmartphone">'.$langs->trans('Enabled').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut1');
}
/** /**
* Return translated label of Public or Private * Return translated label of Public or Private
* *

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
@ -739,7 +739,7 @@ else
// Statut // Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td>'; print '<td>';
print $object->getLibStatutcontact(); print $object->getLibStatut(5);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
@ -946,10 +946,10 @@ else
print nl2br($object->note); print nl2br($object->note);
print '</td></tr>'; print '</td></tr>';
// Statut // Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td>'; print '<td>';
print $object->getLibStatutcontact(); print $object->getLibStatut(5);
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Other attributes // Other attributes

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
@ -3223,16 +3223,23 @@ abstract class CommonObject
print '</table>'; print '</table>';
} }
/**
* Overwrite magic function to solve problem of cloning object that are kept as references
*
* @return void
*/
function __clone() function __clone()
{ {
// Force a copy of this->lines, otherwise it will point to same object. // Force a copy of this->lines, otherwise it will point to same object.
if (isset($this->lines) && is_array($this->lines)) if (isset($this->lines) && is_array($this->lines))
{ {
for($i=0; $i < count($this->lines); $i++) $nboflines=count($this->lines);
for($i=0; $i < $nboflines; $i++)
{ {
$this->lines[$i] = dol_clone($this->lines[$i]); $this->lines[$i] = dol_clone($this->lines[$i]);
} }
} }
} }
} }
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (c) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (c) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -235,37 +235,40 @@ if ($resql) {
$filters = '&sref=' . $sref . '&snom=' . $snom; $filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&sall=' . $sall; $filters .= '&sall=' . $sall;
$filters .= '&salert=' . $salert; $filters .= '&salert=' . $salert;
print_barre_liste($texte, print_barre_liste(
$page, $texte,
'replenish.php', $page,
$filters, 'replenish.php',
$sortfield, $filters,
$sortorder, $sortfield,
'', $sortorder,
$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:'');
$filters .= '&salert=' . $salert; $filters .= '&salert=' . $salert;
print_barre_liste($texte, print_barre_liste(
$page, $texte,
'replenish.php', $page,
$filters, 'replenish.php',
$sortfield, $filters,
$sortorder, $sortfield,
'', $sortorder,
$num); '',
$num
);
} }
echo '<form action="replenish.php" method="post" name="formulaire">', print '<form action="replenish.php" method="post" name="formulaire">'.
'<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">', '<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">'.
'<input type="hidden" name="sortfield" value="' . $sortfield . '">', '<input type="hidden" name="sortfield" value="' . $sortfield . '">'.
'<input type="hidden" name="sortorder" value="' . $sortorder . '">', '<input type="hidden" name="sortorder" value="' . $sortorder . '">'.
'<input type="hidden" name="type" value="' . $type . '">', '<input type="hidden" name="type" value="' . $type . '">'.
'<input type="hidden" name="linecount" value="' . $num . '">', '<input type="hidden" name="linecount" value="' . $num . '">'.
'<input type="hidden" name="action" value="order">', '<input type="hidden" name="action" value="order">'.
'<table class="liste" width="100%">'; '<table class="liste" width="100%">';
@ -274,115 +277,128 @@ if ($resql) {
$param .= '&sref=' . $sref; $param .= '&sref=' . $sref;
// Lignes des titres // Lignes des titres
echo '<tr class="liste_titre">', print '<tr class="liste_titre">'.
'<td><input type="checkbox" onClick="toggle(this)" /></td>'; '<td><input type="checkbox" onClick="toggle(this)" /></td>';
print_liste_field_titre($langs->trans('Ref'), print_liste_field_titre(
'replenish.php', $langs->trans('Ref'),
'p.ref', 'replenish.php',
$param, 'p.ref',
'', $param,
'', '',
$sortfield, '',
$sortorder $sortfield,
); $sortorder
print_liste_field_titre($langs->trans('Label'), );
'replenish.php', print_liste_field_titre(
'p.label', $langs->trans('Label'),
$param, 'replenish.php',
'', 'p.label',
'', $param,
$sortfield, '',
$sortorder '',
); $sortfield,
if (!empty($conf->service->enabled) && $type == 1) { $sortorder
print_liste_field_titre($langs->trans('Duration'), );
'replenish.php', if (!empty($conf->service->enabled) && $type == 1)
'p.duration', {
$param, print_liste_field_titre(
'', $langs->trans('Duration'),
'align="center"', 'replenish.php',
$sortfield, 'p.duration',
$sortorder $param,
); '',
'align="center"',
$sortfield,
$sortorder
);
} }
print_liste_field_titre($langs->trans('DesiredStock'), print_liste_field_titre(
'replenish.php', $langs->trans('DesiredStock'),
'p.desiredstock', 'replenish.php',
$param, 'p.desiredstock',
'', $param,
'align="right"', '',
$sortfield, 'align="right"',
$sortorder $sortfield,
); $sortorder
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(
'replenish.php', $stocklabel,
'stock_physique', 'replenish.php',
$param, 'stock_physique',
'', $param,
'align="right"', '',
$sortfield, 'align="right"',
$sortorder $sortfield,
); $sortorder
print_liste_field_titre($langs->trans('Ordered'), );
'replenish.php', print_liste_field_titre(
'', $langs->trans('Ordered'),
$param, 'replenish.php',
'', '',
'align="right"', $param,
$sortfield, '',
$sortorder 'align="right"',
); $sortfield,
print_liste_field_titre($langs->trans('StockToBuy'), $sortorder
'replenish.php', );
'', print_liste_field_titre(
$param, $langs->trans('StockToBuy'),
'', 'replenish.php',
'align="right"', '',
$sortfield, $param,
$sortorder '',
); 'align="right"',
print_liste_field_titre($langs->trans('Supplier'), $sortfield,
'replenish.php', $sortorder
'', );
$param, print_liste_field_titre(
'', $langs->trans('Supplier'),
'align="right"', 'replenish.php',
$sortfield, '',
$sortorder $param,
); '',
echo '<td>&nbsp;</td>', 'align="right"',
'</tr>', $sortfield,
$sortorder
);
print '<td>&nbsp;</td>'.
'</tr>'.
// Lignes des champs de filtre // Lignes des champs de filtre
'<tr class="liste_titre">', '<tr class="liste_titre">'.
'<td class="liste_titre">&nbsp;</td>', '<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre">', '<td class="liste_titre">'.
'<input class="flat" type="text" name="sref" value="' . $sref . '">', '<input class="flat" type="text" name="sref" value="' . $sref . '">'.
'</td>', '</td>'.
'<td class="liste_titre">', '<td class="liste_titre">'.
'<input class="flat" type="text" name="snom" value="' . $snom . '">', '<input class="flat" type="text" name="snom" value="' . $snom . '">'.
'</td>'; '</td>';
if (!empty($conf->service->enabled) && $type == 1) { if (!empty($conf->service->enabled) && $type == 1)
echo '<td class="liste_titre">', {
'&nbsp;', print '<td class="liste_titre">'.
'&nbsp;'.
'</td>'; '</td>';
} }
echo '<td class="liste_titre">&nbsp;</td>', print '<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" name="salert" ' . $alertchecked . '></td>', '<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" name="salert" ' . $alertchecked . '></td>'.
'<td class="liste_titre" align="right">&nbsp;</td>', '<td class="liste_titre" align="right">&nbsp;</td>'.
'<td class="liste_titre">&nbsp;</td>', '<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre">&nbsp;</td>', '<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre" align="right">', '<td class="liste_titre" align="right">'.
'<input type="image" class="liste_titre" name="button_search"', '<input type="image" class="liste_titre" name="button_search"'.
'src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" alt="' . $langs->trans("Search") . '">', 'src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" alt="' . $langs->trans("Search") . '">'.
'<input type="image" class="liste_titre" name="button_removefilter" '<input type="image" class="liste_titre" name="button_removefilter"
src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">', src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'.
'</td>', '</td>'.
'</tr>'; '</tr>';
$prod = new Product($db); $prod = new Product($db);
@ -452,12 +468,12 @@ if ($resql) {
} else { } else {
$picto = img_picto('', './img/no', '', 1); $picto = img_picto('', './img/no', '', 1);
} }
echo '<tr ' . $bc[$var] . '>', print '<tr ' . $bc[$var] . '>'.
'<td><input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td>', '<td><input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td>'.
'<td class="nowrap">', '<td class="nowrap">'.
$prod->getNomUrl(1, '', 16), $prod->getNomUrl(1, '', 16).
'</td>', '</td>'.
'<td>' . $objp->label . '</td>', '<td>' . $objp->label . '</td>'.
'<input type="hidden" name="desc' . $i . '" value="' . $objp->label . '" >'; '<input type="hidden" name="desc' . $i . '" value="' . $objp->label . '" >';
if (!empty($conf->service->enabled) && $type == 1) { if (!empty($conf->service->enabled) && $type == 1) {
@ -470,80 +486,81 @@ if ($resql) {
} else { } else {
$duration = $objp->duration; $duration = $objp->duration;
} }
echo '<td align="center">', print '<td align="center">'.
$duration, $duration.
'</td>'; '</td>';
} }
echo '<td align="right">' . $objp->desiredstock . '</td>', print '<td align="right">' . $objp->desiredstock . '</td>'.
'<td align="right">', '<td align="right">'.
$warning, $stock, $warning . $stock.
'</td>', '</td>'.
'<td align="right">', '<td align="right">'.
'<a href="replenishorders.php?sproduct=' , $prod->id, '">', '<a href="replenishorders.php?sproduct=' . $prod->id . '">'.
$ordered, '</a> ', $picto, $ordered . '</a> ' . $picto.
'</td>', '</td>'.
'<td align="right">', '<td align="right">'.
'<input type="text" name="tobuy' . $i . '<input type="text" name="tobuy' . $i .
'" value="' . $stocktobuy . '" ' . $disabled . '>', '" value="' . $stocktobuy . '" ' . $disabled . '>'.
'</td>', '</td>'.
'<td align="right">', '<td align="right">'.
$form->select_product_fourn_price($prod->id, $form->select_product_fourn_price($prod->id, 'fourn'.$i, 1).
'fourn' . $i, '</td>'.
1 '<td>&nbsp</td>'.
),
'</td>',
'<td>&nbsp</td>',
'</tr>'; '</tr>';
} }
$i++; $i++;
} }
$value = $langs->trans("CreateOrders"); $value = $langs->trans("CreateOrders");
echo '</table>', print '</table>'.
'</div>', '</div>'.
'<table width="100%">', '<table width="100%">'.
'<tr><td align="right">', '<tr><td align="right">'.
'<input class="butAction" type="submit" name="valid" value="' . $value . '">', '<input class="butAction" type="submit" name="valid" value="' . $value . '">'.
'</td></tr></table>', '</td></tr></table>'.
'</form>'; '</form>';
if ($num > $conf->liste_limit) { if ($num > $conf->liste_limit)
if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) { {
if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha'))
{
$filters = '&sref=' . $sref . '&snom=' . $snom; $filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&sall=' . $sall; $filters .= '&sall=' . $sall;
$filters .= '&salert=' . $salert; $filters .= '&salert=' . $salert;
print_barre_liste('', print_barre_liste(
$page, '',
'replenish.php', $page,
$filters, 'replenish.php',
$sortfield, $filters,
$sortorder, $sortfield,
'', $sortorder,
$num, '',
0, $num,
'' 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)? '&type=' . $type : ''); $filters .= (isset($type)? '&type=' . $type : '');
$filters .= '&salert=' . $salert; $filters .= '&salert=' . $salert;
print_barre_liste('', print_barre_liste(
$page, '',
'replenish.php', $page,
$filters, 'replenish.php',
$sortfield, $filters,
$sortorder, $sortfield,
'', $sortorder,
$num, '',
0, $num,
'' 0,
); ''
);
} }
} }
$db->free($resql); $db->free($resql);
echo ' <script type="text/javascript"> print ' <script type="text/javascript">
function toggle(source) function toggle(source)
{ {
checkboxes = document.getElementsByClassName("check"); checkboxes = document.getElementsByClassName("check");
@ -558,4 +575,6 @@ echo ' <script type="text/javascript">
} }
llxFooter(); llxFooter();
$db->close(); $db->close();
?>

View File

@ -48,11 +48,7 @@ $head[0][2] = 'replenish';
$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php'; $head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
$head[1][1] = $texte; $head[1][1] = $texte;
$head[1][2] = 'replenishorders'; $head[1][2] = 'replenishorders';
dol_fiche_head($head, dol_fiche_head($head, 'replenishorders', $langs->trans('Replenishment'), 0, 'stock');
'replenishorders',
$langs->trans('Replenishment'),
0,
'stock');
$commandestatic = new CommandeFournisseur($db); $commandestatic = new CommandeFournisseur($db);
$sref = GETPOST('search_ref', 'alpha'); $sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha'); $snom = GETPOST('search_nom', 'alpha');
@ -121,33 +117,17 @@ if ($suser) {
if ($sttc) { if ($sttc) {
$sql .= ' AND cf.total_ttc = ' . price2num($sttc); $sql .= ' AND cf.total_ttc = ' . price2num($sttc);
} }
if ($sdate) { if ($sdate)
if(GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') {
&& GETPOST('search_dateyear', 'int')) { if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int'))
$date = date('Y-m-d', {
dol_mktime(0, $date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int'));
0,
0,
GETPOST('search_datemonth', 'int'),
GETPOST('search_dateday', 'int'),
GETPOST('search_dateyear', 'int')
)
);
} else {
$elts = explode('/', $sdate);
$datearray = array();
if ($elts[2]) {
$datearray[0] = $elts[2];
}
if ($elts[1]) {
$datearray[1] = $elts[1];
}
if ($elts[0]) {
$datearray[2] = $elts[0];
}
$date = implode('-', $datearray);
} }
$sql .= ' AND cf.date_creation LIKE "%' . $date . '%"'; else
{
$date = dol_stringtotime($sdate);
}
$sql .= " AND cf.date_creation = '" . $db->idate($date) . "'";
} }
if ($sall) { if ($sall) {
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
@ -165,122 +145,132 @@ $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' '; $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ';
$sql .= $db->plimit($conf->liste_limit+1, $offset); $sql .= $db->plimit($conf->liste_limit+1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql)
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
print_barre_liste($langs->trans('ReplenishmentOrders'), print_barre_liste(
$page, $langs->trans('ReplenishmentOrders'),
'replenishorders.php', $page,
'', 'replenishorders.php',
$sortfield, '',
$sortorder, $sortfield,
'', $sortorder,
$num '',
); $num
echo '<form action="replenishorders.php" method="GET">', );
'<table class="noborder" width="100%">', print '<form action="replenishorders.php" method="GET">'.
'<table class="noborder" width="100%">'.
'<tr class="liste_titre">'; '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'), print_liste_field_titre(
$_SERVER['PHP_SELF'], $langs->trans('Ref'),
'cf.ref', $_SERVER['PHP_SELF'],
'', 'cf.ref',
'', '',
'', '',
$sortfield, '',
$sortorder $sortfield,
); $sortorder
print_liste_field_titre($langs->trans('Company'), );
$_SERVER['PHP_SELF'], print_liste_field_titre(
's.nom', $langs->trans('Company'),
'', $_SERVER['PHP_SELF'],
'', 's.nom',
'', '',
$sortfield, '',
$sortorder '',
); $sortfield,
print_liste_field_titre($langs->trans('Author'), $sortorder
$_SERVER['PHP_SELF'], );
'u.login', print_liste_field_titre(
'', $langs->trans('Author'),
'', $_SERVER['PHP_SELF'],
'', 'u.login',
$sortfield, '',
$sortorder '',
); '',
print_liste_field_titre($langs->trans('AmountTTC'), $sortfield,
$_SERVER['PHP_SELF'], $sortorder
'cf.total_ttc', );
'', print_liste_field_titre(
'', $langs->trans('AmountTTC'),
'', $_SERVER['PHP_SELF'],
$sortfield, 'cf.total_ttc',
$sortorder '',
); '',
print_liste_field_titre($langs->trans('OrderCreation'), '',
$_SERVER['PHP_SELF'], $sortfield,
'cf.date_creation', $sortorder
'', );
'', print_liste_field_titre(
'', $langs->trans('OrderCreation'),
$sortfield, $_SERVER['PHP_SELF'],
$sortorder 'cf.date_creation',
); '',
print_liste_field_titre($langs->trans('Status'), '',
$_SERVER['PHP_SELF'], '',
'cf.fk_statut', $sortfield,
'', $sortorder
'', );
'align="right"', print_liste_field_titre(
$sortfield, $langs->trans('Status'),
$sortorder $_SERVER['PHP_SELF'],
); 'cf.fk_statut',
'',
'',
'align="right"',
$sortfield,
$sortorder
);
$form = new Form($db); $form = new Form($db);
echo '</tr>', print '</tr>'.
'<tr class="liste_titre">', '<tr class="liste_titre">'.
'<td class="liste_titre">', '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ref" value="' . $sref . '">', '<input type="text" class="flat" name="search_ref" value="' . $sref . '">'.
'</td>', '</td>'.
'<td class="liste_titre">', '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_nom" value="' . $snom . '">', '<input type="text" class="flat" name="search_nom" value="' . $snom . '">'.
'</td>', '</td>'.
'<td class="liste_titre">', '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_user" value="' . $suser . '">', '<input type="text" class="flat" name="search_user" value="' . $suser . '">'.
'</td>', '</td>'.
'<td class="liste_titre">', '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">', '<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">'.
'</td>', '</td>'.
'<td class="liste_titre">', '<td class="liste_titre">'.
$form->select_date('', 'search_date', 0, 0, 1, "", 1, 0, 1, 0, ''), $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, '').
'</td>', '</td>'.
'<td class="liste_titre" align="right">'; '<td class="liste_titre" align="right">';
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png'; $src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';
$value = dol_escape_htmltag($langs->trans('Search')); $value = dol_escape_htmltag($langs->trans('Search'));
echo '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="' . $value . '" title="' . $value . '">', print '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="' . $value . '" title="' . $value . '">'.
'</td>', '</td>'.
'</tr>'; '</tr>';
$var = true; $var = true;
$userstatic = new User($db); $userstatic = new User($db);
while ($i < min($num,$conf->liste_limit)) { while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var = !$var; $var = !$var;
if(!dispatched($obj->rowid) && if (!dispatched($obj->rowid) &&
(!$sproduct || in_array($sproduct, getProducts($obj->rowid)))) { (!$sproduct || in_array($sproduct, getProducts($obj->rowid))))
{
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid; $href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
echo '<tr ' . $bc[$var] . '>', print '<tr ' . $bc[$var] . '>'.
// Ref // Ref
'<td>', '<td>'.
'<a href="' . $href . '">', '<a href="' . $href . '">'.
img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref, img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref.
'</a></td>'; '</a></td>';
// Company // Company
$href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid; $href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid;
echo '<td>', print '<td>'.
'<a href="' . $href .'">', '<a href="' . $href .'">'.
img_object($langs->trans('ShowCompany'), 'company'), ' ', img_object($langs->trans('ShowCompany'), 'company'). ' '.
$obj->nom . '</a></td>'; $obj->nom . '</a></td>';
// Author // Author
@ -291,12 +281,12 @@ if ($resql) {
} else { } else {
$txt = '&nbsp;'; $txt = '&nbsp;';
} }
echo '<td>', print '<td>'.
$txt, $txt.
'</td>', '</td>'.
// Amount // Amount
'<td>', '<td>'.
price($obj->total_ttc), price($obj->total_ttc).
'</td>'; '</td>';
// Date // Date
if ($obj->dc) { if ($obj->dc) {
@ -304,18 +294,18 @@ if ($resql) {
} else { } else {
$date = '-'; $date = '-';
} }
echo '<td>', print '<td>'.
$date, $date.
'</td>', '</td>'.
// Statut // Statut
'<td align="right">', '<td align="right">'.
$commandestatic->LibStatut($obj->fk_statut, 5), $commandestatic->LibStatut($obj->fk_statut, 5).
'</td>', '</td>'.
'</tr>'; '</tr>';
} }
$i++; $i++;
} }
echo '</table>', print '</table>'.
'</form>'; '</form>';
$db->free($resql); $db->free($resql);