+ /* Préparation de la requête */
+ $select = "id_souscription, courriel, type_souscription,"
+ ."montant, reglee, spip_transactions.statut, date_paiement, mode, autorisation_id,"
+ ."nom, prenom, adresse, code_postal, ville, pays, telephone, recu_fiscal, envoyer_info, informer_comite_local, date_souscription,"
+ ."spip_souscription_campagnes.id_souscription_campagne, titre";
+ $from = "spip_souscriptions LEFT JOIN spip_transactions USING(id_transaction) LEFT JOIN spip_souscription_campagnes USING(id_souscription_campagne)";
+
+ $where = array();
+ if($type_souscription)
+ $where[] = "type_souscription='$type_souscription'";
+
+ if($statut) {
+ if($statut == "paye")
+ $where[] = "reglee='oui'";
+ elseif($statut == "commande")
+ $where[] = "spip_transactions.statut='commande'";
+ elseif($statut == "erreur")
+ $where[] = "spip_transactions.statut like 'echec%'";
+ }
+
+ if($id_campagne)
+ $where[] = "spip_souscription_campagnes.id_souscription_campagne = '$id_campagne'";
+
+ if($date_debut)
+ $where[] = "date_souscription > '" . date ("Y-m-d 00:00:00", $date_debut) . "'";
+
+ if($date_fin)
+ $where[] = "date_souscription < '" . date ("Y-m-d 23:59:59", $date_fin) . "'";
+
+ $row = sql_select($select, $from, $where);
+
+ $entete = array(_T("souscription:label_exporter_entete_id_don"),
+ _T("souscription:label_exporter_entete_courriel"),
+ _T("souscription:label_exporter_entete_type_souscription"),
+ _T("souscription:label_exporter_entete_montant"),
+ _T("souscription:label_exporter_entete_reglee"),
+ _T("souscription:label_exporter_entete_statut"),
+ _T("souscription:label_exporter_entete_date_paiement"),
+ _T("souscription:label_exporter_entete_mode_paiement"),
+ _T("souscription:label_exporter_entete_id_autorisation"),
+ _T("souscription:label_exporter_entete_nom"),
+ _T("souscription:label_exporter_entete_prenom"),
+ _T("souscription:label_exporter_entete_adresse"),
+ _T("souscription:label_exporter_entete_code_postal"),
+ _T("souscription:label_exporter_entete_ville"),
+ _T("souscription:label_exporter_entete_pays"),
+ _T("souscription:label_exporter_entete_telephone"),
+ _T("souscription:label_exporter_entete_recu_fiscal"),
+ _T("souscription:label_exporter_entete_informer"),
+ _T("souscription:label_exporter_entete_informer_comite_local"),
+ _T("souscription:label_exporter_entete_date_don"),
+ _T("souscription:label_exporter_entete_id_campagne"),
+ _T("souscription:label_exporter_entete_titre_campagne"));