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

Bug du index_if

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.