1 | <?php |
---|
2 | /** |
---|
3 | * Déclarations relatives à la base de données |
---|
4 | * |
---|
5 | * @plugin Factures & devis |
---|
6 | * @copyright 2013 |
---|
7 | * @author Cyril Marion - Ateliers CYM |
---|
8 | * @licence GNU/GPL |
---|
9 | * @package SPIP\Factures\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 factures_declarer_tables_interfaces($interfaces) { |
---|
25 | |
---|
26 | $interfaces['table_des_tables']['factures'] = 'factures'; |
---|
27 | $interfaces['table_des_tables']['lignes_factures'] = 'lignes_factures'; |
---|
28 | |
---|
29 | return $interfaces; |
---|
30 | } |
---|
31 | |
---|
32 | |
---|
33 | /** |
---|
34 | * Déclaration des objets éditoriaux |
---|
35 | * |
---|
36 | * @pipeline declarer_tables_objets_sql |
---|
37 | * @param array $tables |
---|
38 | * Description des tables |
---|
39 | * @return array |
---|
40 | * Description complétée des tables |
---|
41 | */ |
---|
42 | function factures_declarer_tables_objets_sql($tables) { |
---|
43 | |
---|
44 | $tables['spip_factures'] = array( |
---|
45 | 'type' => 'facture', |
---|
46 | 'principale' => "oui", |
---|
47 | 'field'=> array( |
---|
48 | "id_facture" => "bigint(21) NOT NULL", |
---|
49 | "num_facture" => "varchar(50) NOT NULL", |
---|
50 | "id_organisation_emettrice" => "int(11) NOT NULL DEFAULT 0", |
---|
51 | "id_organisation" => "int(11) DEFAULT NULL", |
---|
52 | "date_facture" => "datetime DEFAULT NULL", |
---|
53 | "libelle_facture" => "mediumtext", |
---|
54 | "montant" => "decimal(18,2) DEFAULT NULL", |
---|
55 | "quantite" => "decimal(18,2) DEFAULT NULL", |
---|
56 | "unite" => "varchar(25) NOT NULL DEFAULT ''", |
---|
57 | "conditions" => "text NOT NULL", |
---|
58 | "reglement" => "varchar(50) DEFAULT NULL", |
---|
59 | "nota_bene" => "mediumtext", |
---|
60 | "delais_validite" => "int(11) DEFAULT NULL", |
---|
61 | "fin_validite" => "datetime DEFAULT NULL", |
---|
62 | "num_devis" => "varchar(50) DEFAULT NULL", |
---|
63 | "maj" => "TIMESTAMP" |
---|
64 | ), |
---|
65 | 'key' => array( |
---|
66 | "PRIMARY KEY" => "id_facture", |
---|
67 | ), |
---|
68 | 'titre' => "libelle_facture AS titre, '' AS lang", |
---|
69 | #'date' => "", |
---|
70 | 'champs_editables' => array('num_facture', 'id_organisation_emettrice', 'id_organisation', 'date_facture', 'libelle_facture', 'montant', 'quantite', 'unite', 'conditions', 'reglement', 'nota_bene', 'delais_validite', 'fin_validite', 'num_devis'), |
---|
71 | 'champs_versionnes' => array(), |
---|
72 | 'rechercher_champs' => array("num_facture" => 10, "libelle_facture" => 10), |
---|
73 | 'tables_jointures' => array(), |
---|
74 | |
---|
75 | |
---|
76 | ); |
---|
77 | |
---|
78 | $tables['spip_lignes_factures'] = array( |
---|
79 | 'type' => 'ligne', |
---|
80 | 'principale' => "oui", |
---|
81 | 'table_objet_surnoms' => array('lignesfacture'), // table_objet('ligne') => 'lignes_factures' |
---|
82 | 'field'=> array( |
---|
83 | "id_ligne" => "bigint(21) NOT NULL", |
---|
84 | "id_facture" => "int(11) NOT NULL DEFAULT '0'", |
---|
85 | "position" => "int(11) DEFAULT NULL", |
---|
86 | "quantite" => "float DEFAULT NULL", |
---|
87 | "unite" => "varchar(50) DEFAULT NULL", |
---|
88 | "designation" => "text", |
---|
89 | "prix_unitaire_ht" => "decimal(18,2) DEFAULT NULL", |
---|
90 | "commentaire" => "mediumtext", |
---|
91 | "maj" => "TIMESTAMP" |
---|
92 | ), |
---|
93 | 'key' => array( |
---|
94 | "PRIMARY KEY" => "id_ligne", |
---|
95 | ), |
---|
96 | 'titre' => "designation AS titre, '' AS lang", |
---|
97 | #'date' => "", |
---|
98 | 'champs_editables' => array('id_facture', 'position', 'quantite', 'unite', 'designation', 'commentaire'), |
---|
99 | 'champs_versionnes' => array(), |
---|
100 | 'rechercher_champs' => array(), |
---|
101 | 'tables_jointures' => array(), |
---|
102 | |
---|
103 | |
---|
104 | ); |
---|
105 | |
---|
106 | return $tables; |
---|
107 | } |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | ?> |
---|