forked from Wavyzz/dolibarr
NEW Add accounting code for eec sales and export sales on products
This commit is contained in:
@@ -1837,7 +1837,7 @@ class ExtraFields
|
||||
$out='';
|
||||
|
||||
// Only if something to display (perf)
|
||||
if ($value) // If we have -1 here, pb is into sert, not into ouptu
|
||||
if ($value) // If we have -1 here, pb is into insert, not into ouptut (fix insert instead of changing code here to compensate)
|
||||
{
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ ProductSheet=Product sheet
|
||||
ServiceSheet=Service sheet
|
||||
PossibleValues=Possible values
|
||||
GoOnMenuToCreateVairants=Go on menu %s - %s to prepare attribute variants (like colors, size, ...)
|
||||
UseProductFournDesc=Use vendor descriptions of products in vendor documents
|
||||
UseProductFournDesc=Add a feature to define the descriptions of products defined by the vendors in addition to descriptions for customers
|
||||
ProductSupplierDescription=Vendor description for the product
|
||||
#Attributes
|
||||
VariantAttributes=Variant attributes
|
||||
|
||||
@@ -1218,21 +1218,19 @@ else
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL)
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_export" value="'.$object->accountancy_code_sell_export.'">';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_export" value="'.$object->accountancy_code_sell_export.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
|
||||
@@ -1514,24 +1512,21 @@ else
|
||||
print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL)
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_export, 'accountancy_code_sell_export', 1, '', 1, 1);
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_export, 'accountancy_code_sell_export', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
@@ -1545,22 +1540,19 @@ else
|
||||
print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL)
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td><input name="accountancy_code_sell_intra" class="maxwidth200" value="'.$object->accountancy_code_sell_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td><input name="accountancy_code_sell_export" class="maxwidth200" value="'.$object->accountancy_code_sell_export.'">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td><input name="accountancy_code_sell_intra" class="maxwidth200" value="'.$object->accountancy_code_sell_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td><input name="accountancy_code_sell_export" class="maxwidth200" value="'.$object->accountancy_code_sell_export.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">';
|
||||
@@ -1687,48 +1679,45 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL)
|
||||
// Accountancy sell code intra-community
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
// Accountancy sell code intra-community
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancySellIntraCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
if (! empty($object->accountancy_code_sell_intra))
|
||||
{
|
||||
$accountingaccount2 = new AccountingAccount($db);
|
||||
$accountingaccount2->fetch('', $object->accountancy_code_sell_intra, 1);
|
||||
|
||||
print $accountingaccount2->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
} else {
|
||||
print $object->accountancy_code_sell_intra;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy sell code export
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancySellExportCode");
|
||||
print $langs->trans("ProductAccountancySellIntraCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
if (! empty($object->accountancy_code_sell_export))
|
||||
if (! empty($object->accountancy_code_sell_intra))
|
||||
{
|
||||
$accountingaccount3 = new AccountingAccount($db);
|
||||
$accountingaccount3->fetch('', $object->accountancy_code_sell_export, 1);
|
||||
$accountingaccount2 = new AccountingAccount($db);
|
||||
$accountingaccount2->fetch('', $object->accountancy_code_sell_intra, 1);
|
||||
|
||||
print $accountingaccount3->getNomUrl(0, 1, 1, '', 1);
|
||||
print $accountingaccount2->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
} else {
|
||||
print $object->accountancy_code_sell_export;
|
||||
print $object->accountancy_code_sell_intra;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy sell code export
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancySellExportCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
if (! empty($object->accountancy_code_sell_export))
|
||||
{
|
||||
$accountingaccount3 = new AccountingAccount($db);
|
||||
$accountingaccount3->fetch('', $object->accountancy_code_sell_export, 1);
|
||||
|
||||
print $accountingaccount3->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
} else {
|
||||
print $object->accountancy_code_sell_export;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy buy code
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancyBuyCode");
|
||||
|
||||
@@ -62,6 +62,8 @@ $fourn_id = GETPOST("fourn_id", 'int');
|
||||
$catid = GETPOST('catid', 'int');
|
||||
$search_tobatch = GETPOST("search_tobatch", 'int');
|
||||
$search_accountancy_code_sell = GETPOST("search_accountancy_code_sell", 'alpha');
|
||||
$search_accountancy_code_sell_intra = GETPOST("search_accountancy_code_sell_intra", 'alpha');
|
||||
$search_accountancy_code_sell_export = GETPOST("search_accountancy_code_sell_export", 'alpha');
|
||||
$search_accountancy_code_buy = GETPOST("search_accountancy_code_buy", 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$type=GETPOST("type", "int");
|
||||
@@ -154,6 +156,8 @@ if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
}
|
||||
}
|
||||
|
||||
$isInEEC=isInEEC($mysoc);
|
||||
|
||||
// Definition of fields for lists
|
||||
$arrayfields=array(
|
||||
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
@@ -175,8 +179,10 @@ $arrayfields=array(
|
||||
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
|
||||
'stock_virtual'=>array('label'=>$langs->trans("VirtualStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service' && $virtualdiffersfromphysical)),
|
||||
'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))),
|
||||
'p.accountancy_code_sell'=>array('label'=>$langs->trans("ProductAccountancySellCode"), 'checked'=>0),
|
||||
'p.accountancy_code_buy'=>array('label'=>$langs->trans("ProductAccountancyBuyCode"), 'checked'=>0),
|
||||
'p.accountancy_code_sell'=>array('label'=>$langs->trans("ProductAccountancySellCode"), 'checked'=>0, 'position'=>400),
|
||||
'p.accountancy_code_sell_intra'=>array('label'=>$langs->trans("ProductAccountancySellIntraCode"), 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>401),
|
||||
'p.accountancy_code_sell_export'=>array('label'=>$langs->trans("ProductAccountancySellExportCode"), 'checked'=>0, 'position'=>402),
|
||||
'p.accountancy_code_buy'=>array('label'=>$langs->trans("ProductAccountancyBuyCode"), 'checked'=>0, 'position'=>403),
|
||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000),
|
||||
@@ -227,6 +233,8 @@ if (empty($reshook))
|
||||
|
||||
$show_childproducts = '';
|
||||
$search_accountancy_code_sell='';
|
||||
$search_accountancy_code_sell_intra='';
|
||||
$search_accountancy_code_sell_export='';
|
||||
$search_accountancy_code_buy='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
@@ -321,8 +329,10 @@ if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$db->escape($search_ca
|
||||
if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL";
|
||||
if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id;
|
||||
if ($search_tobatch != '' && $search_tobatch >= 0) $sql.= " AND p.tobatch = ".$db->escape($search_tobatch);
|
||||
if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell);
|
||||
if ($search_accountancy_code_buy) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy);
|
||||
if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell);
|
||||
if ($search_accountancy_code_sell_intra) $sql.= natural_search('p.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
|
||||
if ($search_accountancy_code_sell_export) $sql.= natural_search('p.accountancy_code_sell_export', $search_accountancy_code_sell_export);
|
||||
if ($search_accountancy_code_buy) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy);
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
@@ -418,6 +428,8 @@ if ($resql)
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
|
||||
if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
|
||||
if ($search_accountancy_code_sell_intra) $param="&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra);
|
||||
if ($search_accountancy_code_sell_export) $param="&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export);
|
||||
if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
@@ -630,8 +642,10 @@ if ($resql)
|
||||
// To batch
|
||||
if (! empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno($search_tobatch, '', '', '', 1).'</td>';
|
||||
// Accountancy code sell
|
||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_sell" size="6" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
|
||||
// Accountancy code sell
|
||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
|
||||
if (! empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_intra" value="'.dol_escape_htmltag($search_accountancy_code_sell_intra).'"></td>';
|
||||
if (! empty($arrayfields['p.accountancy_code_sell_export']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_export" value="'.dol_escape_htmltag($search_accountancy_code_sell_export).'"></td>';
|
||||
// Accountancy code buy
|
||||
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_buy" size="6" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
@@ -723,7 +737,13 @@ if ($resql)
|
||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) {
|
||||
if (! empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.accountancy_code_sell_intra']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell_intra", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['p.accountancy_code_sell_export']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.accountancy_code_sell_export']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell_export", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
// Extra fields
|
||||
@@ -1032,7 +1052,17 @@ if ($resql)
|
||||
print '<td>'.$obj->accountancy_code_sell.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Accountancy code sell
|
||||
if (! empty($arrayfields['p.accountancy_code_sell_intra']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->accountancy_code_sell_intra.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['p.accountancy_code_sell_export']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->accountancy_code_sell_export.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Accountancy code buy
|
||||
if (! empty($arrayfields['p.accountancy_code_buy']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->accountancy_code_buy.'</td>';
|
||||
|
||||
Reference in New Issue
Block a user