<?php

class RechercheSi
{

    var $flg_blq = false;

    var $flg_new_si = false;

    var $flg_change = false;

    var $connecteur = null;

    var $lib_si = '';

    var $lib_cg = '';

    var $lib_cdc = '';

    var $lib_sca = '';

    var $codeSociete = '';

    function __construct()
    {
        $this->flg_axe_sca = Param::IsSCASecto();
        if (isset($_SESSION['Session_SocUsr']))
            $this->codeSociete = $_SESSION['Session_SocUsr'];
    }

    function setCodeSociete($codeSociete)
    {
        $this->codeSociete = $codeSociete;
    }

    function TrouveSi(& $SI_INIT_NEW, & $CG_INIT, & $CDC_INIT, & $SCA_INIT, $mode, $champ_modifie)
    {
        $this->flg_blq = false;
        $this->flg_change = false;
        $this->flg_new_si = false;
        if ($mode) {
            $SI_INIT_NEW = (isset($_SESSION['Init_SectionImputation'])) ? $_SESSION['Init_SectionImputation'] : '';
            $CG_INIT = (isset($_SESSION['Init_CG'])) ? $_SESSION['Init_CG'] : '';
            $CDC_INIT = (isset($_SESSION['Init_CDC'])) ? $_SESSION['Init_CDC'] : '';
            $SCA_INIT = (isset($_SESSION['Init_SCA'])) ? $_SESSION['Init_SCA'] : '';
            return;
        }
        // Si le champ modifié est de type SCA ou CDC alors on teste la validité de la valeur saisie
        if ('SCA_CODE' == $champ_modifie)
            SqlPanier::getListeSCA($this->codeSociete, $SCA_INIT, '', true);
        elseif ('CDC_CODE' == $champ_modifie)
            SqlPanier::getListeCDC($this->codeSociete, $CDC_INIT, '', true)->Trouve1();
    }
}