diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 11412c01793..ffa22983385 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -425,12 +425,19 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
{
- $propal = new Propal($db);
- $ret=$propal->fetch($_POST['propalid']);
-
if ($_POST["remise_id"])
{
- $propal->insert_discount($_POST["remise_id"]);
+ $propal = new Propal($db);
+ $propal->id=$_GET['propalid'];
+ $ret=$propal->fetch($_GET['propalid']);
+ if ($ret > 0)
+ {
+ $propal->insert_discount($_POST["remise_id"]);
+ }
+ else
+ {
+ dolibarr_print_error($db,$propal->error);
+ }
}
}
@@ -737,9 +744,9 @@ if ($_GET['propalid'] > 0)
print '. ';
if ($absolute_discount)
{
- print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
- print '.';
-// print $html->form_remise_dispo($_SERVER["PHP_SELF"].'?propalid='.$propal->id,0,'remise_id',$societe->id);
+ print '
';
+ //print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
+ print $html->form_remise_dispo($_SERVER["PHP_SELF"].'?propalid='.$propal->id,0,'remise_id',$societe->id,$absolute_discount);
}
else print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '';
@@ -878,28 +885,6 @@ if ($_GET['propalid'] > 0)
}
print '';
- // Destinataire
-/* On gère les contacts sur onglet contact
- $langs->load('mails');
- print '
| '; - print $langs->trans('MailTo'); - print ' | '; - if ($_GET['action'] != 'editcontact' && $propal->brouillon) print 'id.'">'.img_edit($langs->trans('SetReceiver'),1).' | '; - print '
| '; + print ' | '; + print ''; if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service'); else print img_object($langs->trans('ShowProduct'),'product'); print ' '.$objp->ref.''; @@ -1041,7 +1028,18 @@ if ($_GET['propalid'] > 0) } else { - print ' | '.stripslashes(nl2br($objp->description)); + print ' | ';
+ if ($objp->info_bits == 2)
+ {
+ print '';
+ print $langs->trans("Discount");
+ print '';
+ if ($objp->description) print ': '.nl2br($objp->description);
+ }
+ else
+ {
+ print nl2br($objp->description);
+ }
if ($objp->date_start && $objp->date_end)
{
print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php
index 9c8e93e47c4..c2f744a2d47 100644
--- a/htdocs/compta/propal.php
+++ b/htdocs/compta/propal.php
@@ -544,16 +544,16 @@ et non globalement
/*
* Boutons Actions
*/
- if ($obj->statut <> 4 && $user->societe_id == 0)
+ if ($propal->statut <> 4 && $user->societe_id == 0)
{
print ' ';
-
- if ($obj->statut == 2 && $user->rights->facture->creer)
+
+ if ($propal->statut == 2 && $user->rights->facture->creer)
{
print '".$langs->trans("BuildBill")."";
}
- if ($obj->statut == 2 && sizeof($propal->getFactureListeArray()))
+ if ($propal->statut == 2 && sizeof($propal->getFactureListeArray()))
{
print '".$langs->trans("ClassifyBilled")."";
}
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 7814b3e4293..74120d37a9d 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -2206,7 +2206,7 @@ class FactureLigne
$sql.= " '".price2num($this->qty)."',";
$sql.= " '".price2num($this->txtva)."',";
if ($this->fk_product) { $sql.= "'".$this->fk_product."',"; }
- else { $sql.='0,'; }
+ else { $sql.='null,'; }
$sql.= " '".price2num($this->remise_percent)."',";
$sql.= " '".price2num($this->subprice)."',";
$sql.= " '".price2num($this->remise)."',";
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 81a4fb51953..92ae94b5f99 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -1670,16 +1670,17 @@ class Form
* \param selected Valeur à appliquer
* \param htmlname Nom du formulaire select. Si none, non modifiable
*/
- function form_remise_dispo($page, $selected='', $htmlname='remise_id',$socid)
+ function form_remise_dispo($page, $selected='', $htmlname='remise_id',$socid, $absolute_discount)
{
- global $langs;
+ global $conf,$langs;
if ($htmlname != "none")
{
print ' |