From 6f5a30638cd3263e394e079512d1c84cf284c023 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 22 May 2015 12:21:36 +0200
Subject: [PATCH] NEW On page to see/edit contact of an ojbect, the status of
 contact is visible (for both external and internal users).

---
 htdocs/contact/card.php                  |  4 ++--
 htdocs/contact/class/contact.class.php   |  2 +-
 htdocs/core/class/commonobject.class.php | 12 ++++++------
 htdocs/core/tpl/contacts.tpl.php         | 12 +++++++-----
 htdocs/societe/soc.php                   |  4 ++--
 htdocs/theme/eldy/style.css.php          |  5 +++++
 6 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index d7841677536..3d75c4a2036 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -812,7 +812,7 @@ else
             // Statut
             print '<tr><td>'.$langs->trans("Status").'</td>';
             print '<td>';
-            print $object->getLibStatut(5);
+            print $object->getLibStatut(4);
             print '</td></tr>';
 
             // Other attributes
@@ -1036,7 +1036,7 @@ else
 	 	// Statut
 		print '<tr><td>'.$langs->trans("Status").'</td>';
 		print '<td>';
-		print $object->getLibStatut(5);
+		print $object->getLibStatut(4);
 		print '</td>';
 		print '</tr>'."\n";
         // Other attributes
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index a61b0ea37bf..72590c82e82 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -970,7 +970,7 @@ class Contact extends CommonObject
 		}
 		elseif ($mode == 4)
 		{
-			if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('StatusContactDraft');
+			if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
 			elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
 		}
 		elseif ($mode == 5)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 77877a37cb2..0bd0625ee5d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -418,7 +418,7 @@ abstract class CommonObject
     /**
      *    Get array of all contacts for an object
      *
-     *    @param	int			$statut		Status of lines to get (-1=all)
+     *    @param	int			$statut		Status of links to get (-1=all)
      *    @param	string		$source		Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
      *    @param	int         $list       0:Return array contains all properties, 1:Return array contains just id
      *    @return	array		            Array of contacts
@@ -429,9 +429,9 @@ abstract class CommonObject
 
         $tab=array();
 
-        $sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id, ec.fk_c_type_contact";    // This field contains id of llx_socpeople or id of llx_user
-        if ($source == 'internal') $sql.=", '-1' as socid";
-        if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid";
+        $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact";    // This field contains id of llx_socpeople or id of llx_user
+        if ($source == 'internal') $sql.=", '-1' as socid, t.statut as statuscontact";
+        if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid, t.statut as statuscontact";
         $sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email";
         $sql.= ", tc.source, tc.element, tc.code, tc.libelle";
         $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
@@ -463,8 +463,8 @@ abstract class CommonObject
                     $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
                     $tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,
 					               'nom'=>$obj->lastname,      // For backward compatibility
-					               'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email,
-					               'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut, 'fk_c_type_contact' => $obj->fk_c_type_contact);
+					               'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'statuscontact'=>$obj->statuscontact,
+					               'rowid'=>$obj->rowid, 'code'=>$obj->code, 'libelle'=>$libelle_type, 'status'=>$obj->statuslink, 'fk_c_type_contact'=>$obj->fk_c_type_contact);
                 }
                 else
                 {
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index 867b7cb9ffb..382abbe81c0 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2012      Regis Houssin       <regis.houssin@capnetworks.com>
- * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
+ * Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  *
  * 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
@@ -164,6 +164,8 @@ $userstatic=new User($db);
 		</div>
 		<div class="tagtd">
 			<?php
+			$statusofcontact = $tab[$i]['status'];
+
 			if ($tab[$i]['source']=='internal')
 			{
 				$userstatic->id=$tab[$i]['id'];
@@ -182,24 +184,24 @@ $userstatic=new User($db);
 		</div>
 		<div class="tagtd"><?php echo $tab[$i]['libelle']; ?></div>
 		<div class="tagtd" align="center">
-			<?php if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; ?>
+			<?php //if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; ?>
 			<?php
 			if ($tab[$i]['source']=='internal')
 			{
 				$userstatic->id=$tab[$i]['id'];
 				$userstatic->lastname=$tab[$i]['lastname'];
 				$userstatic->firstname=$tab[$i]['firstname'];
-				//echo $userstatic->LibStatut($tab[$i]['status'],3);
+				echo $userstatic->LibStatut($tab[$i]['statuscontact'],3);
 			}
 			if ($tab[$i]['source']=='external')
 			{
 				$contactstatic->id=$tab[$i]['id'];
 				$contactstatic->lastname=$tab[$i]['lastname'];
 				$contactstatic->firstname=$tab[$i]['firstname'];
-				echo $contactstatic->LibStatut($tab[$i]['status'],3);
+				echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3);
 			}
 			?>
-			<?php if ($object->statut >= 0) echo '</a>'; ?>
+			<?php //if ($object->statut >= 0) echo '</a>'; ?>
 		</div>
 		<div class="tagtd nowrap" align="right">
 			<?php if ($permission) { ?>
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index fdc3a4cc4e8..b26e6766a4e 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -1012,7 +1012,7 @@ else
 
         // Address
         print '<tr><td valign="top"><label for="address">'.$langs->trans('Address').'</label></td>';
-	    print '<td colspan="3"><textarea name="address" id="address" cols="40" rows="3" wrap="soft">';
+	    print '<td colspan="3"><textarea name="address" id="address" cols="80" rows="'._ROWS_2.'" wrap="soft">';
         print $object->address;
         print '</textarea></td></tr>';
 
@@ -2259,7 +2259,7 @@ else
 	        {
 	        	print '<div class="inline-block divButAction"><a class="butActionDelete" href="soc.php?action=merge&socid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MergeThirdparties")).'">'.$langs->trans('Merge').'</a></div>';
 	        }
-	        
+
 	        if ($user->rights->societe->supprimer)
 	        {
 	            if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))	// We can't use preloaded confirm form with jmobile
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index da118d8d7cd..a07538b124b 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -261,6 +261,11 @@ input, textarea, select {
 	margin-bottom:1px;
 	margin-top:1px;
 	}
+input.removedassigned  {
+	padding: 2px !important;
+	vertical-align: text-bottom;
+	margin-bottom: -3px;
+}
 <?php } ?>
 
 select.flat, form.flat select {
-- 
GitLab