[CORE] FIX : la validation d'une demande de prix à "accéptée" ne créer plus d'entré si le prix ou la quantité est à 0.
FIX : la création d'une commande depuis une demande ne prend plus en compte les produits qui ont un prix ou quantité à 0. (#new_ask_price).
This commit is contained in:
parent
b31c77c754
commit
8ace3ee77b
@ -1485,7 +1485,7 @@ class AskPriceSupplier extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the commercial proposal
|
* Close the askprice
|
||||||
*
|
*
|
||||||
* @param User $user Object user that close
|
* @param User $user Object user that close
|
||||||
* @param int $statut Statut
|
* @param int $statut Statut
|
||||||
@ -1587,6 +1587,9 @@ class AskPriceSupplier extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::updateOrCreatePriceFournisseur", LOG_DEBUG);
|
dol_syslog(get_class($this)."::updateOrCreatePriceFournisseur", LOG_DEBUG);
|
||||||
foreach ($this->lines as $product) {
|
foreach ($this->lines as $product) {
|
||||||
|
if ($product->subprice <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
$idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty);
|
$idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty);
|
||||||
$res = $productsupplier->fetch($idProductFourn);
|
$res = $productsupplier->fetch($idProductFourn);
|
||||||
|
|
||||||
@ -2361,6 +2364,48 @@ class AskPriceSupplier extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function printOriginLinesList()
|
||||||
|
{
|
||||||
|
global $langs, $hookmanager;
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans('Ref').'</td>';
|
||||||
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
|
||||||
|
|
||||||
|
$num = count($this->lines);
|
||||||
|
$var = true;
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
foreach ($this->lines as $line)
|
||||||
|
{
|
||||||
|
if (empty($line->subprice) || $line->qty <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
|
||||||
|
{
|
||||||
|
if (empty($line->fk_parent_line))
|
||||||
|
{
|
||||||
|
$parameters=array('line'=>$line,'var'=>$var,'i'=>$i);
|
||||||
|
$action='';
|
||||||
|
$reshook=$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->printOriginLine($line,$var);
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -854,15 +854,6 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
|
|||||||
|
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
if (! empty($origin) && ! empty($originid)) {
|
if (! empty($origin) && ! empty($originid)) {
|
||||||
// Parse element/subelement (ex: project_task)
|
|
||||||
/* PHFAVRE
|
|
||||||
$element = $subelement = $origin;
|
|
||||||
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
|
||||||
$element = $regs [1];
|
|
||||||
$subelement = $regs [2];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$element = 'comm/askpricesupplier';
|
$element = 'comm/askpricesupplier';
|
||||||
$subelement = 'askpricesupplier';
|
$subelement = 'askpricesupplier';
|
||||||
|
|
||||||
@ -914,24 +905,15 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
|
|||||||
|
|
||||||
for($i = 0; $i < $num; $i ++)
|
for($i = 0; $i < $num; $i ++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
$label = (! empty($lines [$i]->label) ? $lines [$i]->label : '');
|
$label = (! empty($lines [$i]->label) ? $lines [$i]->label : '');
|
||||||
$desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle);
|
$desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle);
|
||||||
$product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0);
|
$product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0);
|
||||||
|
|
||||||
// Dates
|
// Reset fk_parent_line for no child products and special product
|
||||||
// TODO mutualiser
|
|
||||||
$date_start = $lines [$i]->date_debut_prevue;
|
|
||||||
if ($lines [$i]->date_debut_reel)
|
|
||||||
$date_start = $lines [$i]->date_debut_reel;
|
|
||||||
if ($lines [$i]->date_start)
|
|
||||||
$date_start = $lines [$i]->date_start;
|
|
||||||
$date_end = $lines [$i]->date_fin_prevue;
|
|
||||||
if ($lines [$i]->date_fin_reel)
|
|
||||||
$date_end = $lines [$i]->date_fin_reel;
|
|
||||||
if ($lines [$i]->date_end)
|
|
||||||
$date_end = $lines [$i]->date_end;
|
|
||||||
|
|
||||||
// Reset fk_parent_line for no child products and special product
|
|
||||||
if (($lines [$i]->product_type != 9 && empty($lines [$i]->fk_parent_line)) || $lines [$i]->product_type == 9) {
|
if (($lines [$i]->product_type != 9 && empty($lines [$i]->fk_parent_line)) || $lines [$i]->product_type == 9) {
|
||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
}
|
}
|
||||||
@ -944,7 +926,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
|
|||||||
$array_option = $lines [$i]->array_options;
|
$array_option = $lines [$i]->array_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
$idprod = $productsupplier->find_min_price_product_fournisseur($lines [$i]->fk_product, $qty);
|
$idprod = $productsupplier->find_min_price_product_fournisseur($lines [$i]->fk_product, $lines [$i]->qty);
|
||||||
$res = $productsupplier->fetch($idProductFourn);
|
$res = $productsupplier->fetch($idProductFourn);
|
||||||
|
|
||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
@ -963,8 +945,8 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
|
|||||||
$lines [$i]->product_type,
|
$lines [$i]->product_type,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$date_start,
|
null,
|
||||||
$date_end
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user