FIX Creating a supplier order from proposal order

This commit is contained in:
Laurent Destailleur 2016-06-04 02:39:13 +02:00
parent b57476153f
commit eb7a4c5ccf
3 changed files with 13 additions and 11 deletions

View File

@ -1030,7 +1030,7 @@ if (empty($reshook))
$num = count($lines);
$productsupplier = new ProductFournisseur($db);
for($i = 0; $i < $num; $i ++)
{
@ -1040,7 +1040,7 @@ if (empty($reshook))
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
// 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) {
$fk_parent_line = 0;
@ -1055,7 +1055,8 @@ if (empty($reshook))
}
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty);
if ($result>0)
if ($result>=0)
{
$tva_tx = $lines[$i]->tva_tx;
@ -1073,7 +1074,7 @@ if (empty($reshook))
$tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0,
$productsupplier->product_fourn_price_id,
$productsupplier->ref_supplier,
$lines[$i]->remise_percent,

View File

@ -1076,31 +1076,32 @@ if ($action == 'create')
// Terms of payment
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
$form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
$form->select_conditions_paiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
print '</td></tr>';
// Mode of payment
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
$form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id');
$form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $soc->mode_reglement_id, 'mode_reglement_id');
print '</td></tr>';
// Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) {
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
$form->select_comptes(GETPOST('fk_account')>0 ? GETPOST('fk_account','int') : $fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">';
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
print $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : $shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>';
}
// Delivery date (or manufacturing)
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
print '<td colspan="2">';
$datedelivery = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") {
$tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
$syear = date("Y", $tmpdte);
@ -1108,7 +1109,7 @@ if ($action == 'create')
$sday = date("d", $tmpdte);
$form->select_date($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addask");
} else {
$form->select_date(-1, 'liv_', '', '', '', "addask", 1, 1);
$form->select_date($datedelivery ? $datedelivery : -1, 'liv_', '', '', '', "addask", 1, 1);
}
print '</td></tr>';

View File

@ -19,7 +19,7 @@
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE LINKEDOBJECTBOCK-->
<?php
@ -35,7 +35,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
$var=!$var;
?>
<tr <?php echo $bc[$var]; ?> >
<td align="center"><?php echo $langs->trans("SupplierProposal"); ?></td>
<td><?php echo $langs->trans("SupplierProposal"); ?></td>
<td><a href="<?php echo DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowSupplierProposal"),"supplier_proposal").' '.$objectlink->ref; ?></a></td>
<td></td>
<td align="center"><?php echo dol_print_date($objectlink->datec,'day'); ?></td>