Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
This commit is contained in:
parent
d422fac3fe
commit
8d7c1f8d4c
@ -23,6 +23,7 @@ Fix: [ bug #2837 ] Product list table column header does not match column body
|
|||||||
Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order
|
Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order
|
||||||
Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page
|
Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page
|
||||||
Fix: [ bug #2715 ] Statistics page has broken layout with long thirdparty names
|
Fix: [ bug #2715 ] Statistics page has broken layout with long thirdparty names
|
||||||
|
Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
|
||||||
|
|
||||||
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
||||||
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
||||||
|
|||||||
@ -33,45 +33,47 @@ $id = GETPOST('id', 'int');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||||
|
|
||||||
|
$contact = new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||||
|
|
||||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||||
|
|
||||||
$form = new Form($db);
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$contact->fetch($id, $user);
|
||||||
|
|
||||||
$contact = new Contact($db);
|
$head = contact_prepare_head($contact);
|
||||||
$contact->fetch($id, $user);
|
|
||||||
|
dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
|
||||||
|
|
||||||
|
|
||||||
$head = contact_prepare_head($contact);
|
/*
|
||||||
|
|
||||||
dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fiche en mode visu
|
* Fiche en mode visu
|
||||||
*/
|
*/
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||||
print $form->showrefnav($contact, 'id', $linkback);
|
print $form->showrefnav($contact, 'id', $linkback);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
||||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||||
{
|
{
|
||||||
if ($contact->socid > 0)
|
if ($contact->socid > 0)
|
||||||
{
|
{
|
||||||
$objsoc = new Societe($db);
|
$objsoc = new Societe($db);
|
||||||
@ -85,29 +87,26 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
|||||||
print $langs->trans("ContactNotLinkedToCompany");
|
print $langs->trans("ContactNotLinkedToCompany");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Civility
|
||||||
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||||
|
print $contact->getCivilityLabel();
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print $langs->trans("ExportCardToFormat").': ';
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$contact->id.'">';
|
||||||
|
print img_picto($langs->trans("VCard"),'vcard.png').' ';
|
||||||
|
print $langs->trans("VCard");
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Civility
|
|
||||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
|
||||||
print $contact->getCivilityLabel();
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print $langs->trans("ExportCardToFormat").': ';
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$contact->id.'">';
|
|
||||||
print img_picto($langs->trans("VCard"),'vcard.png').' ';
|
|
||||||
print $langs->trans("VCard");
|
|
||||||
print '</a>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
?>
|
|
||||||
|
|||||||
@ -35,6 +35,8 @@ $contactid = GETPOST("id",'int');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
|
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
|
||||||
|
|
||||||
|
$contact = new Contact($db);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -43,25 +45,26 @@ $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
|
|||||||
|
|
||||||
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||||
|
|
||||||
|
if ($contactid > 0)
|
||||||
|
{
|
||||||
|
$result = $contact->fetch($contactid, $user);
|
||||||
|
|
||||||
$contact = new Contact($db);
|
$contact->info($contactid);
|
||||||
$contact->fetch($contactid, $user);
|
|
||||||
$contact->info($contactid);
|
|
||||||
|
|
||||||
|
|
||||||
$head = contact_prepare_head($contact);
|
$head = contact_prepare_head($contact);
|
||||||
|
|
||||||
dol_fiche_head($head, 'info', $langs->trans("ContactsAddresses"), 0, 'contact');
|
dol_fiche_head($head, 'info', $langs->trans("ContactsAddresses"), 0, 'contact');
|
||||||
|
|
||||||
|
|
||||||
print '<table width="100%"><tr><td>';
|
print '<table width="100%"><tr><td>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
dol_print_object_info($contact);
|
dol_print_object_info($contact);
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
|
||||||
|
|||||||
@ -40,15 +40,17 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||||
|
|
||||||
$contact = new Contact($db);
|
$contact = new Contact($db);
|
||||||
$contact->fetch($id, $user);
|
|
||||||
|
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$contact->fetch($id, $user);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'dolibarr2ldap')
|
if ($action == 'dolibarr2ldap')
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -72,6 +74,7 @@ if ($action == 'dolibarr2ldap')
|
|||||||
$message.='<div class="error">'.$ldap->error.'</div>';
|
$message.='<div class="error">'.$ldap->error.'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -79,99 +82,101 @@ if ($action == 'dolibarr2ldap')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||||
|
|
||||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||||
|
|
||||||
$form = new Form($db);
|
if ($id > 0)
|
||||||
|
|
||||||
$head = contact_prepare_head($contact);
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'ldap', $title, 0, 'contact');
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
// Ref
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
|
||||||
print $form->showrefnav($contact,'id');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Name
|
|
||||||
print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
|
||||||
print '<td>'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
|
||||||
|
|
||||||
// Company
|
|
||||||
if ($contact->socid > 0)
|
|
||||||
{
|
{
|
||||||
|
$head = contact_prepare_head($contact);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'ldap', $title, 0, 'contact');
|
||||||
|
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||||
|
print $form->showrefnav($contact,'id');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Name
|
||||||
|
print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
||||||
|
print '<td>'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
||||||
|
|
||||||
|
// Company
|
||||||
|
if ($contact->socid > 0)
|
||||||
|
{
|
||||||
$objsoc = new Societe($db);
|
$objsoc = new Societe($db);
|
||||||
$objsoc->fetch($contact->socid);
|
$objsoc->fetch($contact->socid);
|
||||||
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">';
|
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">';
|
||||||
print $langs->trans("ContactNotLinkedToCompany");
|
print $langs->trans("ContactNotLinkedToCompany");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Civility
|
// Civility
|
||||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||||
print $contact->getCivilityLabel();
|
print $contact->getCivilityLabel();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// LDAP DN
|
// LDAP DN
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_CONTACT_DN."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_CONTACT_DN."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Cle
|
// LDAP Cle
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_KEY_CONTACTS."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_KEY_CONTACTS."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Server
|
// LDAP Server
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_htmloutput_mesg($message);
|
dol_htmloutput_mesg($message);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr')
|
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr')
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$contact->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$contact->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print "<br>\n";
|
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Affichage attributs LDAP
|
// Affichage attributs LDAP
|
||||||
print_titre($langs->trans("LDAPInformationsForThisContact"));
|
print_titre($langs->trans("LDAPInformationsForThisContact"));
|
||||||
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("LDAPAttributes").'</td>';
|
print '<td>'.$langs->trans("LDAPAttributes").'</td>';
|
||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Lecture LDAP
|
// Lecture LDAP
|
||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$info=$contact->_load_ldap_info();
|
$info=$contact->_load_ldap_info();
|
||||||
$dn=$contact->_load_ldap_dn($info,1);
|
$dn=$contact->_load_ldap_dn($info,1);
|
||||||
$search = "(".$contact->_load_ldap_dn($info,2).")";
|
$search = "(".$contact->_load_ldap_dn($info,2).")";
|
||||||
@ -198,19 +203,18 @@ if ($result > 0)
|
|||||||
|
|
||||||
$ldap->unbind();
|
$ldap->unbind();
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error('',$ldap->error);
|
dol_print_error('',$ldap->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
?>
|
|
||||||
|
|||||||
@ -38,14 +38,16 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||||
$object = new Contact($db);
|
$object = new Contact($db);
|
||||||
|
|
||||||
/*
|
$result = $object->fetch($id, $user);
|
||||||
|
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
|
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
|
||||||
{
|
{
|
||||||
$ret = $object->fetch($id);
|
|
||||||
|
|
||||||
// Note: Correct date should be completed with location to have exact GM time of birth.
|
// Note: Correct date should be completed with location to have exact GM time of birth.
|
||||||
$object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
|
$object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
|
||||||
$object->birthday_alert = $_POST["birthday_alert"];
|
$object->birthday_alert = $_POST["birthday_alert"];
|
||||||
@ -60,29 +62,29 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
|
|||||||
{
|
{
|
||||||
$error = $object->error;
|
$error = $object->error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||||
|
|
||||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||||
|
|
||||||
$form = new Form($db);
|
if ($id > 0)
|
||||||
|
|
||||||
$object->fetch($id, $user);
|
|
||||||
|
|
||||||
$head = contact_prepare_head($object);
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'perso', $title, 0, 'contact');
|
|
||||||
|
|
||||||
if ($action == 'edit')
|
|
||||||
{
|
{
|
||||||
|
$head = contact_prepare_head($object);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'perso', $title, 0, 'contact');
|
||||||
|
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Fiche en mode edition
|
* Fiche en mode edition
|
||||||
*/
|
*/
|
||||||
@ -152,9 +154,9 @@ if ($action == 'edit')
|
|||||||
print '</center>';
|
print '</center>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Fiche en mode visu
|
* Fiche en mode visu
|
||||||
*/
|
*/
|
||||||
@ -225,12 +227,12 @@ else
|
|||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
if ($action != 'edit')
|
if ($action != 'edit')
|
||||||
{
|
{
|
||||||
// Barre d'actions
|
// Barre d'actions
|
||||||
if ($user->societe_id == 0)
|
if ($user->societe_id == 0)
|
||||||
{
|
{
|
||||||
@ -243,10 +245,10 @@ if ($action != 'edit')
|
|||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
|
||||||
|
|||||||
@ -35,40 +35,43 @@ $id = GETPOST('id', 'int');
|
|||||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||||
|
|
||||||
$contact = new Contact($db);
|
$contact = new Contact($db);
|
||||||
$result=$contact->fetch($id);
|
|
||||||
|
|
||||||
$physicalperson=1;
|
if ($id > 0)
|
||||||
|
|
||||||
$company = new Societe($db);
|
|
||||||
if ($contact->socid)
|
|
||||||
{
|
{
|
||||||
|
$result=$contact->fetch($id);
|
||||||
|
|
||||||
|
$physicalperson=1;
|
||||||
|
|
||||||
|
$company = new Societe($db);
|
||||||
|
if ($contact->socid)
|
||||||
|
{
|
||||||
$result=$company->fetch($contact->socid);
|
$result=$company->fetch($contact->socid);
|
||||||
//print "ee";
|
//print "ee";
|
||||||
}
|
}
|
||||||
|
|
||||||
// We create VCard
|
// We create VCard
|
||||||
$v = new vCard();
|
$v = new vCard();
|
||||||
$v->setProdId('Dolibarr '.DOL_VERSION);
|
$v->setProdId('Dolibarr '.DOL_VERSION);
|
||||||
|
|
||||||
$v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
|
$v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
|
||||||
$v->setName($contact->lastname, $contact->firstname, "", "", "");
|
$v->setName($contact->lastname, $contact->firstname, "", "", "");
|
||||||
$v->setFormattedName($contact->getFullName($langs));
|
$v->setFormattedName($contact->getFullName($langs));
|
||||||
|
|
||||||
// By default, all informations are for work (except phone_perso and phone_mobile)
|
// By default, all informations are for work (except phone_perso and phone_mobile)
|
||||||
$v->setPhoneNumber($contact->phone_pro, "PREF;WORK;VOICE");
|
$v->setPhoneNumber($contact->phone_pro, "PREF;WORK;VOICE");
|
||||||
$v->setPhoneNumber($contact->phone_mobile, "CELL;VOICE");
|
$v->setPhoneNumber($contact->phone_mobile, "CELL;VOICE");
|
||||||
$v->setPhoneNumber($contact->fax, "WORK;FAX");
|
$v->setPhoneNumber($contact->fax, "WORK;FAX");
|
||||||
|
|
||||||
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK;POSTAL");
|
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK;POSTAL");
|
||||||
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK");
|
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK");
|
||||||
$v->setEmail($contact->email,'internet,pref');
|
$v->setEmail($contact->email,'internet,pref');
|
||||||
$v->setNote($contact->note);
|
$v->setNote($contact->note);
|
||||||
|
|
||||||
$v->setTitle($contact->poste);
|
$v->setTitle($contact->poste);
|
||||||
|
|
||||||
// Data from linked company
|
// Data from linked company
|
||||||
if ($company->id)
|
if ($company->id)
|
||||||
{
|
{
|
||||||
$v->setURL($company->url, "WORK");
|
$v->setURL($company->url, "WORK");
|
||||||
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "WORK;VOICE");
|
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "WORK;VOICE");
|
||||||
if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX");
|
if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX");
|
||||||
@ -76,29 +79,28 @@ if ($company->id)
|
|||||||
if ($company->email != $contact->email) $v->setEmail($company->email,'internet');
|
if ($company->email != $contact->email) $v->setEmail($company->email,'internet');
|
||||||
// Si contact lie a un tiers non de type "particulier"
|
// Si contact lie a un tiers non de type "particulier"
|
||||||
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->nom);
|
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->nom);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Personal informations
|
||||||
|
$v->setPhoneNumber($contact->phone_perso, "HOME;VOICE");
|
||||||
|
if ($contact->birthday) $v->setBirthday($contact->birthday);
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
|
||||||
|
// Renvoi la VCard au navigateur
|
||||||
|
|
||||||
|
$output = $v->getVCard();
|
||||||
|
|
||||||
|
$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
|
||||||
|
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
||||||
|
//$filename = dol_sanitizeFileName($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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Personal informations
|
|
||||||
$v->setPhoneNumber($contact->phone_perso, "HOME;VOICE");
|
|
||||||
if ($contact->birthday) $v->setBirthday($contact->birthday);
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
|
|
||||||
// Renvoi la VCard au navigateur
|
|
||||||
|
|
||||||
$output = $v->getVCard();
|
|
||||||
|
|
||||||
$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
|
|
||||||
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
|
||||||
//$filename = dol_sanitizeFileName($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;
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user