From 67ce71bc487feba279c83c57cfb287a6bea08f52 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 9 Feb 2018 18:23:11 +0100 Subject: [PATCH 1/4] Fix: Contracts not show price --- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index eae46dad772..68d7a8462f2 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2018 Juanjo Menent * * 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 @@ -50,7 +51,15 @@ foreach($linkedObjectBlock as $key => $objectlink) getNomUrl(1); ?> date_contrat,'day'); ?> -   + rights->contrat->lire) { + $totalcontrat = 0; + foreach ($objectlink->lines as $linecontrat) { + $totalcontrat = $totalcontrat + $linecontrat->total_ht; + $total = $total + $linecontrat->total_ht; + } + echo price($totalcontrat); + } ?> getLibStatut(7); ?> ">transnoentitiesnoconv("RemoveLink")); ?> From d731857fd0dfaa0ac22ee8db3d8aa1ce29f5d4f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Feb 2018 03:13:12 +0100 Subject: [PATCH 2/4] Update linkedobjectblock.tpl.php --- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 68d7a8462f2..a44f20679b8 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -52,7 +52,11 @@ foreach($linkedObjectBlock as $key => $objectlink) date_contrat,'day'); ?> rights->contrat->lire) { + // Price of contract is not shown by default because a contract is a list of service with + // start and end date that change with time andd that may be different that the period of reference for price. + // So price of a contract does often means nothing. Prices is on the different invoices done on same contract. + if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE)) + { $totalcontrat = 0; foreach ($objectlink->lines as $linecontrat) { $totalcontrat = $totalcontrat + $linecontrat->total_ht; @@ -65,4 +69,4 @@ foreach($linkedObjectBlock as $key => $objectlink) - \ No newline at end of file + From d762226a70ed31da529fa45900327a78710b1566 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 12 Feb 2018 14:39:18 +0100 Subject: [PATCH 3/4] FIX : Call to trigger on chargesociale create --- .../compta/sociales/class/chargesociales.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index cf359d691ec..b6386ae3b98 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -155,6 +155,7 @@ class ChargeSociales extends CommonObject function create($user) { global $conf; + $error=0; $now=dol_now(); @@ -190,8 +191,17 @@ class ChargeSociales extends CommonObject $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); //dol_syslog("ChargesSociales::create this->id=".$this->id); - $this->db->commit(); - return $this->id; + $result=$this->call_trigger('PAYMENTSOCIALECONTRIBUTION_CREATE',$user); + if ($result < 0) $error++; + + if(empty($error)) { + $this->db->commit(); + return $this->id; + } + else { + $this->db->rollback(); + return -1*$error; + } } else { From ea2e46cccd091eb3ae07a40389eed178a6a5690c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Feb 2018 20:46:40 +0100 Subject: [PATCH 4/4] Update chargesociales.class.php --- htdocs/compta/sociales/class/chargesociales.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index b6386ae3b98..07b7d1a5ae7 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -191,7 +191,7 @@ class ChargeSociales extends CommonObject $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); //dol_syslog("ChargesSociales::create this->id=".$this->id); - $result=$this->call_trigger('PAYMENTSOCIALECONTRIBUTION_CREATE',$user); + $result=$this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE',$user); if ($result < 0) $error++; if(empty($error)) {