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)
|
||||||
@ -658,133 +658,110 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$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';
|
||||||
|
|
||||||
|
// Ecrase $pu par celui du produit
|
||||||
|
// Ecrase $desc par celui du produit
|
||||||
|
// Ecrase $txtva par celui du produit
|
||||||
|
if ($_POST['idprod'])
|
||||||
{
|
{
|
||||||
$price_base_type = 'HT';
|
$prod = new Product($db, $_POST['idprod']);
|
||||||
|
$prod->fetch($_POST['idprod']);
|
||||||
// Ecrase $pu par celui du produit
|
|
||||||
// Ecrase $desc par celui du produit
|
$tva_tx = get_default_tva($mysoc,$propal->client,$prod->tva_tx);
|
||||||
// Ecrase $txtva par celui du produit
|
$tva_npr = get_default_npr($mysoc,$propal->client,$prod->tva_tx);
|
||||||
if ($_POST['idprod'])
|
|
||||||
|
// On defini prix unitaire
|
||||||
|
if ($conf->global->PRODUIT_MULTIPRICES && $propal->client->price_level)
|
||||||
{
|
{
|
||||||
$prod = new Product($db, $_POST['idprod']);
|
$pu_ht = $prod->multiprices[$propal->client->price_level];
|
||||||
$prod->fetch($_POST['idprod']);
|
$pu_ttc = $prod->multiprices_ttc[$propal->client->price_level];
|
||||||
|
$price_base_type = $prod->multiprices_base_type[$propal->client->price_level];
|
||||||
$tva_tx = get_default_tva($mysoc,$propal->client,$prod->tva_tx);
|
}
|
||||||
$tva_npr = get_default_npr($mysoc,$propal->client,$prod->tva_tx);
|
else
|
||||||
|
{
|
||||||
// On defini prix unitaire
|
$pu_ht = $prod->price;
|
||||||
if ($conf->global->PRODUIT_MULTIPRICES && $propal->client->price_level)
|
$pu_ttc = $prod->price_ttc;
|
||||||
|
$price_base_type = $prod->price_base_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||||
|
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||||
|
if ($tva_tx != $prod->tva_tx)
|
||||||
|
{
|
||||||
|
if ($price_base_type != 'HT')
|
||||||
{
|
{
|
||||||
$pu_ht = $prod->multiprices[$propal->client->price_level];
|
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
|
||||||
$pu_ttc = $prod->multiprices_ttc[$propal->client->price_level];
|
|
||||||
$price_base_type = $prod->multiprices_base_type[$propal->client->price_level];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pu_ht = $prod->price;
|
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
||||||
$pu_ttc = $prod->price_ttc;
|
|
||||||
$price_base_type = $prod->price_base_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
|
||||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
|
||||||
if ($tva_tx != $prod->tva_tx)
|
|
||||||
{
|
|
||||||
if ($price_base_type != 'HT')
|
|
||||||
{
|
|
||||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$desc = $prod->description;
|
|
||||||
$desc.= ($prod->description && $_POST['np_desc']) ? "\n" : "";
|
|
||||||
$desc.= $_POST['np_desc'];
|
|
||||||
$type = $prod->type;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$pu_ht=$_POST['np_price'];
|
|
||||||
$tva_tx=str_replace('*','',$_POST['np_tva_tx']);
|
|
||||||
$tva_npr=preg_match('/\*/',$_POST['np_tva_tx'])?1:0;
|
|
||||||
$desc=$_POST['dp_desc'];
|
|
||||||
$type=$_POST["type"];
|
|
||||||
}
|
|
||||||
|
|
||||||
$info_bits=0;
|
|
||||||
if ($tva_npr) $info_bits |= 0x01;
|
|
||||||
|
|
||||||
if ($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min)))
|
|
||||||
{
|
|
||||||
$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'</div>' ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Insert line
|
|
||||||
$result=$propal->addline(
|
|
||||||
$_POST['propalid'],
|
|
||||||
$desc,
|
|
||||||
$pu_ht,
|
|
||||||
$_POST['qty'],
|
|
||||||
$tva_tx,
|
|
||||||
$_POST['idprod'],
|
|
||||||
$_POST['remise_percent'],
|
|
||||||
$price_base_type,
|
|
||||||
$pu_ttc,
|
|
||||||
$info_bits,
|
|
||||||
$type
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$desc = $prod->description;
|
||||||
|
$desc.= ($prod->description && $_POST['np_desc']) ? "\n" : "";
|
||||||
|
$desc.= $_POST['np_desc'];
|
||||||
|
$type = $prod->type;
|
||||||
}
|
}
|
||||||
else if($_POST["type"] == 9 && $_POST['dp_desc'])
|
else
|
||||||
{
|
{
|
||||||
|
$pu_ht=$_POST['np_price'];
|
||||||
|
$tva_tx=str_replace('*','',$_POST['np_tva_tx']);
|
||||||
|
$tva_npr=preg_match('/\*/',$_POST['np_tva_tx'])?1:0;
|
||||||
$desc=$_POST['dp_desc'];
|
$desc=$_POST['dp_desc'];
|
||||||
$type=$_POST["type"];
|
$type=$_POST["type"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$info_bits=0;
|
||||||
|
if ($tva_npr) $info_bits |= 0x01;
|
||||||
|
|
||||||
|
if ($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min)))
|
||||||
|
{
|
||||||
|
$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'</div>' ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Insert line
|
// Insert line
|
||||||
$result=$propal->addline(
|
$result=$propal->addline(
|
||||||
$_POST['propalid'],
|
$_POST['propalid'],
|
||||||
$desc,
|
$desc,
|
||||||
0,
|
$pu_ht,
|
||||||
0,
|
$_POST['qty'],
|
||||||
0,
|
$tva_tx,
|
||||||
0,
|
$_POST['idprod'],
|
||||||
0,
|
$_POST['remise_percent'],
|
||||||
'HT',
|
$price_base_type,
|
||||||
0,
|
$pu_ttc,
|
||||||
0,
|
$info_bits,
|
||||||
$type
|
$type
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
if ($result > 0)
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang='';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
|
|
||||||
if (! empty($newlang))
|
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
// Define output language
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||||
|
|
||||||
|
unset($_POST['qty']);
|
||||||
|
unset($_POST['type']);
|
||||||
|
unset($_POST['np_price']);
|
||||||
|
unset($_POST['dp_desc']);
|
||||||
|
unset($_POST['np_tva_tx']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$propal->error.'</div>';
|
||||||
}
|
}
|
||||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
|
||||||
|
|
||||||
unset($_POST['qty']);
|
|
||||||
unset($_POST['type']);
|
|
||||||
unset($_POST['np_price']);
|
|
||||||
unset($_POST['dp_desc']);
|
|
||||||
unset($_POST['np_tva_tx']);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$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)
|
||||||
{
|
{
|
||||||
@ -803,53 +778,37 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$propal->fetch_client();
|
$propal->fetch_client();
|
||||||
|
|
||||||
if ($_POST['type'] < 2)
|
// Define info_bits
|
||||||
|
$info_bits=0;
|
||||||
|
if (preg_match('/\*/',$_POST['tva_tx'])) $info_bits |= 0x01;
|
||||||
|
|
||||||
|
// Define vat_rate
|
||||||
|
$vat_rate=$_POST['tva_tx'];
|
||||||
|
$vat_rate=str_replace('*','',$vat_rate);
|
||||||
|
|
||||||
|
// On verifie que le prix minimum est respecte
|
||||||
|
$productid = $_POST['productid'] ;
|
||||||
|
if ($productid)
|
||||||
{
|
{
|
||||||
// Define info_bits
|
$product = new Product($db) ;
|
||||||
$info_bits=0;
|
$res=$product->fetch($productid) ;
|
||||||
if (preg_match('/\*/',$_POST['tva_tx'])) $info_bits |= 0x01;
|
|
||||||
|
|
||||||
// Define vat_rate
|
|
||||||
$vat_rate=$_POST['tva_tx'];
|
|
||||||
$vat_rate=str_replace('*','',$vat_rate);
|
|
||||||
|
|
||||||
// On verifie que le prix minimum est respecte
|
|
||||||
$productid = $_POST['productid'] ;
|
|
||||||
if ($productid)
|
|
||||||
{
|
|
||||||
$product = new Product($db);
|
|
||||||
$res=$product->fetch($productid);
|
|
||||||
}
|
|
||||||
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>' ;
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result = $propal->updateline($_POST['lineid'],
|
|
||||||
$_POST['subprice'],
|
|
||||||
$_POST['qty'],
|
|
||||||
$_POST['remise_percent'],
|
|
||||||
$vat_rate,
|
|
||||||
$_POST['desc'],
|
|
||||||
'HT',
|
|
||||||
$info_bits);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ($_POST['type'] == 9 && $_POST['desc'])
|
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>' ;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$result = $propal->updateline($_POST['lineid'],
|
$result = $propal->updateline($_POST['lineid'],
|
||||||
0,
|
$_POST['subprice'],
|
||||||
0,
|
$_POST['qty'],
|
||||||
0,
|
$_POST['remise_percent'],
|
||||||
0,
|
$vat_rate,
|
||||||
$_POST['desc']);
|
$_POST['desc'],
|
||||||
}
|
'HT',
|
||||||
|
$info_bits);
|
||||||
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);
|
||||||
|
|
||||||
@ -1578,48 +1536,41 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($objp->product_type < 2)
|
// VAT Rate
|
||||||
|
print '<td align="right" nowrap="nowrap">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
||||||
|
|
||||||
|
// U.P HT
|
||||||
|
print '<td align="right" nowrap="nowrap">'.price($objp->subprice)."</td>\n";
|
||||||
|
|
||||||
|
// Qty
|
||||||
|
print '<td align="right" nowrap="nowrap">';
|
||||||
|
if ((($objp->info_bits & 2) != 2) && $objp->special_code != 3)
|
||||||
{
|
{
|
||||||
// VAT Rate
|
print $objp->qty;
|
||||||
print '<td align="right" nowrap="nowrap">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
}
|
||||||
|
else print ' ';
|
||||||
// U.P HT
|
print '</td>';
|
||||||
print '<td align="right" nowrap="nowrap">'.price($objp->subprice)."</td>\n";
|
|
||||||
|
// Remise percent (negative or positive)
|
||||||
// Qty
|
if (!empty($objp->remise_percent) && $objp->special_code != 3)
|
||||||
print '<td align="right" nowrap="nowrap">';
|
{
|
||||||
if ((($objp->info_bits & 2) != 2) && $objp->special_code != 3)
|
print '<td align="right">'.dol_print_reduction($objp->remise_percent,$langs)."</td>\n";
|
||||||
{
|
|
||||||
print $objp->qty;
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Remise percent (negative or positive)
|
|
||||||
if (!empty($objp->remise_percent) && $objp->special_code != 3)
|
|
||||||
{
|
|
||||||
print '<td align="right">'.dol_print_reduction($objp->remise_percent,$langs)."</td>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td> </td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Montant total HT
|
|
||||||
if ($objp->special_code == 3)
|
|
||||||
{
|
|
||||||
// Si ligne en option
|
|
||||||
print '<td align="right" nowrap="nowrap">'.$langs->trans('Option').'</td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td align="right" nowrap="nowrap">'.price($objp->total_ht)."</td>\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="right" colspan="5" nowrap="nowrap"> </td>';
|
print '<td> </td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Montant total HT
|
||||||
|
if ($objp->special_code == 3)
|
||||||
|
{
|
||||||
|
// Si ligne en option
|
||||||
|
print '<td align="right" nowrap="nowrap">'.$langs->trans('Option').'</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td align="right" nowrap="nowrap">'.price($objp->total_ht)."</td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Icone d'edition et suppression
|
// Icone d'edition et suppression
|
||||||
@ -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,56 +1633,51 @@ 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>';
|
||||||
}
|
}
|
||||||
// editeur wysiwyg
|
if ($_GET["action"] == 'editline')
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
// editeur wysiwyg
|
||||||
$doleditor=new DolEditor('desc',$objp->description,164,'dolibarr_details');
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||||
$doleditor->Create();
|
{
|
||||||
}
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
else
|
$doleditor=new DolEditor('desc',$objp->description,164,'dolibarr_details');
|
||||||
{
|
$doleditor->Create();
|
||||||
$nbrows=ROWS_2;
|
}
|
||||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
else
|
||||||
print '<textarea name="desc" cols="70" class="flat" rows="'.$nbrows.'">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
{
|
||||||
|
$nbrows=ROWS_2;
|
||||||
|
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 '</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>';
|
|
||||||
}
|
|
||||||
print '<td align="right">';
|
|
||||||
print $html->select_tva('tva_tx',$objp->tva_tx,$mysoc,$societe,'',$objp->info_bits);
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right"><input size="6" type="text" class="flat" name="subprice" value="'.price($objp->subprice,0,'',0).'"></td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
if (($objp->info_bits & 2) != 2)
|
|
||||||
{
|
|
||||||
print '<input size="2" type="text" class="flat" name="qty" value="'.$objp->qty.'">';
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right" nowrap>';
|
|
||||||
if (($objp->info_bits & 2) != 2)
|
|
||||||
{
|
|
||||||
print '<input size="1" type="text" class="flat" name="remise_percent" value="'.$objp->remise_percent.'">%';
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
else
|
print '<td align="right">';
|
||||||
|
print $html->select_tva('tva_tx',$objp->tva_tx,$mysoc,$societe,'',$objp->info_bits);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right"><input size="6" type="text" class="flat" name="subprice" value="'.price($objp->subprice,0,'',0).'"></td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
if (($objp->info_bits & 2) != 2)
|
||||||
{
|
{
|
||||||
print '<td align="right" colspan="4"> </td>';
|
print '<input size="2" type="text" class="flat" name="qty" value="'.$objp->qty.'">';
|
||||||
}
|
}
|
||||||
|
else print ' ';
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right" nowrap>';
|
||||||
|
if (($objp->info_bits & 2) != 2)
|
||||||
|
{
|
||||||
|
print '<input size="1" type="text" class="flat" name="remise_percent" value="'.$objp->remise_percent.'">%';
|
||||||
|
}
|
||||||
|
else print ' ';
|
||||||
|
print '</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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -250,43 +250,40 @@ 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
|
||||||
|
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||||
{
|
{
|
||||||
// TVA
|
$pdf->SetXY ($this->posxtva, $curY);
|
||||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
$pdf->MultiCell($this->posxup-$this->posxtva-1, 4, vatrate($propale->lignes[$i]->tva_tx,1,$propale->lignes[$i]->info_bits), 0, 'R');
|
||||||
{
|
}
|
||||||
$pdf->SetXY ($this->posxtva, $curY);
|
|
||||||
$pdf->MultiCell($this->posxup-$this->posxtva-1, 4, vatrate($propale->lignes[$i]->tva_tx,1,$propale->lignes[$i]->info_bits), 0, 'R');
|
// Prix unitaire HT avant remise
|
||||||
}
|
$pdf->SetXY ($this->posxup, $curY);
|
||||||
|
$pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($propale->lignes[$i]->subprice), 0, 'R', 0);
|
||||||
// Prix unitaire HT avant remise
|
|
||||||
$pdf->SetXY ($this->posxup, $curY);
|
// Quantity
|
||||||
$pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($propale->lignes[$i]->subprice), 0, 'R', 0);
|
$pdf->SetXY ($this->posxqty, $curY);
|
||||||
|
if ($propale->lignes[$i]->special_code != 3) $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $propale->lignes[$i]->qty, 0, 'R');
|
||||||
// Quantity
|
|
||||||
$pdf->SetXY ($this->posxqty, $curY);
|
// Remise sur ligne
|
||||||
if ($propale->lignes[$i]->special_code != 3) $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $propale->lignes[$i]->qty, 0, 'R');
|
$pdf->SetXY ($this->posxdiscount, $curY);
|
||||||
|
if ($propale->lignes[$i]->remise_percent && $propale->lignes[$i]->special_code != 3)
|
||||||
// Remise sur ligne
|
{
|
||||||
$pdf->SetXY ($this->posxdiscount, $curY);
|
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($propale->lignes[$i]->remise_percent,$outputlangs), 0, 'R');
|
||||||
if ($propale->lignes[$i]->remise_percent && $propale->lignes[$i]->special_code != 3)
|
}
|
||||||
{
|
|
||||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($propale->lignes[$i]->remise_percent,$outputlangs), 0, 'R');
|
// Total HT ligne
|
||||||
}
|
$pdf->SetXY ($this->postotalht, $curY);
|
||||||
|
if ($propale->lignes[$i]->special_code == 3)
|
||||||
// Total HT ligne
|
{
|
||||||
$pdf->SetXY ($this->postotalht, $curY);
|
// Ligne produit en option
|
||||||
if ($propale->lignes[$i]->special_code == 3)
|
$pdf->MultiCell(26, 4, $outputlangs->transnoentities("Option"), 0, 'R', 0);
|
||||||
{
|
}
|
||||||
// Ligne produit en option
|
else
|
||||||
$pdf->MultiCell(26, 4, $outputlangs->transnoentities("Option"), 0, 'R', 0);
|
{
|
||||||
}
|
$total = price($propale->lignes[$i]->total_ht);
|
||||||
else
|
$pdf->MultiCell(26, 4, $total, 0, 'R', 0);
|
||||||
{
|
|
||||||
$total = price($propale->lignes[$i]->total_ht);
|
|
||||||
$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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user