Changeset 1142

Show
Ignore:
Timestamp:
09/24/08 04:26:34 (2 months ago)
Author:
bermiferrer
Message:

Now mailers can be used as advertised on the docs.

Previously we needed to use set(), now you can just use mailer attributes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/AkActionMailer.php

    r1141 r1142  
    476476            unset($attributes['template']); 
    477477        } 
    478  
    479         if((!empty($attributes['attachment']) || !empty($attributes['attachments'])) && 
    480         (empty($attributes['parts']) && empty($attributes['part']) && empty($attributes['body']))){ 
    481             // we can render here the body if there are attachments 
    482         } 
    483  
    484478        $this->Message->set($attributes); 
     479         
     480        $this->_setter_has_been_called = true; 
    485481    } 
    486482 
     
    578574            $this->Message =& $Message; 
    579575        } 
    580  
     576         
    581577        !empty($this->Message) or trigger_error(Ak::t('No mail object available for delivery!'), E_USER_ERROR); 
    582578        if(!empty($this->perform_deliveries)){ 
     
    596592        'password'     =>  @$this->server_settings['password'], 
    597593        'auth'     =>  (!empty($this->server_settings['user_name']) || @$this->server_settings['authentication']), 
    598         'debug'    =>  true 
     594        //'debug'    =>  true 
    599595        ); 
    600596        $settings = array_merge($default_settings, $settings); 
  • trunk/lib/AkActionMailer/AkMailComposer.php

    r977 r1142  
    136136            trigger_error(Ak::t('Could not find the method %method on the model %model', array('%method'=>$method_name, '%model'=>$this->ActionMailer->getModelName())), E_USER_ERROR); 
    137137        } 
     138        $this->_setAttributesIfRequired(); 
     139    } 
     140     
     141    function _setAttributesIfRequired() 
     142    { 
     143        if(empty($this->ActionMailer->_setter_has_been_called)){ 
     144            $attributes = array(); 
     145            foreach ((array)$this->ActionMailer as $k=>$v){ 
     146                if(gettype($v) != 'object' && $k[0] != '_'){ 
     147                    $attributes[$k] = $v; 
     148                } 
     149            } 
     150            $this->ActionMailer->set($attributes); 
     151        } 
    138152    } 
    139153 
     
    213227 
    214228    function &_getPartsWithRenderedTemplates() 
    215     {        
     229    { 
    216230        $templates = $this->_getAvailableTemplates(); 
    217231        $alternative_multiparts = array();