| '.$langs->trans("Profit").' | ';
if ($modecompta == 'CREANCES-DETTES') {
print ''.price(price2num($total_ht, 'MT')).' | ';
-} else {
+} elseif ($modecompta == 'RECETTES-DEPENSES') {
print ' | ';
}
print ''.price(price2num($total_ttc, 'MT')).' | ';
diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php
index bbe32d0cbc1..ac9ebb4e6b6 100644
--- a/htdocs/compta/resultat/result.php
+++ b/htdocs/compta/resultat/result.php
@@ -274,6 +274,7 @@ if ($modecompta == 'CREANCES-DETTES') {
} elseif ($modecompta == "BOOKKEEPING") {
// Get array of all report groups that are active
$cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include
+ $unactive_cats = $AccCat->getCats(-1, 0);
/*
$sql = 'SELECT DISTINCT t.numero_compte as nb FROM '.MAIN_DB_PREFIX.'accounting_bookkeeping as t, '.MAIN_DB_PREFIX.'accounting_account as aa';
@@ -325,6 +326,11 @@ if ($modecompta == 'CREANCES-DETTES') {
$vars = array();
+ // Unactive categories have a total of 0 to be used in the formula.
+ foreach ($unactive_cats as $un_cat) {
+ $vars[$un_cat['code']] = 0;
+ }
+
// Previous Fiscal year (N-1)
foreach ($sommes as $code => $det) {
$vars[$code] = $det['NP'];
@@ -405,6 +411,9 @@ if ($modecompta == 'CREANCES-DETTES') {
// Set $cpts with array of accounts in the category/group
$cpts = $AccCat->getCptsCat($cat['rowid']);
+ // We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number.
+ if (empty($cpts)) $cpts[] = array();
+
$arrayofaccountforfilter = array();
foreach ($cpts as $i => $cpt) { // Loop on each account.
@@ -477,7 +486,7 @@ if ($modecompta == 'CREANCES-DETTES') {
// Label of group
print '';
print dol_escape_htmltag($cat['label']);
- if (count($cpts) > 0) { // Show example of 5 first accounting accounts
+ if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts
$i = 0;
foreach ($cpts as $cpt) {
if ($i > 5) {
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 26d2d6b6bcb..78f97b3124a 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -237,8 +237,8 @@ class Contrat extends CommonObject
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
- 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
- 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
+ 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
+ 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index e2699970a7b..ca81d9a3da0 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -554,6 +554,7 @@ if (empty($reshook)) {
$object->fetch($id);
$lines = $object->lines;
$line = new ExpeditionLigne($db);
+ $line->fk_expedition = $object->id;
$num_prod = count($lines);
for ($i = 0; $i < $num_prod; $i++) {
@@ -595,6 +596,7 @@ if (empty($reshook)) {
for ($i = 0; $i < $num_prod; $i++) {
if ($lines[$i]->id == $line_id) { // we have found line to update
$line = new ExpeditionLigne($db);
+ $line->fk_expedition = $object->id;
// Extrafields Lines
$line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index b19609dc7bb..c33c404664e 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -236,8 +236,8 @@ class CommandeFournisseur extends CommonOrder
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>3, 'position'=>140, 'isameasure'=>1),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>1, 'position'=>145, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1),
- 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
- 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1),
+ 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155, 'searchall'=>1),
+ 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165),
'fk_input_method' =>array('type'=>'integer', 'label'=>'OrderMode', 'enabled'=>1, 'visible'=>3, 'position'=>170),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175),
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index c4e034dd7a1..5efbddca849 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -302,8 +302,8 @@ class FactureFournisseur extends CommonInvoice
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
- 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
- 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
+ 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
+ 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|