From 59cbde042c8f919614c61a9863b304519eac58ba Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Thu, 12 Mar 2015 17:29:52 +0100
Subject: [PATCH] Generalize option MAIN_HTML_TITLE for all tabs of thirdparty.

---
 htdocs/categories/categorie.php |  4 +++-
 htdocs/societe/agenda.php       |  5 ++++-
 htdocs/societe/consumption.php  |  6 ++++--
 htdocs/societe/document.php     |  4 +++-
 htdocs/societe/info.php         | 12 ++++++------
 htdocs/societe/notify/card.php  |  8 ++++++--
 6 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index 0746475ecec..e116ac668ab 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -235,7 +235,9 @@ if ($socid)
 	$soc = new Societe($db);
 	$result = $soc->fetch($socid);
 
-	llxHeader("","",$langs->trans("Category"));
+	$title=$langs->trans("Category");
+	if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$soc->name." - ".$title;
+	llxHeader("",$title);
 
 	// Show tabs
 	$head = societe_prepare_head($soc);
diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php
index 19d943798ce..e3b273796fa 100644
--- a/htdocs/societe/agenda.php
+++ b/htdocs/societe/agenda.php
@@ -69,7 +69,10 @@ if ($socid)
 
 	$object = new Societe($db);
 	$result = $object->fetch($socid);
-	llxHeader("",$langs->trans("Agenda"),'');
+
+	$title=$langs->trans("Agenda");
+	if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
+	llxHeader('',$title);
 
 	if (! empty($conf->notification->enabled)) $langs->load("mails");
 	$head = societe_prepare_head($object);
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index d8aad10d054..e581b6b8c29 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -98,8 +98,10 @@ $form = new Form($db);
 $formother = new FormOther($db);
 $productstatic=new Product($db);
 
-$titre = $langs->trans("Referer",$object->name);
-llxHeader('',$titre,'');
+$title = $langs->trans("Referer",$object->name);
+if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
+$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
+llxHeader('',$title,$help_url);
 
 if (empty($socid))
 {
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index c2ad751f196..f3c217d0a54 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -82,8 +82,10 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php
 
 $form = new Form($db);
 
+$title=$langs->trans("ThirdParty").' - '.$langs->trans("Files");
+if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files");
 $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
-llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Files"),$help_url);
+llxHeader('',$title,$help_url);
 
 if ($object->id)
 {
diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php
index 9d06d203d9c..b3586c4f327 100644
--- a/htdocs/societe/info.php
+++ b/htdocs/societe/info.php
@@ -56,16 +56,16 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
  *	View
  */
 
-$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
-llxHeader('',$langs->trans("ThirdParty"),$help_url);
-
 $object = new Societe($db);
 $object->fetch($socid);
 $object->info($socid);
 
-/*
- * Affichage onglets
- */
+$title=$langs->trans("ThirdParty");
+if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Info");
+$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
+llxHeader('',$title,$help_url);
+
+
 $head = societe_prepare_head($object);
 
 dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company');
diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index 1845669dcfc..e5de6a89d92 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -123,11 +123,15 @@ if ($action == 'delete')
 
 $form = new Form($db);
 
-llxHeader();
-
 $object = new Societe($db);
 $result=$object->fetch($socid);
 
+$title=$langs->trans("ThirdParty").' - '.$langs->trans("Notification");
+if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Notification");
+$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
+llxHeader('',$title,$help_url);
+
+
 if ($result > 0)
 {
     $langs->load("other");
-- 
GitLab