From cdb63bada39a44c7e555c77bd617fb1a1e7e22f6 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 26 Jan 2018 18:13:55 +0100 Subject: [PATCH 1/3] FIX: #7974 Contract - Invalid reference on the document --- htdocs/contrat/card.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index a1a38d04626..ae1178adf9a 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2017 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014-2016 Ferran Marcet @@ -753,6 +753,30 @@ if (empty($reshook)) else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->validate($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } } else if ($action == 'reopen' && $user->rights->contrat->creer) From 3c281ccefab54ddb9d2caad5bcaf7d8178fa7349 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 29 Jan 2018 17:50:00 +0100 Subject: [PATCH 2/3] FIX: Bad localtaxes assignment in cashdesk --- htdocs/cashdesk/class/Facturation.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index b55524a874a..6397e3d30da 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -1,7 +1,7 @@ +/* Copyright (C) 2007-2008 Jeremie Ollivier * Copyright (C) 2008-2010 Laurent Destailleur - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-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 @@ -117,7 +117,12 @@ class Facturation } // Define part of HT, VAT, TTC - $resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray); + + // Local Taxes + $localtax1_tx = get_localtax($txtva, 1, $societe); + $localtax2_tx = get_localtax($txtva, 2, $societe); + + $resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, $localtax1_tx, $localtax2_tx, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray); // Calcul du total ht sans remise $total_ht = $resultarray[0]; From 464ee6f9d6e9b5d9357d808a911010a1207eb21c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 2 Feb 2018 17:46:25 +0100 Subject: [PATCH 3/3] Revert --- htdocs/cashdesk/class/Facturation.class.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 6397e3d30da..b55524a874a 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -1,7 +1,7 @@ +/* Copyright (C) 2007-2008 Jeremie Ollivier * Copyright (C) 2008-2010 Laurent Destailleur - * Copyright (C) 2010-2018 Juanjo Menent + * Copyright (C) 2010 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 @@ -117,12 +117,7 @@ class Facturation } // Define part of HT, VAT, TTC - - // Local Taxes - $localtax1_tx = get_localtax($txtva, 1, $societe); - $localtax2_tx = get_localtax($txtva, 2, $societe); - - $resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, $localtax1_tx, $localtax2_tx, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray); + $resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray); // Calcul du total ht sans remise $total_ht = $resultarray[0];