Fix: regression
This commit is contained in:
parent
de4419f74a
commit
94ede894a6
@ -643,13 +643,13 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
|||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
if ((empty($_POST['idprod']) && $_POST["type"] < 2) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not ''
|
if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not ''
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0 && isset($_POST['qty']) && (($_POST['np_price']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod']))
|
||||||
{
|
{
|
||||||
$ret=$propal->fetch($_POST['propalid']);
|
$ret=$propal->fetch($_POST['propalid']);
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
@ -659,8 +659,6 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
$ret=$propal->fetch_client();
|
$ret=$propal->fetch_client();
|
||||||
|
|
||||||
if ($_POST["type"] < 2 && isset($_POST['qty']) && (($_POST['np_price']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod']))
|
|
||||||
{
|
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
|
|
||||||
// Ecrase $pu par celui du produit
|
// Ecrase $pu par celui du produit
|
||||||
@ -739,28 +737,6 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
|||||||
$info_bits,
|
$info_bits,
|
||||||
$type
|
$type
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
else if($_POST["type"] == 9 && $_POST['dp_desc'])
|
|
||||||
{
|
|
||||||
$desc=$_POST['dp_desc'];
|
|
||||||
$type=$_POST["type"];
|
|
||||||
|
|
||||||
// Insert line
|
|
||||||
$result=$propal->addline(
|
|
||||||
$_POST['propalid'],
|
|
||||||
$desc,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
'HT',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
$type
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -787,6 +763,7 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
|||||||
$mesg='<div class="error">'.$propal->error.'</div>';
|
$mesg='<div class="error">'.$propal->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -794,8 +771,6 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
|||||||
*/
|
*/
|
||||||
if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
|
if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
|
||||||
{
|
{
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
if (! $propal->fetch($_POST['propalid']) > 0)
|
if (! $propal->fetch($_POST['propalid']) > 0)
|
||||||
{
|
{
|
||||||
@ -804,8 +779,6 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
|||||||
}
|
}
|
||||||
$propal->fetch_client();
|
$propal->fetch_client();
|
||||||
|
|
||||||
if ($_POST['type'] < 2)
|
|
||||||
{
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
$info_bits=0;
|
$info_bits=0;
|
||||||
if (preg_match('/\*/',$_POST['tva_tx'])) $info_bits |= 0x01;
|
if (preg_match('/\*/',$_POST['tva_tx'])) $info_bits |= 0x01;
|
||||||
@ -818,13 +791,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
|||||||
$productid = $_POST['productid'] ;
|
$productid = $_POST['productid'] ;
|
||||||
if ($productid)
|
if ($productid)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db) ;
|
||||||
$res=$product->fetch($productid);
|
$res=$product->fetch($productid) ;
|
||||||
}
|
}
|
||||||
if ($productid && $product->price_min && ( price2num($_POST['subprice'])*(1-price2num($_POST['remise_percent'])/100) < price2num($product->price_min)))
|
if ($productid && $product->price_min && ( price2num($_POST['subprice'])*(1-price2num($_POST['remise_percent'])/100) < price2num($product->price_min)))
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'</div>' ;
|
$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'</div>' ;
|
||||||
$error++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -836,20 +808,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
|||||||
$_POST['desc'],
|
$_POST['desc'],
|
||||||
'HT',
|
'HT',
|
||||||
$info_bits);
|
$info_bits);
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($_POST['type'] == 9 && $_POST['desc'])
|
|
||||||
{
|
|
||||||
$result = $propal->updateline($_POST['lineid'],
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
$_POST['desc']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error)
|
|
||||||
{
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang='';
|
$newlang='';
|
||||||
@ -1515,7 +1474,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||||
else if ($type==9) $text = img_object($langs->trans('Notes'),'generic');
|
|
||||||
else $text = img_object($langs->trans('Product'),'product');
|
else $text = img_object($langs->trans('Product'),'product');
|
||||||
print $text.' '.nl2br($objp->description);
|
print $text.' '.nl2br($objp->description);
|
||||||
|
|
||||||
@ -1579,8 +1537,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($objp->product_type < 2)
|
|
||||||
{
|
|
||||||
// VAT Rate
|
// VAT Rate
|
||||||
print '<td align="right" nowrap="nowrap">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
print '<td align="right" nowrap="nowrap">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
||||||
|
|
||||||
@ -1616,11 +1572,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
print '<td align="right" nowrap="nowrap">'.price($objp->total_ht)."</td>\n";
|
print '<td align="right" nowrap="nowrap">'.price($objp->total_ht)."</td>\n";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td align="right" colspan="5" nowrap="nowrap"> </td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Icone d'edition et suppression
|
// Icone d'edition et suppression
|
||||||
if ($propal->statut == 0 && $user->rights->propale->creer)
|
if ($propal->statut == 0 && $user->rights->propale->creer)
|
||||||
@ -1675,7 +1626,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<input type="hidden" name="action" value="updateligne">';
|
print '<input type="hidden" name="action" value="updateligne">';
|
||||||
print '<input type="hidden" name="propalid" value="'.$propal->id.'">';
|
print '<input type="hidden" name="propalid" value="'.$propal->id.'">';
|
||||||
print '<input type="hidden" name="lineid" value="'.$_GET["lineid"].'">';
|
print '<input type="hidden" name="lineid" value="'.$_GET["lineid"].'">';
|
||||||
print '<input type="hidden" name="type" value="'.$objp->product_type.'">';
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||||
@ -1683,12 +1633,14 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
print '<input type="hidden" name="productid" value="'.$objp->fk_product.'">';
|
print '<input type="hidden" name="productid" value="'.$objp->fk_product.'">';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
|
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
|
||||||
if ($objp->product_type==1) print img_object($langs->trans('ShowService'),'service');
|
if ($objp->fk_product_type==1) print img_object($langs->trans('ShowService'),'service');
|
||||||
else print img_object($langs->trans('ShowProduct'),'product');
|
else print img_object($langs->trans('ShowProduct'),'product');
|
||||||
print ' '.$objp->ref.'</a>';
|
print ' '.$objp->ref.'</a>';
|
||||||
print ' - '.nl2br($objp->product_label);
|
print ' - '.nl2br($objp->product_label);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
if ($_GET["action"] == 'editline')
|
||||||
|
{
|
||||||
// editeur wysiwyg
|
// editeur wysiwyg
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||||
{
|
{
|
||||||
@ -1702,9 +1654,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||||
print '<textarea name="desc" cols="70" class="flat" rows="'.$nbrows.'">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
print '<textarea name="desc" cols="70" class="flat" rows="'.$nbrows.'">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($objp->product_type < 2)
|
|
||||||
{
|
|
||||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
if ($conf->global->PRODUIT_USE_MARKUP)
|
||||||
{
|
{
|
||||||
print '<td align="right">'.vatrate($objp->marge_tx).'%</td>';
|
print '<td align="right">'.vatrate($objp->marge_tx).'%</td>';
|
||||||
@ -1727,12 +1678,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td align="right" colspan="4"> </td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<td align="center" colspan="5" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
print '<td align="center" colspan="5" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
|
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||||
print '</tr>' . "\n";
|
print '</tr>' . "\n";
|
||||||
|
|||||||
@ -479,13 +479,6 @@ class Form
|
|||||||
if (1 == $selected) print ' selected="true"';
|
if (1 == $selected) print ' selected="true"';
|
||||||
print '>'.$langs->trans("Service");
|
print '>'.$langs->trans("Service");
|
||||||
|
|
||||||
if ($conf->global->MAIN_USE_NOTES_IN_DETAILS)
|
|
||||||
{
|
|
||||||
print '<option value="9"';
|
|
||||||
if (9 == $selected) print ' selected="true"';
|
|
||||||
print '>'.$langs->trans("Notes");
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</select>';
|
print '</select>';
|
||||||
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -251,8 +251,6 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
if ($propale->lignes[$i]->product_type < 2)
|
|
||||||
{
|
|
||||||
// TVA
|
// TVA
|
||||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||||
{
|
{
|
||||||
@ -287,7 +285,6 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$total = price($propale->lignes[$i]->total_ht);
|
$total = price($propale->lignes[$i]->total_ht);
|
||||||
$pdf->MultiCell(26, 4, $total, 0, 'R', 0);
|
$pdf->MultiCell(26, 4, $total, 0, 'R', 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||||
$tvaligne=$propale->lignes[$i]->total_tva;
|
$tvaligne=$propale->lignes[$i]->total_tva;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user