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