diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 8e74c674084..67ba28b4e47 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -563,10 +563,12 @@ if (empty($reshook))
// Boucle sur chaque taux de tva
$i = 0;
foreach ($object->lines as $line) {
- $amount_ht [$line->tva_tx] += $line->total_ht;
- $amount_tva [$line->tva_tx] += $line->total_tva;
- $amount_ttc [$line->tva_tx] += $line->total_ttc;
- $i ++;
+ if($line->total_ht!=0) { // no need to create discount if amount is null
+ $amount_ht [$line->tva_tx] += $line->total_ht;
+ $amount_tva [$line->tva_tx] += $line->total_tva;
+ $amount_ttc [$line->tva_tx] += $line->total_ttc;
+ $i ++;
+ }
}
// Insert one discount by VAT rate category
@@ -583,6 +585,7 @@ if (empty($reshook))
$discount->fk_facture_source = $object->id;
$error = 0;
+
foreach ($amount_ht as $tva_tx => $xxx) {
$discount->amount_ht = abs($amount_ht [$tva_tx]);
$discount->amount_tva = abs($amount_tva [$tva_tx]);
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index b586241c11e..83ad1495a9f 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -22,7 +22,7 @@
/**
* \file htdocs/compta/resultat/index.php
- * \brief Page reporting resultat
+ * \brief Page reporting result
*/
require '../../main.inc.php';
@@ -570,8 +570,8 @@ print '';
print '
| '.$langs->trans("Month").' | ';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
- print ''.$langs->trans("Outcome").' | ';
- print ''.$langs->trans("Income").' | ';
+ print ''.$langs->trans("Outcome").' | ';
+ print ''.$langs->trans("Income").' | ';
}
print '
';
@@ -634,7 +634,7 @@ print "\n";
// Balance
$var=!$var;
-print '| '.$langs->trans("Profit").' | ';
+print '
| '.$langs->trans("AccountingResult").' | ';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
print ' ';
diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php
index c2620fd34df..5d8dce0fd73 100644
--- a/htdocs/compta/tva/clients.php
+++ b/htdocs/compta/tva/clients.php
@@ -35,6 +35,7 @@ $langs->load("bills");
$langs->load("compta");
$langs->load("companies");
$langs->load("products");
+$langs->load("other");
// Date range
$year=GETPOST("year");
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index 681448e901e..f551e92cb9d 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -41,6 +41,7 @@ $langs->load("bills");
$langs->load("compta");
$langs->load("companies");
$langs->load("products");
+$langs->load("other");
// Date range
$year=GETPOST("year");
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index 7381fd77b93..58e79da87b9 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -7,6 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2012 Yann Droneaud
* Copyright (C) 2012 Florian Henry
+ * Copyright (C) 2015 Marcos GarcĂa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -255,7 +256,7 @@ class DoliDBPgsql extends DoliDB
$newreg3=preg_replace('/ NOT NULL/i','',$newreg3);
$newreg3=preg_replace('/ NULL/i','',$newreg3);
$newreg3=preg_replace('/ DEFAULT 0/i','',$newreg3);
- $newreg3=preg_replace('/ DEFAULT \'[0-9a-zA-Z_@]*\'/i','',$newreg3);
+ $newreg3=preg_replace('/ DEFAULT \'?[0-9a-zA-Z_@]*\'?/i','',$newreg3);
$line.= "ALTER TABLE ".$reg[1]." ALTER COLUMN ".$reg[2]." TYPE ".$newreg3;
// TODO Add alter to set default value or null/not null if there is this in $reg[3]
}
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index 89a32876dc3..116b2c52fa8 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -29,6 +29,7 @@ ReportTurnover=Turnover
PaymentsNotLinkedToInvoice=Payments not linked to any invoice, so not linked to any third party
PaymentsNotLinkedToUser=Payments not linked to any user
Profit=Profit
+AccountingResult=Accounting result
Balance=Balance
Debit=Debit
Credit=Credit
|