reformat
This commit is contained in:
parent
4c50b23b40
commit
2c82484d45
@ -34,9 +34,12 @@ $langs->load("stocks");
|
||||
$langs->load("orders");
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
if ($user->societe_id) {
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$result=restrictedArea($user,'produit|service');
|
||||
|
||||
//checks if a product has been ordered
|
||||
function ordered($product_id) {
|
||||
global $db;
|
||||
$sql = 'SELECT DISTINCT cfd.fk_product, SUM(cfd.qty) from ';
|
||||
@ -58,7 +61,7 @@ function ordered($product_id) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
$error=$db->lasterror();
|
||||
$error = $db->lasterror();
|
||||
dol_print_error($db);
|
||||
dol_syslog('replenish.php: ' . $error, LOG_ERROR);
|
||||
return $langs->trans('error');
|
||||
@ -77,8 +80,14 @@ $tobuy = GETPOST('tobuy');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (! $sortfield) $sortfield = 'stock_physique';
|
||||
if (! $sortorder) $sortorder = 'ASC';
|
||||
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'stock_physique';
|
||||
}
|
||||
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'ASC';
|
||||
}
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
@ -279,10 +288,12 @@ if ($resql) {
|
||||
$head[1][2] = 'replenishorders';
|
||||
dol_fiche_head($head, 'replenish', $title, 0, 'stock');
|
||||
if ($sref || $snom || $sall || GETPOST('search')) {
|
||||
$filters = '&sref=' . $sref . '&snom=' . $snom;
|
||||
$filters .= '&sall=' . $sall;
|
||||
print_barre_liste($texte,
|
||||
$page,
|
||||
'replenish.php',
|
||||
'&sref=' . $sref . '&snom=' . $snom . '&sall=' . $sall,
|
||||
$filters,
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
@ -290,10 +301,13 @@ if ($resql) {
|
||||
);
|
||||
}
|
||||
else {
|
||||
$filters = '&sref=' . $sref . '&snom=' . $snom;
|
||||
$filters .= '&fourn_id=' . $fourn_id;
|
||||
$filters .= (isset($type)?'&type=' . $type:'');
|
||||
print_barre_liste($texte,
|
||||
$page,
|
||||
'replenish.php',
|
||||
'&sref=$sref&snom=$snom&fourn_id=$fourn_id' . (isset($type)?'&type=$type':''),
|
||||
$filters,
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
@ -336,8 +350,9 @@ if ($resql) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$param = (isset($type)? '&type=$type' : '');
|
||||
$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom . '&sref=' . $sref;
|
||||
$param = (isset($type)? '&type=' . $type : '');
|
||||
$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom;
|
||||
$param .= '&sref=' . $sref;
|
||||
|
||||
// Lignes des titres
|
||||
print '<tr class="liste_titre">';
|
||||
@ -566,10 +581,12 @@ if ($resql) {
|
||||
|
||||
if ($num > $conf->liste_limit) {
|
||||
if ($sref || $snom || $sall || GETPOST('search')) {
|
||||
$filters = '&sref=' . $sref . '&snom=' . $snom;
|
||||
$filters .= '&sall=' . $sall;
|
||||
print_barre_liste('',
|
||||
$page,
|
||||
'replenish.php',
|
||||
'&sref=' . $sref . '&snom=' . $snom . '&sall=' . $sall,
|
||||
$filters,
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
@ -579,10 +596,13 @@ if ($resql) {
|
||||
);
|
||||
}
|
||||
else {
|
||||
$filters = '&sref=' . $sref . '&snom=' . $snom;
|
||||
$filters .= '&fourn_id=' . $fourn_id;
|
||||
$filters .= (isset($type)? '&type=' . $type : '');
|
||||
print_barre_liste('',
|
||||
$page,
|
||||
'replenish.php',
|
||||
"&sref=$sref&snom=$snom&fourn_id=$fourn_id" . (isset($type)?"&type=$type":""),
|
||||
$filters,
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
|
||||
@ -47,7 +47,10 @@ $head[0][2] = 'replenish';
|
||||
$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
|
||||
$head[1][1] = $langs->trans("ReplenishmentOrders");
|
||||
$head[1][2] = 'replenishorders';
|
||||
dol_fiche_head($head, 'replenishorders', $langs->trans("Replenishment"), 0, 'stock');
|
||||
dol_fiche_head($head, 'replenishorders',
|
||||
$langs->trans("Replenishment"),
|
||||
0,
|
||||
'stock');
|
||||
$commandestatic = new CommandeFournisseur($db);
|
||||
$sref = GETPOST('search_ref');
|
||||
$snom = GETPOST('search_nom');
|
||||
@ -59,17 +62,27 @@ $page = GETPOST('page', 'int');
|
||||
|
||||
$sortorder = GETPOST('sortorder');
|
||||
$sortfield = GETPOST('sortfield');
|
||||
if(!$sortorder) $sortorder = 'DESC';
|
||||
if(!$sortfield) $sortfield = 'cf.date_creation';
|
||||
|
||||
if(!$sortorder) {
|
||||
$sortorder = 'DESC';
|
||||
}
|
||||
|
||||
if(!$sortfield) {
|
||||
$sortfield = 'cf.date_creation';
|
||||
}
|
||||
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$sql = 'SELECT s.rowid as socid, s.nom, cf.date_creation as dc,';
|
||||
$sql .= ' cf.rowid,cf.ref, cf.fk_statut, cf.total_ttc';
|
||||
$sql .= ", cf.fk_user_author, u.login";
|
||||
$sql .= ' FROM (' . MAIN_DB_PREFIX . 'societe as s,';
|
||||
$sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
|
||||
|
||||
}
|
||||
|
||||
$sql .= ') LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ';
|
||||
$sql .= 'ON cf.fk_user_author = u.rowid';
|
||||
$sql .= ' WHERE cf.fk_soc = s.rowid ';
|
||||
@ -100,19 +113,18 @@ if ($socid) {
|
||||
$sql .= ' AND s.rowid = ' . $socid;
|
||||
}
|
||||
|
||||
if (GETPOST('statut'))
|
||||
{
|
||||
$sql .= ' AND fk_statut = ' . GETPOST('statut');
|
||||
if (GETPOST('statut')) {
|
||||
$sql .= ' AND fk_statut = ' . GETPOST('statut');
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ';
|
||||
$sql .= $db->plimit($conf->liste_limit+1, $offset);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print_barre_liste($langs->trans('ReplenishmentOrders'),
|
||||
$page,
|
||||
'replenishorders.php',
|
||||
@ -197,7 +209,7 @@ if ($resql) {
|
||||
print '<td colspan="2" class="liste_titre" align="right">';
|
||||
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';
|
||||
$value = dol_escape_htmltag($langs->trans('Search'));
|
||||
print '<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 . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -214,32 +226,32 @@ if ($resql) {
|
||||
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
|
||||
print '<a href="' . $href . '">';
|
||||
print img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref;
|
||||
print '</a></td>'."";
|
||||
print '</a></td>';
|
||||
|
||||
// Company
|
||||
print '<td>';
|
||||
$href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid;
|
||||
print '<a href="' . $href .'">';
|
||||
print img_object($langs->trans('ShowCompany'), 'company') . ' ' . $obj->nom;
|
||||
print '</a></td>'."";
|
||||
print img_object($langs->trans('ShowCompany'), 'company') . ' ';
|
||||
print $obj->nom . '</a></td>';
|
||||
|
||||
// Author
|
||||
$userstatic->id = $obj->fk_user_author;
|
||||
$userstatic->login = $obj->login;
|
||||
print '<td>';
|
||||
|
||||
if ($userstatic->id) {
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else {
|
||||
print ' ';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td align="right" width="100">';
|
||||
print price($obj->total_ttc);
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td align="center" width="100">';
|
||||
if ($obj->dc) {
|
||||
@ -249,12 +261,10 @@ if ($resql) {
|
||||
print '-';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Statut
|
||||
print '<td align="right">';
|
||||
print $commandestatic->LibStatut($obj->fk_statut, 5);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user