Merge pull request #10401 from aspangaro/10.0_accountancy2
NEW: Automatically binding for intra/export accountancy code in customer list
This commit is contained in:
commit
12e75cb8c9
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -212,7 +212,8 @@ if (empty($chartaccountcode))
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||
$sql.= " aa.rowid as aarowid,";
|
||||
$sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql.= " co.code as country_code, co.label as country,";
|
||||
$sql.= " s.tva_intra";
|
||||
$parameters=array();
|
||||
@ -437,7 +438,9 @@ if ($result) {
|
||||
$code_sell_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
|
||||
if ($objp->type_l == 1) {
|
||||
$isinEEC = isInEEC($objp->country_code);
|
||||
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
if ($objp->aarowid == '') {
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
@ -450,8 +453,19 @@ if ($result) {
|
||||
}
|
||||
if ($objp->code_sell_l == -1) $objp->code_sell_l='';
|
||||
|
||||
if ($objp->country_sell == '1') {
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
} elseif ($isinEEC == true) {
|
||||
$objp->code_sell_p = $objp->code_sell_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
} else {
|
||||
$objp->code_sell_p = $objp->code_sell_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
}
|
||||
|
||||
if (! empty($objp->code_sell)) {
|
||||
$objp->code_sell_p = $objp->code_sell; // Code on product
|
||||
//$objp->code_sell_p = $objp->code_sell; // Code on product
|
||||
} else {
|
||||
$code_sell_p_notset = 'color:orange';
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
@ -1179,24 +1179,21 @@ else
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 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="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell_intra'), 'accountancy_code_sell_intra', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell_export'), 'accountancy_code_sell_export', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell_intra'), 'accountancy_code_sell_intra', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell_export'), 'accountancy_code_sell_export', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user