print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '</div>'; print "</form>"; } } if (!empty($id) && $action != 'edit' && $action != 'create') { $objsoc = new Societe($db); /* * Fiche en mode visualisation */ dol_htmloutput_errors($error, $errors); dol_fiche_head($head, 'card', $title, 0, 'contact'); if ($action == 'create_user') { // Full firstname and lastname separated with a dot : firstname.lastname include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; $login = dol_buildlogin($object->lastname, $object->firstname); $generated_password = ''; if (!$ldap_sid) { require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; $generated_password = getRandomPassword(false); } $password = $generated_password; // Create a form array $formquestion = array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password)); $text = $langs->trans("ConfirmCreateContact") . '<br>'; if (!empty($conf->societe->enabled)) { if ($object->socid > 0) { $text .= $langs->trans("UserWillBeExternalUser"); } else { $text .= $langs->trans("UserWillBeInternalUser"); }
/** * Set content of ->tpl array, to use into template * * @param string $action Type of action * @param int $id Id * @return string HTML output */ function assign_values(&$action, $id) { global $conf, $langs, $user, $canvas; global $form, $formcompany, $objsoc; if ($action == 'add' || $action == 'update') { $this->assign_post(); } foreach ($this->object as $key => $value) { $this->tpl[$key] = $value; } $this->tpl['error'] = $this->error; $this->tpl['errors'] = $this->errors; if ($action == 'create' || $action == 'edit') { if ($conf->use_javascript_ajax) { $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript"> jQuery(document).ready(function () { jQuery("#selectcountry_id").change(function() { document.formsoc.action.value="' . $action . '"; document.formsoc.canvas.value="' . $canvas . '"; document.formsoc.submit(); }); }) </script>' . "\n"; } if (is_object($objsoc) && $objsoc->id > 0) { $this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company_id'] = $objsoc->id; } else { $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1); } // Civility $this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id); // Predefined with third party if (isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) { if (dol_strlen(trim($this->object->address)) == 0) { $this->tpl['address'] = $objsoc->address; } if (dol_strlen(trim($this->object->zip)) == 0) { $this->object->zip = $objsoc->zip; } if (dol_strlen(trim($this->object->town)) == 0) { $this->object->town = $objsoc->town; } if (dol_strlen(trim($this->object->phone_pro)) == 0) { $this->object->phone_pro = $objsoc->phone; } if (dol_strlen(trim($this->object->fax)) == 0) { $this->object->fax = $objsoc->fax; } if (dol_strlen(trim($this->object->email)) == 0) { $this->object->email = $objsoc->email; } } // Zip $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); // Town $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); if (dol_strlen(trim($this->object->country_id)) == 0) { $this->object->country_id = $objsoc->country_id; } // Country $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id'); $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')'; if ($user->admin) { $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } // State if ($this->object->country_id) { $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement, $this->object->country_code); } else { $this->tpl['select_state'] = $countrynotdefined; } // Public or private $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate")); $this->tpl['select_visibility'] = $form->selectarray('priv', $selectarray, $this->object->priv, 0); } if ($action == 'view' || $action == 'edit' || $action == 'delete') { // Emailing if (!empty($conf->mailing->enabled)) { $langs->load("mails"); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); } // Linked element $this->tpl['contact_element'] = array(); $i = 0; $this->object->load_ref_elements(); if (!empty($conf->commande->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForOrders"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_commande ? $this->object->ref_commande : $langs->trans("NoContactForAnyOrder"); $i++; } if (!empty($conf->propal->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForProposals"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_propal ? $this->object->ref_propal : $langs->trans("NoContactForAnyProposal"); $i++; } if (!empty($conf->contrat->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForContracts"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_contrat ? $this->object->ref_contrat : $langs->trans("NoContactForAnyContract"); $i++; } if (!empty($conf->facture->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForInvoices"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_facturation ? $this->object->ref_facturation : $langs->trans("NoContactForAnyInvoice"); $i++; } // Dolibarr user if ($this->object->user_id) { $dolibarr_user = new User($this->db); $result = $dolibarr_user->fetch($this->object->user_id); $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); } else { $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); } } if ($action == 'view' || $action == 'delete') { $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id'); if ($this->object->socid > 0) { $objsoc = new Societe($this->db); $objsoc->fetch($this->object->socid); $this->tpl['company'] = $objsoc->getNomUrl(1); } else { $this->tpl['company'] = $langs->trans("ContactNotLinkedToCompany"); } $this->tpl['civility'] = $this->object->getCivilityLabel(); $this->tpl['address'] = dol_nl2br($this->object->address); $this->tpl['zip'] = $this->object->zip ? $this->object->zip . ' ' : ''; $img = picto_from_langcode($this->object->country_code); $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country; $this->tpl['phone_pro'] = dol_print_phone($this->object->phone_pro, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX'); $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL'); $this->tpl['visibility'] = $this->object->LibPubPriv($this->object->priv); $this->tpl['note'] = nl2br($this->object->note); } if ($action == 'create_user') { // Full firstname and lastname separated with a dot : firstname.lastname include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; $login = dol_buildlogin($this->object->lastname, $this->object->firstname); $generated_password = getRandomPassword(false); $password = $generated_password; // Create a form array $formquestion = array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password)); $this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $this->object->id, $langs->trans("CreateDolibarrLogin"), $langs->trans("ConfirmCreateContact"), "confirm_create_user", $formquestion, 'no'); } }
*/ $head = member_prepare_head($adh); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); dol_htmloutput_errors($errmsg,$errmsgs); // Confirm create user if ($_GET["action"] == 'create_user') { $login=$adh->login; if (empty($login)) { // Full firstname and name separated with a dot : firstname.name include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php'); $login=dol_buildlogin($adh->nom,$adh->prenom); } if (empty($login)) $login=strtolower(substr($adh->prenom, 0, 4)) . strtolower(substr($adh->nom, 0, 4)); // Create a form array $formquestion=array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) ); $text=$langs->trans("ConfirmCreateLogin").'<br>'; if ($conf->societe->enabled) { if ($adh->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); else $text.=$langs->trans("UserWillBeInternalUser"); } $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); if ($ret == 'html') print '<br>';
if (GETPOST("id") && GETPOST("action") != 'edit') { $objsoc = new Societe($db); /* * Fiche en mode visualisation */ dol_htmloutput_errors($error,$errors); if ($_GET["action"] == 'create_user') { // Full firstname and name separated with a dot : firstname.name include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php'); $login=dol_buildlogin($object->nom,$object->prenom); $generated_password=''; if (! $ldap_sid) // TODO ldap_sid ? { include_once(DOL_DOCUMENT_ROOT.'/lib/security.lib.php'); $generated_password=getRandomPassword(''); } $password=$generated_password; // Create a form array $formquestion=array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password), //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) );
print '<div class="row">'; $titre = $langs->trans("Member"); print start_box($titre, "twelve", "16-User.png"); /* * Affichage onglets */ $head = member_prepare_head($object); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); dol_htmloutput_errors($errmsg, $errmsgs); // Confirm create user if ($_GET["action"] == 'create_user') { $login = $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)); $text = $langs->trans("ConfirmCreateLogin") . '<br>'; if ($conf->societe->enabled) { if ($object->fk_soc > 0) { $text .= $langs->trans("UserWillBeExternalUser"); } else { $text .= $langs->trans("UserWillBeInternalUser"); } } $ret = $form->form_confirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');