Fix generation of user from member, contact, applications for job
This commit is contained in:
parent
1cc7b41de3
commit
7294a47ef5
@ -191,6 +191,9 @@ if (empty($reshook)) {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans($nuser->error), null, 'errors');
|
setEventMessages($langs->trans($nuser->error), null, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("NewUserCreated", $nuser->login), null, 'mesgs');
|
||||||
|
$action = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -1272,7 +1275,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
// Confirm create user
|
// Confirm create user
|
||||||
if ($action == 'create_user') {
|
if ($action == 'create_user') {
|
||||||
$login = $object->login;
|
$login = (GETPOSTISSET('login') ? GETPOST('login', 'alphanohtml') : $object->login);
|
||||||
if (empty($login)) {
|
if (empty($login)) {
|
||||||
// Full firstname and name separated with a dot : firstname.name
|
// Full firstname and name separated with a dot : firstname.name
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
@ -1701,13 +1704,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
|
||||||
if ($user->rights->adherent->supprimer) {
|
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
|
|
||||||
} else {
|
|
||||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Action SPIP
|
// Action SPIP
|
||||||
if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
|
if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
|
||||||
$isinspip = $mailmanspip->is_in_spip($object);
|
$isinspip = $mailmanspip->is_in_spip($object);
|
||||||
@ -1719,6 +1715,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n";
|
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete
|
||||||
|
if ($user->rights->adherent->supprimer) {
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
|
||||||
|
} else {
|
||||||
|
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -1833,7 +1833,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
//Form to close proposal (signed or not)
|
//Form to close proposal (signed or not)
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
array('type' => 'select', 'name' => 'statut', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array(2=>$object->LibStatut($object::STATUS_SIGNED), 3=>$object->LibStatut($object::STATUS_NOTSIGNED))),
|
array('type' => 'select', 'name' => 'statut', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))),
|
||||||
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
|
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1688,10 +1688,23 @@ function is_ip($ip)
|
|||||||
*/
|
*/
|
||||||
function dol_buildlogin($lastname, $firstname)
|
function dol_buildlogin($lastname, $firstname)
|
||||||
{
|
{
|
||||||
$login = strtolower(dol_string_unaccent($firstname));
|
global $conf;
|
||||||
$login .= ($login ? '.' : '');
|
|
||||||
$login .= strtolower(dol_string_unaccent($lastname));
|
//$conf->global->MAIN_BUILD_LOGIN_RULE = 'f.lastname';
|
||||||
$login = dol_string_nospecial($login, ''); // For special names
|
if (!empty($conf->global->MAIN_BUILD_LOGIN_RULE) && $conf->global->MAIN_BUILD_LOGIN_RULE == 'f.lastname') { // f.lastname
|
||||||
|
$login = strtolower(dol_string_unaccent(dol_trunc($firstname, 1, 'right', 'UTF-8', 1)));
|
||||||
|
$login .= ($login ? '.' : '');
|
||||||
|
$login .= strtolower(dol_string_unaccent($lastname));
|
||||||
|
$login = dol_string_nospecial($login, ''); // For special names
|
||||||
|
} else { // firstname.lastname
|
||||||
|
$login = strtolower(dol_string_unaccent($firstname));
|
||||||
|
$login .= ($login ? '.' : '');
|
||||||
|
$login .= strtolower(dol_string_unaccent($lastname));
|
||||||
|
$login = dol_string_nospecial($login, ''); // For special names
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add a hook to allow external modules to suggest new rules
|
||||||
|
|
||||||
return $login;
|
return $login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,7 @@ RequestedRemuneration=Requested remuneration
|
|||||||
ProposedRemuneration=Proposed remuneration
|
ProposedRemuneration=Proposed remuneration
|
||||||
ContractProposed=Contract proposed
|
ContractProposed=Contract proposed
|
||||||
ContractSigned=Contract signed
|
ContractSigned=Contract signed
|
||||||
|
ContractRefused=Contract refused
|
||||||
RecruitmentCandidature=Application
|
RecruitmentCandidature=Application
|
||||||
JobPositions=Job positions
|
JobPositions=Job positions
|
||||||
RecruitmentCandidatures=Applications
|
RecruitmentCandidatures=Applications
|
||||||
|
|||||||
@ -68,6 +68,7 @@ class RecruitmentCandidature extends CommonObject
|
|||||||
//const STATUS_INTERVIEW_SCHEDULED = 2;
|
//const STATUS_INTERVIEW_SCHEDULED = 2;
|
||||||
const STATUS_CONTRACT_PROPOSED = 3;
|
const STATUS_CONTRACT_PROPOSED = 3;
|
||||||
const STATUS_CONTRACT_SIGNED = 5;
|
const STATUS_CONTRACT_SIGNED = 5;
|
||||||
|
const STATUS_CONTRACT_REFUSED = 6;
|
||||||
const STATUS_REFUSED = 8;
|
const STATUS_REFUSED = 8;
|
||||||
const STATUS_CANCELED = 9;
|
const STATUS_CANCELED = 9;
|
||||||
|
|
||||||
@ -679,7 +680,7 @@ class RecruitmentCandidature extends CommonObject
|
|||||||
public function reopen($user, $notrigger = 0)
|
public function reopen($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
// Protection
|
// Protection
|
||||||
if ($this->status != self::STATUS_CANCELED)
|
if ($this->status != self::STATUS_REFUSED && $this->status != self::STATUS_CANCELED && $this->status != self::STATUS_CONTRACT_REFUSED)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -821,13 +822,15 @@ class RecruitmentCandidature extends CommonObject
|
|||||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Received').' ('.$langs->trans("InterviewToDo").')';
|
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Received').' ('.$langs->trans("InterviewToDo").')';
|
||||||
$this->labelStatus[self::STATUS_CONTRACT_PROPOSED] = $langs->trans('ContractProposed');
|
$this->labelStatus[self::STATUS_CONTRACT_PROPOSED] = $langs->trans('ContractProposed');
|
||||||
$this->labelStatus[self::STATUS_CONTRACT_SIGNED] = $langs->trans('ContractSigned');
|
$this->labelStatus[self::STATUS_CONTRACT_SIGNED] = $langs->trans('ContractSigned');
|
||||||
$this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused');
|
$this->labelStatus[self::STATUS_CONTRACT_REFUSED] = $langs->trans('ContractRefused');
|
||||||
$this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused');
|
$this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused');
|
||||||
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
||||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
|
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Received');
|
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Received');
|
||||||
$this->labelStatusShort[self::STATUS_CONTRACT_PROPOSED] = $langs->trans('ContractProposed');
|
$this->labelStatusShort[self::STATUS_CONTRACT_PROPOSED] = $langs->trans('ContractProposed');
|
||||||
$this->labelStatusShort[self::STATUS_CONTRACT_SIGNED] = $langs->trans('ContractSigned');
|
$this->labelStatusShort[self::STATUS_CONTRACT_SIGNED] = $langs->trans('ContractSigned');
|
||||||
|
$this->labelStatusShort[self::STATUS_CONTRACT_REFUSED] = $langs->trans('ContractRefused');
|
||||||
|
$this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('Refused');
|
||||||
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,11 +59,12 @@ if (!$res) die("Include of main fails");
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
dol_include_once('/recruitment/class/recruitmentcandidature.class.php');
|
dol_include_once('/recruitment/class/recruitmentcandidature.class.php');
|
||||||
dol_include_once('/recruitment/lib/recruitment_recruitmentcandidature.lib.php');
|
dol_include_once('/recruitment/lib/recruitment_recruitmentcandidature.lib.php');
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("recruitment", "other"));
|
$langs->loadLangs(array("recruitment", "other", "users"));
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
@ -165,6 +166,100 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'confirm_makeofferordecline' && $permissiontoadd && !GETPOST('cancel', 'alpha')) {
|
||||||
|
if (!(GETPOST('status', 'int') > 0)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||||
|
$action = 'makeofferordecline';
|
||||||
|
} else {
|
||||||
|
// prevent browser refresh from closing proposal several times
|
||||||
|
if ($object->status == $object::STATUS_VALIDATED)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
if (GETPOST('status', 'int') == $object::STATUS_REFUSED) {
|
||||||
|
$result = $object->setStatut($object::STATUS_REFUSED, null, '', $triggermodname);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = $object->setStatut($object::STATUS_CONTRACT_PROPOSED, null, '', $triggermodname);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'confirm_closeas' && $permissiontoadd && !GETPOST('cancel', 'alpha')) {
|
||||||
|
if (!(GETPOST('status', 'int') > 0)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||||
|
$action = 'makeofferordecline';
|
||||||
|
} else {
|
||||||
|
// prevent browser refresh from closing proposal several times
|
||||||
|
if ($object->status == $object::STATUS_CONTRACT_PROPOSED)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
if (GETPOST('status', 'int') == $object::STATUS_CONTRACT_REFUSED) {
|
||||||
|
$result = $object->setStatut($object::STATUS_CONTRACT_REFUSED, null, '', $triggermodname);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = $object->setStatut($object::STATUS_CONTRACT_SIGNED, null, '', $triggermodname);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create user from a member
|
||||||
|
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) {
|
||||||
|
if ($result > 0) {
|
||||||
|
// Creation user
|
||||||
|
$nuser = new User($db);
|
||||||
|
$nuser->login = GETPOST('login', 'alphanohtml');
|
||||||
|
$nuser->fk_soc = 0;
|
||||||
|
$nuser->employee = 1;
|
||||||
|
$nuser->firstname = $object->firstname;
|
||||||
|
$nuser->lastname = $object->lastname;
|
||||||
|
$nuser->personal_mobile = $object->phone;
|
||||||
|
$nuser->birth = $object->date_birth;
|
||||||
|
$nuser->salary = $object->remuneration_proposed;
|
||||||
|
|
||||||
|
$result = $nuser->create($user);
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans($nuser->error), null, 'errors');
|
||||||
|
$action = 'create_user';
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("NewUserCreated", $nuser->login), null, 'mesgs');
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$action = 'create_user';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$triggersendname = 'RECRUITMENTCANDIDATURE_SENTBYMAIL';
|
$triggersendname = 'RECRUITMENTCANDIDATURE_SENTBYMAIL';
|
||||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_RECRUITMENTCANDIDATURE_TO';
|
$autocopy = 'MAIN_MAIL_AUTOCOPY_RECRUITMENTCANDIDATURE_TO';
|
||||||
@ -302,21 +397,61 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation of action xxxx
|
if ($action == 'makeofferordecline')
|
||||||
if ($action == 'xxx')
|
|
||||||
{
|
{
|
||||||
$formquestion = array();
|
$langs->load("propal");
|
||||||
/*
|
|
||||||
$forcecombo=0;
|
//Form to close proposal (signed or not)
|
||||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
array('type' => 'select', 'name' => 'status', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array($object::STATUS_CONTRACT_PROPOSED => $object->LibStatut($object::STATUS_CONTRACT_PROPOSED), $object::STATUS_REFUSED => $object->LibStatut($object::STATUS_REFUSED))),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
|
||||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
|
||||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
$text = '';
|
||||||
|
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_makeofferordecline', $formquestion, '', 1, 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'closeas')
|
||||||
|
{
|
||||||
|
$langs->load("propal");
|
||||||
|
|
||||||
|
//Form to close proposal (signed or not)
|
||||||
|
$formquestion = array(
|
||||||
|
array('type' => 'select', 'name' => 'status', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array($object::STATUS_CONTRACT_SIGNED => $object->LibStatut($object::STATUS_CONTRACT_PROPOSED), $object::STATUS_CONTRACT_REFUSED => $object->LibStatut($object::STATUS_CONTRACT_REFUSED))),
|
||||||
|
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
|
||||||
|
);
|
||||||
|
|
||||||
|
$text = '';
|
||||||
|
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm create user
|
||||||
|
if ($action == 'create_user') {
|
||||||
|
$login = (GETPOSTISSET('login') ? GETPOST('login', 'alphanohtml') : $object->login);
|
||||||
|
if (empty($login)) {
|
||||||
|
// Full firstname and name separated with a dot : firstname.name
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$login = dol_buildlogin($object->lastname, $object->firstname);
|
||||||
|
}
|
||||||
|
if (empty($login)) $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
|
||||||
|
|
||||||
|
// Create a form array
|
||||||
|
$formquestion = array(
|
||||||
|
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
if (!empty($conf->societe->enabled) && $object->socid > 0) {
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
$formquestion[] = array('label' => $langs->trans("UserWillBe"), 'type' => 'radio', 'name' => 'internalorexternal', 'default'=>'external', 'values' => array('external'=>$langs->trans("External").' - '.$langs->trans("LinkedToDolibarrThirdParty").' '.$object->thirdparty->getNomUrl(1, '', 0, 1), 'internal'=>$langs->trans("Internal")));
|
||||||
|
}
|
||||||
|
$text = '';
|
||||||
|
if (!empty($conf->societe->enabled) && $object->socid <= 0) {
|
||||||
|
$text .= $langs->trans("UserWillBeInternalUser").'<br>';
|
||||||
|
} */
|
||||||
|
$text .= $langs->trans("ConfirmCreateLogin");
|
||||||
|
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Hook formConfirm
|
// Call Hook formConfirm
|
||||||
@ -500,12 +635,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refuse - Decline
|
// Make offer - Refuse - Decline
|
||||||
if ($object->status >= $object::STATUS_VALIDATED && $object->status < $object::STATUS_REFUSED)
|
if ($object->status >= $object::STATUS_VALIDATED && $object->status < $object::STATUS_CONTRACT_PROPOSED)
|
||||||
{
|
{
|
||||||
if ($permissiontoadd)
|
if ($permissiontoadd)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_decline&confirm=yes">'.$langs->trans("Decline").'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=makeofferordecline">'.$langs->trans("MakeOffer").' / '.$langs->trans("Decline").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Contract refused / accepted
|
||||||
|
if ($object->status == $object::STATUS_CONTRACT_PROPOSED)
|
||||||
|
{
|
||||||
|
if ($permissiontoadd)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=closeas">'.$langs->trans("Accept").' / '.$langs->trans("Decline").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,30 +659,34 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentcandidature">'.$langs->trans("ToClone").'</a>'."\n";
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentcandidature">'.$langs->trans("ToClone").'</a>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Button to convert into a user
|
||||||
if ($permissiontoadd)
|
if ($object->status == $object::STATUS_CONTRACT_SIGNED)
|
||||||
{
|
{
|
||||||
if ($object->status == $object::STATUS_ENABLED)
|
if ($user->rights->user->user->creer) {
|
||||||
{
|
// TODO Check if a user already exists
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a>'."\n";
|
$useralreadyexists = 0;
|
||||||
}
|
if (empty($useralreadyexists)) {
|
||||||
else
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
|
||||||
{
|
} else {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a>'."\n";
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin")."</font></div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cancel
|
||||||
if ($permissiontoadd)
|
if ($permissiontoadd)
|
||||||
{
|
{
|
||||||
if ($object->status == $object::STATUS_VALIDATED)
|
if ($object->status == $object::STATUS_VALIDATED)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("Cancel").'</a>'."\n";
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("Cancel").'</a>'."\n";
|
||||||
}
|
}
|
||||||
else
|
elseif ($object->status == $object::STATUS_REFUSED || $object->status == $object::STATUS_CANCELED || $object->status == $object::STATUS_CONTRACT_REFUSED)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Re-Open").'</a>'."\n";
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("Re-Open").'</a>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Delete (need delete permission, or if draft, just need create/modify permission)
|
// Delete (need delete permission, or if draft, just need create/modify permission)
|
||||||
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd))
|
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd))
|
||||||
|
|||||||
@ -1268,7 +1268,10 @@ class User extends CommonObject
|
|||||||
$this->country_id = $contact->country_id;
|
$this->country_id = $contact->country_id;
|
||||||
$this->employee = 0;
|
$this->employee = 0;
|
||||||
|
|
||||||
if (empty($login)) $login = strtolower(substr($contact->firstname, 0, 4)).strtolower(substr($contact->lastname, 0, 4));
|
if (empty($login)) {
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$login = dol_buildlogin($contact->lastname, $contact->firstname);
|
||||||
|
}
|
||||||
$this->login = $login;
|
$this->login = $login;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -1315,9 +1318,9 @@ class User extends CommonObject
|
|||||||
* Create a user into database from a member object.
|
* Create a user into database from a member object.
|
||||||
* If $member->fk_soc is set, it will be an external user.
|
* If $member->fk_soc is set, it will be an external user.
|
||||||
*
|
*
|
||||||
* @param Adherent $member Object member source
|
* @param Adherent $member Object member source
|
||||||
* @param string $login Login to force
|
* @param string $login Login to force
|
||||||
* @return int <0 if KO, if OK, return id of created account
|
* @return int <0 if KO, if OK, return id of created account
|
||||||
*/
|
*/
|
||||||
public function create_from_member($member, $login = '')
|
public function create_from_member($member, $login = '')
|
||||||
{
|
{
|
||||||
@ -1341,7 +1344,10 @@ class User extends CommonObject
|
|||||||
$this->pass = $member->pass;
|
$this->pass = $member->pass;
|
||||||
$this->pass_crypted = $member->pass_indatabase_crypted;
|
$this->pass_crypted = $member->pass_indatabase_crypted;
|
||||||
|
|
||||||
if (empty($login)) $login = strtolower(substr($member->firstname, 0, 4)).strtolower(substr($member->lastname, 0, 4));
|
if (empty($login)) {
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$login = dol_buildlogin($member->lastname, $member->firstname);
|
||||||
|
}
|
||||||
$this->login = $login;
|
$this->login = $login;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user