Works on contact canvas in relation to the thirdparty canvas module
This commit is contained in:
parent
9d82ea9a69
commit
06f2288904
@ -265,6 +265,8 @@ class ActionsContactCardCommon
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$errors='';
|
||||
|
||||
// Creation utilisateur depuis contact
|
||||
if (GETPOST("action") == 'confirm_create_user' && GETPOST("confirm") == 'yes' && $user->rights->user->user->creer)
|
||||
{
|
||||
@ -279,13 +281,15 @@ class ActionsContactCardCommon
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
$msg=$nuser->error;
|
||||
$errors=$nuser->error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg=$object->error;
|
||||
$errors=$this->object->error;
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
// Creation contact
|
||||
@ -313,6 +317,8 @@ class ActionsContactCardCommon
|
||||
$_GET["action"] = $_POST["action"] = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes' && $user->rights->societe->contact->supprimer)
|
||||
@ -330,8 +336,10 @@ class ActionsContactCardCommon
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$this->object->error;
|
||||
$errors=$this->object->error;
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
|
||||
@ -360,9 +368,11 @@ class ActionsContactCardCommon
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$this->object->error;
|
||||
$errors=$this->object->error;
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ if (! empty($canvas))
|
||||
// -----------------------------------------
|
||||
|
||||
// Load data control
|
||||
$objcanvas->doActions($id);
|
||||
$msg = $objcanvas->doActions($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -249,6 +249,18 @@ if (! empty($canvas))
|
||||
// When used with CANVAS
|
||||
// -----------------------------------------
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression du contact
|
||||
*/
|
||||
if ($user->rights->societe->contact->supprimer)
|
||||
{
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
if (GETPOST("action") == 'create')
|
||||
@ -313,6 +325,23 @@ if (! empty($canvas))
|
||||
{
|
||||
// Set action type
|
||||
$objcanvas->setAction('view');
|
||||
|
||||
if ($msg)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<div class="error">'.$langs->trans($msg).'</div>';
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'create_user')
|
||||
{
|
||||
$login=strtolower(substr($object->prenom, 0, 4)) . strtolower(substr($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=".$object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Fetch object
|
||||
$result=$objcanvas->fetch($id);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user