method add documentation in bbn\Entities\People

function($fn, $force = false) { //$id = false; $fields = array_keys($this->db->getColumns('bbn_people')); $extra_fields = []; $not_cfg = ['id_lieu', 'roles', 'id_adherent', 'fnom', 'fonctions', 'licence', 'montant', 'parts', 'effet', 'adherents', 'types_liens', 'id_option', 'suggestions', 'relations', 'ffnom', 'id_tier_ext', 'wp_group', 'is_admin']; $wp_group = false; $id_adh = false; if ($fn = $this->set_info($fn)) { if ($force) { foreach ($fn as $k => $v) { if (!in_array($k, $fields)) { //properties arriving in $fn but not to insert in cfg column of bbn_people if ($fn[$k] && !in_array($k, $not_cfg)) { if (($k !== 'inscriptions') || (!empty($v) && \bbn\Str::isEmail($fn['email']))) { $fn['cfg'][$k] = $fn[$k]; } } if ($k === 'wp_group') { $wp_group = $v; } if ($k === 'id_adherent') { $id_adh = $v; } unset($fn[$k]); } } $fn['cfg'] = !empty($fn['cfg']) ? json_encode($fn['cfg']) : null; if (isset($fn['id']) && ($fn['id'] === '')) { unset($fn['id']); } if ($this->db->insert("bbn_people", $fn)) { $id = $this->db->lastId(); if (!empty($wp_group) && !empty($id_adh)) { $adh = new \apst\adherent($this->db, $id_adh); if ($adh->check()) { $adh->wps_add_contact( [ 'id' => $id, 'group' => $wp_group, 'email' => $fn['email'], 'nom' => $this->db->selectOne('bbn_people', 'fullname', ['id' => $id]) ] ); } } } } return $id; } return false; }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.