New: Add a new mode for automatic stock increase: Can be increased on supplier order dispatching of products.
This commit is contained in:
parent
c23041826a
commit
38d91e99dd
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -80,17 +80,20 @@ if ($_POST["action"] == 'STOCK_CALCULATE_ON_BILL'
|
|||||||
dol_print_error("Error in some requests", LOG_ERR);
|
dol_print_error("Error in some requests", LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Mode of stock decrease
|
// Mode of stock increase
|
||||||
if ($_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
if ($_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
||||||
|| $_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER')
|
|| $_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'
|
||||||
|
|| $_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')
|
||||||
{
|
{
|
||||||
$count=0;
|
$count=0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
|
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
|
||||||
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||||
|
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
|
||||||
if ($_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", $_POST["STOCK_CALCULATE_ON_SUPPLIER_BILL"],'chaine',0,'',$conf->entity);
|
if ($_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", $_POST["STOCK_CALCULATE_ON_SUPPLIER_BILL"],'chaine',0,'',$conf->entity);
|
||||||
if ($_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $_POST["STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER"],'chaine',0,'',$conf->entity);
|
if ($_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $_POST["STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER"],'chaine',0,'',$conf->entity);
|
||||||
if ($count == 3)
|
if ($_POST["action"] == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $_POST["STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER"],'chaine',0,'',$conf->entity);
|
||||||
|
if ($count == 4)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
Header("Location: stock.php");
|
Header("Location: stock.php");
|
||||||
@ -243,6 +246,17 @@ if ($conf->commande->enabled)
|
|||||||
print $html->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1);
|
print $html->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1);
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print "</form>\n</td>\n</tr>\n";
|
print "</form>\n</td>\n</tr>\n";
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td width="60%">'.$langs->trans("ReStockOnDispatchOrder").'</td>';
|
||||||
|
print '<td width="160" align="right">';
|
||||||
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">";
|
||||||
|
print $html->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print "</form>\n</td>\n</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2703,9 +2703,10 @@ class Form
|
|||||||
* \param option Valeur de l'option en fonction du type choisi
|
* \param option Valeur de l'option en fonction du type choisi
|
||||||
* \param translate Traduire la valeur
|
* \param translate Traduire la valeur
|
||||||
* \param maxlen Length maximum for labels
|
* \param maxlen Length maximum for labels
|
||||||
|
* \param disabled Html select box is disabled
|
||||||
* \return string HTML select string
|
* \return string HTML select string
|
||||||
*/
|
*/
|
||||||
function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $optionType=0, $option='', $translate=0, $maxlen=0)
|
function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $optionType=0, $option='', $translate=0, $maxlen=0, $disabled=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -2714,11 +2715,11 @@ class Form
|
|||||||
// \TODO Simplify optionType and option (only one should be necessary)
|
// \TODO Simplify optionType and option (only one should be necessary)
|
||||||
if ($optionType == 1 && $option != '')
|
if ($optionType == 1 && $option != '')
|
||||||
{
|
{
|
||||||
$out.='<select class="flat" name="'.$htmlname.'" '.$option.'>';
|
$out.='<select '.($disabled?'disabled="true"':'').' class="flat" name="'.$htmlname.'" '.$option.'>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out.='<select class="flat" name="'.$htmlname.'">';
|
$out.='<select '.($disabled?'disabled="true"':'').' class="flat" name="'.$htmlname.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_empty)
|
if ($show_empty)
|
||||||
|
|||||||
@ -505,7 +505,7 @@ class CommandeFournisseur extends Commande
|
|||||||
$this->log($user, 2, time()); // Statut 2
|
$this->log($user, 2, time()); // Statut 2
|
||||||
|
|
||||||
// If stock is incremented on validate order, we must increment it
|
// If stock is incremented on validate order, we must increment it
|
||||||
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER == 1)
|
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||||
|
|
||||||
@ -918,36 +918,22 @@ class CommandeFournisseur extends Commande
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Dispatch un element de la commande dans un stock
|
* Add a product into a stock warehouse.
|
||||||
|
*
|
||||||
|
* @param unknown_type $user
|
||||||
|
* @param unknown_type $product
|
||||||
|
* @param unknown_type $qty
|
||||||
|
* @param unknown_type $entrepot Id of warehouse to add product
|
||||||
|
* @param unknown_type $price
|
||||||
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
function DispatchProducts($user, $products, $qtys, $entrepots)
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
require_once DOL_DOCUMENT_ROOT ."/product/stock/class/mouvementstock.class.php";
|
|
||||||
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
if ( is_array($products) )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$res = $this->DispatchProduct($user, $product, $qty, $entrepot);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->rollback();
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
function DispatchProduct($user, $product, $qty, $entrepot, $price=0)
|
function DispatchProduct($user, $product, $qty, $entrepot, $price=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
require_once DOL_DOCUMENT_ROOT ."/product/stock/class/mouvementstock.class.php";
|
require_once DOL_DOCUMENT_ROOT ."/product/stock/class/mouvementstock.class.php";
|
||||||
|
|
||||||
dol_syslog("CommandeFournisseur::DispatchProduct");
|
$now=dol_now();
|
||||||
|
|
||||||
if ( ($this->statut == 3 || $this->statut == 4 || $this->statut == 5) && $qty > 0)
|
if ( ($this->statut == 3 || $this->statut == 4 || $this->statut == 5) && $qty > 0)
|
||||||
{
|
{
|
||||||
@ -955,23 +941,26 @@ class CommandeFournisseur extends Commande
|
|||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_dispatch ";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_dispatch ";
|
||||||
$sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec) VALUES ";
|
$sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec) VALUES ";
|
||||||
$sql.= " ('".$this->id."','".$product."','".$qty."','".$entrepot."','".$user->id."',".$this->db->idate(mktime()).")";
|
$sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."')";
|
||||||
|
|
||||||
|
dol_syslog("CommandeFournisseur::DispatchProduct sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$error = -1;
|
$this->error=$this->db->lasterror();
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si module stock gere et que expedition faite depuis un entrepot
|
// Si module stock gere et que expedition faite depuis un entrepot
|
||||||
if (!$error && $conf->stock->enabled && $entrepot)
|
if (!$error && $entrepot > 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||||
{
|
{
|
||||||
$mouv = new MouvementStock($this->db);
|
$mouv = new MouvementStock($this->db);
|
||||||
$result=$mouv->reception($user, $product, $entrepot, $qty, $price);
|
$result=$mouv->reception($user, $product, $entrepot, $qty, $price);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error()." - sql=$sql";
|
$this->error=$mouv->error;
|
||||||
dol_syslog("CommandeFournisseur::DispatchProduct".$this->error, LOG_ERR);
|
dol_syslog("CommandeFournisseur::DispatchProduct ".$this->error, LOG_ERR);
|
||||||
$error = -2;
|
$error++;
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/fourn/commande/fiche.php
|
* \file htdocs/fourn/commande/dispatch.php
|
||||||
* \ingroup commande
|
* \ingroup commande
|
||||||
* \brief Fiche de ventilation des commandes fournisseurs
|
* \brief Fiche de ventilation des commandes fournisseurs
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
@ -64,16 +64,23 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
|
|||||||
{
|
{
|
||||||
if ( preg_match('/^product_([0-9]+)$/i', $key, $reg) )
|
if ( preg_match('/^product_([0-9]+)$/i', $key, $reg) )
|
||||||
{
|
{
|
||||||
$prod = "product_".$reg[1];
|
$prod = "product_".$reg[1];
|
||||||
$qty = "qty_".$reg[1];
|
$qty = "qty_".$reg[1];
|
||||||
$ent = "entrepot_".$reg[1];
|
$ent = "entrepot_".$reg[1];
|
||||||
$pu = "pu_".$reg[1];
|
$pu = "pu_".$reg[1];
|
||||||
$result = $commande->DispatchProduct($user, $_POST[$prod], $_POST[$qty], $_POST[$ent], $_POST[$pu]);
|
$result = $commande->DispatchProduct($user, $_POST[$prod], $_POST[$qty], $_POST[$ent], $_POST[$pu]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Header("Location: dispatch.php?id=".$_GET["id"]);
|
if ($result > 0)
|
||||||
exit;
|
{
|
||||||
|
Header("Location: dispatch.php?id=".$_GET["id"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg=$commande->error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +93,7 @@ llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
|
|||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$now=gmmktime();
|
$now=dol_now();
|
||||||
|
|
||||||
$id = $_GET['id'];
|
$id = $_GET['id'];
|
||||||
$ref= $_GET['ref'];
|
$ref= $_GET['ref'];
|
||||||
@ -160,6 +167,10 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($mesg) print $mesg;
|
if ($mesg) print $mesg;
|
||||||
else print '<br>';
|
else print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
$disabled=1;
|
||||||
|
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) $disabled=0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes de commandes
|
* Lignes de commandes
|
||||||
*/
|
*/
|
||||||
@ -200,6 +211,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
$remaintodispatch=$objp->qty - $products_dispatched[$objp->fk_product];
|
||||||
|
if ($remaintodispatch < 0) $remaintodispatch=0;
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -207,8 +221,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<td align="right">'.$langs->trans("QtyOrdered").'</td>';
|
print '<td align="right">'.$langs->trans("QtyOrdered").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("QtyDispatched").'</td>';
|
print '<td align="right">'.$langs->trans("QtyDispatched").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Warehouse").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("QtyDelivered").'</td>';
|
print '<td align="right">'.$langs->trans("QtyDelivered").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Warehouse").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,20 +248,22 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">'.$objp->qty.'</td>';
|
print '<td align="right">'.$objp->qty.'</td>';
|
||||||
print '<td align="right">'.$products_dispatched[$objp->fk_product].'</td>';
|
print '<td align="right">'.$products_dispatched[$objp->fk_product].'</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
// Dispatch
|
||||||
|
print '<td align="right"><input name="qty_'.$i.'" type="text" size="8" value="'.($remaintodispatch).'"></td>';
|
||||||
|
|
||||||
|
// Warehouse
|
||||||
|
print '<td align="right">';
|
||||||
if (sizeof($user->entrepots) === 1)
|
if (sizeof($user->entrepots) === 1)
|
||||||
{
|
{
|
||||||
$uentrepot = array();
|
$uentrepot = array();
|
||||||
$uentrepot[$user->entrepots[0]['id']] = $user->entrepots[0]['label'];
|
$uentrepot[$user->entrepots[0]['id']] = $user->entrepots[0]['label'];
|
||||||
$html->select_array("entrepot_".$i, $uentrepot);
|
print $html->selectarray("entrepot_".$i, $uentrepot, '', $disabled, 0, 0, 0, '', 0, 0, $disabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$html->select_array("entrepot_".$i, $entrepot->list_array());
|
print $html->selectarray("entrepot_".$i, $entrepot->list_array(), '', $disabled, 0, 0, 0, '', 0, 0, $disabled);
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '<td align="right"><input name="qty_'.$i.'" type="text" size="8" value="'.($objp->qty-$products_dispatched[$objp->fk_product]).'"></td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
@ -261,22 +277,24 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "<br/>\n";
|
print "<br/>\n";
|
||||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"></center></form>';
|
|
||||||
|
print '<center><input type="submit" class="button" value="'.$langs->trans("DispatchVerb").'"></center>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<br/>\n";
|
print "<br/>\n";
|
||||||
|
|
||||||
|
// List of already dispatching
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
$sql = "SELECT p.ref, p.label, e.label as entrepot,";
|
||||||
$sql = "SELECT p.ref,cfd.fk_product, cfd.qty";
|
$sql.= " cfd.fk_product, cfd.qty, cfd.rowid";
|
||||||
$sql.= ", cfd.rowid";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p,";
|
||||||
$sql.= ", p.label, e.label as entrepot";
|
$sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid";
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."product as p ";
|
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."entrepot as e ";
|
|
||||||
$sql.= " WHERE cfd.fk_commande = ".$commande->id;
|
$sql.= " WHERE cfd.fk_commande = ".$commande->id;
|
||||||
$sql.= " AND cfd.fk_product = p.rowid";
|
$sql.= " AND cfd.fk_product = p.rowid";
|
||||||
$sql.= " AND cfd.fk_entrepot = e.rowid";
|
|
||||||
$sql.= " ORDER BY cfd.rowid ASC";
|
$sql.= " ORDER BY cfd.rowid ASC";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -305,7 +323,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
print '<td align="right">'.$objp->qty.'</td>';
|
print '<td align="right">'.$objp->qty.'</td>';
|
||||||
print '<td align="right">'.stripslashes($objp->entrepot).'</td>';
|
print '<td align="right">'.$objp->entrepot.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -328,45 +346,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($commande->statut == 0 && $num > 0)
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->valider)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&action=valid">'.$langs->trans("Valid").'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($commande->statut == 1)
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->approuver)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&action=approve">'.$langs->trans("ApproveOrder").'</a>';
|
|
||||||
|
|
||||||
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&action=refuse">'.$langs->trans("RefuseOrder").'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($commande->statut == 2)
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->commander)
|
|
||||||
{
|
|
||||||
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&action=cancel">'.$langs->trans("CancelOrder").'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($commande->statut == 0)
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->creer)
|
|
||||||
{
|
|
||||||
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1314,8 +1314,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$formorder->select_methodes_commande($_POST["methodecommande"],"methodecommande",1);
|
$formorder->select_methodes_commande($_POST["methodecommande"],"methodecommande",1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="30" type="text" name="comment" value="'.$_POST["comment"].'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment" value="'.$_POST["comment"].'"></td></tr>';
|
||||||
print '<tr><td align="center" colspan="2"><input type="submit" class="button" name="'.$langs->trans("Activate").'"></td></tr>';
|
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("ToOrder").'"></td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
@ -1346,8 +1346,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print $html->select_array("type",$liv);
|
print $html->select_array("type",$liv);
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="30" type="text" name="comment"></td></tr>';
|
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment"></td></tr>';
|
||||||
print '<tr><td align="center" colspan="2"><input type="submit" class="button" name="'.$langs->trans("Activate").'"></td></tr>';
|
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Receive").'"></td></tr>';
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,9 @@ DeStockOnValidateOrder=Decrease real stocks on orders notes validation (warning,
|
|||||||
DeStockOnShipment=Decrease real stocks on shipment validation (recommended)
|
DeStockOnShipment=Decrease real stocks on shipment validation (recommended)
|
||||||
ReStockOnBill=Increase real stocks on invoices/credit notes validation (warning, in this version, it's only in warehouse number 1 that stock is modified)
|
ReStockOnBill=Increase real stocks on invoices/credit notes validation (warning, in this version, it's only in warehouse number 1 that stock is modified)
|
||||||
ReStockOnValidateOrder=Increase real stocks on orders notes validation (warning, in this version, it's only in warehouse number 1 that stock is modified)
|
ReStockOnValidateOrder=Increase real stocks on orders notes validation (warning, in this version, it's only in warehouse number 1 that stock is modified)
|
||||||
|
ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after order receiving
|
||||||
StockDiffPhysicTeoric=Reason for difference stock physical and theoretical
|
StockDiffPhysicTeoric=Reason for difference stock physical and theoretical
|
||||||
|
DispatchVerb=Dispatch
|
||||||
StockLimitShort=Limit
|
StockLimitShort=Limit
|
||||||
StockLimit=Stock limit for alerts
|
StockLimit=Stock limit for alerts
|
||||||
PhysicalStock=Physical stock
|
PhysicalStock=Physical stock
|
||||||
|
|||||||
@ -48,7 +48,9 @@ DeStockOnValidateOrder=Décrémente les stocks physiques sur validation des comm
|
|||||||
DeStockOnShipment=Décrémente les stocks physiques sur validation des expéditions (recommandé)
|
DeStockOnShipment=Décrémente les stocks physiques sur validation des expéditions (recommandé)
|
||||||
ReStockOnBill=Incrémente les stocks physiques sur validation des factures/avoirs (attention, dans cette version, c'est toujours dans le premier entrepôt que se fait l'ajustement)
|
ReStockOnBill=Incrémente les stocks physiques sur validation des factures/avoirs (attention, dans cette version, c'est toujours dans le premier entrepôt que se fait l'ajustement)
|
||||||
ReStockOnValidateOrder=Incrémente les stocks physiques sur validation des commandes (attention, dans cette version, c'est toujours dans le premier entrepôt que se fait l'ajustement)
|
ReStockOnValidateOrder=Incrémente les stocks physiques sur validation des commandes (attention, dans cette version, c'est toujours dans le premier entrepôt que se fait l'ajustement)
|
||||||
|
ReStockOnDispatchOrder=Incrémente les stocks physiques sur ventilation manuelle de la réception des commandes dans les entrepots
|
||||||
StockDiffPhysicTeoric=Raison écart stock physique-théorique
|
StockDiffPhysicTeoric=Raison écart stock physique-théorique
|
||||||
|
DispatchVerb=Ventiler
|
||||||
StockLimitShort=Seuil
|
StockLimitShort=Seuil
|
||||||
StockLimit=Seuil alerte stock
|
StockLimit=Seuil alerte stock
|
||||||
PhysicalStock=Stock physique
|
PhysicalStock=Stock physique
|
||||||
|
|||||||
@ -91,7 +91,7 @@ function ordersupplier_prepare_head($commande)
|
|||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($conf->stock->enabled)
|
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||||
{
|
{
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$commande->id;
|
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$commande->id;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user