Accountancy Add a list to select accounting account on product card
This commit is contained in:
parent
90dbfc4870
commit
b064d1106b
@ -94,7 +94,7 @@ class FormVentilation extends Form
|
|||||||
* @param array $event Event options
|
* @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_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 $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
|
* @return string String with HTML select
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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/product.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.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->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->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->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("products");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -250,8 +252,11 @@ if (empty($reshook))
|
|||||||
$object->volume_units = GETPOST('volume_units');
|
$object->volume_units = GETPOST('volume_units');
|
||||||
$object->finished = GETPOST('finished');
|
$object->finished = GETPOST('finished');
|
||||||
$object->fk_unit = GETPOST('units');
|
$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
|
// MultiPrix
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
@ -719,6 +724,7 @@ llxHeader('', $title, $helpurl);
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
|
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||||
|
|
||||||
|
|
||||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||||
@ -1004,19 +1010,33 @@ else
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Accountancy_code_sell
|
if (! empty($conf->accounting->enabled))
|
||||||
print '<tr><td>'.$langs->trans("ProductAccountancySellCode").'</td>';
|
{
|
||||||
print '<td><input name="accountancy_code_sell" size="16" value="'.$object->accountancy_code_sell.'">';
|
// Accountancy_code_sell
|
||||||
print '</td></tr>';
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 0, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_code_buy
|
// Accountancy_code_buy
|
||||||
print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
print '<td><input name="accountancy_code_buy" size="16" value="'.$object->accountancy_code_buy.'">';
|
print '<td>';
|
||||||
print '</td></tr>';
|
print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 0, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
else // For external software
|
||||||
|
{
|
||||||
|
// Accountancy_code_sell
|
||||||
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||||
|
print '<td><input name="accountancy_code_sell" size="16" value="'.$object->accountancy_code_sell.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
// Accountancy_code_buy
|
||||||
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
print '<br>';
|
print '<td><input name="accountancy_code_buy" size="16" value="'.$object->accountancy_code_buy.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
@ -1263,14 +1283,24 @@ else
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
/*if (empty($conf->accounting->enabled) && empty($conf->comptabilite->enabled) && empty($conf->accountingexpert->enabled))
|
print '<table class="border" width="100%">';
|
||||||
{
|
|
||||||
// Don't show accounting field when accounting id disabled.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{*/
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
|
if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
// Accountancy_code_sell
|
||||||
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_buy
|
||||||
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
else // For external software
|
||||||
|
{
|
||||||
// Accountancy_code_sell
|
// Accountancy_code_sell
|
||||||
print '<tr><td width="20%">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||||
print '<td><input name="accountancy_code_sell" size="16" value="'.$object->accountancy_code_sell.'">';
|
print '<td><input name="accountancy_code_sell" size="16" value="'.$object->accountancy_code_sell.'">';
|
||||||
@ -1280,9 +1310,8 @@ else
|
|||||||
print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
print '<td><input name="accountancy_code_buy" size="16" value="'.$object->accountancy_code_buy.'">';
|
print '<td><input name="accountancy_code_buy" size="16" value="'.$object->accountancy_code_buy.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
//}
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user