diff --git a/ChangeLog b/ChangeLog
index 31e97a634cf..c014d2890b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,10 @@ 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 #2814 ] JPEG photos are not displayed in Product photos page
Fix: [ bug #2715 ] Statistics page has broken layout with long thirdparty names
+Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
+Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter
+Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result
+Fix: [ bug #1791 ] Margin menu not available if any Finance module is not enabled
Fix: [ bug #3206 ] PropaleLigne, OrderLine and FactureLigne given to triggers through update function does not contain all the information
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 29480acd60d..421e98b7c2a 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -2877,11 +2877,12 @@ class PropaleLigne extends CommonObject
if (empty($this->total_localtax2)) $this->total_localtax2=0;
if (empty($this->rang)) $this->rang=0;
if (empty($this->remise)) $this->remise=0;
- if (empty($this->remise_percent)) $this->remise_percent=0;
+ if (empty($this->remise_percent) || ! is_numeric($this->remise_percent)) $this->remise_percent=0;
if (empty($this->info_bits)) $this->info_bits=0;
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
+ if (! is_numeric($this->qty)) $this->qty = 0;
if (empty($this->pa_ht)) $this->pa_ht=0;
diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php
index 5149eed9efb..c76655f5099 100644
--- a/htdocs/contact/exportimport.php
+++ b/htdocs/contact/exportimport.php
@@ -33,81 +33,80 @@ $id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
+$contact = new Contact($db);
+
/*
* View
*/
+$form = new Form($db);
+
$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');
-$form = new Form($db);
-
-$contact = new Contact($db);
-$contact->fetch($id, $user);
-
-
-$head = contact_prepare_head($contact);
-
-dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
-
-
-/*
- * Fiche en mode visu
- */
-print '
';
-
-$linkback = ''.$langs->trans("BackToList").'';
-
-// Ref
-print '| '.$langs->trans("Ref").' | ';
-print $form->showrefnav($contact, 'id', $linkback);
-print ' |
';
-
-// Name
-print '| '.$langs->trans("Lastname").' / '.$langs->trans("Label").' | '.$contact->lastname.' | ';
-print ''.$langs->trans("Firstname").' | '.$contact->firstname.' |
';
-
-// Company
-if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
+if ($id > 0)
{
- if ($contact->socid > 0)
- {
- $objsoc = new Societe($db);
- $objsoc->fetch($contact->socid);
+ $contact->fetch($id, $user);
- print '| '.$langs->trans("Company").' | '.$objsoc->getNomUrl(1).' |
';
- }
- else
- {
- print '| '.$langs->trans("Company").' | ';
- print $langs->trans("ContactNotLinkedToCompany");
- print ' |
';
- }
+ $head = contact_prepare_head($contact);
+
+ dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
+
+
+ /*
+ * Fiche en mode visu
+ */
+ print '';
+
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ print $form->showrefnav($contact, 'id', $linkback);
+ print ' |
';
+
+ // Name
+ print '| '.$langs->trans("Lastname").' / '.$langs->trans("Label").' | '.$contact->lastname.' | ';
+ print ''.$langs->trans("Firstname").' | '.$contact->firstname.' |
';
+
+ // Company
+ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
+ {
+ if ($contact->socid > 0)
+ {
+ $objsoc = new Societe($db);
+ $objsoc->fetch($contact->socid);
+
+ print '| '.$langs->trans("Company").' | '.$objsoc->getNomUrl(1).' |
';
+ }
+ else
+ {
+ print '| '.$langs->trans("Company").' | ';
+ print $langs->trans("ContactNotLinkedToCompany");
+ print ' |
';
+ }
+ }
+
+ // Civility
+ print '| '.$langs->trans("UserTitle").' | ';
+ print $contact->getCivilityLabel();
+ print ' |
';
+
+ print '
';
+
+ print '';
+
+ print '
';
+
+ print $langs->trans("ExportCardToFormat").': ';
+ print '';
+ print img_picto($langs->trans("VCard"),'vcard.png').' ';
+ print $langs->trans("VCard");
+ print '';
}
-// Civility
-print '| '.$langs->trans("UserTitle").' | ';
-print $contact->getCivilityLabel();
-print ' |
';
-
-print '
';
-
-print '';
-
-print '
';
-
-print $langs->trans("ExportCardToFormat").': ';
-print '';
-print img_picto($langs->trans("VCard"),'vcard.png').' ';
-print $langs->trans("VCard");
-print '';
-
-
-
-
$db->close();
llxFooter();
-?>
diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php
index 3ac6747bb6b..5d4904faa87 100644
--- a/htdocs/contact/info.php
+++ b/htdocs/contact/info.php
@@ -35,6 +35,8 @@ $contactid = GETPOST("id",'int');
if ($user->societe_id) $socid=$user->societe_id;
$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');
+if ($contactid > 0)
+{
+ $result = $contact->fetch($contactid, $user);
-$contact = new Contact($db);
-$contact->fetch($contactid, $user);
-$contact->info($contactid);
+ $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 '';
+ print '';
-dol_print_object_info($contact);
+ dol_print_object_info($contact);
-print "";
+ print "";
+}
llxFooter();
$db->close();
-?>
diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php
index f284ee1834d..79e6246fc60 100644
--- a/htdocs/contact/ldap.php
+++ b/htdocs/contact/ldap.php
@@ -40,37 +40,40 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db);
-$contact->fetch($id, $user);
-
-/*
- * Actions
- */
-
-if ($action == 'dolibarr2ldap')
+if ($id > 0)
{
- $message="";
+ $contact->fetch($id, $user);
- $db->begin();
+ /*
+ * Actions
+ */
- $ldap=new Ldap();
- $result=$ldap->connect_bind();
-
- $info=$contact->_load_ldap_info();
- $dn=$contact->_load_ldap_dn($info);
- $olddn=$dn; // We can say that old dn = dn as we force synchro
-
- $result=$ldap->update($dn,$info,$user,$olddn);
-
- if ($result >= 0)
+ if ($action == 'dolibarr2ldap')
{
- $message.=''.$langs->trans("ContactSynchronized").'
';
- $db->commit();
- }
- else
- {
- $message.=''.$ldap->error.'
';
- $db->rollback();
+ $message="";
+
+ $db->begin();
+
+ $ldap=new Ldap();
+ $result=$ldap->connect_bind();
+
+ $info=$contact->_load_ldap_info();
+ $dn=$contact->_load_ldap_dn($info);
+ $olddn=$dn; // We can say that old dn = dn as we force synchro
+
+ $result=$ldap->update($dn,$info,$user,$olddn);
+
+ if ($result >= 0)
+ {
+ $message.=''.$langs->trans("ContactSynchronized").'
';
+ $db->commit();
+ }
+ else
+ {
+ $message.=''.$ldap->error.'
';
+ $db->rollback();
+ }
}
}
@@ -79,138 +82,139 @@ if ($action == 'dolibarr2ldap')
* View
*/
+$form = new Form($db);
+
$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');
-$form = new Form($db);
-
-$head = contact_prepare_head($contact);
-
-dol_fiche_head($head, 'ldap', $title, 0, 'contact');
-
-
-print '';
-
-// Ref
-print '| '.$langs->trans("Ref").' | ';
-print $form->showrefnav($contact,'id');
-print ' |
';
-
-// Name
-print '| '.$langs->trans("Lastname").' / '.$langs->trans("Label").' | '.$contact->lastname.' | ';
-print ''.$langs->trans("Firstname").' | '.$contact->firstname.' |
';
-
-// Company
-if ($contact->socid > 0)
+if ($id > 0)
{
- $objsoc = new Societe($db);
- $objsoc->fetch($contact->socid);
+ $head = contact_prepare_head($contact);
- print '| '.$langs->trans("Company").' | '.$objsoc->getNomUrl(1).' |
';
-}
-else
-{
- print '| '.$langs->trans("Company").' | ';
- print $langs->trans("ContactNotLinkedToCompany");
+ dol_fiche_head($head, 'ldap', $title, 0, 'contact');
+
+
+ print '';
+
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ print $form->showrefnav($contact,'id');
print ' | ';
-}
-// Civility
-print '| '.$langs->trans("UserTitle").' | ';
-print $contact->getCivilityLabel();
-print ' | ';
+ // Name
+ print '| '.$langs->trans("Lastname").' / '.$langs->trans("Label").' | '.$contact->lastname.' | ';
+ print ''.$langs->trans("Firstname").' | '.$contact->firstname.' | ';
-// LDAP DN
-print '| LDAP '.$langs->trans("LDAPContactDn").' | '.$conf->global->LDAP_CONTACT_DN." | \n";
-
-// LDAP Cle
-print '| LDAP '.$langs->trans("LDAPNamingAttribute").' | '.$conf->global->LDAP_KEY_CONTACTS." | \n";
-
-// LDAP Server
-print '| LDAP '.$langs->trans("LDAPPrimaryServer").' | '.$conf->global->LDAP_SERVER_HOST." | \n";
-print '| LDAP '.$langs->trans("LDAPSecondaryServer").' | '.$conf->global->LDAP_SERVER_HOST_SLAVE." | \n";
-print '| LDAP '.$langs->trans("LDAPServerPort").' | '.$conf->global->LDAP_SERVER_PORT." | \n";
-
-print ' ';
-
-print '';
-
-
-dol_htmloutput_mesg($message);
-
-
-/*
- * Barre d'actions
- */
-
-print '\n";
-
-if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print " \n";
-
-
-
-// Affichage attributs LDAP
-print_titre($langs->trans("LDAPInformationsForThisContact"));
-
-print '';
-
-print '';
-print '| '.$langs->trans("LDAPAttributes").' | ';
-print ''.$langs->trans("Value").' | ';
-print ' ';
-
-// Lecture LDAP
-$ldap=new Ldap();
-$result=$ldap->connect_bind();
-if ($result > 0)
-{
- $info=$contact->_load_ldap_info();
- $dn=$contact->_load_ldap_dn($info,1);
- $search = "(".$contact->_load_ldap_dn($info,2).")";
- $records=$ldap->getAttribute($dn,$search);
-
- //var_dump($records);
-
- // Affichage arbre
- if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
+ // Company
+ if ($contact->socid > 0)
{
- if (! is_array($records))
- {
- print '| '.$langs->trans("ErrorFailedToReadLDAP").' | ';
- }
- else
- {
- $result=show_ldap_content($records,0,$records['count'],true);
- }
+ $objsoc = new Societe($db);
+ $objsoc->fetch($contact->socid);
+
+ print '| '.$langs->trans("Company").' | '.$objsoc->getNomUrl(1).' | ';
}
else
{
- print '| '.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.') | ';
+ print '| '.$langs->trans("Company").' | ';
+ print $langs->trans("ContactNotLinkedToCompany");
+ print ' | ';
}
- $ldap->unbind();
- $ldap->close();
+ // Civility
+ print '| '.$langs->trans("UserTitle").' | ';
+ print $contact->getCivilityLabel();
+ print ' | ';
+
+ // LDAP DN
+ print '| LDAP '.$langs->trans("LDAPContactDn").' | '.$conf->global->LDAP_CONTACT_DN." | \n";
+
+ // LDAP Cle
+ print '| LDAP '.$langs->trans("LDAPNamingAttribute").' | '.$conf->global->LDAP_KEY_CONTACTS." | \n";
+
+ // LDAP Server
+ print '| LDAP '.$langs->trans("LDAPPrimaryServer").' | '.$conf->global->LDAP_SERVER_HOST." | \n";
+ print '| LDAP '.$langs->trans("LDAPSecondaryServer").' | '.$conf->global->LDAP_SERVER_HOST_SLAVE." | \n";
+ print '| LDAP '.$langs->trans("LDAPServerPort").' | '.$conf->global->LDAP_SERVER_PORT." | \n";
+
+ print ' ';
+
+ print '';
+
+
+ dol_htmloutput_mesg($message);
+
+
+ /*
+ * Barre d'actions
+ */
+
+ print '\n";
+
+ if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print " \n";
+
+
+
+ // Affichage attributs LDAP
+ print_titre($langs->trans("LDAPInformationsForThisContact"));
+
+ print '';
+
+ print '';
+ print '| '.$langs->trans("LDAPAttributes").' | ';
+ print ''.$langs->trans("Value").' | ';
+ print ' ';
+
+ // Lecture LDAP
+ $ldap=new Ldap();
+ $result=$ldap->connect_bind();
+ if ($result > 0)
+ {
+ $info=$contact->_load_ldap_info();
+ $dn=$contact->_load_ldap_dn($info,1);
+ $search = "(".$contact->_load_ldap_dn($info,2).")";
+ $records=$ldap->getAttribute($dn,$search);
+
+ //var_dump($records);
+
+ // Affichage arbre
+ if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
+ {
+ if (! is_array($records))
+ {
+ print '| '.$langs->trans("ErrorFailedToReadLDAP").' | ';
+ }
+ else
+ {
+ $result=show_ldap_content($records,0,$records['count'],true);
+ }
+ }
+ else
+ {
+ print '| '.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.') | ';
+ }
+
+ $ldap->unbind();
+ $ldap->close();
+ }
+ else
+ {
+ dol_print_error('',$ldap->error);
+ }
+
+
+ print ' ';
+
}
-else
-{
- dol_print_error('',$ldap->error);
-}
-
-
-print ' |
';
-
-
$db->close();
llxFooter();
-?>
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index 86462d05fae..bd74fc75ef8 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -38,210 +38,213 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
-/*
- * Action
- */
+$result = $object->fetch($id, $user);
-if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
+if ($id > 0)
{
- $ret = $object->fetch($id);
+ /*
+ * Action
+ */
- // 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_alert = $_POST["birthday_alert"];
+ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
+ {
+ // 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_alert = $_POST["birthday_alert"];
- $result = $object->update_perso($id, $user);
- if ($result > 0)
- {
- $object->old_name='';
- $object->old_firstname='';
- }
- else
- {
- $error = $object->error;
- }
+ $result = $object->update_perso($id, $user);
+ if ($result > 0)
+ {
+ $object->old_name='';
+ $object->old_firstname='';
+ }
+ else
+ {
+ $error = $object->error;
+ }
+ }
}
-
/*
* View
*/
+$form = new Form($db);
+
$now=dol_now();
$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');
-$form = new Form($db);
-
-$object->fetch($id, $user);
-
-$head = contact_prepare_head($object);
-
-dol_fiche_head($head, 'perso', $title, 0, 'contact');
-
-if ($action == 'edit')
+if ($id > 0)
{
- /*
- * Fiche en mode edition
- */
+ $head = contact_prepare_head($object);
- print '