3 * Déclarations relatives à la base de données
7 * @author Olivier Tétard
9 * @package SPIP\Souscription\Pipelines
12 if (!defined('_ECRIRE_INC_VERSION')) return;
16 * Déclaration des alias de tables et filtres automatiques de champs
18 * @pipeline declarer_tables_interfaces
19 * @param array $interfaces
20 * Déclarations d'interface pour le compilateur
22 * Déclarations d'interface pour le compilateur
24 function souscription_declarer_tables_interfaces($interfaces) {
25 $interfaces['table_des_tables']['souscription_dons'] = 'souscription_dons';
26 $interfaces['table_des_tables']['souscription_campagnes'] = 'souscription_campagnes';
33 * Déclaration des objets éditoriaux
35 * @pipeline declarer_tables_objets_sql
36 * @param array $tables
37 * Description des tables
39 * Description complétée des tables
41 function souscription_declarer_tables_objets_sql($tables) {
43 $tables['spip_souscription_dons'] =
44 array('type' => 'souscription_don',
45 'principale' => "oui",
46 'table_objet_surnoms' => array('souscriptiondon'), // table_objet('souscription_don') => 'souscription_dons'
47 'field'=> array("id_souscription_don" => "bigint(21) NOT NULL",
48 "id_transaction" => "bigint(21) NOT NULL DEFAULT 0",
49 "id_souscription_campagne" => "bigint(21) NOT NULL DEFAULT 0",
50 "courriel" => "text NOT NULL DEFAULT ''",
51 "nom" => "text NOT NULL DEFAULT ''",
52 "prenom" => "text NOT NULL DEFAULT ''",
53 "code_postal" => "text NOT NULL DEFAULT ''",
54 "adresse" => "text NOT NULL DEFAULT ''",
55 "ville" => "text NOT NULL DEFAULT ''",
56 "recu_fiscal" => "varchar(3) NOT NULL DEFAULT ''",
57 "envoyer_info" => "varchar(3) NOT NULL DEFAULT ''",
58 "date_souscription " => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
61 'key' => array("PRIMARY KEY" => "id_souscription_don",
62 "KEY id_transaction" => "id_transaction",
63 "KEY id_souscription_campagne" => "id_souscription_campagne"),
64 'titre' => "nom AS titre, '' AS lang",
65 'date' => "date_souscription",
66 'champs_editables' => array('courriel', 'nom', 'prenom', 'code_postal', 'adresse', 'ville', 'recu_fiscal', 'envoyer_info'),
67 'champs_versionnes' => array('courriel', 'nom', 'prenom', 'code_postal', 'adresse', 'ville', 'recu_fiscal', 'envoyer_info'),
68 'rechercher_champs' => array(),
69 'join' => array("id_transaction" => "id_transaction"),
70 /* 'join' => array("id_souscription_campagne" => "id_souscription_campagne"), */
71 /* 'tables_jointures' => array('souscription_campagnes'), */
72 'tables_jointures' => array('spip_transactions'),
75 $tables['spip_souscription_campagnes'] =
76 array('type' => 'souscription_campagne',
77 'principale' => "oui",
78 'table_objet_surnoms' => array('souscriptioncampagne'),
79 'field'=> array("id_souscription_campagne" => "bigint(21) NOT NULL",
80 "objectif" => "int(11) NOT NULL DEFAULT 0",
81 "objectif_initial" => "int(11) NOT NULL DEFAULT 0",
82 "type_objectif" => "varchar(255) NOT NULL DEFAULT 0",
83 "titre" => "text NOT NULL DEFAULT ''",
84 "texte" => "longtext NOT NULL DEFAULT ''",
85 "statut" => "varchar(255) NOT NULL DEFAULT 0",
86 "date" => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
89 'key' => array("PRIMARY KEY" => "id_souscription_campagne",
90 "KEY id_souscription_campagne" => "id_souscription_campagne",
92 'titre' => "titre AS titre, '' AS lang",
94 'champs_editables' => array('objectif', 'titre', 'texte', 'objectif_initial', 'type_objectif'),
95 'champs_versionnes' => array('objectif', 'titre', 'texte', 'objectif_initial', 'type_objectif'),
96 'rechercher_champs' => array(),
97 /* 'tables_jointures' => array('spip_souscription_campagnes'), */