Ajout gestion de notion de contact facturation
This commit is contained in:
parent
06e6dea8fc
commit
fcfc435df9
@ -29,7 +29,8 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require (DOL_DOCUMENT_ROOT."/lib/ldap.lib.php");
|
require_once (DOL_DOCUMENT_ROOT."/lib/ldap.lib.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \class Contact
|
/*! \class Contact
|
||||||
@ -270,15 +271,18 @@ class Contact
|
|||||||
*/
|
*/
|
||||||
function update_perso($id, $user=0)
|
function update_perso($id, $user=0)
|
||||||
{
|
{
|
||||||
# Mis a jour contact
|
// Mis a jour contact
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET idp=$id ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET idp=$id ";
|
||||||
|
|
||||||
if ($this->birthday>0) {
|
if ($this->birthday>0)
|
||||||
if (eregi('\-',$this->birthday)) {
|
{
|
||||||
|
if (eregi('\-',$this->birthday))
|
||||||
|
{
|
||||||
// Si date = chaine
|
// Si date = chaine
|
||||||
$sql .= ", birthday='".$this->birthday."'";
|
$sql .= ", birthday='".$this->birthday."'";
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// Si date = timestamp
|
// Si date = timestamp
|
||||||
$sql .= ", birthday=".$this->db->idate($this->birthday);
|
$sql .= ", birthday=".$this->db->idate($this->birthday);
|
||||||
}
|
}
|
||||||
@ -291,11 +295,14 @@ class Contact
|
|||||||
print $this->db->error() . '<br>' . $sql;
|
print $this->db->error() . '<br>' . $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mis a jour alerte birthday
|
// Mis a jour alerte birthday
|
||||||
if ($this->birthday_alert) {
|
if ($this->birthday_alert)
|
||||||
|
{
|
||||||
$sql = "INSERT into ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) ";
|
$sql = "INSERT into ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) ";
|
||||||
$sql.= "values (1,".$id.",".$user->id.")";
|
$sql.= "values (1,".$id.",".$user->id.")";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."user_alert ";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."user_alert ";
|
||||||
$sql.= "where type=1 AND fk_contact=".$id." AND fk_user=".$user->id;
|
$sql.= "where type=1 AND fk_contact=".$id." AND fk_user=".$user->id;
|
||||||
}
|
}
|
||||||
@ -373,6 +380,24 @@ class Contact
|
|||||||
}
|
}
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT count(*) ";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."contact_facture";
|
||||||
|
$sql .= " WHERE fk_contact = ". $_id;
|
||||||
|
|
||||||
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows())
|
||||||
|
{
|
||||||
|
$this->facturation = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->facturation = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->db->free();
|
||||||
|
|
||||||
if ($user)
|
if ($user)
|
||||||
{
|
{
|
||||||
$sql = "SELECT fk_user";
|
$sql = "SELECT fk_user";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user