trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
print '' . $langs->trans("DescVentilCustomer") . '';
-print '';
+print '';
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
@@ -345,4 +393,4 @@ print "\n";
print '';
llxFooter();
-$db->close();
+$db->close();
\ No newline at end of file
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 555a8a3818e..a2a1619cb63 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -148,7 +148,7 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) {
- print '' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '
';
+ print '' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '
';
} else {
print '' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '
' . $sql . '
';
}
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index 43792ca500a..314d7abbcf3 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -629,5 +629,4 @@ if ($action == 'export_csv') {
llxFooter();
}
-
$db->close();
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index 082fdc25fd4..747943575b9 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -83,6 +83,50 @@ if ($action == 'validatehistory') {
$db->commit();
setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
}
+} elseif ($action == 'fixaccountancycode') {
+ $error = 0;
+ $db->begin();
+
+ $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
+ $sql1 .= " SET fd.fk_code_ventilation = 0";
+ $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
+ $sql1 .= ' (SELECT accnt.rowid ';
+ $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
+ $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
+ $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
+
+ dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
+
+ $resql1 = $db->query($sql1);
+ if (! $resql1) {
+ $error ++;
+ $db->rollback();
+ setEventMessage($db->lasterror(), 'errors');
+ } else {
+ $db->commit();
+ setEventMessage($langs->trans('Done'), 'mesgs');
+ }
+} elseif ($action == 'cleanaccountancycode') {
+ $error = 0;
+ $db->begin();
+
+ $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
+ $sql1 .= " SET fd.fk_code_ventilation = 0";
+ $sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
+ $sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
+ $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
+
+ dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
+
+ $resql1 = $db->query($sql1);
+ if (! $resql1) {
+ $error ++;
+ $db->rollback();
+ setEventMessage($db->lasterror(), 'errors');
+ } else {
+ $db->commit();
+ setEventMessage($langs->trans('Done'), 'mesgs');
+ }
}
/*
@@ -97,7 +141,11 @@ $textnextyear = '