Fix virtual card feature

This commit is contained in:
Laurent Destailleur 2023-01-07 12:36:53 +01:00
parent 93f5c69b1c
commit 75d9793145
11 changed files with 286 additions and 226 deletions

View File

@ -1731,11 +1731,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
* @param string $url Relative Url to open. For example '/project/card.php'
* @param string $disabled Disabled text
* @param string $morecss More CSS
* @param string $jsonopen Some JS code to execute on click/open of popup
* @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect.
* Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label'
* @param string $accesskey A key to use shortcut
* @return string HTML component with button
*/
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $backtopagejsfields = '')
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $jsonopen = '', $backtopagejsfields = '', $accesskey = '')
{
global $conf;
@ -1763,9 +1765,11 @@ 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 button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'"';
$out .= '<a '.($accesskey ? ' accesskey="'.$accesskey.'"' : '').' 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"';
} elseif ($jsonopen) {
$out .= ' onclick="javascript:'.$jsonopen.'"';
}
$out .= '>'.$buttonstring.'</a>';
@ -2324,7 +2328,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
// Add alias for thirdparty
if (!empty($object->name_alias)) {
$morehtmlref .= '<div class="refidno opacitymedium">'.$object->name_alias.'</div>';
$morehtmlref .= '<div class="refidno opacitymedium">'.dol_escape_htmltag($object->name_alias).'</div>';
}
// Add label
@ -2346,7 +2350,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) {
$morehtmlref .= '<div style="clear: both;"></div>';
$morehtmlref .= '<div class="refidno opacitymedium">';
$morehtmlref .= $langs->trans("TechnicalID").': '.$object->id;
$morehtmlref .= $langs->trans("TechnicalID").': '.((int) $object->id);
$morehtmlref .= '</div>';
}
@ -3166,11 +3170,10 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
if (!empty($type)) {
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
// Use dictionary definition for picto $dictsocialnetworks[$type]['icon']
$htmllink .= '<span class="fa paddingright '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>';
$htmllink .= '<span class="fa paddingright pictofixedwidth '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>';
if ($type == 'skype') {
$htmllink .= dol_escape_htmltag($value);
$htmllink .= '&nbsp;';
$htmllink .= '<a href="skype:';
$htmllink .= '&nbsp; <a href="skype:';
$htmllink .= dol_string_nospecial($value, '_', '', array('@'));
$htmllink .= '?call" alt="'.$langs->trans("Call").'&nbsp;'.$value.'" title="'.dol_escape_htmltag($langs->trans("Call").' '.$value).'">';
$htmllink .= '<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
@ -3208,9 +3211,9 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
}
$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
if (preg_match('/^https?:\/\//i', $link)) {
$htmllink .= '&nbsp;<a href="'.dol_sanitizeUrl($link, 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
$htmllink .= '<a href="'.dol_sanitizeUrl($link, 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
} else {
$htmllink .= '&nbsp;<a href="'.dol_sanitizeUrl($link, 1).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
$htmllink .= '<a href="'.dol_sanitizeUrl($link, 1).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
}
} else {
$htmllink .= dol_escape_htmltag($value);
@ -3263,7 +3266,7 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton
* @param string $countrycode Country code to use for formatting
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
* @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set)
* @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set), 'tel'=Force "tel:..." link
* @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @param string $withpicto Show picto ('fax', 'phone', 'mobile')
* @param string $titlealt Text to show on alt
@ -3471,7 +3474,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
}
}
if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
if ($conf->browser->layout == 'phone' || (isModEnabled('clicktodial') && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
if ($addlink == 'tel' || $conf->browser->layout == 'phone' || (isModEnabled('clicktodial') && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
$newphoneform = $newphone;
$newphone = '<a href="tel:'.$phone.'"';
$newphone .= '>'.$newphoneform.'</a>';

View File

@ -226,6 +226,7 @@ NoUserGroupDefined=No user group defined
Password=Password
PasswordRetype=Repeat your password
NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration.
YourUserFile=Your user file
Name=Name
NameSlashCompany=Name / Company
Person=Person
@ -1213,4 +1214,5 @@ InternalUser=Internal user
ExternalUser=External user
NoSpecificContactAddress=No specific contact or address
NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate.
HideOnVCard=Hide %s
AddToContacts=Add address to my contacts

View File

@ -2280,12 +2280,14 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
if (empty($urllogout)) {
$urllogout = DOL_URL_ROOT.'/user/logout.php?token='.newToken();
}
$logoutLink = '<a accesskey="l" href="'.$urllogout.'" class="button-top-menu-dropdown" ><i class="fa fa-sign-out-alt"></i> '.$langs->trans("Logout").'</a>';
$profilLink = '<a accesskey="l" href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="button-top-menu-dropdown" ><i class="fa fa-user"></i> '.$langs->trans("Card").'</a>';
// Defined the links for bottom of card
$profilLink = '<a accesskey="c" href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="button-top-menu-dropdown" title="'.dol_escape_htmltag($langs->trans("YourUserFile")).'"><i class="fa fa-user"></i> '.$langs->trans("Card").'</a>';
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $user->id);
$virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v');
$logoutLink = '<a accesskey="l" href="'.$urllogout.'" class="button-top-menu-dropdown" title="'.dol_escape_htmltag($langs->trans("Logout")).'"><i class="fa fa-sign-out-alt"></i> '.$langs->trans("Logout").'</a>';
$profilName = $user->getFullName($langs).' ('.$user->login.')';
if (!empty($user->admin)) {
$profilName = '<i class="far fa-star classfortooltip" title="'.$langs->trans("Administrator").'" ></i> '.$profilName;
}
@ -2341,6 +2343,9 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
<div class="pull-left">
'.$profilLink.'
</div>
<div class="pull-left">
'.$virtuelcardLink.'
</div>
<div class="pull-right">
'.$logoutLink.'
</div>
@ -2363,12 +2368,15 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$btnUser .= '
<!-- Code to show/hide the user drop-down -->
<script>
function closeTopMenuLoginDropdown() {
//console.log("close login dropdown"); // This is call at each click on page, so we disable the log
// Hide the menus.
jQuery("#topmenu-login-dropdown").removeClass("open");
}
jQuery(document).ready(function() {
jQuery(document).on("click", function(event) {
if (!$(event.target).closest("#topmenu-login-dropdown").length) {
//console.log("close login dropdown");
// Hide the menus.
jQuery("#topmenu-login-dropdown").removeClass("open");
closeTopMenuLoginDropdown();
}
});
';

View File

@ -699,7 +699,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
// TODO @LDR Implement this
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$tmpbacktopagejsfields = 'addthirdparty:socid,search_socid';
print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', $tmpbacktopagejsfields);
print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', '', $tmpbacktopagejsfields);
} else {
print ' <a href="'.DOL_URL_ROOT.$url.'">'.$newbutton.'</a>';
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2020-2022 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
@ -45,6 +45,7 @@ $langs->loadLangs(array("companies", "other", "recruitment"));
// Get parameters
$action = GETPOST('action', 'aZ09');
$mode = GETPOST('mode', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = '';
@ -64,7 +65,11 @@ $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than curren
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');
httponly_accessforbidden('Bad value for securitykey or public profile not enabled');
}
if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
httponly_accessforbidden('Bad value for securitykey or public profile not enabled');
}
@ -80,52 +85,6 @@ if ($cancel) {
$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
@ -134,7 +93,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
$form = new Form($db);
$company = $mysoc;
if ($action == 'vcard') {
if ($mode == 'vcard') {
// We create VCard
$v = new vCard();
$output = $v->buildVCardString($object, $company, $langs);
@ -219,16 +178,16 @@ if (!empty($logosmall) && is_readable($conf->user->dir_output.'/'.$logosmall)) {
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>';
}*/
// Name
print '<div class="double colortext">'.$object->getFullName($langs).'</div>';
// User position
if ($object->job && !getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) {
print '<div class="">';
print dol_escape_htmltag($object->job);
print '</div>';
}
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>';
@ -242,105 +201,73 @@ if (!empty($conf->global->USER_IMAGE_PUBLIC_INTERFACE)) {
print '</div>';
}
$urlforqrcode = $_SERVER["PHP_SELF"].'?action=vcard&id='.((int) $object->id).'&securekey='.urlencode($securekey);
$urlforqrcode = $object->getOnlineVirtualCardUrl('vcard');
$socialnetworksdict = getArrayOfSocialNetworks();
// 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 '<img src="'.$dolibarr_main_url_root.'/viewimage.php?modulepart=barcode&entity='.((int) $conf->entity).'&generator=tcpdfbarcode&encoding=QRCODE&code='.urlencode($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&amp;entity='.$conf->entity.'&amp;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&amp;entity='.$conf->entity.'&amp;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
// Me
// Show photo
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 '<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.'">';
}
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">';
// User email
if ($object->email && !getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) {
print '<div class="flexitemsmall">';
print dol_print_email($object->email, 0, 0, 1, 0, 1, 1);
print '</div>';
}
if ($mysoc->email) {
print '<br>';
print img_picto('', 'email', 'class="pictofixedwidth"').dol_print_email($mysoc->email, 0, 0, 1);
print '<br>';
// User url
if ($object->url && !getDolUserInt('USER_PUBLIC_HIDE_URL', 0, $object)) {
print '<div class="flexitemsmall">';
print img_picto('', 'globe', 'class="pictofixedwidth"');
print dol_print_url($object->url, '_blank', 0, 0, '');
print '</div>';
}
if ($mysoc->url) {
print '<br>';
print img_picto('', 'globe', 'class="pictofixedwidth"');
//print 'rr';
print dol_print_url($mysoc->url, '_blank', 0, 0, '');
print '<br>';
// User phone
if ($object->office_phone && !getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) {
print '<div class="flexitemsmall">';
print img_picto('', 'phone', 'class="pictofixedwidth"');
print dol_print_phone($object->office_phone, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
print '<div>';
}
if ($object->user_mobile && !getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
print '<div class="flexitemsmall">';
print img_picto('', 'phone', 'class="pictofixedwidth"');
print dol_print_phone($object->user_mobile, $object->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
print '<div>';
}
// Social networks
if (!empty($object->socialnetworks) && is_array($object->socialnetworks) && count($object->socialnetworks) > 0) {
if (!getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
foreach ($object->socialnetworks as $key => $value) {
if ($value) {
print '<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'</div>';
}
}
}
}
@ -353,6 +280,98 @@ print '</table>'."\n";
if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
$companysection = '';
if ($mysoc->email) {
$companysection .= '<div class="flexitemsmall">';
$companysection .= img_picto('', 'email', 'class="pictofixedwidth"');
$companysection .= dol_print_email($mysoc->email, 0, 0, 1);
$companysection .= '<div>';
}
if ($mysoc->url) {
$companysection .= '<div class="flexitemsmall">';
$companysection .= img_picto('', 'globe', 'class="pictofixedwidth"');
$companysection .= dol_print_url($mysoc->url, '_blank', 0, 0, '');
$companysection .= '</div>';
}
if ($mysoc->phone) {
$companysection .= '<div class="flexitemsmall">';
$companysection .= img_picto('', 'phone', 'class="pictofixedwidth"');
$companysection .= dol_print_phone($mysoc->phone, $mysoc->country_code, 0, $mysoc->id, 'tel', ' ', 0, '');
$companysection .= '<div>';
}
// Social networks
if (!empty($mysoc->socialnetworks) && is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
foreach ($mysoc->socialnetworks as $key => $value) {
if ($value) {
$companysection .= '<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'</div>';
}
}
}
// 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_squarred_small ? $mysoc->logo_squarred_small : $mysoc->logo_small;
$logo = $mysoc->logo_squarred ? $mysoc->logo_squarred : $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&amp;entity='.$conf->entity.'&amp;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&amp;entity='.$conf->entity.'&amp;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 center">';
if (!empty($mysoc->url)) {
print '<a href="'.$mysoc->url.'" target="_blank" rel="noopener">';
}
print '<img class="userphotopublicvcard" id="dolpaymentlogo" src="'.$urllogofull.'">';
if (!empty($mysoc->url)) {
print '</a>';
}
print '</div>';
}
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
if ($mysoc->name) {
print '<div class="center bold">';
print $mysoc->name;
print '</div>';
print '<br>';
}
print $companysection;
print '</div>'."\n";
print "\n";
print '</td></tr>'."\n";
print '</table>'."\n";
}
// Description
$text = getDolUserString('USER_PUBLIC_MORE', '', $object);
print $text;
@ -368,8 +387,8 @@ print '<br>';
print '<div class="backgreypublicpayment">';
print '<div class="center">';
print '<a href="'.$urlforqrcode.'">';
print img_picto($langs->trans("AddTocontacts"), 'add').' ';
print $langs->trans("AddTocontacts");
print img_picto($langs->trans("AddToContacts"), 'add').' ';
print $langs->trans("AddToContacts");
print '</a>';
print '</div>';
//print '<div>';

View File

@ -3110,6 +3110,17 @@ img.userphotosmall { /* size for user photo in lists */
vertical-align: middle;
background-color: #FFF;
}
img.userphotopublicvcard {
width: 60px;
height: 60px;
border-radius: 50%;
background-size: contain;
border: 1px solid;
border-color: rgba(128, 128, 128, 0.5);
position: relative;
top: 25px;
left: -110px;
}
img.userphoto[alt="Gravatar avatar"], img.photouserphoto.dropdown-user-image[alt="Gravatar avatar"] {
background: #fff;
}
@ -7814,6 +7825,12 @@ div.clipboardCPValue.hidewithsize {
.lilevel1 span.paddingright {
padding-right: 4px;
}
img.userphotopublicvcard {
left: unset;
top: unset;
margin-top: 30px;
}
}
@media only screen and (max-width: 320px)

View File

@ -3232,6 +3232,17 @@ img.userphotosmall { /* size for user photo in lists */
img.userphoto[alt="Gravatar avatar"], img.photouserphoto.dropdown-user-image[alt="Gravatar avatar"] {
background: #fff;
}
img.userphotopublicvcard {
width: 60px;
height: 60px;
border-radius: 50%;
background-size: contain;
border: 1px solid;
border-color: rgba(128, 128, 128, 0.5);
position: relative;
top: 25px;
left: -110px;
}
form[name="addtime"] img.userphoto {
border: 1px solid #444;
}
@ -7639,6 +7650,12 @@ div.clipboardCPValue.hidewithsize {
.lilevel1 span.paddingright {
padding-right: 3px;
}
img.userphotopublicvcard {
left: unset;
top: unset;
margin-top: 30px;
}
}

View File

@ -1433,12 +1433,10 @@ if ($action == 'create' || $action == 'adduserldap') {
print dol_get_fiche_head($head, 'user', $title, -1, 'user');
$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 .= img_picto($langs->trans("Download").' '.$langs->trans("VCard").' ('.$langs->trans("AddToContacts").')', '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"');

View File

@ -3789,9 +3789,10 @@ class User extends CommonObject
/**
* Return string with full Url to virtual card
*
* @return string Url string
* @param string $mode Mode for link
* @return string Url string link
*/
public function getOnlineVirtualCardUrl()
public function getOnlineVirtualCardUrl($mode = '')
{
global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root;
global $conf;
@ -3807,7 +3808,7 @@ class User extends CommonObject
$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;
return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr.($mode ? '&mode='.urlencode($mode) : '');
}
/**

View File

@ -29,7 +29,7 @@ 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");
$langs->loadLangs(array("users", "companies"));
// Security check
$id = GETPOST('id', 'int');
@ -62,11 +62,12 @@ if (($object->id != $user->id) && empty($user->rights->user->user->lire)) {
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_HIDE_JOBPOSITION'] = (GETPOST('USER_PUBLIC_HIDE_JOBPOSITION') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_EMAIL'] = (GETPOST('USER_PUBLIC_HIDE_EMAIL') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_OFFICE_PHONE'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_PHONE') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0);
$tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : '');
dol_set_user_param($db, $conf, $object, $tmparray);
@ -133,6 +134,7 @@ print '<br>';
print '<span class="opacitymedium">'.$langs->trans("UserPublicPageDesc").'</span><br><br>';
$param = '&id='.((int) $object->id);
$param .= '&dol_openinpopup=1';
$enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' ';
if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
@ -179,40 +181,46 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
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 $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("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 $form->selectyesno("USER_PUBLIC_HIDE_JOBPOSITION", (getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object) : 0), 1);
print "</td></tr>\n";
// Email
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("Email");
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("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 $form->selectyesno("USER_PUBLIC_HIDE_EMAIL", (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object) : 0), 1);
print "</td></tr>\n";
// Phone
// Office phone
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("Phone");
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("OfficePhone"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_PHONE", (getDolUserInt('USER_PUBLIC_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_PHONE', 0, $object) : 0), 1);
print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_PHONE", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) : 0), 1);
print "</td></tr>\n";
// Office phone
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("UserMobile"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_USER_MOBILE", (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) : 0), 1);
print "</td></tr>\n";
// Social networks
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("SocialNetworks");
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("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 $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) : 0), 1);
print "</td></tr>\n";
// Company name
print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_COMPANY", (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object) : 0), 1);
print "</td></tr>\n";
// More

View File

@ -52,44 +52,31 @@ if (!defined('NOREQUIREAJAX')) {
// Some value of modulepart can be used to get resources that are public so no login are required.
// Note that only directory logo is free to access without login.
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file'])) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
$needlogin = 1;
if (isset($_GET["modulepart"])) {
// For logo of company
if ($_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file'])) {
$needlogin = 0;
}
if (!defined("NOCSRFCHECK")) {
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
// For barcode live generation
if ($_GET["modulepart"] == 'barcode') {
$needlogin = 0;
}
if (!defined("NOIPCHECK")) {
define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
// Some value of modulepart can be used to get resources that are public so no login are required.
if ($_GET["modulepart"] == 'medias') {
$needlogin = 0;
}
// Used by TakePOS Auto Order
if ($_GET["modulepart"] == 'product' && isset($_GET["publictakepos"])) {
$needlogin = 0;
}
}
// For direct external download link, we don't need to load/check we are into a login session
if (isset($_GET["hashp"]) && !defined("NOLOGIN")) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
}
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 (isset($_GET["hashp"])) {
$needlogin = 0;
}
// Some value of modulepart can be used to get resources that are public so no login are required.
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
}
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
}
}
// Used by TakePOS Auto Order
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'product' && isset($_GET["publictakepos"])) {
// If nologin required
if (!$needlogin) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
}
@ -130,11 +117,11 @@ require 'main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$action = GETPOST('action', 'aZ09');
$original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp = GETPOST('hashp', 'aZ09');
$modulepart = GETPOST('modulepart', 'alpha');
$original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp = GETPOST('hashp', 'aZ09', 1); // Must be read only by GET
$modulepart = GETPOST('modulepart', 'alpha', 1); // Must be read only by GET
$urlsource = GETPOST('urlsource', 'alpha');
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
$entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : $conf->entity);
// Security check
if (empty($modulepart) && empty($hashp)) {