Works on contact canvas in relation to the thirdparty canvas module

This commit is contained in:
Regis Houssin 2010-11-04 18:15:36 +00:00
parent 05ed583cf1
commit 017422dfee
3 changed files with 14 additions and 18 deletions

View File

@ -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)

View File

@ -21,6 +21,7 @@
<!-- BEGIN PHP TEMPLATE -->
<?php if ($this->control->tpl['action_create_user']) echo $this->control->tpl['action_create_user']; ?>
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
<table class="border" width="100%">

View File

@ -311,26 +311,8 @@ if (! empty($canvas))
// Set action type
$objcanvas->setAction('view');
if ($msg)
{
$langs->load("errors");
print '<div class="error">'.$langs->trans($msg).'</div>';
}
// 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 '<br>';
}
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();