[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dolibarr-dev] Ajout des commandes brouillons dans les produits
From: |
CONTACT EXPRESSIV |
Subject: |
[Dolibarr-dev] Ajout des commandes brouillons dans les produits |
Date: |
Mon, 24 Apr 2006 12:03:28 +0200 |
User-agent: |
KMail/1.9.1 |
Bonjour,
Je veisnd ajouter la possiblité de faire suivre les commandes brouillons dans
les produits. je poste donc les modifications apportées:
Fichier /htdocs/product/fiche.php
Ligne 36 ->
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
Ligne 208 ->
/*
* Ajout du produit dans une commande
*/
if ($_POST["action"] == 'addinorder')
{
$order = new Commande($db);
$order->fetch($_POST["orderid"]);
$result = $order->add_product($_GET["id"], $_POST["qty"],
$_POST["remise_percent"]);
if ( $result < 0)
{
$mesg = $langs->trans("ErrorUnknown").": $result";
}
Header("Location: ../commande/fiche.php?id=".$order->id);
exit;
}
Ligne 751 ->
// Orders
if($user->rights->commande->creer)
{
$langs->load("propal");
print '<tr><td width="50%" valign="top">';
print_titre($langs->trans("AddToMyOrders")) . '</td>';
print '<td width="50%" valign="top">';
print_titre($langs->trans("AddToOtherOrders")) . '</td>';
print '</tr>';
// Liste de "Mes Orders"
print '<tr><td width="50%" valign="top">';
$sql = "SELECT s.nom, s.idp, c.rowid as orderid, c.ref,".
$db->pdate("c.date_creation")." as dp";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as
s, ".MAIN_DB_PREFIX."commande as c";
$sql .=" WHERE c.fk_soc = s.idp AND c.fk_statut = 0 AND
c.fk_user_author = ".$user->id;
$sql .= " ORDER BY c.date_creation DESC, c.tms DESC";
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if ($num) {
$i = 0;
print '<table class="noborder" width="100%">';
$var=true;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print '<form method="POST" action="fiche.php?id='.
$product->id.'">';
print "<tr $bc[$var]>";
print "<td nowrap><a
href=\"../commande/fiche.php?id=$objp->orderid\">".img_object($langs->trans("ShowPropal"),"propal")."
".
$objp->ref."</a></td>\n";
print "<td><a
href=\"../comm/fiche.php?socid=$objp->idp\">".dolibarr_trunc($objp->nom,18)."</a></td>\n";
print "<td>". strftime("%d %b",$objp->dp)."</td>\n";
print '<input type="hidden" name="action"
value="addinorder">';
print '<td><input type="hidden" name="orderid" value="'.
$objp->orderid.'">';
print '<input type="text" class="flat" name="qty" size="1"
value="1"></td><td nowrap>'.$langs->trans("Discount");
print '<input type="text" class="flat"
name="remise_percent" size="1" value="0">%';
print " ".$product->stock_proposition;
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.
$langs->trans("Add").'">';
print '</td>';
print '</tr>';
print '</form>';
$i++;
}
print "</table>";
}
else {
print $langs->trans("NoOpenedOrders");
}
$db->free($result);
}
print '</td>';
// Liste de Autres commandes
$var=true;
$sql = "SELECT s.nom, s.idp, c.rowid as orderid, c.ref,".
$db->pdate("c.date_commande")." as dc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as
s, ".MAIN_DB_PREFIX."commande as c";
$sql .=" WHERE c.fk_soc = s.idp AND c.fk_statut = 0 AND
c.fk_user_author <> ".$user->id;
$sql .= " ORDER BY c.tms DESC, c.rowid DESC";
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if ($num) {
$i = 0;
print '<table class="noborder" width="100%">';
$var=true;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print '<form method="POST" action="fiche.php?id='.
$product->id.'">';
print "<tr $bc[$var]>";
print "<td><a
href=\"../commande/fiche.php?id=$objp->orderid\">$objp->ref</a></td>\n";
print "<td><a
href=\"../comm/fiche.php?socid=$objp->idp\">$objp->nom</a></td>\n";
print "<td>". strftime("%d %b",$objp->df)."</td>\n";
print '<input type="hidden" name="action"
value="addinorder">';
print '<td><input type="hidden" name="orderid" value="'.
$objp->orderid.'">';
print '<input type="text" class="flat" name="qty" size="1"
value="1"></td><td nowrap>'.$langs->trans("Discount");
print '<input type="text" class="flat"
name="remise_percent" size="1" value="0">%';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.
$langs->trans("Add").'">';
print '</td>';
print '</tr>';
print '</form>';
$i++;
}
print "</table>";
}
else {
print $langs->trans("NoOtherDraftOrders");
}
$db->free($result);
}
else
{
dolibarr_print_error($db);
}
print '</td></tr>';
}
Fichier /htdocs/commande/commande.class.php
Ligne 392 ->
/**
* Ajoute un produit dans la commande
*
*/
function add_product($idproduct, $qty, $remise_percent=0)
{
if ($idproduct > 0)
{
$i = sizeof($this->products);
$this->products[$i] = $idproduct;
if (!$qty)
{
$qty = 1 ;
}
$this->products_qty[$i] = $qty;
$this->products_remise_percent[$i] = $remise_percent;
/*
Sauvegarde dans la base !!!!!!!!!!!!!!!!!
*/
$Product = new Product($idproduct);
$Product->fetch();
$this->addline($Product->libelle,$Product->price,$qty,$Product->tva_tx,
$idproduct,$remise_percent);
}
}
--
MESSIN Enguerrand
SARL Expressiv
PIT de la Pompignane-T4
Rue de la veille poste
34055 Montpellier
tel/fax : 04-67-50-15-49
www.expressiv.net