Changeset 1414


Ignore:
Timestamp:
Sep 25, 2010, 9:55:49 PM (10 years ago)
Author:
teymour
Message:

Bug du index_if

Location:
cpc/trunk/project/lib/model
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/lib/model/doctrine/Commentaire.class.php

    r1377 r1414  
    1111  }
    1212  public function getPersonne() {
    13     return $this->getCitoyen()->getLogin();
     13    if ($this->getCitoyen())
     14      return $this->getCitoyen()->getLogin();
     15    return '';
    1416  }
    1517  public function getTitre() {
     
    8082
    8183  public function updateNbCommentaires($inc = 0) {
    82     $o = Doctrine::getTable($this->object_type)->find($this->object_id);
    83     $o->updateNbCommentaires($inc);
     84    if ($this->object_type) {
     85      $o = Doctrine::getTable($this->object_type)->find($this->object_id);
     86      $o->updateNbCommentaires($inc);
     87    }
    8488    foreach ($this->getObjects() as $object) {
    8589      $o = Doctrine::getTable($object->object_type)->find($object->object_id);
     
    8993  }
    9094
    91   public function setIsPublic($b) {
    92     $this->_set('is_public', $b);
    93     if ($this->id) {
    94       $this->updateNbCommentaires(($b) ? 1 : -1);
    95     }
    96   }
    9795  public function getLien() {
    9896    return preg_replace('/@amendement\?id=/', '@amendement_id?id=', $this->_get('lien'));
    9997  }
     98
     99  public function save(Doctrine_Connection $c = null) {
     100    parent::save($c);
     101    $b = $this->is_public;
     102    $this->updateNbCommentaires(($b) ? 1 : -1);
     103  }
    100104}
  • cpc/trunk/project/lib/model/doctrine/ParlementairePhoto.class.php

    r1407 r1414  
    1919    return base64_decode($this->_get('photo'));
    2020  }
    21   public function save(Doctrine_Connection $c = null) {
    22     return parent::save($c);
    23   }
    2421}
  • cpc/trunk/project/lib/model/solr/SolrListener.php

    r1405 r1414  
    7272
    7373    $t = null;
    74     if (isset( $this->_options['index_if']) && $t = $this->_options['index_if'] && $t && !$obj->get($t))
    75       return ;
     74    if (isset( $this->_options['index_if']) && $t = $this->_options['index_if']) {
     75      if (!($obj->get($t))) {
     76        return $this->postDelete($event);
     77      }
     78    }
    7679   
    7780    $json = array();
     
    7982    $json['object_id'] =  $obj->getId();
    8083    $json['object_name'] = get_class($obj);
    81    
    8284    if (isset($this->_options['description']) && $t = $this->_options['description']) {
    8385      $content = $this->getObjFieldsValue($obj, $t);
Note: See TracChangeset for help on using the changeset viewer.