Fix: Creation nouveau type d'adherent

This commit is contained in:
Laurent Destailleur 2006-10-31 21:35:48 +00:00
parent 85d050a48a
commit 0675975f36
2 changed files with 34 additions and 26 deletions

View File

@ -73,31 +73,30 @@ class AdherentType
}
/**
\brief Fonction qui permet de créer le status de l'adhérent
\param userid userid de l'adhérent
\return > 0 si ok, < 0 si ko
*/
/**
\brief Fonction qui permet de créer le status de l'adhérent
\param userid userid de l'adhérent
\return > 0 si ok, < 0 si ko
*/
function create($userid)
{
$this->statut=trim($this->statut);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (statut)";
$sql .= " VALUES ($this->statut)";
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
return $this->update();
$this->statut=trim($this->statut);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (statut)";
$sql.= " VALUES ($this->statut)";
dolibarr_syslog("Adherent_type::create sql=".$sql);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
return $this->update();
}
else
{
return -1;
}
}
else
{
return -1;
}
}
/**

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,13 +33,16 @@ require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
$langs->load("members");
$user->getrights('adherent');
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
if ($_POST["action"] == 'add' && $user->rights->adherent->configurer)
if ($_POST["action"] == 'add')
{
if (! $user->rights->adherent->configurer) accessforbidden();
if ($_POST["button"] != $langs->trans("Cancel"))
{
$adht = new AdherentType($db);
@ -56,14 +59,20 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->configurer)
if ($id > 0)
{
Header("Location: type.php");
exit
exit;
}
}
else
{
$mesg=$this->langs("ErrorFieldRequired",$langs->trans("Label"));
}
}
}
if ($_POST["action"] == 'update' && $user->rights->adherent->creer)
if ($_POST["action"] == 'update')
{
if (! $user->rights->adherent->creer) accessforbidden();
if ($_POST["button"] != $langs->trans("Cancel"))
{
$adht = new AdherentType($db);