Enhance vcard
This commit is contained in:
parent
982ee6259f
commit
b754b7a99f
@ -183,7 +183,7 @@ class vCard
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mise en forme de l'adresse
|
* Address
|
||||||
*
|
*
|
||||||
* @param string $postoffice Postoffice
|
* @param string $postoffice Postoffice
|
||||||
* @param string $extended Extended
|
* @param string $extended Extended
|
||||||
@ -196,7 +196,7 @@ class vCard
|
|||||||
* @param string $label Label
|
* @param string $label Label
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME", $label = '')
|
public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "", $label = "")
|
||||||
{
|
{
|
||||||
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
|
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
|
||||||
$key = "ADR";
|
$key = "ADR";
|
||||||
@ -207,7 +207,7 @@ class vCard
|
|||||||
$key .= ';LABEL="'.encode($label).'"';
|
$key .= ';LABEL="'.encode($label).'"';
|
||||||
}
|
}
|
||||||
$key .= ";".$this->encoding;
|
$key .= ";".$this->encoding;
|
||||||
$this->properties[$key] = ";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
|
$this->properties[$key] = encode($postoffice).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
|
||||||
|
|
||||||
//if ($this->properties["LABEL;".$type.";".$this->encoding] == '') {
|
//if ($this->properties["LABEL;".$type.";".$this->encoding] == '') {
|
||||||
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
|
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
|
||||||
@ -215,7 +215,7 @@ class vCard
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mise en forme du label
|
* Address (old standard)
|
||||||
*
|
*
|
||||||
* @param string $postoffice Postoffice
|
* @param string $postoffice Postoffice
|
||||||
* @param string $extended Extended
|
* @param string $extended Extended
|
||||||
@ -226,6 +226,7 @@ class vCard
|
|||||||
* @param string $country Country
|
* @param string $country Country
|
||||||
* @param string $type Type
|
* @param string $type Type
|
||||||
* @return void
|
* @return void
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME")
|
public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME")
|
||||||
{
|
{
|
||||||
@ -378,6 +379,7 @@ class vCard
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a VCARD string
|
* Return a VCARD string
|
||||||
|
* See RFC https://datatracker.ietf.org/doc/html/rfc6350
|
||||||
*
|
*
|
||||||
* @param Object $object Object (User or Contact)
|
* @param Object $object Object (User or Contact)
|
||||||
* @param Societe|null $company Company. May be null
|
* @param Societe|null $company Company. May be null
|
||||||
|
|||||||
@ -114,11 +114,11 @@ if (!empty($object->photo)) {
|
|||||||
$urllogo = '';
|
$urllogo = '';
|
||||||
$urllogofull = '';
|
$urllogofull = '';
|
||||||
if (!empty($logosmall) && is_readable($dir.'/'.$logosmall)) {
|
if (!empty($logosmall) && is_readable($dir.'/'.$logosmall)) {
|
||||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall);
|
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall);
|
||||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall);
|
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall);
|
||||||
} elseif (!empty($logo) && is_readable($dir.'/'.$logo)) {
|
} elseif (!empty($logo) && is_readable($dir.'/'.$logo)) {
|
||||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo);
|
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logo);
|
||||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo);
|
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean data we don't want on public page
|
// Clean data we don't want on public page
|
||||||
@ -152,6 +152,12 @@ if (getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object)) {
|
|||||||
if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
|
if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
|
||||||
$object->socialnetworks = '';
|
$object->socialnetworks = '';
|
||||||
}
|
}
|
||||||
|
if (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object)) {
|
||||||
|
$object->address = '';
|
||||||
|
$object->zip = '';
|
||||||
|
$object->state = '';
|
||||||
|
$object->country = '';
|
||||||
|
}
|
||||||
if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
||||||
$company = null;
|
$company = null;
|
||||||
}
|
}
|
||||||
@ -159,9 +165,6 @@ if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
|||||||
|
|
||||||
// Output vcard
|
// Output vcard
|
||||||
if ($mode == 'vcard') {
|
if ($mode == 'vcard') {
|
||||||
// Reset data no selected for public VCard
|
|
||||||
|
|
||||||
|
|
||||||
// We create VCard
|
// We create VCard
|
||||||
$output = $v->buildVCardString($object, $company, $langs, $urllogofull);
|
$output = $v->buildVCardString($object, $company, $langs, $urllogofull);
|
||||||
|
|
||||||
@ -169,7 +172,7 @@ if ($mode == 'vcard') {
|
|||||||
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
||||||
//$filename = dol_sanitizeFileName($filename);
|
//$filename = dol_sanitizeFileName($filename);
|
||||||
|
|
||||||
top_httphead('text/x-vcard; name="'.$filename.'"');
|
top_httphead('text/vcard; name="'.$filename.'"');
|
||||||
|
|
||||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
||||||
header("Content-Length: ".dol_strlen($output));
|
header("Content-Length: ".dol_strlen($output));
|
||||||
@ -387,11 +390,11 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
|
|||||||
$urllogo = '';
|
$urllogo = '';
|
||||||
$urllogofull = '';
|
$urllogofull = '';
|
||||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
|
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);
|
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&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);
|
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
|
} 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);
|
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/'.$logo);
|
||||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/'.$logo);
|
||||||
}
|
}
|
||||||
// Output html code for logo
|
// Output html code for logo
|
||||||
if ($urllogo) {
|
if ($urllogo) {
|
||||||
|
|||||||
@ -75,6 +75,7 @@ if ($action == 'update') {
|
|||||||
$tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0);
|
$tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0);
|
||||||
$tmparray['USER_PUBLIC_HIDE_BIRTH'] = (GETPOST('USER_PUBLIC_HIDE_BIRTH') ? 1 : 0);
|
$tmparray['USER_PUBLIC_HIDE_BIRTH'] = (GETPOST('USER_PUBLIC_HIDE_BIRTH') ? 1 : 0);
|
||||||
$tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0);
|
$tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0);
|
||||||
|
$tmparray['USER_PUBLIC_HIDE_ADDRESS'] = (GETPOST('USER_PUBLIC_HIDE_ADDRESS') ? 1 : 0);
|
||||||
$tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 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') : '');
|
$tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : '');
|
||||||
|
|
||||||
@ -242,6 +243,13 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
|
|||||||
print $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_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";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
// Address
|
||||||
|
print '<tr class="oddeven" id="tredit"><td>';
|
||||||
|
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Address"));
|
||||||
|
print '</td><td>';
|
||||||
|
print $form->selectyesno("USER_PUBLIC_HIDE_ADDRESS", (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object) : 0), 1);
|
||||||
|
print "</td></tr>\n";
|
||||||
|
|
||||||
// Company name
|
// Company name
|
||||||
print '<tr class="oddeven" id="tramount"><td>';
|
print '<tr class="oddeven" id="tramount"><td>';
|
||||||
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection"));
|
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection"));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user