diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index ef061259f19..38b690e568d 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -332,19 +332,20 @@ if (! empty($canvas)) print '
'.$langs->trans($msg).'
'; } + // Fetch object + $result=$objcanvas->fetch($id); + if ($_GET["action"] == 'create_user') { - $login=strtolower(substr($object->prenom, 0, 4)) . strtolower(substr($object->nom, 0, 4)); + $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=".$object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); if ($ret == 'html') print '
'; } - // Fetch object - $result=$objcanvas->fetch($id); if ($result > 0) { // Card header @@ -365,25 +366,25 @@ if (! empty($canvas)) if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } - if (! $object->user_id && $user->rights->user->user->creer) + if (! $objcanvas->control->object->user_id && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; + print ''.$langs->trans("CreateDolibarrLogin").''; } if ($user->rights->societe->contact->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } print "
"; } - print show_actions_todo($conf,$langs,$db,$objsoc,$object); + print show_actions_todo($conf,$langs,$db,$objsoc,$objcanvas->control->object); - print show_actions_done($conf,$langs,$db,$objsoc,$object); + print show_actions_done($conf,$langs,$db,$objsoc,$objcanvas->control->object); } else {