From 22a0045a7404d2e989b67c2a385a32bb60b622b4 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Sat, 15 Jan 2011 13:00:36 +0000
Subject: [PATCH] Fix: uniformize code

---
 .../canvas/actions_contactcard_common.class.php      | 12 ++++++------
 htdocs/societe/canvas/default/tpl/card_view.tpl.php  |  4 ++--
 .../societe/canvas/individual/tpl/card_view.tpl.php  |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php
index 7e9c2c051c1..3e1f752b863 100644
--- a/htdocs/contact/canvas/actions_contactcard_common.class.php
+++ b/htdocs/contact/canvas/actions_contactcard_common.class.php
@@ -99,18 +99,18 @@ class ActionsContactCardCommon
         	if ($objsoc->typent_code == 'TE_PRIVATE')
         	{
         		if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
-        		if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->cp;
-        		if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->ville;
-        		if (dol_strlen(trim($this->object->phone_pro)) == 0) $this->object->phone_pro = $objsoc->tel;
+        		if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip;
+        		if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town;
+        		if (dol_strlen(trim($this->object->phone_pro)) == 0) $this->object->phone_pro = $objsoc->phone;
         		if (dol_strlen(trim($this->object->fax)) == 0) $this->object->fax = $objsoc->fax;
         		if (dol_strlen(trim($this->object->email)) == 0) $this->object->email = $objsoc->email;
         	}
         	
             // Zip
-            $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->cp,'zipcode',array('town','selectpays_id','departement_id'),6);
+            $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectpays_id','departement_id'),6);
 
             // Town
-            $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->ville,'town',array('zipcode','selectpays_id','departement_id'));
+            $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectpays_id','departement_id'));
             
             if (dol_strlen(trim($this->object->fk_pays)) == 0) $this->object->fk_pays = $objsoc->pays_id;
 
@@ -212,7 +212,7 @@ class ActionsContactCardCommon
 
             $this->tpl['address'] = dol_nl2br($this->object->address);
             
-            $this->tpl['zip'] = ($this->object->cp?$this->object->cp.'&nbsp;':'');
+            $this->tpl['zip'] = ($this->object->zip?$this->object->zip.'&nbsp;':'');
 
             $img=picto_from_langcode($this->object->pays_code);
             $this->tpl['country'] = ($img?$img.' ':'').$this->object->pays;
diff --git a/htdocs/societe/canvas/default/tpl/card_view.tpl.php b/htdocs/societe/canvas/default/tpl/card_view.tpl.php
index 5fa70007d81..06c419fcfac 100644
--- a/htdocs/societe/canvas/default/tpl/card_view.tpl.php
+++ b/htdocs/societe/canvas/default/tpl/card_view.tpl.php
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
+/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
  *
  * 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
@@ -243,7 +243,7 @@ function CheckVAT(a) {
 <?php } ?>
 
 <?php if ($user->rights->societe->contact->creer) { ?>
-<a class="butAction" href="<?php echo DOL_URL_ROOT.'/contact/fiche.php?socid='.$this->control->tpl['id'].'&amp;action=create&amp;canvas='.$canvas; ?>"><?php echo $langs->trans("AddContact"); ?></a>
+<a class="butAction" href="<?php echo DOL_URL_ROOT.'/contact/fiche.php?socid='.$this->control->tpl['id'].'&amp;action=create&amp;canvas=default'; ?>"><?php echo $langs->trans("AddContact"); ?></a>
 <?php } ?>
 
 <?php if ($user->rights->societe->supprimer) { ?>
diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php
index 5ace3d3158a..5c13670e3fe 100644
--- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php
+++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
+/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
  *
  * 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
@@ -176,7 +176,7 @@
 <?php } ?>
 
 <?php if ($user->rights->societe->contact->creer) { ?>
-<a class="butAction" href="<?php echo DOL_URL_ROOT.'/contact/fiche.php?socid='.$this->control->tpl['id'].'&amp;action=create&amp;canvas='.$canvas; ?>"><?php echo $langs->trans("AddContact"); ?></a>
+<a class="butAction" href="<?php echo DOL_URL_ROOT.'/contact/fiche.php?socid='.$this->control->tpl['id'].'&amp;action=create&amp;canvas=default'; ?>"><?php echo $langs->trans("AddContact"); ?></a>
 <?php } ?>
 
 <?php if ($user->rights->societe->supprimer) { ?>
-- 
GitLab