Works on contact canvas in relation to the thirdparty canvas module
This commit is contained in:
parent
05ed583cf1
commit
017422dfee
@ -181,6 +181,16 @@ class ActionsContactCardCommon
|
|||||||
|
|
||||||
if ($action == 'view')
|
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');
|
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'id');
|
||||||
|
|
||||||
if ($this->object->socid > 0)
|
if ($this->object->socid > 0)
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- 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']; ?>
|
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
||||||
|
|
||||||
<table class="border" width="100%">
|
<table class="border" width="100%">
|
||||||
|
|||||||
@ -311,26 +311,8 @@ if (! empty($canvas))
|
|||||||
// Set action type
|
// Set action type
|
||||||
$objcanvas->setAction('view');
|
$objcanvas->setAction('view');
|
||||||
|
|
||||||
if ($msg)
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
print '<div class="error">'.$langs->trans($msg).'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch object
|
// Fetch object
|
||||||
$result=$objcanvas->fetch($id);
|
$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)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Card header
|
// Card header
|
||||||
@ -340,6 +322,9 @@ if (! empty($canvas))
|
|||||||
|
|
||||||
// Assign values
|
// Assign values
|
||||||
$objcanvas->assign_values();
|
$objcanvas->assign_values();
|
||||||
|
|
||||||
|
//Show errors
|
||||||
|
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
|
||||||
|
|
||||||
// Display canvas
|
// Display canvas
|
||||||
$objcanvas->display_canvas();
|
$objcanvas->display_canvas();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user