diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index ca6b2eadae1..935f0cf69c4 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -201,7 +201,18 @@ else if ($action == 'classin' && $user->rights->contrat->creer)
else if ($action == 'addline' && $user->rights->contrat->creer)
{
- if (GETPOST('pqty') && ((GETPOST('pu') != '' && GETPOST('desc')) || GETPOST('idprod')))
+ if (! GETPOST('qty'))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")),'errors');
+ $error++;
+ }
+ if ((GETPOST('price_ht') == '' || ! GETPOST('dp_desc')) && ! GETPOST('idprod'))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")),'errors');
+ $error++;
+ }
+
+ if (! $error)
{
$ret=$object->fetch($id);
if ($ret < 0)
@@ -286,11 +297,11 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
}
else
{
- $pu_ht=GETPOST('pu');
+ $pu_ht=GETPOST('price_ht');
$price_base_type = 'HT';
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
- $desc=GETPOST('desc');
+ $desc=GETPOST('dp_desc');
}
$localtax1_tx=get_localtax($tva_tx,1,$object->societe);
@@ -310,12 +321,12 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$result = $object->addline(
$desc,
$pu_ht,
- GETPOST('pqty'),
+ GETPOST('qty'),
$tva_tx,
$localtax1_tx,
$localtax2_tx,
GETPOST('idprod'),
- GETPOST('premise'),
+ GETPOST('remise_percent'),
$date_start,
$date_end,
$price_base_type,
@@ -343,6 +354,14 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
contrat_pdf_create($db, $object->id, $object->modelpdf, $outputlangs);
}
*/
+
+ unset($_POST['qty']);
+ unset($_POST['type']);
+ unset($_POST['idprod']);
+ unset($_POST['remise_percent']);
+ unset($_POST['price_ht']);
+ unset($_POST['tva_tx']);
+ unset($_POST['dp_desc']);
}
else
{
@@ -372,7 +391,7 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
$localtax1_tx=get_localtax(GETPOST('eltva_tx'),1,$object->thirdparty);
$localtax2_tx=get_localtax(GETPOST('eltva_tx'),2,$object->thirdparty);
- $objectline->description=GETPOST('eldesc');
+ $objectline->description=GETPOST('product_desc');
$objectline->price_ht=GETPOST('elprice');
$objectline->subprice=GETPOST('elprice');
$objectline->qty=GETPOST('elqty');
@@ -898,7 +917,7 @@ else
}
else
{
- print "
".nl2br($objp->description)." | \n";
+ print "".dol_htmlentitiesbr($objp->description)." | \n";
}
// TVA
print ''.vatrate($objp->tva_tx,'%',$objp->info_bits).' | ';
@@ -997,7 +1016,16 @@ else
{
print $objp->label?$objp->label.'
':'';
}
- print '';
+
+ // editeur wysiwyg
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ $nbrows=ROWS_2;
+ if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
+ $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
+ $doleditor=new DolEditor('product_desc',$objp->description,'',92,'dolibarr_details','',false,true,$enable,$nbrows,70);
+ $doleditor->Create();
+
+ print '';
print '';
print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->thirdparty);
print ' | ';
@@ -1252,108 +1280,60 @@ else
}
print '';
- /*
- * Ajouter une ligne produit/service
- */
+ // Form to add new line
if ($user->rights->contrat->creer && ($object->statut >= 0))
{
+ $dateSelector=1;
+
print '
';
- print ''; // Array with (n*2)+1 lines
+ print ''; // Array with (n*2)+1 lines
- print "";
- print '| '.$langs->trans("Service").' | ';
- print ''.$langs->trans("VAT").' | ';
- print ''.$langs->trans("PriceUHT").' | ';
- print ''.$langs->trans("Qty").' | ';
- print ''.$langs->trans("ReductionShort").' | ';
- print ' | ';
- print ' | ';
- print "
\n";
-
- $var=false;
-
- // Service sur produit predefini
- print '';
-
- $var=!$var;
-
- // Service libre
- print '';
print '
';
}
-
- //print '';
-
- //print ' |
';
-
print '';
- /*************************************************************
- * Boutons Actions
- *************************************************************/
+ /*
+ * Buttons
+ */
if ($user->societe_id == 0)
{
@@ -1391,6 +1371,10 @@ else
{
print 'id.'&action=delete">'.$langs->trans("Delete").'';
}
+ else
+ {
+ print ''.$langs->trans("Delete").'';
+ }
print "";
print '
';
@@ -1410,5 +1394,6 @@ else
llxFooter();
+
$db->close();
?>
diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php
index 5b611768119..f2a621f7047 100644
--- a/htdocs/core/tpl/freeproductline_create.tpl.php
+++ b/htdocs/core/tpl/freeproductline_create.tpl.php
@@ -23,6 +23,10 @@
* $this (invoice, order, ...)
* $line defined
*/
+
+$usemargins=0;
+if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
+
?>
@@ -37,23 +41,23 @@
trans('ReductionShort'); ?> |
margin->enabled)) {
+ if (! empty($usemargins))
+ {
?>
- trans('BuyingPrice'); ?> |
-global->DISPLAY_MARGIN_RATES))
- $colspan++;
- if (! empty($conf->global->DISPLAY_MARK_RATES))
- $colspan++;
+ trans('BuyingPrice'); ?> |
+ global->DISPLAY_MARGIN_RATES)) $colspan++;
+ if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
}
-?>
+ ?>
|