From 5c1a84746cbb5c8045ef62bbec132b3c5ea11db2 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Mon, 12 Aug 2019 15:21:41 -0500 Subject: [PATCH 1/4] Add Linked objects Fichinter Ref. in PDF formats --- htdocs/core/lib/pdf.lib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 56ca215e118..22bccb4462e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -10,6 +10,7 @@ * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015-2016 Marcos GarcĂ­a + * Copyright (C) 2019 Lenin Rivas * * 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 @@ -2129,6 +2130,17 @@ function pdf_getLinkedObjects($object, $outputlangs) $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs); } } + else if ($objecttype == 'fichinter') + { + $outputlangs->load('interventions'); + foreach($objects as $elementobject) + { + $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("InterRef"); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("InterDate"); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->datec,'day','',$outputlangs); + } + } elseif ($objecttype == 'shipping') { $outputlangs->loadLangs(array("orders", "sendings")); From 28d0b85b84e15299a576fa0ac4674f33efaf2a63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Jan 2020 14:56:19 +0100 Subject: [PATCH 2/4] Fix phpcs --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 56b7f54d609..c1489a1b751 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2143,7 +2143,7 @@ function pdf_getLinkedObjects($object, $outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("InterRef"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("InterDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->datec,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->datec, 'day', '', $outputlangs); } } elseif ($objecttype == 'shipping') From 7964699674f0e92cd859f873ac0dec512d4e94ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Jan 2020 16:22:53 +0100 Subject: [PATCH 3/4] FIX Check on unicity on prof id was not triggered sometimes --- htdocs/societe/class/societe.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f1d489751ac..793cbbbb97e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3284,6 +3284,12 @@ class Societe extends CommonObject // Define if third party is treated as company (or not) when nature is unknown $isacompany=empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES)?0:1; // 0 by default if (! empty($this->tva_intra)) $isacompany=1; + elseif (! empty($this->idprof1)) $isacompany=1; + elseif (! empty($this->idprof2)) $isacompany=1; + elseif (! empty($this->idprof3)) $isacompany=1; + elseif (! empty($this->idprof4)) $isacompany=1; + elseif (! empty($this->idprof5)) $isacompany=1; + elseif (! empty($this->idprof6)) $isacompany=1; elseif (! empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') { // TODO Add a field is_a_company into dictionary From 381f2d5eee3e41c896e608e9ea3ebb21c5cd334d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Jan 2020 16:24:16 +0100 Subject: [PATCH 4/4] Fix typo --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 793cbbbb97e..dd6765e34f5 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -769,7 +769,7 @@ class Societe extends CommonObject } } - // Check for mandatory prof id (but only if country is other than ours) + // Check for mandatory prof id (but only if country is same than ours) if ($mysoc->country_id > 0 && $this->country_id == $mysoc->country_id) { $idprof_mandatory ='SOCIETE_'.$key.'_MANDATORY';