Skip to content

Commit

Permalink
fix set entity
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Nov 21, 2024
1 parent b381a6c commit 7c229fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion htdocs/adherents/class/adherent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,9 @@ public function create($user, $notrigger = 0)
}
}

// setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active
$this->entity = setEntity($this);

$this->db->begin();

// Insert member
Expand All @@ -658,7 +661,7 @@ public function create($user, $notrigger = 0)
$sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
$sql .= ", null, null, '".$this->db->escape($this->morphy)."'";
$sql .= ", ".((int) $this->typeid);
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $this->entity);
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
$sql .= ", ".(!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null");
$sql .= ")";
Expand Down
3 changes: 2 additions & 1 deletion htdocs/contact/class/contact.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ public function create($user, $notrigger = 0)
$this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
}

$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
// setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active
$this->entity = setEntity($this);

$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
$sql .= " datec";
Expand Down

0 comments on commit 7c229fe

Please sign in to comment.