diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php
index f92f5b3ab88..c4be176bf68 100644
--- a/htdocs/accountancy/class/html.formventilation.class.php
+++ b/htdocs/accountancy/class/html.formventilation.class.php
@@ -94,7 +94,7 @@ class FormVentilation extends Form
* @param array $event Event options
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
- * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by
+ * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
*
* @return string String with HTML select
*/
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 77b14b24c7a..5f60724a135 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -43,9 +43,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
-if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
-if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
+if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
+if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
+if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
+if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
$langs->load("products");
$langs->load("other");
@@ -250,8 +252,11 @@ if (empty($reshook))
$object->volume_units = GETPOST('volume_units');
$object->finished = GETPOST('finished');
$object->fk_unit = GETPOST('units');
- $object->accountancy_code_sell = GETPOST('accountancy_code_sell');
- $object->accountancy_code_buy = GETPOST('accountancy_code_buy');
+
+ if (GETPOST('accountancy_code_sell') <= 0) { $accountancy_code_sell = ''; } else { $accountancy_code_sell = GETPOST('accountancy_code_sell'); }
+ if (GETPOST('accountancy_code_buy') <= 0) { $accountancy_code_buy = ''; } else { $accountancy_code_buy = GETPOST('accountancy_code_buy'); }
+ $object->accountancy_code_sell = $accountancy_code_sell;
+ $object->accountancy_code_buy = GETPOST('accountancy_code_buy');
// MultiPrix
if (! empty($conf->global->PRODUIT_MULTIPRICES))
@@ -719,6 +724,7 @@ llxHeader('', $title, $helpurl);
$form = new Form($db);
$formproduct = new FormProduct($db);
+if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
@@ -1003,20 +1009,34 @@ else
}
print '
';
+
+ if (! empty($conf->accounting->enabled))
+ {
+ // Accountancy_code_sell
+ print '| '.$langs->trans("ProductAccountancySellCode").' | ';
+ print '';
+ print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 0, 1);
+ print ' |
';
- // Accountancy_code_sell
- print '| '.$langs->trans("ProductAccountancySellCode").' | ';
- print '';
- print ' |
';
+ // Accountancy_code_buy
+ print '| '.$langs->trans("ProductAccountancyBuyCode").' | ';
+ print '';
+ print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 0, 1);
+ print ' |
';
+ }
+ else // For external software
+ {
+ // Accountancy_code_sell
+ print '| '.$langs->trans("ProductAccountancySellCode").' | ';
+ print '';
+ print ' |
';
- // Accountancy_code_buy
- print '| '.$langs->trans("ProductAccountancyBuyCode").' | ';
- print '';
- print ' |
';
-
- print '
';
-
- print '
';
+ // Accountancy_code_buy
+ print '| '.$langs->trans("ProductAccountancyBuyCode").' | ';
+ print '';
+ print ' |
';
+ }
+ print '';
dol_fiche_end();
@@ -1263,14 +1283,24 @@ else
print '
';
- /*if (empty($conf->accounting->enabled) && empty($conf->comptabilite->enabled) && empty($conf->accountingexpert->enabled))
- {
- // Don't show accounting field when accounting id disabled.
- }
- else
- {*/
- print '';
+ print '';
+ if (! empty($conf->accounting->enabled))
+ {
+ // Accountancy_code_sell
+ print '| '.$langs->trans("ProductAccountancySellCode").' | ';
+ print '';
+ print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
+ print ' |
';
+
+ // Accountancy_code_buy
+ print '| '.$langs->trans("ProductAccountancyBuyCode").' | ';
+ print '';
+ print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
+ print ' |
';
+ }
+ else // For external software
+ {
// Accountancy_code_sell
print '| '.$langs->trans("ProductAccountancySellCode").' | ';
print '';
@@ -1280,9 +1310,8 @@ else
print ' |
| '.$langs->trans("ProductAccountancyBuyCode").' | ';
print '';
print ' |
';
-
- print '
';
- //}
+ }
+ print '
';
dol_fiche_end();