Works on multicompany module
Fix: rename "optid" to "rowid" and "adhid" to "fk_member"
This commit is contained in:
parent
4cb3c5641a
commit
34bf0421cf
@ -268,11 +268,10 @@ DROP TABLE IF EXISTS `llx_adherent_options`;
|
|||||||
SET @saved_cs_client = @@character_set_client;
|
SET @saved_cs_client = @@character_set_client;
|
||||||
SET character_set_client = utf8;
|
SET character_set_client = utf8;
|
||||||
CREATE TABLE `llx_adherent_options` (
|
CREATE TABLE `llx_adherent_options` (
|
||||||
`optid` int(11) NOT NULL auto_increment,
|
`rowid` int(11) NOT NULL auto_increment,
|
||||||
`tms` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
`tms` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||||
`adhid` int(11) NOT NULL default '0',
|
`fk_member` int(11) NOT NULL default '0',
|
||||||
PRIMARY KEY (`optid`),
|
PRIMARY KEY (`rowid`)
|
||||||
UNIQUE KEY `adhid` (`adhid`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
SET character_set_client = @saved_cs_client;
|
SET character_set_client = @saved_cs_client;
|
||||||
|
|
||||||
|
|||||||
@ -655,7 +655,7 @@
|
|||||||
</TABLE>
|
</TABLE>
|
||||||
<TABLE ID="1005" Tablename="llx_adherent_options" PrevTableName="" XPos="3686" YPos="1295" TableType="0" TablePrefix="0" nmTable="0" Temporary="0" UseStandardInserts="0" StandardInserts="" TableOptions="" Comments="" Collapsed="1" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="7" >
|
<TABLE ID="1005" Tablename="llx_adherent_options" PrevTableName="" XPos="3686" YPos="1295" TableType="0" TablePrefix="0" nmTable="0" Temporary="0" UseStandardInserts="0" StandardInserts="" TableOptions="" Comments="" Collapsed="1" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="7" >
|
||||||
<COLUMNS>
|
<COLUMNS>
|
||||||
<COLUMN ID="1219" ColName="optid" PrevColName="" Pos="1" idDatatype="5" DatatypeParams="(11)" Width="0" Prec="0" PrimaryKey="1" NotNull="1" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="">
|
<COLUMN ID="1219" ColName="rowid" PrevColName="" Pos="1" idDatatype="5" DatatypeParams="(11)" Width="0" Prec="0" PrimaryKey="1" NotNull="1" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="">
|
||||||
<OPTIONSELECTED>
|
<OPTIONSELECTED>
|
||||||
<OPTIONSELECT Value="0" />
|
<OPTIONSELECT Value="0" />
|
||||||
<OPTIONSELECT Value="0" />
|
<OPTIONSELECT Value="0" />
|
||||||
@ -665,7 +665,7 @@
|
|||||||
<OPTIONSELECTED>
|
<OPTIONSELECTED>
|
||||||
</OPTIONSELECTED>
|
</OPTIONSELECTED>
|
||||||
</COLUMN>
|
</COLUMN>
|
||||||
<COLUMN ID="1221" ColName="adhid" PrevColName="" Pos="3" idDatatype="5" DatatypeParams="(11)" Width="0" Prec="0" PrimaryKey="0" NotNull="1" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="">
|
<COLUMN ID="1221" ColName="fk_member" PrevColName="" Pos="3" idDatatype="5" DatatypeParams="(11)" Width="0" Prec="0" PrimaryKey="0" NotNull="1" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="">
|
||||||
<OPTIONSELECTED>
|
<OPTIONSELECTED>
|
||||||
<OPTIONSELECT Value="0" />
|
<OPTIONSELECT Value="0" />
|
||||||
<OPTIONSELECT Value="0" />
|
<OPTIONSELECT Value="0" />
|
||||||
@ -678,7 +678,7 @@
|
|||||||
<INDEXCOLUMN idColumn="1219" LengthParam="0" />
|
<INDEXCOLUMN idColumn="1219" LengthParam="0" />
|
||||||
</INDEXCOLUMNS>
|
</INDEXCOLUMNS>
|
||||||
</INDEX>
|
</INDEX>
|
||||||
<INDEX ID="1223" IndexName="adhid" IndexKind="1" FKRefDef_Obj_id="-1">
|
<INDEX ID="1223" IndexName="fk_member" IndexKind="1" FKRefDef_Obj_id="-1">
|
||||||
<INDEXCOLUMNS>
|
<INDEXCOLUMNS>
|
||||||
<INDEXCOLUMN idColumn="1221" LengthParam="0" />
|
<INDEXCOLUMN idColumn="1221" LengthParam="0" />
|
||||||
</INDEXCOLUMNS>
|
</INDEXCOLUMNS>
|
||||||
|
|||||||
@ -422,11 +422,11 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
if (sizeof($this->array_options) > 0)
|
if (sizeof($this->array_options) > 0)
|
||||||
{
|
{
|
||||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = ".$this->id;
|
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE fk_member = ".$this->id;
|
||||||
dol_syslog("Adherent::update sql=".$sql_del);
|
dol_syslog("Adherent::update sql=".$sql_del);
|
||||||
$this->db->query($sql_del);
|
$this->db->query($sql_del);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (adhid";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (fk_member";
|
||||||
foreach($this->array_options as $key => $value)
|
foreach($this->array_options as $key => $value)
|
||||||
{
|
{
|
||||||
// Add field of attribut
|
// Add field of attribut
|
||||||
@ -637,7 +637,7 @@ class Adherent extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Suppression options
|
// Suppression options
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = ".$rowid;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE fk_member = ".$rowid;
|
||||||
|
|
||||||
dol_syslog("Adherent::delete sql=".$sql);
|
dol_syslog("Adherent::delete sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -1083,7 +1083,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
$tab=array();
|
$tab=array();
|
||||||
|
|
||||||
$sql = "SELECT optid";
|
$sql = "SELECT rowid";
|
||||||
|
|
||||||
foreach ($optionsArray as $name => $label)
|
foreach ($optionsArray as $name => $label)
|
||||||
{
|
{
|
||||||
@ -1091,7 +1091,7 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_options";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_options";
|
||||||
$sql.= " WHERE adhid=".$rowid;
|
$sql.= " WHERE fk_member=".$rowid;
|
||||||
|
|
||||||
dol_syslog("Adherent::fetch_optionals sql=".$sql, LOG_DEBUG);
|
dol_syslog("Adherent::fetch_optionals sql=".$sql, LOG_DEBUG);
|
||||||
$result=$this->db->query( $sql);
|
$result=$this->db->query( $sql);
|
||||||
@ -1103,7 +1103,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
foreach ($tab as $key => $value)
|
foreach ($tab as $key => $value)
|
||||||
{
|
{
|
||||||
if ($key != 'optid' && $key != 'tms' && $key != 'adhid')
|
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member')
|
||||||
{
|
{
|
||||||
// we can add this attribute to adherent object
|
// we can add this attribute to adherent object
|
||||||
$this->array_options["options_$key"]=$value;
|
$this->array_options["options_$key"]=$value;
|
||||||
|
|||||||
@ -201,7 +201,7 @@ class modAdherent extends DolibarrModules
|
|||||||
// Fin complement
|
// Fin complement
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'adherent as a, '.MAIN_DB_PREFIX.'adherent_type as ta)';
|
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'adherent as a, '.MAIN_DB_PREFIX.'adherent_type as ta)';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_options as ao ON a.rowid = ao.adhid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_options as ao ON a.rowid = ao.fk_member';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'cotisation as c ON c.fk_adherent = a.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'cotisation as c ON c.fk_adherent = a.rowid';
|
||||||
$this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid';
|
$this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -479,8 +479,13 @@ ALTER TABLE llx_c_methode_commande_fournisseur ADD UNIQUE INDEX uk_c_methode_com
|
|||||||
ALTER TABLE llx_menu change user usertype integer NOT NULL default '0';
|
ALTER TABLE llx_menu change user usertype integer NOT NULL default '0';
|
||||||
|
|
||||||
-- Rename index
|
-- Rename index
|
||||||
|
ALTER TABLE llx_adherent_options MODIFY COLUMN optid integer;
|
||||||
|
ALTER TABLE llx_adherent_options DROP PRIMARY KEY;
|
||||||
ALTER TABLE llx_adherent_options DROP INDEX uk_adherent_options;
|
ALTER TABLE llx_adherent_options DROP INDEX uk_adherent_options;
|
||||||
|
ALTER TABLE llx_adherent_options DROP INDEX idx_adherent_options;
|
||||||
ALTER TABLE llx_adherent_options DROP INDEX adhid;
|
ALTER TABLE llx_adherent_options DROP INDEX adhid;
|
||||||
ALTER TABLE llx_adherent_options ADD INDEX idx_adherent_options (adhid);
|
ALTER TABLE llx_adherent_options CHANGE optid rowid integer AUTO_INCREMENT PRIMARY KEY;
|
||||||
|
ALTER TABLE llx_adherent_options CHANGE adhid fk_member integer NOT NULL;
|
||||||
|
ALTER TABLE llx_adherent_options ADD INDEX idx_adherent_options (fk_member);
|
||||||
|
|
||||||
ALTER TABLE llx_adherent DROP INDEX idx_adherent_fk_soc;
|
ALTER TABLE llx_adherent DROP INDEX idx_adherent_fk_soc;
|
||||||
|
|||||||
@ -21,4 +21,4 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_adherent_options ADD INDEX idx_adherent_options (adhid);
|
ALTER TABLE llx_adherent_options ADD INDEX idx_adherent_options (fk_member);
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
create table llx_adherent_options
|
create table llx_adherent_options
|
||||||
(
|
(
|
||||||
optid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
adhid integer NOT NULL -- id de l'adherent auquel correspond ces attributs optionnel
|
fk_member integer NOT NULL -- member id
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user