<commit_before><?php
class ChgtDenomValidation extends DocumentValidation
{
    const TYPE_ERROR = 'erreur';

    protected $etablissement = null;
    protected $produit_revendication_rendement = array();

    public function __construct($document, $options = null)
    {
        $this->etablissement = $document->getEtablissementObject();
        parent::__construct($document, $options);
        $this->noticeVigilance = true;
    }

    public function configure()
    {
        $this->addControle(self::TYPE_ERROR, 'lot_volume', "Le volume saisi est supérieur au volume initial.");

    }

    public function controle()
    {
        $this->controleLots();
    }

    protected function controleLots(){
        $produits = [];

      if($this->document->exist('lots')){
        foreach ($this->document->lots as $key => $lot) {
          $lot_origine = $this->getLotDocById_unique();
          $volume = sprintf("%01.02f",$lot->getVolume());
          if($lot->volume > $lot_origine->volume){
            $this->addPoint(self::TYPE_ERROR, 'lot_volume', $lot->getProduitLibelle()." $lot->millesime ( ".$volume." hl )", $this->generateUrl('chgtdenom_edition', array("id" => $this->document->_id, "appellation" => $key)));
          }
      }
    }
  }

  protected function getLotDocById_unique(){
    $doc_origine = acCouchdbManager::getClient()->find($this->document->changement_origine_id_document);
    foreach ($doc_origine->lots as $key => $lot_origine) {
      if($this->document->changement_origine_lot_unique_id == $lot_origine->unique_id)
        return $lot_origine;
    }
  }

}<commit_msg>Gestion du Cas: ChgtDenom sans lot_origine<commit_after><?php
class ChgtDenomValidation extends DocumentValidation
{
    const TYPE_ERROR = 'erreur';

    protected $etablissement = null;
    protected $produit_revendication_rendement = array();

    public function __construct($document, $options = null)
    {
        $this->etablissement = $document->getEtablissementObject();
        parent::__construct($document, $options);
        $this->noticeVigilance = true;
    }

    public function configure()
    {
        $this->addControle(self::TYPE_ERROR, 'lot_volume', "Le volume saisi est supérieur au volume initial.");

    }

    public function controle()
    {
        $this->controleLots();
    }

    protected function controleLots(){
        $produits = [];

      if($this->document->exist('lots')){
        foreach ($this->document->lots as $key => $lot) {
          $lot_origine = $this->getLotDocById_unique();
          $volume = sprintf("%01.02f",$lot->getVolume());

          if($lot->volume > $lot_origine->volume && $lot_origine !== null ){ 
            $this->addPoint(self::TYPE_ERROR, 'lot_volume', $lot->getProduitLibelle()." $lot->millesime ( ".$volume." hl )", $this->generateUrl('chgtdenom_edition', array("id" => $this->document->_id, "appellation" => $key)));
          }
      }
    }
  }

  protected function getLotDocById_unique(){
    $doc_origine = acCouchdbManager::getClient()->find($this->document->changement_origine_id_document);
    foreach ($doc_origine->lots as $key => $lot_origine) {
      if($this->document->changement_origine_lot_unique_id == $lot_origine->unique_id)
        return $lot_origine;
    }

  }

}
{'fraction_non_alphanumeric': 0.15452876376988983, 'fraction_numerical': 0.0024479804161566705, 'mean_word_length': 3.3938172043010755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7663371', 'n_tokens_mistral': 1022, 'n_tokens_neox': 1028, 'n_words': 173}