62dded602b2471c24d306d24bb7a4f5c9ecf1318
[spip_souscriptions.git] / base / souscription.php~
1 <?php
2 /**
3  * Déclarations relatives à la base de données
4  *
5  * @plugin     Souscription
6  * @copyright  2013
7  * @author     Olivier Tétard
8  * @licence    GNU/GPL
9  * @package    SPIP\Souscription\Pipelines
10  */
11
12 if (!defined('_ECRIRE_INC_VERSION')) return;
13
14
15 /**
16  * Déclaration des alias de tables et filtres automatiques de champs
17  *
18  * @pipeline declarer_tables_interfaces
19  * @param array $interfaces
20  *     Déclarations d'interface pour le compilateur
21  * @return array
22  *     Déclarations d'interface pour le compilateur
23  */
24 function souscription_declarer_tables_interfaces($interfaces) {
25
26   $interfaces['table_des_tables']['souscription_dons'] = 'souscription_dons';
27
28   return $interfaces;
29 }
30
31
32 /**
33  * Déclaration des objets éditoriaux
34  *
35  * @pipeline declarer_tables_objets_sql
36  * @param array $tables
37  *     Description des tables
38  * @return array
39  *     Description complétée des tables
40  */
41 function souscription_declarer_tables_objets_sql($tables) {
42
43   $tables['spip_souscription_dons'] =
44     array(
45           'type' => 'souscription_don',
46           'principale' => "oui",
47           'table_objet_surnoms' => array('souscriptiondon'), // table_objet('souscription_don') => 'souscription_dons'
48           'field'=> array("id_souscription_don" => "bigint(21) NOT NULL",
49                           "id_transaction"      => "bigint(21) NOT NULL DEFAULT 0",
50                           "montant"             => "int(11) NOT NULL DEFAULT 0",
51                           "courriel"            => "text NOT NULL DEFAULT ''",
52                           "nom"                 => "text NOT NULL DEFAULT ''",
53                           "prenom"              => "text NOT NULL DEFAULT ''",
54                           "code_postal"         => "text NOT NULL DEFAULT ''",
55                           "adresse"             => "text NOT NULL DEFAULT ''",
56                           "ville"               => "text NOT NULL DEFAULT ''",
57                           "recu_fiscal"         => "int(1) NOT NULL DEFAULT 0",
58                           "envoyer_info"        => "int(2) NOT NULL DEFAULT 0",
59                           /* "statut"              => "varchar(255) DEFAULT '0' NOT NULL COLLATE NOCASE", */
60                           "date_souscription "  => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
61                           "maj"                 => "TIMESTAMP"
62                           ),
63           'key' => array("PRIMARY KEY"          => "id_souscription_don",
64                          ),
65           'titre' => "nom AS titre, '' AS lang",
66           'date' => "date_souscription",
67           'champs_editables'  => array('montant', 'courriel', 'nom', 'prenom', 'code_postal', 'adresse', 'ville', 'recu_fiscal', 'envoyer_info'),
68           'champs_versionnes' => array('montant', 'courriel', 'nom', 'prenom', 'code_postal', 'adresse', 'ville', 'recu_fiscal', 'envoyer_info'),
69           'rechercher_champs' => array(),
70           'tables_jointures'  => array('spip_transactions' => 'id_transaction'),
71           );
72
73   return $tables;
74 }
75
76
77 /* /\** */
78 /*  * Déclaration des tables secondaires (liaisons) */
79 /*  * */
80 /*  * @pipeline declarer_tables_auxiliaires */
81 /*  * @param array $tables */
82 /*  *     Description des tables */
83 /*  * @return array */
84 /*  *     Description complétée des tables */
85 /*  *\/ */
86 /* function souscription_declarer_tables_auxiliaires($tables) { */
87
88 /*   $tables['spip_souscription_dons_liens'] = */
89 /*     array( */
90 /*           'field' => array("id_souscription_don" => "bigint(21) DEFAULT '0' NOT NULL", */
91 /*                            "id_objet"           => "bigint(21) DEFAULT '0' NOT NULL", */
92 /*                            "objet"              => "VARCHAR(25) DEFAULT '' NOT NULL", */
93 /*                            "vu"                 => "VARCHAR(6) DEFAULT 'non' NOT NULL" */
94 /*                            ), */
95 /*           'key' => array("PRIMARY KEY"        => "id_souscription_don,id_objet,objet", */
96 /*                          "KEY id_souscription_don" => "id_souscription_don" */
97 /*                          ) */
98 /*           ); */
99
100 /*   return $tables; */
101 /* } */
102 ?>