From d99535d9da8af239e41ecdcb1299295fe52fd40a Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 10 Jan 2018 16:40:43 +0100 Subject: [PATCH 1/2] Fix: Still using property ->client instead of ->thirdparty. --- .../contract/doc/doc_generic_contract_odt.modules.php | 5 +++-- .../modules/product/doc/doc_generic_product_odt.modules.php | 4 ++-- .../core/modules/user/doc/doc_generic_user_odt.modules.php | 4 ++-- .../usergroup/doc/doc_generic_usergroup_odt.modules.php | 4 ++-- htdocs/fichinter/card.php | 6 +++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index f9dac51389f..72ea8925177 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet * * 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 @@ -280,14 +281,14 @@ class doc_generic_contract_odt extends ModelePDFContract // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->client; + $socobject = $object->thirdparty; // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use $contactobject = $object->contact; } } else { - $socobject=$object->client; + $socobject=$object->thirdparty; } // Make substitution $substitutionarray=array( diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 811a99d5b2a..a05e1d6327f 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -307,14 +307,14 @@ class doc_generic_product_odt extends ModelePDFProduct // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->client; + $socobject = $object->thirdparty; // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use $contactobject = $object->contact; } } else { - $socobject=$object->client; + $socobject=$object->thirdparty; } // Make substitution $substitutionarray=array( diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 11ae5729b3b..ee329b0bd7a 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -304,14 +304,14 @@ class doc_generic_user_odt extends ModelePDFUser // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->client; + $socobject = $object->thirdparty; // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use $contactobject = $object->contact; } } else { - $socobject=$object->client; + $socobject=$object->thirdparty; } // Open and load template diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 35367052796..fe54e587e46 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -306,14 +306,14 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->client; + $socobject = $object->thirdparty; // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use $contactobject = $object->contact; } } else { - $socobject=$object->client; + $socobject=$object->thirdparty; } // Make substitution $substitutionarray=array( diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 2cce9534873..c8951a3f035 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014-2015 Ferran Marcet + * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2014-2015 Charlie Benke * Copyright (C) 2015-2016 Abbes Bahfir * @@ -297,7 +297,7 @@ if (empty($reshook)) $outputlangs = $langs; $newlang=''; if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); - if (empty($newlang)) $newlang=$srcobject->client->default_lang; + if (empty($newlang)) $newlang=$srcobject->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); @@ -878,7 +878,7 @@ if ($action == 'create') $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); - $soc = $objectsrc->client; + $soc = $objectsrc->thirdparty; $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private'))); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public')); From 0bd45dc64bf93312a4ca19e468442393fd0d07ae Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 10 Jan 2018 20:34:32 +0100 Subject: [PATCH 2/2] fix: search translation into external module files also --- htdocs/admin/translation.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 651335d0a6d..0c4df916943 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -367,6 +367,14 @@ if ($mode == 'searchkey') foreach($filearray as $file) { $tmpfile=preg_replace('/.lang/i', '', basename($file['name'])); + //Detect if trans coming from extranl module + foreach ($conf->file->dol_document_root as $keyconf=>$dirconfalt) { + if (($keyconf!='main') && (preg_match('$'.preg_quote($dirconfalt).'$i', $file['fullname']))) { + //In this case load modulename@nmodulename + $tmpfile=$tmpfile.'@'.$tmpfile; + break; + } + } $newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite $newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only //print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records
'."\n";