Exemple #1
0
}

// bascule du statut d'un contact
if ($_GET["action"] == 'swapstatut' && $user->rights->contrat->creer)
{
	$contrat = new Contrat($db);
	if ($contrat->fetch($_GET["id"]))
	{
		$db->begin();

		$contact = $contrat->detail_contact($_GET["ligne"]);
		$id_type_contact = $contact->fk_c_type_contact;

		$statut = ($contact->statut == 4) ? 5 : 4;

		$result = $contrat->update_contact($_GET["ligne"], $statut, $id_type_contact);
		if ($result >= 0)
		{
			$db->commit();
		}
		else
		{
			dol_print_error($db, "result=$result");
			$db->rollback();
		}
	}
	else
	{
		dol_print_error($db,$contrat->error);
	}
}