Can delete a price line log
This commit is contained in:
parent
def9892548
commit
51160ac2e0
@ -717,15 +717,41 @@ class Product extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 1;
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Lit le prix pratiqu<EFBFBD> par un fournisseur
|
* \brief Delete a price line
|
||||||
|
* \param user Object user
|
||||||
|
* \param rowid Line id to delete
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function log_price_delete($user,$rowid)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price";
|
||||||
|
$sql.= " WHERE rowid=".$rowid;
|
||||||
|
|
||||||
|
dolibarr_syslog("Product::log_price_delete sql=".$sql);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Lit le prix pratique par un fournisseur
|
||||||
* On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref)
|
* On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref)
|
||||||
* \param prodfournprice Id du tarif = rowid table product_fournisseur_price
|
* \param prodfournprice Id du tarif = rowid table product_fournisseur_price
|
||||||
* \param qty Quantit<EFBFBD> du produit
|
* \param qty Quantit<EFBFBD> du produit
|
||||||
|
|||||||
@ -21,11 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/product/price.php
|
\file htdocs/product/price.php
|
||||||
\ingroup product
|
\ingroup product
|
||||||
\brief Page de la fiche produit
|
\brief Page de la fiche produit
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
||||||
@ -43,8 +43,7 @@ accessforbidden();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'update_price' &&
|
if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && $user->rights->produit->creer)
|
||||||
! $_POST["cancel"] && $user->rights->produit->creer)
|
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
|
|
||||||
@ -56,12 +55,12 @@ if ($_POST["action"] == 'update_price' &&
|
|||||||
$newprice='';
|
$newprice='';
|
||||||
$newpricebase='';
|
$newpricebase='';
|
||||||
$newvat='';
|
$newvat='';
|
||||||
|
|
||||||
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
{
|
{
|
||||||
if($_POST["price_".$i])
|
if($_POST["price_".$i])
|
||||||
{
|
{
|
||||||
// le prix 1 est considéré comme le prix de base du produit
|
// le prix 1 est considere comme le prix de base du produit
|
||||||
if ($i == 1)
|
if ($i == 1)
|
||||||
{
|
{
|
||||||
$newprice=price2num($_POST["price_".$i],'MU');
|
$newprice=price2num($_POST["price_".$i],'MU');
|
||||||
@ -70,9 +69,9 @@ if ($_POST["action"] == 'update_price' &&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$product->multiprices["$i"] = price2num($_POST["price_".$i],'MU');
|
$product->multiprices["$i"] = price2num($_POST["price_".$i],'MU');
|
||||||
$product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i];
|
$product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i];
|
||||||
$product->multiprices_vat_rate["$i"] = $_POST["tva_tx_".$i];
|
$product->multiprices_vat_rate["$i"] = $_POST["tva_tx_".$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -90,10 +89,10 @@ if ($_POST["action"] == 'update_price' &&
|
|||||||
$newpricebase=$_POST["price_base_type"];
|
$newpricebase=$_POST["price_base_type"];
|
||||||
$newvat=$_POST["tva_tx"];
|
$newvat=$_POST["tva_tx"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$newprice_min = '' ;
|
$newprice_min = '' ;
|
||||||
$newprice_min = price2num($_POST["price_min"],'MU');
|
$newprice_min = price2num($_POST["price_min"],'MU');
|
||||||
|
|
||||||
if ($product->update_price($product->id, $newprice, $newpricebase, $user, $newvat,$newprice_min) > 0)
|
if ($product->update_price($product->id, $newprice, $newpricebase, $user, $newvat,$newprice_min) > 0)
|
||||||
{
|
{
|
||||||
$_GET["action"] = '';
|
$_GET["action"] = '';
|
||||||
@ -106,10 +105,18 @@ if ($_POST["action"] == 'update_price' &&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'delete' && $user->rights->produit->creer)
|
||||||
|
{
|
||||||
|
$productstatic = new Product($db);
|
||||||
|
$result=$productstatic->log_price_delete($user,$_GET["lineid"]);
|
||||||
|
if ($result < 0) $mesg='<div class="error">'.$productstatic->error.'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affiche historique prix
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -118,6 +125,8 @@ if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
|||||||
|
|
||||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||||
|
|
||||||
|
if ($mesg) print $mesg;
|
||||||
|
|
||||||
$head=product_prepare_head($product, $user);
|
$head=product_prepare_head($product, $user);
|
||||||
$titre=$langs->trans("CardProduct".$product->type);
|
$titre=$langs->trans("CardProduct".$product->type);
|
||||||
dolibarr_fiche_head($head, 'price', $titre);
|
dolibarr_fiche_head($head, 'price', $titre);
|
||||||
@ -140,29 +149,29 @@ print '</tr>';
|
|||||||
// MultiPrix
|
// MultiPrix
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
if($conf->global->PRODUIT_MULTIPRICES)
|
||||||
{
|
{
|
||||||
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td>';
|
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td>';
|
||||||
|
|
||||||
if ($product->multiprices_base_type["$i"] == 'TTC')
|
if ($product->multiprices_base_type["$i"] == 'TTC')
|
||||||
{
|
{
|
||||||
print '<td>'.price($product->multiprices_ttc["$i"]);
|
print '<td>'.price($product->multiprices_ttc["$i"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td>'.price($product->multiprices["$i"]);
|
print '<td>'.price($product->multiprices["$i"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($product->multiprices_base_type["$i"])
|
if ($product->multiprices_base_type["$i"])
|
||||||
{
|
{
|
||||||
print ' '.$langs->trans($product->multiprices_base_type["$i"]);
|
print ' '.$langs->trans($product->multiprices_base_type["$i"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ' '.$langs->trans($product->price_base_type);
|
print ' '.$langs->trans($product->price_base_type);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Prix
|
// Prix
|
||||||
else
|
else
|
||||||
@ -199,7 +208,7 @@ print $product->getLibStatut(2);
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
|
||||||
@ -210,14 +219,14 @@ print "</div>\n";
|
|||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
if (! $_GET["action"])
|
if (empty($_GET["action"]) || $_GET["action"]=='delete')
|
||||||
{
|
{
|
||||||
print "\n<div class=\"tabsAction\">\n";
|
print "\n<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if ($user->rights->produit->modifier || $user->rights->produit->creer)
|
if ($user->rights->produit->modifier || $user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/price.php?action=edit_price&id='.$product->id.'">'.$langs->trans("UpdatePrice").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/price.php?action=edit_price&id='.$product->id.'">'.$langs->trans("UpdatePrice").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
}
|
}
|
||||||
@ -238,12 +247,20 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
|
|||||||
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Price base
|
||||||
|
print '<tr><td width="15%">';
|
||||||
|
print $langs->trans('PriceBase');
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Price
|
// Price
|
||||||
print '<tr><td width="15%">';
|
print '<tr><td width="15%">';
|
||||||
$text=$langs->trans('SellingPrice');
|
$text=$langs->trans('SellingPrice');
|
||||||
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($product->price_base_type == 'TTC')
|
if ($product->price_base_type == 'TTC')
|
||||||
{
|
{
|
||||||
print '<td><input name="price" size="10" value="'.price($product->price_ttc).'">';
|
print '<td><input name="price" size="10" value="'.price($product->price_ttc).'">';
|
||||||
@ -252,10 +269,10 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
|
|||||||
{
|
{
|
||||||
print '<td><input name="price" size="10" value="'.price($product->price).'">';
|
print '<td><input name="price" size="10" value="'.price($product->price).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>' ;
|
print '<tr><td>' ;
|
||||||
$text=$langs->trans('MinPrice') ;
|
$text=$langs->trans('MinPrice') ;
|
||||||
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
||||||
if ($product->price_base_type == 'TTC')
|
if ($product->price_base_type == 'TTC')
|
||||||
{
|
{
|
||||||
print '<td><input name="price_min" size="10" value="'.price($product->price_min_ttc).'">';
|
print '<td><input name="price_min" size="10" value="'.price($product->price_min_ttc).'">';
|
||||||
@ -264,147 +281,145 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
|
|||||||
{
|
{
|
||||||
print '<td><input name="price_min" size="10" value="'.price($product->price_min).'">';
|
print '<td><input name="price_min" size="10" value="'.price($product->price_min).'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
||||||
print $html->select_tva("tva_tx",$product->tva_tx,$mysoc,'');
|
print $html->select_tva("tva_tx",$product->tva_tx,$mysoc,'');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
{
|
{
|
||||||
print '<form action="price.php?id='.$product->id.'" method="post">';
|
print '<form action="price.php?id='.$product->id.'" method="post">';
|
||||||
print '<input type="hidden" name="action" value="update_price">';
|
print '<input type="hidden" name="action" value="update_price">';
|
||||||
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td width="15%">';
|
print '<tr><td width="15%">';
|
||||||
$text=$langs->trans('SellingPrice').' '.$i;
|
$text=$langs->trans('SellingPrice').' '.$i;
|
||||||
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($product->multiprices_base_type["$i"] == 'TTC')
|
if ($product->multiprices_base_type["$i"] == 'TTC')
|
||||||
{
|
{
|
||||||
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices_ttc["$i"]).'">';
|
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices_ttc["$i"]).'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices["$i"]).'">';
|
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices["$i"]).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i);
|
print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<tr><td>' ;
|
print '<tr><td>' ;
|
||||||
$text=$langs->trans('MinPrice') ;
|
$text=$langs->trans('MinPrice') ;
|
||||||
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
||||||
if ($product->price_base_type == 'TTC')
|
if ($product->price_base_type == 'TTC')
|
||||||
{
|
{
|
||||||
print '<td><input name="price_min" size="10" value="'.price($product->price_min_ttc).'">';
|
print '<td><input name="price_min" size="10" value="'.price($product->price_min_ttc).'">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td><input name="price_min" size="10" value="'.price($product->price_min).'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// VAT
|
||||||
|
print '<td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
||||||
|
print $html->select_tva("tva_tx_".$i,$product->multiprices_tva_tx["$i"],$mysoc,'');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
print '<td><input name="price_min" size="10" value="'.price($product->price_min).'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// VAT
|
|
||||||
print '<td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
|
||||||
print $html->select_tva("tva_tx_".$i,$product->multiprices_tva_tx["$i"],$mysoc,'');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
print '</form>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Liste des evolutions du prix
|
// Liste des evolutions du prix
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
if($conf->global->PRODUIT_MULTIPRICES)
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx,";
|
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx,";
|
||||||
$sql.= " p.price_level,";
|
$sql.= " p.price_level,";
|
||||||
$sql.= " ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
|
$sql.= " ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price as p, ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_price as p, ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE fk_product = ".$product->id;
|
$sql.= " WHERE fk_product = ".$product->id;
|
||||||
$sql.= " AND p.fk_user_author = u.rowid ";
|
$sql.= " AND p.fk_user_author = u.rowid ";
|
||||||
$sql.= " ORDER BY p.price_level ASC, p.date_price DESC";
|
$sql.= " ORDER BY p.price_level ASC, p.date_price DESC";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx,";
|
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx,";
|
||||||
$sql.= " p.price_min, p.price_min_ttc,";
|
$sql.= " p.price_min, p.price_min_ttc,";
|
||||||
$sql.= " ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
|
$sql.= " ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."product_price as p ";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."product_price as p ";
|
||||||
$sql.= " WHERE p.fk_product = ".$product->id;
|
$sql.= " WHERE p.fk_product = ".$product->id;
|
||||||
$sql.= " AND p.fk_user_author = u.rowid";
|
$sql.= " AND p.fk_user_author = u.rowid";
|
||||||
$sql.= " ORDER BY p.date_price DESC";
|
$sql.= " ORDER BY p.date_price DESC";
|
||||||
}
|
}
|
||||||
//$sql .= $db->plimit();
|
//$sql .= $db->plimit();
|
||||||
|
|
||||||
$result = $db->query($sql) ;
|
$result = $db->query($sql) ;
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
if (! $num)
|
if (! $num)
|
||||||
{
|
{
|
||||||
$db->free($result) ;
|
$db->free($result) ;
|
||||||
|
|
||||||
// Il doit au moins y avoir la ligne de prix initial.
|
// Il doit au moins y avoir la ligne de prix initial.
|
||||||
// On l'ajoute donc pour remettre à niveau (pb vieilles versions)
|
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
|
||||||
$product->update_price($product->id, $product->price, 'HT' ,$user,$newprice_min);
|
$product->update_price($product->id, $product->price, 'HT', $user, $newprice_min);
|
||||||
|
|
||||||
$result = $db->query($sql) ;
|
$result = $db->query($sql) ;
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
|
|
||||||
|
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
if($conf->global->PRODUIT_MULTIPRICES)
|
||||||
{
|
{
|
||||||
print '<td>'.$langs->trans("MultiPriceLevelsName").'</td>';
|
print '<td>'.$langs->trans("MultiPriceLevelsName").'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="center">'.$langs->trans("PriceBase").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("VAT").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("HT").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("TTC").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("ChangedBy").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$var=True;
|
print '<td align="center">'.$langs->trans("PriceBase").'</td>';
|
||||||
$i = 0;
|
print '<td align="right">'.$langs->trans("VAT").'</td>';
|
||||||
while ($i < $num)
|
print '<td align="right">'.$langs->trans("HT").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("TTC").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("ChangedBy").'</td>';
|
||||||
|
if ($user->rights->produit->creer) print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$var=True;
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
// Date
|
// Date
|
||||||
print "<td>".dolibarr_print_date($objp->dp,"dayhour")."</td>";
|
print "<td>".dolibarr_print_date($objp->dp,"dayhour")."</td>";
|
||||||
|
|
||||||
// catégorie de Prix
|
// Price level
|
||||||
if ($conf->global->PRODUIT_MULTIPRICES)
|
if ($conf->global->PRODUIT_MULTIPRICES)
|
||||||
{
|
{
|
||||||
print "<td>".$objp->price_level."</td>";
|
print "<td>".$objp->price_level."</td>";
|
||||||
@ -414,22 +429,37 @@ if ($result)
|
|||||||
print '<td align="right">'.vatrate($objp->tva_tx,true)."</td>";
|
print '<td align="right">'.vatrate($objp->tva_tx,true)."</td>";
|
||||||
print '<td align="right">'.price($objp->price)."</td>";
|
print '<td align="right">'.price($objp->price)."</td>";
|
||||||
print '<td align="right">'.price($objp->price_ttc)."</td>";
|
print '<td align="right">'.price($objp->price_ttc)."</td>";
|
||||||
print '<td align="right">'.price($objp->price_min).'</td>';
|
print '<td align="right">'.price($objp->price_min).'</td>';
|
||||||
print '<td align="right">'.price($objp->price_min_ttc).'</td>';
|
print '<td align="right">'.price($objp->price_min_ttc).'</td>';
|
||||||
|
|
||||||
// User
|
// User
|
||||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'</a></td>';
|
print '<td align="right"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'</a></td>';
|
||||||
|
|
||||||
|
// Action
|
||||||
|
if ($user->rights->produit->creer)
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
|
if ($i > 0)
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$product->id.'&lineid='.$objp->rowid.'">';
|
||||||
|
print img_delete();
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
|
else print ' '; // Can not delete last price (it's current price)
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "<br>";
|
print "<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user