From e469ef2a7d4a490fc4ac8ba69fda36492955132b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 5 Nov 2010 08:28:49 +0000 Subject: [PATCH] Works on contact canvas in relation to the thirdparty canvas module --- .../actions_contactcard_default.class.php | 11 ++++++++ htdocs/contact/fiche.php | 10 +++----- htdocs/core/class/canvas.class.php | 25 +++++++++++++------ htdocs/lib/company.lib.php | 2 +- htdocs/lib/contact.lib.php | 2 +- .../default/actions_card_default.class.php | 11 ++++++++ .../actions_card_individual.class.php | 11 ++++++++ htdocs/societe/soc.php | 6 ++--- 8 files changed, 57 insertions(+), 21 deletions(-) diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 132c71b7139..8959113c32f 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -58,6 +58,17 @@ class ActionsContactCardDefault extends ActionsContactCardCommon return $out; } + + /** + * Return the head of card (tabs) + */ + function showHead($action) + { + $head = contact_prepare_head($this->object); + $title = $this->getTitle($action); + + return dol_fiche_head($head, 'card', $title, 0, 'contact'); + } /** * Assigne les valeurs POST dans l'objet diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index d73d2303b2f..8090c4ba7a9 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -284,9 +284,7 @@ if (! empty($canvas)) if ($result > 0) { // Card header - $head = contact_prepare_head($objcanvas->control->object); - $title = $objcanvas->getTitle(); - dol_fiche_head($head, 'general', $title, 0, 'contact'); + $objcanvas->showHead(); if ($_POST["name"]) { @@ -316,9 +314,7 @@ if (! empty($canvas)) if ($result > 0) { // Card header - $head = contact_prepare_head($objcanvas->control->object); - $title = $objcanvas->getTitle(); - dol_fiche_head($head, 'general', $title, 0, 'contact'); + $objcanvas->showHead(); // Assign values $objcanvas->assign_values(); @@ -377,7 +373,7 @@ else */ $head = contact_prepare_head($contact); - dol_fiche_head($head, 'general', $langs->trans("Contact"), 0, 'contact'); + dol_fiche_head($head, 'card', $langs->trans("Contact"), 0, 'contact'); } if ($user->rights->societe->contact->creer) diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 67634805418..a1333e300eb 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -56,6 +56,15 @@ class Canvas { $this->db = $DB; } + + /** + * Set action type + */ + function setAction($action='view') + { + return $this->action = $action; + } + /** * Return the title of card @@ -64,6 +73,14 @@ class Canvas { return $this->control->getTitle($this->action); } + + /** + * Return the head of card (tabs) + */ + function showHead() + { + return $this->control->showHead($this->action); + } /** * Assigne les valeurs POST dans l'objet @@ -73,14 +90,6 @@ class Canvas return $this->control->assign_post(); } - /** - * Set action type - */ - function setAction($action='view') - { - return $this->action = $action; - } - /** * Execute actions * @param Id of object (may be empty for creation) diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index 0aed8ffbe57..a5850f9d691 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -41,7 +41,7 @@ function societe_prepare_head($objsoc) $head[$h][0] = DOL_URL_ROOT.'/societe/soc.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'company'; + $head[$h][2] = 'card'; $h++; if ($objsoc->client==1 || $objsoc->client==3 || $objsoc->object->client==1 || $objsoc->object->client==3) diff --git a/htdocs/lib/contact.lib.php b/htdocs/lib/contact.lib.php index 0d7c342e7a3..b6aa624c1e9 100644 --- a/htdocs/lib/contact.lib.php +++ b/htdocs/lib/contact.lib.php @@ -41,7 +41,7 @@ function contact_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'general'; + $head[$h][2] = 'card'; $h++; if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) diff --git a/htdocs/societe/canvas/default/actions_card_default.class.php b/htdocs/societe/canvas/default/actions_card_default.class.php index 8f2675df6d2..716d8d2f448 100644 --- a/htdocs/societe/canvas/default/actions_card_default.class.php +++ b/htdocs/societe/canvas/default/actions_card_default.class.php @@ -59,6 +59,17 @@ class ActionsCardDefault extends ActionsCardCommon return $out; } + + /** + * Return the head of card (tabs) + */ + function showHead($action) + { + $head = societe_prepare_head($this->object); + $title = $this->getTitle($action); + + return dol_fiche_head($head, 'card', $title, 0, 'company'); + } /** * Assigne les valeurs POST dans l'objet diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index 9f360a4a7e8..7678cfe3f41 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -59,6 +59,17 @@ class ActionsCardIndividual extends ActionsCardCommon return $out; } + + /** + * Return the head of card (tabs) + */ + function showHead($action) + { + $head = societe_prepare_head($this->object); + $title = $this->getTitle($action); + + return dol_fiche_head($head, 'card', $title, 0, 'company'); + } /** * Assigne les valeurs POST dans l'objet diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 7aff7f0a76d..57806c67209 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -461,9 +461,7 @@ if (! empty($canvas)) if ($result > 0) { // Card header - $head = societe_prepare_head($soccanvas->control->object); - $title = $soccanvas->getTitle(); - dol_fiche_head($head, 'company', $title, 0, 'company'); + $soccanvas->showHead(); // Assign values $soccanvas->assign_values(); @@ -1330,7 +1328,7 @@ else $head = societe_prepare_head($soc); - dol_fiche_head($head, 'company', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); $html = new Form($db);