/**
  * @return void
  * @author Carlos Escribano <*****@*****.**>
  **/
 public function save($con = null)
 {
     parent::save();
     $currency_decimals = sfConfig::get('app_currency_decimals', array());
     foreach ($this->getValues() as $key => $value) {
         switch ($key) {
             case 'company_logo':
                 if ("on" == $this->getValue('company_logo_delete') && is_file($old = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . PropertyTable::get('company_logo'))) {
                     @unlink($old);
                     PropertyTable::set('company_logo', null);
                 }
                 if ($value) {
                     $fname = $value->generateFilename();
                     $value->save(sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . $fname);
                     PropertyTable::set('company_logo', $fname);
                 }
                 break;
             case 'company_logo_delete':
                 break;
             case 'currency':
                 PropertyTable::set('currency_decimals', array_key_exists($value, $currency_decimals) ? $currency_decimals[$value] : 2);
                 PropertyTable::set('currency', $value);
                 break;
             case 'seriess':
             case 'taxes':
                 break;
             default:
                 PropertyTable::set($key, $value);
                 break;
         }
     }
 }
Example #2
0
 public function __construct($options = array(), $CSRFSecret = null)
 {
     $this->old_taxes = Doctrine::getTable('Tax')->findAll();
     $forms = array();
     foreach ($this->old_taxes as $tax) {
         $forms['old_' . $tax->getId()] = new TaxForm($tax, $options, false);
     }
     parent::__construct($forms, 'TaxForm', $options, $CSRFSecret);
 }
 public function __construct($options = array(), $CSRFSecret = null)
 {
     $this->old_series = Doctrine::getTable('Series')->findAll();
     $forms = array();
     foreach ($this->old_series as $series) {
         $forms['old_' . $series->id] = new SeriesForm($series, $options, false);
     }
     parent::__construct($forms, 'SeriesForm', $options, $CSRFSecret);
 }
 public function __construct($invoice_id = null, $options = array(), $CSRFSecret = null)
 {
     if ($invoice_id) {
         $this->old_payments = Doctrine::getTable('Payment')->createQuery()->where('invoice_id = ?', $invoice_id)->orderBy('date')->execute();
         $forms = array();
         foreach ($this->old_payments as $payment) {
             $forms['old_' . $payment->getId()] = new PaymentForm($payment, $options, false);
         }
     }
     parent::__construct($forms, 'PaymentForm', $options, $CSRFSecret);
 }