validatorSchema['is_anonymous'], $this->validatorSchema['katao_node_id'], $this->validatorSchema['accounting_code'], $this->validatorSchema['accounting_code_sol'], $this->validatorSchema['initial_amount'], $this->validatorSchema['is_referer'], $this->validatorSchema['is_delegate'], $this->validatorSchema['katao_member_id'], $this->validatorSchema['user_status'], $this->validatorSchema['katao_index'], $this->validatorSchema['created_at'], $this->validatorSchema['updated_at'],$this->validatorSchema['user_birthday'],$this->validatorSchema['user_situation'],$this->validatorSchema['parrain_name']); unset($this->widgetSchema['is_anonymous'], $this->widgetSchema['katao_node_id'], $this->widgetSchema['accounting_code'], $this->widgetSchema['accounting_code_sol'], $this->widgetSchema['initial_amount'], $this->widgetSchema['is_referer'], $this->widgetSchema['is_delegate'], $this->widgetSchema['katao_member_id'], $this->widgetSchema['user_status'], $this->widgetSchema['katao_index'], $this->widgetSchema['created_at'], $this->widgetSchema['updated_at'], $this->widgetSchema['user_birthday'], $this->widgetSchema['user_situation'], $this->widgetSchema['parrain_name']); $this->widgetSchema['first_name'] = new sfWidgetFormInput(); $this->validatorSchema['first_name'] = new sfValidatorString(array('max_length' => 255), array('required' => 'Veuillez entrer votre prénom')); $this->widgetSchema['last_name'] = new sfWidgetFormInput(); $this->validatorSchema['last_name'] = new sfValidatorString(array('max_length' => 255), array('required' => 'Veuillez entrer votre nom')); $this->widgetSchema->setLabels(array( 'first_name' => 'Prénom', 'last_name' => 'Nom', )); $katao_member = new KataoMember(); $katao_user = new KataoUser(); $this->widgetSchema['user_email'] = new sfWidgetFormInput(); $this->validatorSchema['user_email'] = new sfValidatorString(array('max_length' => 255), array('required' => 'Veuillez entrer un email valide')); $this->widgetSchema->setLabel('user_email', 'Email'); $this->widgetSchema['user_membercard'] = new sfWidgetFormInput(); $this->validatorSchema['user_membercard'] = new sfValidatorString(array('max_length' => 255, 'required' => false)); $this->widgetSchema->setLabel('user_membercard', 'Numéro de carte'); $this->widgetSchema['user_membercard_lost'] = new sfWidgetFormInputCheckbox(); $this->validatorSchema['user_membercard_lost'] = new sfValidatorString(); $this->widgetSchema->setLabel('user_membercard_lost', 'Carte perdue ?'); $this->widgetSchema['user_payment_amount'] = new sfWidgetFormSelectRadio(array('choices' => array(0 => '50 € - de base', 1 => '25 € - réduite', 2 => '100 € - de soutien'))); $this->validatorSchema['user_payment_amount'] = new sfValidatorString(array('required' => 'Choisissez un montant')); $this->widgetSchema->setLabel('user_payment_amount', 'Choisissez le montant de votre adhésion '); $this->setDefault('user_payment_amount', 0); $this->widgetSchema['user_payment_mode'] = new sfWidgetFormSelectRadio(array('choices' => array(KataoMemberDeposit::PAYMENT_MODE_OTHER => 'Carte Bleue', KataoMemberDeposit::PAYMENT_MODE_CHECK => 'Chèque', KataoMemberDeposit::PAYMENT_MODE_CASH => 'Espèces'))); $this->validatorSchema['user_payment_mode'] = new sfValidatorPass(); $this->widgetSchema->setLabel('user_payment_mode', 'Mon moyen de paiement '); $this->setDefault('user_payment_mode', '0'); $this->widgetSchema['user_parraining'] = new sfWidgetFormInput(); $this->validatorSchema['user_parraining'] = new sfValidatorString(array('max_length' => 255, 'required' => false)); $this->widgetSchema->setLabel('user_parraining', 'Nom de la structure'); $this->widgetSchema['user_payment_mode_cheque'] = new sfWidgetFormInput(); $this->widgetSchema['user_payment_mode_cheque']->setAttributes(array('placeholder' => 'Numéro du chèque')); $this->validatorSchema['user_payment_mode_cheque'] = new sfValidatorString(array('max_length' => 255, 'required' => false)); $this->widgetSchema->setLabel('user_payment_mode_cheque', 'Cheque'); $this->widgetSchema['no_spam'] = new sfWidgetFormInputHidden(); $this->setDefault('no_spam', ''); $this->widgetSchema->setNameFormat('form_renew[%s]'); //$this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare('user_password', sfValidatorSchemaCompare::EQUAL, 'user_password_confirmation')); } protected function doSave($con = null) { $katao_user = new KataoUser(); $katao_user->setStatus(KataoUser::STATUS_PENDING); $katao_user->setEmail($this->getValue('user_email')); $katao_user->setPhone($this->getValue('user_phone')); $katao_user->setFax($this->getValue('user_fax')); $katao_user->setAddress1($this->getValue('user_address1')); $katao_user->setAddress2($this->getValue('user_address2')); $katao_user->setZip($this->getValue('user_zip')); $katao_user->setCity($this->getValue('user_city')); $katao_user->setLogin($this->getValue('user_login')); if ($this->getValue('user_password') && $this->getValue('user_password_confirmation') && $this->getValue('user_password') == $this->getValue('user_password_confirmation')) { $katao_user->setPassword($this->getValue('user_password')); } $katao_user->save($con); $this->getObject()->setKataoNodeRelatedByKataoNodeId(sfContext::getInstance()->getUser()->getActiveNode()?sfContext::getInstance()->getUser()->getActiveNode():KataoNodePeer::getDefaultOne()); $this->getObject()->setIsMember(false); $return = parent::doSave($con); $katao_user->setKataoMember($this->getObject()); $katao_user->save(); return $return; } }