1 | <?php |
---|
2 | /***************************************************************************\ |
---|
3 | * Associaspip, extension de SPIP pour gestion d'associations |
---|
4 | * |
---|
5 | * @copyright Copyright (c) 2007 (v1) Bernard Blazin & Francois de Montlivault |
---|
6 | * @copyright Copyright (c) 2010--2011 (v2) Emmanuel Saint-James & Jeannot Lapin |
---|
7 | * |
---|
8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
---|
9 | \***************************************************************************/ |
---|
10 | |
---|
11 | if (!defined('_ECRIRE_INC_VERSION')) |
---|
12 | return; |
---|
13 | |
---|
14 | function exec_adherent() { |
---|
15 | include_spip('inc/navigation_modules'); |
---|
16 | $id_auteur = association_passeparam_id('auteur'); |
---|
17 | $full = autoriser('editer_membres', 'association'); |
---|
18 | if (!autoriser('voir_membres', 'association', $id_auteur)) { |
---|
19 | include_spip('inc/minipres'); |
---|
20 | echo minipres(); |
---|
21 | } else { |
---|
22 | $data = sql_fetsel('m.sexe, m.nom_famille, m.prenom, m.date_validite, m.id_asso, c.libelle','spip_asso_membres as m LEFT JOIN spip_asso_categories as c ON m.id_categorie=c.id_categorie', "m.id_auteur=$id_auteur"); |
---|
23 | include_spip('inc/association_comptabilite'); |
---|
24 | $nom_membre = association_formater_nom($data['sexe'], $data['prenom'], $data['nom_famille']); |
---|
25 | $validite = $data['date_validite']; |
---|
26 | $adresses = association_formater_adresses(array($id_auteur)); |
---|
27 | $emails = association_formater_emails(array($id_auteur)); |
---|
28 | $telephones = association_formater_telephones(array($id_auteur)); |
---|
29 | $sites = association_formater_urls(array($id_auteur)); |
---|
30 | $categorie = $data['libelle']?$data['libelle']:_T('asso:pas_de_categorie_attribuee'); |
---|
31 | $statut = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur='.$id_auteur); |
---|
32 | switch($statut) { |
---|
33 | case '0minirezo': |
---|
34 | $statut='auteur'; break; |
---|
35 | case '1comite': |
---|
36 | $statut='auteur'; break; |
---|
37 | default : |
---|
38 | $statut='visiteur'; break; |
---|
39 | } |
---|
40 | onglets_association('titre_onglet_membres', 'adherents'); |
---|
41 | // INFOS |
---|
42 | if ($full) { |
---|
43 | $infos['adherent_libelle_categorie'] = $categorie; |
---|
44 | } |
---|
45 | $infos['adherent_libelle_validite'] = association_formater_date($data['date_validite']); |
---|
46 | if ($GLOBALS['association_metas']['id_asso']) { |
---|
47 | $infos['adherent_libelle_reference_interne'] = ($data['id_asso']?$data['id_asso']:_T('asso:pas_de_reference_interne_attribuee')) ; |
---|
48 | } |
---|
49 | if ($adresses[$id_auteur]) |
---|
50 | $infos['coordonnees:adresses'] = $adresses[$id_auteur]; |
---|
51 | if ($emails[$id_auteur]) |
---|
52 | $infos['coordonnees:emails'] = $emails[$id_auteur]; |
---|
53 | if ($telephones[$id_auteur]) |
---|
54 | $infos['coordonnees:numeros'] = $telephones[$id_auteur]; |
---|
55 | if ($sites[$id_auteur]) |
---|
56 | $infos['coordonnees:pages'] = $sites[$id_auteur]; |
---|
57 | echo '<div class="vcard">'. association_totauxinfos_intro('<span class="fn">'.htmlspecialchars($nom_membre).'</span>', $statut, $id_auteur, $infos, 'asso_membre') .'</div>'; |
---|
58 | // datation et raccourcis |
---|
59 | raccourcis_association('', array( |
---|
60 | 'adherent_label_modifier_membre' => array('edit-24.gif', array('edit_adherent', "id=$id_auteur"), $full), |
---|
61 | "adherent_label_modifier_$statut" => array('membre_infos.png', array('auteur_infos', "id_auteur=$id_auteur"), ), |
---|
62 | )); |
---|
63 | debut_cadre_association('annonce.gif', 'membre'); |
---|
64 | if ( autoriser('voir_groupes', 'association') ) |
---|
65 | echo propre($data['commentaire']); |
---|
66 | $query_groupes = sql_select('g.*, fonction', 'spip_asso_groupes g LEFT JOIN spip_asso_groupes_liaisons l ON g.id_groupe=l.id_groupe', 'g.id_groupe>=100 AND l.id_auteur='.$id_auteur, '', 'g.nom'); // Liste des groupes (on ignore les groupes d'id <100 qui sont dedies a la gestion des autorisations) |
---|
67 | if (sql_count($query_groupes)) { |
---|
68 | echo debut_cadre_relief('', TRUE, '', _T('asso:groupes_membre') ); |
---|
69 | echo association_bloc_listehtml( |
---|
70 | $query_groupes, // requete |
---|
71 | array( |
---|
72 | 'id_groupe' => array('asso:entete_id', 'entier'), |
---|
73 | 'nom' => array('asso:groupe', 'texte'), |
---|
74 | 'fonction' => array('asso:fonction', 'texte'), |
---|
75 | ), // entetes et formats des donnees |
---|
76 | array( |
---|
77 | array('list', 'membres_groupe', 'id=$$') |
---|
78 | ), // boutons d'action |
---|
79 | 'id_groupe' // champ portant la cle des lignes et des boutons |
---|
80 | ); |
---|
81 | echo fin_cadre_relief(TRUE); |
---|
82 | } |
---|
83 | if (test_plugin_actif('fpdf') AND $GLOBALS['association_metas']['recufiscal']) { // JUSTIFICATIFS : afficher le lien vers les justificatifs seulemeunt si active en configuration et si FPDF est actif |
---|
84 | echo debut_cadre_relief('', TRUE, '', _T('asso:liens_vers_les_justificatifs') ); |
---|
85 | $data = array_map('array_shift', sql_allfetsel("DATE_FORMAT(date, '%Y') AS annee", 'spip_asso_comptes', "id_journal=$id_auteur", 'annee', 'annee ASC') ); |
---|
86 | foreach($data as $k => $annee) { |
---|
87 | echo '<a href="'. generer_url_ecrire('pdf_fiscal', "id=$id_auteur&annee=$annee") .'">'.$annee.'</a> '; |
---|
88 | } |
---|
89 | echo fin_cadre_relief(TRUE); |
---|
90 | } |
---|
91 | if ($GLOBALS['association_metas']['pc_cotisations']) { // HISTORIQUE COTISATIONS |
---|
92 | echo debut_cadre_relief('', TRUE, '', _T('asso:adherent_titre_historique_cotisations') ); |
---|
93 | if ($full) { // si on a l'autorisation admin, on ajoute un bouton pour ajouter une cotisation |
---|
94 | echo '<p> <a href="' .generer_url_ecrire('ajout_cotisation', "id=$id_auteur").'">' . _T('asso:adherent_label_ajouter_cotisation') .'</a> '. association_bouton_paye('ajout_cotisation','id='.$id_auteur, '') .' </p>'; |
---|
95 | } |
---|
96 | $association_imputation = charger_fonction('association_imputation', 'inc'); |
---|
97 | echo voir_adherent_paiements( |
---|
98 | array('id_compte, recette AS montant, date, justification, journal', 'spip_asso_comptes', $association_imputation('pc_cotisations', $id_auteur), '', 'date DESC, id_compte DESC', '0,10' ), |
---|
99 | $full, |
---|
100 | 'cotisation' |
---|
101 | ); |
---|
102 | echo fin_cadre_relief(TRUE); |
---|
103 | } |
---|
104 | if ($GLOBALS['association_metas']['activites']) { // HISTORIQUE ACTIVITES |
---|
105 | echo debut_cadre_relief('', TRUE, '', _T('asso:adherent_titre_historique_activites') ); |
---|
106 | echo association_bloc_listehtml( |
---|
107 | array('*', 'spip_asso_activites As a INNER JOIN spip_evenements AS e ON a.id_evenement=e.id_evenement', "id_auteur=$id_auteur", '', 'date_debut DESC, date_fin DESC', '0,10'), // requete |
---|
108 | array( |
---|
109 | 'id_activite' => array('asso:entete_id', 'entier'), |
---|
110 | 'date_debut' => array('asso:entete_date', 'date'), |
---|
111 | 'titre' => array('asso:adherent_entete_activite', 'texte', $full?'propre':'nettoyer_raccourcis_typo', ), |
---|
112 | 'quantite' => array('asso:entete_quantite', 'entier'), |
---|
113 | 'prix_activite' => array('asso:entete_montant', 'prix'), |
---|
114 | ), // entetes et formats des donnees |
---|
115 | autoriser('editer_activites', 'association') ? array( |
---|
116 | array('edit', 'activite', 'id=$$'), |
---|
117 | ) : array(), // boutons d'action |
---|
118 | 'id_activite' // champ portant la cle des lignes et des boutons |
---|
119 | ); |
---|
120 | echo fin_cadre_relief(TRUE); |
---|
121 | } |
---|
122 | if ($GLOBALS['association_metas']['ventes']) { // HISTORIQUE VENTES |
---|
123 | echo debut_cadre_relief('', TRUE, '', _T('asso:adherent_titre_historique_ventes') ); |
---|
124 | echo association_bloc_listehtml( |
---|
125 | array('*', 'spip_asso_ventes', "id_auteur=$id_auteur", '', 'date_vente DESC', '0,10'), // requete |
---|
126 | array( |
---|
127 | 'id_vente' => array('asso:entete_id', 'entier'), |
---|
128 | 'date_vente' => array('asso:ventes_entete_date_vente', 'date'), |
---|
129 | 'article' => array('asso:entete_article', 'texte', $full?'propre':'nettoyer_raccourcis_typo', ), |
---|
130 | 'quantite' => array('asso:entete_quantite', 'nombre'), |
---|
131 | 'date_envoie' => array('asso:ventes_entete_date_envoi', 'date'), |
---|
132 | ), // entetes et formats des donnees |
---|
133 | autoriser('voir_ventes', 'association') ? array( |
---|
134 | array('list', 'ventes', 'id=$$') |
---|
135 | ) : array(), // boutons d'action |
---|
136 | 'id_vente' // champ portant la cle des lignes et des boutons |
---|
137 | ); |
---|
138 | echo fin_cadre_relief(TRUE); |
---|
139 | } |
---|
140 | if ($GLOBALS['association_metas']['dons']) { // HISTORIQUE DONS |
---|
141 | echo debut_cadre_relief('', TRUE, '', _T('asso:adherent_titre_historique_dons') ); |
---|
142 | echo association_bloc_listehtml( |
---|
143 | array('*', 'spip_asso_dons', "id_auteur=$id_auteur", '', 'date_don DESC', '0,10'), // requete |
---|
144 | array( |
---|
145 | 'id_don' => array('asso:entete_id', 'entier'), |
---|
146 | 'date_don' => array('asso:entete_date', 'date'), |
---|
147 | 'argent' => array('asso:entete_montant', 'prix'), |
---|
148 | 'colis' => array('asso:colis', 'texte', $full?'propre':'nettoyer_raccourcis_typo', ), |
---|
149 | ), // entetes et formats des donnees |
---|
150 | autoriser('voir_dons', 'association') ? array( |
---|
151 | array('list', 'dons', 'id=$$') |
---|
152 | ) : array(), // boutons d'action |
---|
153 | 'id_don' // champ portant la cle des lignes et des boutons |
---|
154 | ); |
---|
155 | /* |
---|
156 | $association_imputation = charger_fonction('association_imputation', 'inc'); |
---|
157 | $critere = $association_imputation('pc_dons'); |
---|
158 | echo voir_adherent_paiements( |
---|
159 | array('D.id_don AS id, D.argent AS montant, D.date_don AS date, justification, journal, id_compte', 'spip_asso_dons AS D LEFT JOIN spip_asso_comptes AS C ON C.id_journal=D.id_don', "$critere AND id_auteur=$id_auteur",'D.date_don DESC', '0,10'), |
---|
160 | $full, |
---|
161 | 'don' |
---|
162 | ); |
---|
163 | */ |
---|
164 | echo fin_cadre_relief(TRUE); |
---|
165 | } |
---|
166 | if ($GLOBALS['association_metas']['prets']) { // HISTORIQUE PRETS |
---|
167 | echo debut_cadre_relief('', TRUE, '', _T('asso:adherent_titre_historique_prets') ); |
---|
168 | echo association_bloc_listehtml( |
---|
169 | array('*', 'spip_asso_prets AS P LEFT JOIN spip_asso_ressources AS R ON P.id_ressource=R.id_ressource', "id_auteur=$id_auteur", '', 'id_pret DESC', '0,10'), // requete |
---|
170 | array( |
---|
171 | 'id_pret' => array('asso:entete_id', 'entier'), |
---|
172 | 'date_sortie' => array('asso:prets_entete_date_sortie', 'date', 'dtstart'), |
---|
173 | 'intitule' => array('asso:entete_article', 'texte', $full?'propre':'nettoyer_raccourcis_typo', ), |
---|
174 | # 'duree' => array('asso:entete_duree', 'duree'), |
---|
175 | 'date_retour' => array('asso:prets_entete_date_retour', 'date', 'dtend'), |
---|
176 | ), // entetes et formats des donnees |
---|
177 | autoriser('voir_prets', 'association') ? array( |
---|
178 | array('list', 'prets', 'id=$$') |
---|
179 | ) : array(), // boutons d'action |
---|
180 | 'id_pret' // champ portant la cle des lignes et des boutons |
---|
181 | ); |
---|
182 | echo fin_cadre_relief(TRUE); |
---|
183 | } |
---|
184 | fin_page_association(); |
---|
185 | } |
---|
186 | } |
---|
187 | |
---|
188 | function voir_adherent_paiements($data, $lien) { |
---|
189 | return association_bloc_listehtml( |
---|
190 | $data, // requete |
---|
191 | array( |
---|
192 | 'id_compte' => array('asso:entete_id', 'entier'), |
---|
193 | 'date' => array('asso:entete_date', 'date'), |
---|
194 | 'journal' => array('asso:adherent_entete_journal', 'texte'), |
---|
195 | 'justification' => array('asso:adherent_entete_justification', 'texte', $lien?'propre':'nettoyer_raccourcis_typo', ), |
---|
196 | 'montant' => array('asso:entete_montant', 'prix'), |
---|
197 | ), |
---|
198 | autoriser('voir_compta', 'association') ? array( |
---|
199 | array('list', 'comptes', 'id_compte=$$') |
---|
200 | ) : array(), // boutons d'action : voir l'operation dans le journal comptable |
---|
201 | 'id_compte' // champ portant la cle des lignes et des boutons |
---|
202 | ); |
---|
203 | } |
---|
204 | |
---|
205 | ?> |
---|