<?php
//$Id$ 
//gen openMairie le 20/08/2020 12:12

require_once "../gen/obj/document_numerise_nature.class.php";

class document_numerise_nature extends document_numerise_nature_gen {

    public function get_default_select_value() {
        $all_data = $this->get_all_data();
        foreach ($all_data as $data) {
            if ($data['default_value'] === 't') {
                return $data[$this->clePrimaire];
            }
        }
        return null;
    }

    protected function get_all_data() {
        $result = array();
        $query = sprintf('
            SELECT *
            FROM %1$sdocument_numerise_nature
            ORDER BY document_numerise_nature
            ',
            DB_PREFIXE
        );
        $res = $this->f->get_all_results_from_db_query($query, true);
        if ($res['code'] === 'KO') {
            return false;
        }
        $result = $res['result'];
        return $result;
    }

}
