/**
  * @param null $file
  */
 public function write()
 {
     $dbvals = $this->getDbValues();
     $isnew = array();
     foreach ($dbvals as $var) {
         /** @var TransferPaymentConfig $var */
         $isnew[$var->getName()] = true;
     }
     $this->pushValues();
     $vars = $this->getThisVars();
     foreach ($vars as $key => $value) {
         $tmp = new TransferPaymentConfig();
         $tmp->setNew(!isset($isnew[$key]));
         $tmp->setName($key);
         $tmp->setValue($value);
         $tmp->save();
     }
 }
Exemplo n.º 2
0
 public function configure()
 {
     if (null !== ($response = $this->checkAuth(array(AdminResources::MODULE), array('TransferPayment'), AccessManager::UPDATE))) {
         return $response;
     }
     $form = new ConfigureTransfer($this->getRequest());
     $config = new TransferPaymentConfig();
     $errmes = "";
     try {
         $vform = $this->validateForm($form);
         $name = $vform->get('name')->getData();
         $iban = $vform->get('iban')->getData();
         $bic = $vform->get('bic')->getData();
         $config->setCompanyName($name)->setIban($iban)->setBic($bic)->write();
     } catch (\Exception $e) {
         $errmes = $e->getMessage();
     }
     $this->redirectToRoute("admin.module.configure", array(), array('module_code' => "TransferPayment", '_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction', 'errmes' => $errmes));
 }
Exemplo n.º 3
0
 /**
  *
  * in this function you add all the fields you need for your Form.
  * Form this you have to call add method on $this->formBuilder attribute :
  *
  * $this->formBuilder->add("name", "text")
  *   ->add("email", "email", array(
  *           "attr" => array(
  *               "class" => "field"
  *           ),
  *           "label" => "email",
  *           "constraints" => array(
  *               new \Symfony\Component\Validator\Constraints\NotBlank()
  *           )
  *       )
  *   )
  *   ->add('age', 'integer');
  *
  * @return null
  */
 protected function buildForm()
 {
     $config = TransferPaymentConfig::read();
     $this->formBuilder->add("name", "text", array("label" => Translator::getInstance()->trans("company name"), "label_attr" => array("for" => "namefield"), "constraints" => array(new NotBlank()), "data" => !empty($config['companyName']) && $config['companyName'] !== null ? $config['companyName'] : ""))->add("iban", "text", array("label" => Translator::getInstance()->trans("IBAN"), "label_attr" => array("for" => "ibanfield"), "constraints" => array(new NotBlank(), new Iban()), "data" => !empty($config['iban']) && $config['iban'] !== null ? $config['iban'] : ""))->add("bic", "text", array("label" => Translator::getInstance()->trans("BIC"), "label_attr" => array("for" => "bicfield"), "constraints" => array(new NotBlank(), new BIC()), "data" => !empty($config['bic']) && $config['bic'] !== null ? $config['bic'] : ""));
 }
 /**
  * Exclude object from result
  *
  * @param   ChildTransferPaymentConfig $transferPaymentConfig Object to remove from the list of results
  *
  * @return ChildTransferPaymentConfigQuery The current query, for fluid interface
  */
 public function prune($transferPaymentConfig = null)
 {
     if ($transferPaymentConfig) {
         $this->addUsingAlias(TransferPaymentConfigTableMap::NAME, $transferPaymentConfig->getName(), Criteria::NOT_EQUAL);
     }
     return $this;
 }