Qual: Add integrity on member type

Fix: Incomplete module leopard
This commit is contained in:
Laurent Destailleur 2009-03-09 10:10:02 +00:00
parent fa4395d699
commit eb8d23d680
7 changed files with 38 additions and 21 deletions

View File

@ -259,7 +259,7 @@ class Adherent extends CommonObject
{ {
global $conf,$langs; global $conf,$langs;
// Verification parametres // Check parameters
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email)) if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email))
{ {
$this->error = $langs->trans("ErrorBadEMail",$this->email); $this->error = $langs->trans("ErrorBadEMail",$this->email);
@ -269,13 +269,14 @@ class Adherent extends CommonObject
$this->db->begin(); $this->db->begin();
// Insertion membre // Insert member
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
$sql.= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy)"; $sql.= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type)";
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= " '".$this->db->idate($this->datec)."',"; $sql.= " '".$this->db->idate($this->datec)."',";
$sql.= " '".addslashes($this->login)."',"; $sql.= " '".addslashes($this->login)."',";
$sql.= " '".$user->id."',null,null,'".$this->morphy."'"; $sql.= " '".$user->id."',null,null,'".$this->morphy."',";
$sql.= " '".$this->typeid."'";
$sql.= ")"; $sql.= ")";
dol_syslog("Adherent::create sql=".$sql); dol_syslog("Adherent::create sql=".$sql);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -20,10 +20,10 @@
*/ */
/** /**
\file htdocs/admin/societe.php * \file htdocs/admin/societe.php
\ingroup company * \ingroup company
\brief Page d'administration/configuration du module Societe * \brief Third party module setup page
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -38,8 +38,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
* Attention ce module est utilise par defaut si aucun module n'a * Attention ce module est utilise par defaut si aucun module n'a
* ete definit dans la configuration * ete definit dans la configuration
* *
* Le fonctionnement de celui-ci doit dont rester le plus ouvert * Le fonctionnement de celui-ci doit dont rester le plus ouvert possible
* possible
*/ */
var $nom; // Nom du modele var $nom; // Nom du modele
@ -48,7 +47,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
var $code_modifiable_null; // Code modifiables si il est null var $code_modifiable_null; // Code modifiables si il est null
var $code_null; // Code facultatif var $code_null; // Code facultatif
var $version; // 'development', 'experimental', 'dolibarr' var $version; // 'development', 'experimental', 'dolibarr'
var $code_auto; // Numerotation automatique var $code_auto; // Numerotation automatique
/** \brief Constructeur classe /** \brief Constructeur classe
@ -75,10 +74,20 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
} }
/** \brief Return next value available
* \return string Value
*/
function getNextValue($objsoc=0,$type=-1)
{
global $langs;
return '';
}
/** /**
* \brief V<EFBFBD>rifie la validit<EFBFBD> du code * \brief check validity of code
* \param $db Handler acces base * \param $db Handler acces base
* \param $code Code a v<EFBFBD>rifier * \param $code Code to check
* \param $soc Objet societe * \param $soc Objet societe
*/ */
function verif($db, &$code, $soc) function verif($db, &$code, $soc)

View File

@ -73,13 +73,13 @@ class ModeleThirdPartyCode
return true; return true;
} }
/** \brief Renvoi prochaine valeur attribu<EFBFBD>e /** \brief Return next value available
* \return string Valeur * \return string Value
*/ */
function getNextValue($objsoc=0,$type=-1) function getNextValue($objsoc=0,$type=-1)
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("Function_getNextValue_InModuleNotWorking");
} }
@ -149,8 +149,8 @@ class ModeleThirdPartyCode
$s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide,1,2).'<br>'; $s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide,1,2).'<br>';
$s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto,1,2).'<br>'; $s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto,1,2).'<br>';
$s.='<br>'; $s.='<br>';
if ($type == 0 || $type == -1) $s.=$langs->trans("NextValue").': <b>'.$this->getNextValue($soc,0).'</b><br>'; if ($type == 0 || $type == -1) $s.=$langs->trans("NextValue").' ('.$langs->trans("Customer").') : <b>'.$this->getNextValue($soc,0).'</b><br>';
if ($type == 1 || $type == -1) $s.=$langs->trans("NextValue").': <b>'.$this->getNextValue($soc,1).'</b>'; if ($type == 1 || $type == -1) $s.=$langs->trans("NextValue").' ('.$langs->trans("Supplier").') : <b>'.$this->getNextValue($soc,1).'</b>';
return $s; return $s;
} }

View File

@ -90,6 +90,10 @@ alter table llx_facture_fourn_det add column date_end datetime DEFAUL
-- V4.1 delete from llx_projet_task where fk_projet not in (select rowid from llx_projet); -- V4.1 delete from llx_projet_task where fk_projet not in (select rowid from llx_projet);
-- V4.1 ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); -- V4.1 ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
ALTER TABLE llx_adherent modify fk_adherent_type integer NOT NULL;
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_adherent_type (fk_adherent_type);
-- V4.1 delete from llx_adherent where fk_adherent_type not in (select rowid from llx_adherent_type);
-- V4.1 ALTER TABLE llx_adherent ADD CONSTRAINT fk_adherent_adherent_type FOREIGN KEY (fk_adherent_type) REFERENCES llx_adherent_type (rowid);
-- Put at the end. Cas have duplicate values -- Put at the end. Cas have duplicate values
ALTER TABLE llx_categorie_association drop index idx_categorie_association_fk_categorie_fille; ALTER TABLE llx_categorie_association drop index idx_categorie_association_fk_categorie_fille;

View File

@ -20,6 +20,9 @@
ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login); ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login);
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc); ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc);
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_adherent_type (fk_adherent_type);
ALTER TABLE llx_adherent ADD CONSTRAINT adherent_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_adherent ADD CONSTRAINT adherent_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_adherent ADD CONSTRAINT fk_adherent_adherent_type FOREIGN KEY (fk_adherent_type) REFERENCES llx_adherent_type (rowid);

View File

@ -32,7 +32,7 @@ create table llx_adherent
prenom varchar(50), prenom varchar(50),
login varchar(50) NOT NULL, -- login login varchar(50) NOT NULL, -- login
pass varchar(50), -- password pass varchar(50), -- password
fk_adherent_type smallint, fk_adherent_type integer NOT NULL,
morphy varchar(3) NOT NULL, -- personne morale / personne physique morphy varchar(3) NOT NULL, -- personne morale / personne physique
societe varchar(50), societe varchar(50),
fk_soc integer NULL, -- Link to third party linked to member fk_soc integer NULL, -- Link to third party linked to member