WIP Work on public virtual card
This commit is contained in:
parent
35256d4ecb
commit
00740ca267
@ -178,7 +178,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
$entity_qr = '?entity='.((int) $conf->entity);
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
}
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
use Splash\Tests\WsObjects\O00ObjectBaseTest;
|
||||
use JMS\Serializer\Exception\ObjectConstructionException;
|
||||
|
||||
/* Copyright (C) Kai Blankenhorn <kaib@bitfolge.de>
|
||||
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
@ -367,6 +370,90 @@ class vCard
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a VCARD string
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param Societe $company Company
|
||||
* @param Translate $langs Lang object
|
||||
* @return string String
|
||||
*/
|
||||
public function buildVCardString($object, $company, $langs)
|
||||
{
|
||||
$this->setProdId('Dolibarr '.DOL_VERSION);
|
||||
|
||||
$this->setUid('DOLIBARR-USERID-'.$object->id);
|
||||
$this->setName($object->lastname, $object->firstname, "", $object->civility_code, "");
|
||||
$this->setFormattedName($object->getFullName($langs, 1));
|
||||
|
||||
$this->setPhoneNumber($object->office_phone, "TYPE=WORK;VOICE");
|
||||
$this->setPhoneNumber($object->personal_mobile, "TYPE=HOME;VOICE");
|
||||
$this->setPhoneNumber($object->user_mobile, "TYPE=CELL;VOICE");
|
||||
$this->setPhoneNumber($object->office_fax, "TYPE=WORK;FAX");
|
||||
|
||||
$country = $object->country_code ? $object->country : '';
|
||||
|
||||
$this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL");
|
||||
$this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK");
|
||||
|
||||
$this->setEmail($object->email, "TYPE=WORK");
|
||||
$this->setNote($object->note_public);
|
||||
$this->setTitle($object->job);
|
||||
|
||||
if ($company->id > 0) {
|
||||
$this->setURL($company->url, "TYPE=WORK");
|
||||
if (!$object->office_phone) {
|
||||
$this->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
|
||||
}
|
||||
if (!$object->office_fax) {
|
||||
$this->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
|
||||
}
|
||||
if (!$object->zip) {
|
||||
$this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
|
||||
}
|
||||
|
||||
// when company e-mail is empty, use only user e-mail
|
||||
if (empty(trim($company->email))) {
|
||||
// was set before, don't set twice
|
||||
} elseif (empty(trim($object->email))) {
|
||||
// when user e-mail is empty, use only company e-mail
|
||||
$this->setEmail($company->email, "TYPE=WORK");
|
||||
} else {
|
||||
$tmpuser2 = explode("@", trim($object->email));
|
||||
$tmpcompany = explode("@", trim($company->email));
|
||||
|
||||
if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) {
|
||||
// when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second)
|
||||
$this->setEmail($object->email, "TYPE=WORK");
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$this->setEmail($company->email, 'INTERNET');
|
||||
} else {
|
||||
// when e-mail of user and company complete different use company e-mail at first (and user e-mail at second)
|
||||
$this->setEmail($company->email, "TYPE=WORK");
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$this->setEmail($object->email, 'INTERNET');
|
||||
}
|
||||
}
|
||||
|
||||
// Si user lie a un tiers non de type "particulier"
|
||||
if ($company->typent_code != 'TE_PRIVATE') {
|
||||
$this->setOrg($company->name);
|
||||
}
|
||||
}
|
||||
|
||||
// Personal informations
|
||||
$this->setPhoneNumber($object->personal_mobile, "TYPE=HOME;VOICE");
|
||||
if ($object->birth) {
|
||||
$this->setBirthday($object->birth);
|
||||
}
|
||||
|
||||
// Return VCard string
|
||||
return $this->getVCard();
|
||||
}
|
||||
|
||||
|
||||
/* Example from Microsoft Outlook 2019
|
||||
|
||||
BEGIN:VCARD
|
||||
|
||||
@ -101,31 +101,41 @@ function getDolGlobalInt($key, $default = 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return dolibarr user constant string value
|
||||
* Return Dolibarr user constant string value
|
||||
*
|
||||
* @param string $key key to return value, return '' if not set
|
||||
* @param string $default value to return
|
||||
* @param User $tmpuser To get another user than current user
|
||||
* @return string
|
||||
*/
|
||||
function getDolUserString($key, $default = '')
|
||||
function getDolUserString($key, $default = '', $tmpuser = null)
|
||||
{
|
||||
global $user;
|
||||
if (empty($tmpuser)) {
|
||||
global $user;
|
||||
$tmpuser = $user;
|
||||
}
|
||||
|
||||
// return $conf->global->$key ?? $default;
|
||||
return (string) (empty($user->conf->$key) ? $default : $user->conf->$key);
|
||||
return (string) (empty($tmpuser->conf->$key) ? $default : $$tmpuser->conf->$key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return dolibarr user constant int value
|
||||
* Return Dolibarr user constant int value
|
||||
*
|
||||
* @param string $key key to return value, return 0 if not set
|
||||
* @param int $default value to return
|
||||
* @param User $tmpuser To get another user than current user
|
||||
* @return int
|
||||
*/
|
||||
function getDolUserInt($key, $default = 0)
|
||||
function getDolUserInt($key, $default = 0, $tmpuser = null)
|
||||
{
|
||||
global $user;
|
||||
if (empty($tmpuser)) {
|
||||
global $user;
|
||||
$tmpuser = $user;
|
||||
}
|
||||
|
||||
// return $conf->global->$key ?? $default;
|
||||
return (int) (empty($user->conf->$key) ? $default : $user->conf->$key);
|
||||
return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1717,7 +1727,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
||||
*
|
||||
* @param string $name A name for the html component
|
||||
* @param string $label Label shown in Popup title top bar
|
||||
* @param string $buttonstring button string
|
||||
* @param string $buttonstring button string (HTML text we can click on)
|
||||
* @param string $url Relative Url to open. For example '/project/card.php'
|
||||
* @param string $disabled Disabled text
|
||||
* @param string $morecss More CSS
|
||||
@ -1725,7 +1735,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
||||
* Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label'
|
||||
* @return string HTML component with button
|
||||
*/
|
||||
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'button bordertransp', $backtopagejsfields = '')
|
||||
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $backtopagejsfields = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1753,7 +1763,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
|
||||
|
||||
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
|
||||
$out .= '<!-- a link for button to open url into a dialog popup with backtopagejsfields = '.$backtopagejsfields.' -->';
|
||||
$out .= '<a class="cursorpointer classlink button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'"';
|
||||
$out .= '<a class="cursorpointer button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'"';
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
$out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"';
|
||||
}
|
||||
@ -2239,6 +2249,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
}
|
||||
}
|
||||
|
||||
// Show barcode
|
||||
if ($showbarcode) {
|
||||
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object, 100, 'photoref valignmiddle').'</div>';
|
||||
}
|
||||
@ -2988,9 +2999,10 @@ function dol_print_size($size, $shortvalue = 0, $shortunit = 0)
|
||||
* @param string $target Target for link
|
||||
* @param int $max Max number of characters to show
|
||||
* @param int $withpicto With picto
|
||||
* @param string $morecss More CSS
|
||||
* @return string HTML Link
|
||||
*/
|
||||
function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0)
|
||||
function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $morecss = 'float')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -3013,7 +3025,12 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0)
|
||||
}
|
||||
$link .= dol_trunc($url, $max);
|
||||
$link .= '</a>';
|
||||
return '<div class="nospan float" style="margin-right: 10px">'.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'</div>';
|
||||
|
||||
if ($morecss == 'float') {
|
||||
return '<div class="nospan'.($morecss ? ' '.$morecss : '').'" style="margin-right: 10px">'.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'</div>';
|
||||
} else {
|
||||
return '<span class="nospan'.($morecss ? ' '.$morecss : '').'" style="margin-right: 10px">'.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4067,7 +4084,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus',
|
||||
'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
|
||||
'help', 'holiday',
|
||||
'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement',
|
||||
'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement',
|
||||
'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right',
|
||||
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
|
||||
'off', 'on', 'order',
|
||||
@ -4134,7 +4151,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'supplier'=>'building', 'technic'=>'cogs',
|
||||
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
|
||||
'title_agenda'=>'calendar-alt',
|
||||
'uncheck'=>'times', 'uparrow'=>'share', 'url'=>'external-link-alt', 'vat'=>'money-check-alt', 'vcard'=>'address-card',
|
||||
'uncheck'=>'times', 'uparrow'=>'share', 'url'=>'external-link-alt', 'vat'=>'money-check-alt', 'vcard'=>'arrow-alt-circle-down',
|
||||
'jabber'=>'comment-o',
|
||||
'website'=>'globe-americas', 'workstation'=>'pallet', 'webhook'=>'bullseye', 'world'=>'globe', 'private'=>'user-lock',
|
||||
'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram'
|
||||
|
||||
@ -1784,7 +1784,7 @@ function weight_convert($weight, &$from_unit, $to_unit)
|
||||
* @param DoliDB $db Handler database
|
||||
* @param Conf $conf Object conf
|
||||
* @param User $user Object user
|
||||
* @param array $tab Array (key=>value) with all parameters to save
|
||||
* @param array $tab Array (key=>value) with all parameters to save/update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*
|
||||
* @see dolibarr_get_const(), dolibarr_set_const(), dolibarr_del_const()
|
||||
|
||||
@ -129,3 +129,6 @@ IPLastLogin=IP last login
|
||||
IPPreviousLogin=IP previous login
|
||||
ShowAllPerms=Show all permission rows
|
||||
HideAllPerms=Hide all permission rows
|
||||
UserPublicPageDesc=You can enable a virtual card for this user. An url with the user profile and a barcode will be available to allow anybody with a smartphone to scan it and add your contact to its address book.
|
||||
EnablePublicVirtualCard=Enable the public virtual user card
|
||||
PublicVirtualCardUrl=Public virtual user card
|
||||
381
htdocs/public/users/view.php
Normal file
381
htdocs/public/users/view.php
Normal file
@ -0,0 +1,381 @@
|
||||
<?php
|
||||
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/public/users/view.php
|
||||
* \ingroup user
|
||||
* \brief Public file to user profile
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "other", "recruitment"));
|
||||
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$backtopage = '';
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$securekey = GETPOST('securekey', 'alpha');
|
||||
$suffix = GETPOST('suffix');
|
||||
|
||||
$object = new User($db);
|
||||
$object->fetch($id, '', '', 1);
|
||||
|
||||
// Define $urlwithroot
|
||||
//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
|
||||
|
||||
// Security check
|
||||
global $dolibarr_main_instance_unique_id;
|
||||
$encodedsecurekey = dol_hash($dolibarr_main_instance_unique_id.'uservirtualcard'.$object->id.'-'.$object->login, 'md5');
|
||||
if ($encodedsecurekey != $securekey) {
|
||||
httponly_accessforbidden('User profile page not found or not allowed');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel) {
|
||||
if (!empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == "view" || $action == "presend" || $action == "dosubmit") {
|
||||
$error = 0;
|
||||
$display_ticket = false;
|
||||
if (!strlen($ref)) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")));
|
||||
$action = '';
|
||||
}
|
||||
if (!strlen($email)) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
|
||||
$action = '';
|
||||
} else {
|
||||
if (!isValidEmail($email)) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorEmailInvalid"));
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$ret = $object->fetch('', $ref);
|
||||
}
|
||||
|
||||
if ($error || $errors) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
if ($action == "dosubmit") {
|
||||
$action = 'presend';
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//var_dump($action);
|
||||
//$object->doActions($action);
|
||||
|
||||
// Actions to send emails (for ticket, we need to manage the addfile and removefile only)
|
||||
/*$triggersendname = 'USER_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_USER_TO'; // used to know the automatic BCC to add
|
||||
$trackid = 'use'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$company = $mysoc;
|
||||
|
||||
if ($action == 'vcard') {
|
||||
// We create VCard
|
||||
$v = new vCard();
|
||||
$output = $v->buildVCardString($object, $company, $langs);
|
||||
|
||||
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
|
||||
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
||||
//$filename = dol_sanitizeFileName($filename);
|
||||
|
||||
top_httphead('text/x-vcard; name="'.$filename.'"');
|
||||
|
||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
||||
header("Content-Length: ".dol_strlen($output));
|
||||
header("Connection: close");
|
||||
|
||||
print $output;
|
||||
|
||||
$db->close();
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$head = '';
|
||||
if (!empty($conf->global->MAIN_USER_PROFILE_CSS_URL)) {
|
||||
$head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_USER_PROFILE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
}
|
||||
|
||||
$conf->dol_hide_topmenu = 1;
|
||||
$conf->dol_hide_leftmenu = 1;
|
||||
|
||||
if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
|
||||
$langs->load("errors");
|
||||
print '<div class="error">'.$langs->trans('ErrorPublicInterfaceNotEnabled').'</div>';
|
||||
$db->close();
|
||||
exit();
|
||||
}
|
||||
|
||||
$arrayofjs = array();
|
||||
$arrayofcss = array();
|
||||
|
||||
$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
|
||||
llxHeader($head, $langs->trans("UserProfile").' '.$object->getFullName($langs), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1, 1);
|
||||
|
||||
print '<span id="dolpaymentspan"></span>'."\n";
|
||||
print '<div class="center">'."\n";
|
||||
print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
||||
print '<input type="hidden" name="action" value="dosubmit">'."\n";
|
||||
print '<input type="hidden" name="securekey" value="'.$securekey.'">'."\n";
|
||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||
print "\n";
|
||||
print '<!-- Form to view job -->'."\n";
|
||||
|
||||
$modulepart = 'user';
|
||||
$imagesize = 'small';
|
||||
$dir = $conf->user->dir_output;
|
||||
$email = $object->email;
|
||||
|
||||
// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
|
||||
// Define logo and logosmall
|
||||
$logo = '';
|
||||
$logosmall = '';
|
||||
if (!empty($object->photo)) {
|
||||
if (dolIsAllowedForPreview($object->photo)) {
|
||||
$logosmall = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
|
||||
$logo = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
|
||||
//$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
|
||||
}
|
||||
}
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo = '';
|
||||
$urllogofull = '';
|
||||
if (!empty($logosmall) && is_readable($conf->user->dir_output.'/'.$logosmall)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logosmall);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logosmall);
|
||||
} elseif (!empty($logo) && is_readable($conf->user->dir_output.'/'.$logo)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logo);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='.urlencode($logo);
|
||||
}
|
||||
|
||||
// Output html code for logo
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="logopublicpayment">';
|
||||
|
||||
// Show photo
|
||||
if ($urllogo) {
|
||||
/*if (!empty($mysoc->url)) {
|
||||
print '<a href="'.$mysoc->url.'" target="_blank" rel="noopener">';
|
||||
}*/
|
||||
print '<img id="dolpaymentlogo" src="'.$urllogofull.'">';
|
||||
/*if (!empty($mysoc->url)) {
|
||||
print '</a>';
|
||||
}*/
|
||||
}
|
||||
print '</div>';
|
||||
/*if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
|
||||
print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
|
||||
}*/
|
||||
print '</div>';
|
||||
|
||||
|
||||
if (!empty($conf->global->USER_IMAGE_PUBLIC_INTERFACE)) {
|
||||
print '<div class="backimagepublicrecruitment">';
|
||||
print '<img id="idUSER_IMAGE_PUBLIC_SUGGEST_BOOTH" src="'.$conf->global->USER_IMAGE_PUBLIC_INTERFACE.'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$urlforqrcode = $_SERVER["PHP_SELF"].'?action=vcard&id='.((int) $object->id).'&securekey='.urlencode($securekey);
|
||||
|
||||
// Show barcode
|
||||
$showbarcode = GETPOST('nobarcode') ? 0 : 1;
|
||||
if ($showbarcode) {
|
||||
print '<br>';
|
||||
print '<div class="floatleft inline-block valignmiddle divphotoref">';
|
||||
print 'QRCODE...<br>';
|
||||
print $urlforqrcode;
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<div class="opacitymedium">'.$langs->trans("Me").'</div>'."\n";
|
||||
print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
|
||||
|
||||
// Output payment summary form
|
||||
print '<tr><td class="left">';
|
||||
|
||||
print '<div class="nowidthimp" id="tablepublicpayment">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Add contact info
|
||||
print '...';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '</div>'."\n";
|
||||
print "\n";
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="opacitymedium">'.$langs->trans("MyCompany").'</div>'."\n";
|
||||
print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
|
||||
|
||||
// Output payment summary form
|
||||
print '<tr><td class="left">';
|
||||
|
||||
print '<div class="nowidthimp" id="tablepublicpayment">';
|
||||
|
||||
// Add company info
|
||||
|
||||
|
||||
// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
|
||||
// Define logo and logosmall
|
||||
$logosmall = $mysoc->logo_small;
|
||||
$logo = $mysoc->logo;
|
||||
$paramlogo = 'ONLINE_USER_LOGO_'.$suffix;
|
||||
if (!empty($conf->global->$paramlogo)) {
|
||||
$logosmall = $conf->global->$paramlogo;
|
||||
} elseif (!empty($conf->global->ONLINE_USER_LOGO)) {
|
||||
$logosmall = $conf->global->ONLINE_USER_LOGO;
|
||||
}
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo = '';
|
||||
$urllogofull = '';
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
}
|
||||
// Output html code for logo
|
||||
if ($urllogo) {
|
||||
print '<div class="logopublicpayment">';
|
||||
if (!empty($mysoc->url)) {
|
||||
print '<a href="'.$mysoc->url.'" target="_blank" rel="noopener">';
|
||||
}
|
||||
print '<img id="dolpaymentlogo" src="'.$urllogofull.'">';
|
||||
if (!empty($mysoc->url)) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($mysoc->email) {
|
||||
print '<br>';
|
||||
print img_picto('', 'email', 'class="pictofixedwidth"').dol_print_email($mysoc->email, 0, 0, 1);
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
if ($mysoc->url) {
|
||||
print '<br>';
|
||||
print img_picto('', 'globe', 'class="pictofixedwidth"');
|
||||
//print 'rr';
|
||||
print dol_print_url($mysoc->url, '_blank', 0, 0, '');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '</div>'."\n";
|
||||
print "\n";
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
|
||||
|
||||
// Description
|
||||
$text = getDolUserString('USER_PUBLIC_MORE', '', $object);
|
||||
print $text;
|
||||
|
||||
|
||||
print '</form>'."\n";
|
||||
print '</div>'."\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
//htmlPrintOnlinePaymentFooter($mysoc, $langs);
|
||||
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="center">';
|
||||
print '<a href="'.$urlforqrcode.'">';
|
||||
print img_picto($langs->trans("AddTocontacts"), 'add').' ';
|
||||
print $langs->trans("AddTocontacts");
|
||||
print '</a>';
|
||||
print '</div>';
|
||||
//print '<div>';
|
||||
//print '</div>';
|
||||
print '</div>';
|
||||
|
||||
llxFooter('', 'public');
|
||||
|
||||
$db->close();
|
||||
@ -910,7 +910,9 @@ textarea.centpercent {
|
||||
.nomarginright {
|
||||
margin-<?php print $right; ?>: unset;
|
||||
}
|
||||
|
||||
.nowidthimp {
|
||||
width: unset !important;
|
||||
}
|
||||
.cursordefault {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
@ -1147,6 +1147,9 @@ textarea.centpercent {
|
||||
.nomarginright {
|
||||
margin-<?php print $right; ?>: unset;
|
||||
}
|
||||
.nowidthimp {
|
||||
width: unset !important;
|
||||
}
|
||||
|
||||
.cursordefault {
|
||||
cursor: default;
|
||||
|
||||
@ -1432,10 +1432,18 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
if ($action != 'edit') {
|
||||
print dol_get_fiche_head($head, 'user', $title, -1, 'user');
|
||||
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid" rel="noopener">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
//$urltovirtualcard = $object->getOnlineVirtualCardUrl();
|
||||
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
|
||||
|
||||
$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
|
||||
/*$morehtmlref .= '<a href="'.$urltovirtualcard.'" class="refid" target="_blank" rel="noopener">';
|
||||
$morehtmlref .= img_picto($langs->trans("PublicVirtualCardUrl"), 'id-card', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';*/
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@ -3786,6 +3786,30 @@ class User extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string with full Url to virtual card
|
||||
*
|
||||
* @return string Url string
|
||||
*/
|
||||
public function getOnlineVirtualCardUrl()
|
||||
{
|
||||
global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root;
|
||||
global $conf;
|
||||
|
||||
$encodedsecurekey = dol_hash($dolibarr_main_instance_unique_id.'uservirtualcard'.$this->id.'-'.$this->login, 'md5');
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '&entity='.((int) $conf->entity);
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
}
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all objects into $this->users
|
||||
*
|
||||
|
||||
@ -51,7 +51,7 @@ $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
|
||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||
|
||||
// If user is not user that read and no permission to read other users, we stop
|
||||
if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
|
||||
if (($object->id != $user->id) && empty($user->rights->user->user->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/user/vcard.php
|
||||
* \ingroup societe
|
||||
* \brief Onglet vcard d'un user
|
||||
* \ingroup user
|
||||
* \brief Page to return a user vcard
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
@ -31,9 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
|
||||
|
||||
$user2 = new User($db);
|
||||
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Security check
|
||||
@ -44,106 +41,38 @@ if ($user->socid > 0) {
|
||||
$feature2 = 'user';
|
||||
$result = restrictedArea($user, 'user', $id, 'user', $feature2);
|
||||
|
||||
|
||||
$result = $user2->fetch($id);
|
||||
$object = new User($db);
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($user2->error);
|
||||
dol_print_error($object->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
$physicalperson = 1;
|
||||
|
||||
// Data from linked company
|
||||
$company = new Societe($db);
|
||||
if ($user2->socid) {
|
||||
$result = $company->fetch($user2->socid);
|
||||
if ($object->socid > 0) {
|
||||
$result = $company->fetch($object->socid);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// We create VCard
|
||||
$v = new vCard();
|
||||
$v->setProdId('Dolibarr '.DOL_VERSION);
|
||||
|
||||
$v->setUid('DOLIBARR-USERID-'.$user2->id);
|
||||
$v->setName($user2->lastname, $user2->firstname, "", $user2->civility_code, "");
|
||||
$v->setFormattedName($user2->getFullName($langs, 1));
|
||||
|
||||
$v->setPhoneNumber($user2->office_phone, "TYPE=WORK;VOICE");
|
||||
$v->setPhoneNumber($user2->personal_mobile, "TYPE=HOME;VOICE");
|
||||
$v->setPhoneNumber($user2->user_mobile, "TYPE=CELL;VOICE");
|
||||
$v->setPhoneNumber($user2->office_fax, "TYPE=WORK;FAX");
|
||||
|
||||
$country = $user2->country_code ? $user2->country : '';
|
||||
|
||||
$v->setAddress("", "", $user2->address, $user2->town, $user2->state, $user2->zip, $country, "TYPE=WORK;POSTAL");
|
||||
$v->setLabel("", "", $user2->address, $user2->town, $user2->state, $user2->zip, $country, "TYPE=WORK");
|
||||
|
||||
$v->setEmail($user2->email, "TYPE=WORK");
|
||||
$v->setNote($user2->note_public);
|
||||
$v->setTitle($user2->job);
|
||||
|
||||
// Data from linked company
|
||||
if ($company->id) {
|
||||
$v->setURL($company->url, "TYPE=WORK");
|
||||
if (!$user2->office_phone) {
|
||||
$v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
|
||||
}
|
||||
if (!$user2->office_fax) {
|
||||
$v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
|
||||
}
|
||||
if (!$user2->zip) {
|
||||
$v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
|
||||
}
|
||||
|
||||
// when company e-mail is empty, use only user e-mail
|
||||
if (empty(trim($company->email))) {
|
||||
// was set before, don't set twice
|
||||
} elseif (empty(trim($user2->email))) {
|
||||
// when user e-mail is empty, use only company e-mail
|
||||
$v->setEmail($company->email, "TYPE=WORK");
|
||||
} else {
|
||||
$tmpuser2 = explode("@", trim($user2->email));
|
||||
$tmpcompany = explode("@", trim($company->email));
|
||||
|
||||
if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) {
|
||||
// when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second)
|
||||
$v->setEmail($user2->email, "TYPE=WORK");
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($company->email, 'INTERNET');
|
||||
} else {
|
||||
// when e-mail of user and company complete different use company e-mail at first (and user e-mail at second)
|
||||
$v->setEmail($company->email, "TYPE=WORK");
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($user2->email, 'INTERNET');
|
||||
}
|
||||
}
|
||||
|
||||
// Si user lie a un tiers non de type "particulier"
|
||||
if ($company->typent_code != 'TE_PRIVATE') {
|
||||
$v->setOrg($company->name);
|
||||
}
|
||||
}
|
||||
|
||||
// Personal informations
|
||||
$v->setPhoneNumber($user2->personal_mobile, "TYPE=HOME;VOICE");
|
||||
if ($user2->birth) {
|
||||
$v->setBirthday($user2->birth);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
// Renvoi la VCard au navigateur
|
||||
|
||||
$output = $v->getVCard();
|
||||
$output = $v->buildVCardString($object, $company, $langs);
|
||||
|
||||
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
|
||||
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
||||
//$filename = dol_sanitizeFileName($filename);
|
||||
|
||||
top_httphead('text/x-vcard; name="'.$filename.'"');
|
||||
|
||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
||||
header("Content-Length: ".dol_strlen($output));
|
||||
header("Connection: close");
|
||||
header("Content-Type: text/x-vcard; name=\"".$filename."\"");
|
||||
|
||||
print $output;
|
||||
|
||||
$db->close();
|
||||
|
||||
248
htdocs/user/virtualcard.php
Normal file
248
htdocs/user/virtualcard.php
Normal file
@ -0,0 +1,248 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/user/virtualcard.php
|
||||
* \ingroup core
|
||||
* \brief Page to setup a virtual card
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
// Load translation files required by page
|
||||
$langs->load("users");
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$object = new User($db);
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref, '', 1);
|
||||
$object->getrights();
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
|
||||
|
||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||
|
||||
// If user is not the user that read and has no permission to read other users, we stop
|
||||
if (($object->id != $user->id) && empty($user->rights->user->user->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update') {
|
||||
$tmparray = array();
|
||||
$tmparray['USER_PUBLIC_COMPANY_NAME'] = (GETPOST('USER_PUBLIC_COMPANY_NAME') ? 1 : 0);
|
||||
$tmparray['USER_PUBLIC_JOBPOSITION'] = (GETPOST('USER_PUBLIC_JOBPOSITION') ? 1 : 0);
|
||||
$tmparray['USER_PUBLIC_EMAIL'] = (GETPOST('USER_PUBLIC_EMAIL') ? 1 : 0);
|
||||
$tmparray['USER_PUBLIC_PHONE'] = (GETPOST('USER_PUBLIC_PHONE') ? 1 : 0);
|
||||
$tmparray['USER_PUBLIC_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_SOCIALNETWORKS') ? 1 : 0);
|
||||
$tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : '');
|
||||
|
||||
dol_set_user_param($db, $conf, $object, $tmparray);
|
||||
}
|
||||
|
||||
if ($action == 'setUSER_ENABLE_PUBLIC') {
|
||||
if (GETPOST('value')) {
|
||||
$tmparray = array('USER_ENABLE_PUBLIC' => 1);
|
||||
} else {
|
||||
$tmparray = array('USER_ENABLE_PUBLIC' => 0);
|
||||
}
|
||||
dol_set_user_param($db, $conf, $object, $tmparray);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
|
||||
$title = $person_name." - ".$langs->trans('Info');
|
||||
$help_url = '';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$head = user_prepare_head($object);
|
||||
|
||||
$title = $langs->trans("User");
|
||||
//print dol_get_fiche_head($head, 'info', $title, -1, 'user');
|
||||
|
||||
|
||||
$linkback = '';
|
||||
|
||||
if ($user->rights->user->user->lire || $user->admin) {
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
}
|
||||
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
//dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
print '<span class="opacitymedium">'.$langs->trans("VCard").'</span><br>';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid" rel="noopener">';
|
||||
print img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
print '</a>';
|
||||
|
||||
|
||||
print '<hr>';
|
||||
//print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
*/
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("UserPublicPageDesc").'</span><br><br>';
|
||||
|
||||
$param = '&id='.((int) $object->id);
|
||||
|
||||
$enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' ';
|
||||
if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setUSER_ENABLE_PUBLIC&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
} else {
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setUSER_ENABLE_PUBLIC&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
print $enabledisablehtml;
|
||||
print '<input type="hidden" id="USER_ENABLE_PUBLIC" name="USER_ENABLE_PUBLIC" value="'.(empty($conf->global->USER_ENABLE_PUBLIC) ? 0 : 1).'">';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('PublicVirtualCardUrl').'</span><br>';
|
||||
|
||||
$fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl();
|
||||
|
||||
print '<div class="urllink">';
|
||||
print '<input type="text" id="publicurluser" class="quatrevingtpercentminusx" value="'.$fullexternaleurltovirtualcard.'">';
|
||||
print '<a target="_blank" rel="noopener noreferrer" href="'.$fullexternaleurltovirtualcard.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
|
||||
print '</div>';
|
||||
print ajax_autoselect('publicurluser');
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Company name
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("Company");
|
||||
print '</td><td>';
|
||||
//print '<input type="text" class="maxwidth300" id="USER_PUBLIC_COMPANY_NAME" name="USER_PUBLIC_COMPANY_NAME" value="'.(getDolUserString('USER_PUBLIC_COMPANY_NAME', $mysoc->name, $object) ? getDolUserString('USER_PUBLIC_COMPANY_NAME', $mysoc->name, $object) : 0).'">';
|
||||
print $form->selectyesno("USER_PUBLIC_COMPANY_NAME", (getDolUserInt('USER_PUBLIC_COMPANY_NAME', 0, $object) ? getDolUserInt('USER_PUBLIC_COMPANY_NAME', 0, $object) : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Job position
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("PostOrFunction");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("USER_PUBLIC_JOBPOSITION", (getDolUserInt('USER_PUBLIC_JOBPOSITION', 0, $object) ? getDolUserInt('USER_PUBLIC_JOBPOSITION', 0, $object) : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Email
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("Email");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("USER_PUBLIC_EMAIL", (getDolUserInt('USER_PUBLIC_EMAIL', 0, $object) ? getDolUserInt('USER_PUBLIC_EMAIL', 0, $object) : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Phone
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("Phone");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("USER_PUBLIC_PHONE", (getDolUserInt('USER_PUBLIC_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_PHONE', 0, $object) : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Social networks
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("SocialNetworks");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("USER_PUBLIC_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_SOCIALNETWORKS', 0, $object) : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// More
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("More");
|
||||
print '</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('USER_PUBLIC_MORE', getDolUserString('USER_PUBLIC_MORE', '', $object), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
|
||||
$doleditor->Create();
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
Loading…
Reference in New Issue
Block a user