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/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index b71762a0f60..5a351e9a3c5 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -13,8 +13,8 @@ insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire', '', 2, 6, __ENTITY__);
-insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__);
-insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 0, 7, __ENTITY__);
+insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 6, __ENTITY__);
+insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 7, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 8, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 11, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 15, __ENTITY__);
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 3aaa26c3271..c8370a699b0 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -240,12 +240,15 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after)
// TODO Find a way to add parent menu only if child menu exists. For the moment, no ther method than hard coded methods.
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS))
{
- $langs->load("products");
- $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools');
- if ($leftmenu=="modulesadmintools")
- {
- $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",$langs->trans("ProductVatMassChange"),1);
- }
+ if (empty($user->societe_id))
+ {
+ $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools');
+ if ($leftmenu=="modulesadmintools" && $user->admin)
+ {
+ $langs->load("products");
+ $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
+ }
+ }
}
/**
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 4ef4ede7015..683e3796774 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -712,12 +712,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
// Modules system tools
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS))
{
- $langs->load("products");
- $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools');
- if ($leftmenu=="modulesadmintools")
- {
- $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",$langs->trans("ProductVatMassChange"),1);
- }
+ if (empty($user->societe_id))
+ {
+ $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools');
+ if ($leftmenu=="modulesadmintools" && $user->admin)
+ {
+ $langs->load("products");
+ $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
+ }
+ }
}
}
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++;
}
-?>
+ ?>
|