';
+llxHeader($head, $langs->trans("UserProfile").' '.$object->getFullName($langs), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1, 1);
+
+print '
'."\n";
+print '
'."\n";
+print '
'."\n";
+print '
'."\n";
+print '
';
+
+
+//htmlPrintOnlinePaymentFooter($mysoc, $langs);
+
+print '
';
+print '
';
+//print '
';
+//print '
';
+print '
';
+
+llxFooter('', 'public');
+
+$db->close();
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 4f44ab20bad..983e571e399 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -910,7 +910,9 @@ textarea.centpercent {
.nomarginright {
margin-: unset;
}
-
+.nowidthimp {
+ width: unset !important;
+}
.cursordefault {
cursor: default;
}
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 41c20074d6a..89358053ef3 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -1147,6 +1147,9 @@ textarea.centpercent {
.nomarginright {
margin-: unset;
}
+.nowidthimp {
+ width: unset !important;
+}
.cursordefault {
cursor: default;
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index f26d61da521..8fceddf313b 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -1432,10 +1432,18 @@ if ($action == 'create' || $action == 'adduserldap') {
if ($action != 'edit') {
print dol_get_fiche_head($head, 'user', $title, -1, 'user');
- $morehtmlref = '
';
+ $morehtmlref = '';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '';
+ //$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 .= '
';
+ $morehtmlref .= img_picto($langs->trans("PublicVirtualCardUrl"), 'id-card', 'class="valignmiddle marginleftonly paddingrightonly"');
+ $morehtmlref .= '';*/
+
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
print '
';
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index a4d4c7acfe6..9104dd5cfd4 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -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
*
diff --git a/htdocs/user/info.php b/htdocs/user/info.php
index dfb1fe23d0b..3f5d1aea604 100644
--- a/htdocs/user/info.php
+++ b/htdocs/user/info.php
@@ -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();
}
diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php
index 6e7035d99ec..576d2b90a5b 100644
--- a/htdocs/user/vcard.php
+++ b/htdocs/user/vcard.php
@@ -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();
diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php
new file mode 100644
index 00000000000..30dc32ad01c
--- /dev/null
+++ b/htdocs/user/virtualcard.php
@@ -0,0 +1,248 @@
+
+ * Copyright (C) 2005-2015 Regis Houssin
+ *
+ * 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 .
+ */
+
+/**
+ * \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 = ''.$langs->trans("BackToList").'';
+}
+
+$morehtmlref = '';
+$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
+$morehtmlref .= '';
+
+//dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
+
+
+print '';
+
+
+print dol_get_fiche_end();
+
+// End of page
+llxFooter();
+$db->close();