diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php
index ef39252ff87..227949a3c1c 100644
--- a/htdocs/accountancy/admin/defaultaccounts.php
+++ b/htdocs/accountancy/admin/defaultaccounts.php
@@ -51,8 +51,8 @@ $action = GETPOST('action', 'alpha');
$list_account_main = array (
- 'ACCOUNTING_ACCOUNT_SUPPLIER',
'ACCOUNTING_ACCOUNT_CUSTOMER',
+ 'ACCOUNTING_ACCOUNT_SUPPLIER',
);
$list_account = array (
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index f40bfda856f..5c558ca0a90 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -387,10 +387,10 @@ if ($action == 'create') {
if ($action == 'update' && $line->id == $id) {
print '
';
print '| ';
- print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
+ print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, 'maxwidth300');
print ' | ';
print '';
- print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
+ print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, 'maxwidth300');
print ' | ';
print ' | ';
print ' | ';
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index cd93b1142f8..4a7bca5e1b7 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -389,11 +389,11 @@ print '';
print ' ';
print $langs->trans('From');
-print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
+print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
print ' ';
print '';
print $langs->trans('to');
-print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
+print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
print ' ';
print ' | ';
print '';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 9ed4ef29ac1..d607c1dc287 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -185,7 +185,12 @@ class BookKeeping extends CommonObject
else
{
//$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte);
- $this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForLine', $this->label_compte);
+ $mesg=$this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte;
+ if ($this->subledger_account && $this->subledger_account != $this->numero_compte)
+ {
+ $mesg.=', '.$langs->trans("SubledgerAccount").': '.$this->subledger_account;
+ }
+ $this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForLine', $mesg);
}
return -1;
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index ca9d05e7e93..f73596c5aa4 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -92,15 +92,15 @@ $sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation, erd.vat_src_code, ";
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
-$sql .= " ct.accountancy_code_buy as account_tva";
+//$sql .= " ct.accountancy_code_buy as account_tva";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
+//$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
-$sql .= " WHERE er.fk_statut > 0 ";
-$sql .= " AND erd.fk_code_ventilation > 0 ";
+$sql .= " WHERE er.fk_statut > 0";
+$sql .= " AND erd.fk_code_ventilation > 0";
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
if ($date_start && $date_end)
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
@@ -129,7 +129,9 @@ if ($result) {
// Controls
$compta_user = (! empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
$compta_fees = $obj->compte;
- $compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $account_vat);
+
+ $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
+ $compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
// Define array to display all VAT rates that use this accounting account $compta_tva
if (! empty(price2num($obj->tva_tx)) || ! empty($obj->vat_src_code))
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index b5f763fe2b1..27dfd532981 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -90,21 +90,21 @@ $idpays = $mysoc->country_id;
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
-$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
-$sql .= " ct.accountancy_code_buy as account_tva";
+$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
+//$sql .= " ct.accountancy_code_buy as account_tva";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
+//$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " WHERE f.fk_statut > 0"; // TODO Facture annulée ?
-$sql .= " AND fd.fk_code_ventilation > 0 ";
+$sql .= " AND fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
+ $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
} else {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
+ $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
}
if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
@@ -130,7 +130,7 @@ if ($result) {
while ( $i < $num ) {
$obj = $db->fetch_object($result);
- // contrôles
+ // Controls
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
$compta_prod = $obj->compte;
@@ -536,8 +536,18 @@ if (empty($action) || $action == 'view') {
print '';
}*/
+ // Button to write into Ledger
+ if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
+ print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
+ print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
+ }
print ' ';
- print '';
+ if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
+ print '';
+ }
+ else {
+ print '';
+ }
print ' ';
print '
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 24f5ae6e7aa..3150b74e9bd 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -135,6 +135,7 @@ if ($result) {
while ( $i < $num ) {
$obj = $db->fetch_object($result);
+ // Controls
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
$compta_prod = $obj->compte;
@@ -549,8 +550,19 @@ if (empty($action) || $action == 'view') {
} else {
print '';
}*/
+
+ // Button to write into Ledger
+ if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
+ print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
+ print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
+ }
print '';
- print '';
+ if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
+ print '';
+ }
+ else {
+ print '';
+ }
print ' ';
print '
diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php
index 7248c4bda3a..8a348dba57a 100644
--- a/htdocs/core/class/html.formaccounting.class.php
+++ b/htdocs/core/class/html.formaccounting.class.php
@@ -325,14 +325,13 @@ class FormAccounting extends Form
/**
* Return list of auxilary thirdparty accounts
*
- * @param string $selectid Preselected pcg_type
- * @param string $htmlname Name of field in html form
- * @param int $showempty Add an empty field
- * @param array $event Event options
- *
- * @return string String with HTML select
+ * @param string $selectid Preselected pcg_type
+ * @param string $htmlname Name of field in html form
+ * @param int $showempty Add an empty field
+ * @param string $morecss More css
+ * @return string String with HTML select
*/
- function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) {
+ function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') {
$aux_account = array();
@@ -377,8 +376,7 @@ class FormAccounting extends Form
$this->db->free($resql);
// Build select
- $out = ajax_combobox($htmlname, $event);
- $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
+ $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
return $out;
}
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 8ff65371fa5..64744eedf4a 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -256,6 +256,7 @@ Calculated=Calculated
Formula=Formula
## Error
+SomeMandatoryStepsOfSetupWereNotDone=Some mandatory steps of setup was not done, please complete them
ErrorNoAccountingCategoryForThisCountry=No accounting account group available for country %s (See Home - Setup - Dictionaries)
ExportNotSupported=The export format setuped is not supported into this page
BookeppingLineAlreayExists=Lines already existing into bookeeping
|