コード例 #1
0
ファイル: note.php プロジェクト: remyyounes/dolibarr
if ($result > 0)
{
    $adht = new AdherentType($db);
    $result=$adht->fetch($adh->typeid);
}


/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/

if ($_POST["action"] == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
{
	$db->begin();

	$res=$adh->update_note($_POST["note"],$user);
	if ($res < 0)
	{
		$mesg='<div class="error">'.$adh->error.'</div>';
		$db->rollback();
	}
	else
	{
		$db->commit();
	}
}



/*
 * View
コード例 #2
0
$action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int');
// Security check
$result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db);
$result = $object->fetch($id);
if ($result > 0) {
    $adht = new AdherentType($db);
    $result = $adht->fetch($object->typeid);
}
/*
 * Actions
 */
if ($action == 'update' && $user->rights->adherent->creer && !$_POST["cancel"]) {
    $db->begin();
    $res = $object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
    if ($res < 0) {
        setEventMessage($object->error, 'errors');
        $db->rollback();
    } else {
        $db->commit();
    }
}
/*
 * View
 */
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$form = new Form($db);
if ($id) {
    $head = member_prepare_head($object);
    dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');
コード例 #3
0
ファイル: AdherentTest.php プロジェクト: nrjacker4/crm-php
    /**
     * testAdherentUpdate
     *
     * @param	Adherent	$localobject	Member instance
     * @return	Adherent
     *
     * @depends	testAdherentFetch
     * The depends says test is run only if previous is ok
     */
    public function testAdherentUpdate($localobject)
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject->login='******';
		$localobject->societe='New company';
		$localobject->note='New note after update';
		//$localobject->note_public='New note public after update';
		$localobject->lastname='New name';
		$localobject->firstname='New firstname';
		$localobject->address='New address';
		$localobject->zip='New zip';
		$localobject->town='New town';
		$localobject->country_id=2;
		$localobject->statut=0;
		$localobject->phone='New tel pro';
		$localobject->phone_perso='New tel perso';
		$localobject->phone_mobile='New tel mobile';
		$localobject->email='*****@*****.**';
		$result=$localobject->update($user);
		print __METHOD__." id=".$localobject->id." result=".$result."\n";
		$this->assertLessThan($result, 0);
		$result=$localobject->update_note($localobject->note);
		print __METHOD__." id=".$localobject->id." result=".$result."\n";
		$this->assertLessThan($result, 0);
		//$result=$localobject->update_note_public($localobject->note_public);
		//print __METHOD__." id=".$localobject->id." result=".$result."\n";
		//$this->assertLessThan($result, 0);

		$newobject=new Adherent($this->savdb);
		$result=$newobject->fetch($localobject->id);
		print __METHOD__." id=".$localobject->id." result=".$result."\n";
		$this->assertLessThan($result, 0);

		$this->assertEquals($localobject->login, $newobject->login);
		$this->assertEquals($localobject->societe, $newobject->societe);
		$this->assertEquals($localobject->note, $newobject->note);
		//$this->assertEquals($localobject->note_public, $newobject->note_public);
		$this->assertEquals($localobject->lastname, $newobject->lastname);
		$this->assertEquals($localobject->firstname, $newobject->firstname);
		$this->assertEquals($localobject->address, $newobject->address);
		$this->assertEquals($localobject->zip, $newobject->zip);
		$this->assertEquals($localobject->town, $newobject->town);
		$this->assertEquals($localobject->country_id, $newobject->country_id);
		$this->assertEquals('BE', $newobject->country_code);
		$this->assertEquals($localobject->statut, $newobject->statut);
		$this->assertEquals($localobject->phone, $newobject->phone);
		$this->assertEquals($localobject->phone_perso, $newobject->phone_perso);
		$this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile);
		$this->assertEquals($localobject->email, $newobject->email);

    	return $localobject;
    }