From 017422dfee1eb5c2c0f7641571db6eed10960860 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 4 Nov 2010 18:15:36 +0000 Subject: [PATCH] Works on contact canvas in relation to the thirdparty canvas module --- .../actions_contactcard_common.class.php | 10 +++++++++ .../default/tpl/contactcard_view.tpl.php | 1 + htdocs/contact/fiche.php | 21 +++---------------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 6e60c308144..65660b5fc02 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -181,6 +181,16 @@ class ActionsContactCardCommon if ($action == 'view') { + if ($_GET["action"] == 'create_user') + { + $login=strtolower(substr($this->object->prenom, 0, 4)) . strtolower(substr($this->object->nom, 0, 4)); + + // Create a form array + $formquestion=array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)); + + $this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); + } + $this->tpl['showrefnav'] = $form->showrefnav($this->object,'id'); if ($this->object->socid > 0) diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index 8c1c10a81fa..70ad78c5581 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -21,6 +21,7 @@ +control->tpl['action_create_user']) echo $this->control->tpl['action_create_user']; ?> control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?> diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 56898d93f15..d73d2303b2f 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -311,26 +311,8 @@ if (! empty($canvas)) // Set action type $objcanvas->setAction('view'); - if ($msg) - { - $langs->load("errors"); - print '
'.$langs->trans($msg).'
'; - } - // Fetch object $result=$objcanvas->fetch($id); - - if ($_GET["action"] == 'create_user') - { - $login=strtolower(substr($objcanvas->control->object->prenom, 0, 4)) . strtolower(substr($objcanvas->control->object->nom, 0, 4)); - - // Create a form array - $formquestion=array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)); - - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); - if ($ret == 'html') print '
'; - } - if ($result > 0) { // Card header @@ -340,6 +322,9 @@ if (! empty($canvas)) // Assign values $objcanvas->assign_values(); + + //Show errors + dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); // Display canvas $objcanvas->display_canvas();