Exemplo n.º 1
0
        }
        $adh->photo       = $_POST["photo"];
        $adh->note        = $_POST["note"];
        $adh->pays_id     = $_POST["pays_id"];
        $adh->typeid      = $_POST["type"];
        $adh->note        = $_POST["comment"];
        $adh->morphy      = $_POST["morphy"];
        $adh->naiss       = $birthday;

        foreach($_POST as $key => $value){
            if (preg_match("/^options_/",$key)){
                $adh->array_options[$key]=$_POST[$key];
            }
        }

        $result=$adh->create($user->id);
        if ($result > 0)
        {
            // Send email to say it has been created and will be validated soon...
            if (! empty($conf->global->ADHERENT_AUTOREGISTER_MAIL) && ! empty($conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT))
            {
                $result=$adh->send_an_email($conf->global->ADHERENT_AUTOREGISTER_MAIL,$conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT,array(),array(),array(),"","",0,-1);
            }

            if ($backtopage) $urlback=$backtopage;
            else if ($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)
            {
                $urlback=$conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
                // TODO Make replacement of __AMOUNT__, etc...
            }
            else $urlback=$_SERVER["PHP_SELF"]."?action=added";
 $member->public = 1;
 $member->birth = dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_BIRTHDATE]);
 $member->statut = -1;
 if (isset($ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS])) {
     $member->datec = dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]);
     $member->datevalid = dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]);
     $member->statut = $ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS];
 }
 //if ($member->statut > 1) $member->statut=1;
 //print_r($ldapuser);
 // Propriete type membre
 $member->typeid = $typeid;
 // Creation membre
 print $langs->transnoentities("MemberCreate") . ' # ' . $key . ': login='******', fullname=' . $member->getFullName($langs);
 print ', datec=' . $member->datec;
 $member_id = $member->create($user);
 if ($member_id > 0) {
     print ' --> Created member id=' . $member_id . ' login='******' --> ' . $member->error;
 }
 print "\n";
 //print_r($member);
 $datefirst = '';
 if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE) {
     $datefirst = dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]);
     $pricefirst = price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT]);
 }
 $datelast = '';
 if ($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE) {
Exemplo n.º 3
0
    /**
     */
    public function testAdherentCreate()
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new Adherent($this->savdb);
    	$localobject->initAsSpecimen();
     	$result=$localobject->create($user);
        print __METHOD__." result=".$result."\n";
    	$this->assertLessThan($result, 0);

    	return $result;
    }