'id', 'nom' => 'name', 'name_alias' => 'alias', 'address' => 'address', 'zip' => 'zip', 'town' => 'city', 'fk_pays' => 'country', 'phone' => 'phone', 'email' => 'email', 'url' => 'website', 'siren' => 'siren', 'siret' => 'siret', 'tva_intra' => 'vat_number', 'logo' => 'logo', 'status' => 'status', 'date_creation' => 'created_at', // Extrafields 'options_category' => 'category' ]; protected $parentFieldsOverride = [ 'logo' => ['type' => 'image'] ]; public function __construct() { global $langs; $langs->load("companies"); $this->boot(); } /** * Logo en base64 */ public function fieldFilterValueLogo($object) { global $conf; if (empty($object->logo)) { return null; } $dir = $conf->societe->multidir_output[$object->entity]; $path = $dir . "/" . $object->id . "/logos/" . $object->logo; if (!file_exists($path)) { return null; } $ext = pathinfo($path, PATHINFO_EXTENSION); $content = file_get_contents($path); return 'data:image/' . $ext . ';base64,' . base64_encode($content); } /** * Statut en texte */ public function fieldFilterValueStatus($object) { return $object->status == 1 ? 'active' : 'inactive'; } }