* @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ */ class InvoiceItemForm extends BaseInvoiceItemForm { protected $boundChoices = array('none' => 'Nevázáno', 'job' => 'Vázáno na inzerát', 'topjob' => 'Vázáno na Top inzerát', 'banner' => 'Vázáno na banner', 'profile' => 'Vázáno na profil'); public function configure() { $this->widgetSchema['bound'] = new sfWidgetFormChoice(array('choices' => $this->boundChoices)); $this->validatorSchema['bound'] = new sfValidatorChoice(array('choices' => array_keys($this->boundChoices))); $this->widgetSchema['invoice_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema->setLabels(array('job_id' => __('Inzerát'), 'topjob_id' => __('Top inzerát'), 'banner_id' => __('Banner'), 'profile_id' => __('Profil'), 'amount' => __('Počet kusů'), 'price_one' => __('Cena za kus (bez dph)'), 'dph' => __('DPH (%)'), 'bound' => __('Vázáno'), 'currency' => __('Měna') )); $this->widgetSchema->moveField('bound', sfWidgetFormSchema::FIRST); commonFormFunctions::setJqUiFormater($this); if(!$this->isNew()) { $this->setBound(); } $this->setDefault('dph', saSettings::get('invoice_dph', 0)); $this->setDefault('currency', 'EUR'); } public function setBound() { $item = $this->getObject(); if(!is_null($item->getJobId())) { $this->setDefault('bound', 'job'); } elseif(!is_null($item->getTopjobId())) { $this->setDefault('bound', 'topjob'); } elseif(!is_null($item->getBannerId())) { $this->setDefault('bound', 'banner'); } elseif(!is_null($item->getProfileId())) { $this->setDefault('bound', 'profile'); } else { $this->setDefault('bound', 'none'); } } public function getJavaScripts() { $result = parent::getJavaScripts(); $result[] = 'forms/InvoiceItemForm.js'; return $result; } }