Correction de l'export : les souscriptions reglées doivent avoir le statut 'ok'.
[spip_souscriptions.git] / action / exporter_souscriptions.php
index 56f65a0..031b352 100644 (file)
@@ -62,7 +62,7 @@ function action_exporter_souscriptions_dist($arg=null) {
   /* 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, date_souscription,"
+    ."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)";
 
@@ -72,11 +72,11 @@ function action_exporter_souscriptions_dist($arg=null) {
 
   if($statut) {
     if($statut == "paye")
-      $where[] = "reglee='oui'";
+      $where[] = "spip_transactions.statut='ok' and reglee='oui'";
     elseif($statut == "commande")
       $where[] = "spip_transactions.statut='commande'";
     elseif($statut == "erreur")
-      $where[] = "spip_transactions.statut like 'echec'";
+      $where[] = "spip_transactions.statut like 'echec%'";
   }
 
   if($id_campagne)
@@ -90,27 +90,28 @@ function action_exporter_souscriptions_dist($arg=null) {
 
   $row = sql_select($select, $from, $where);
 
-  $entete = array("ID du don",
-                  "Courriel",
-                  "Type de souscription",
-                  "Montant",
-                  "Reglée",
-                  "Statut",
-                  "Date de paiement",
-                  "Mode de paiement",
-                  "ID de l'autorisation",
-                  "Nom",
-                  "Prénom",
-                  "Adresse",
-                  "Code Postal",
-                  "Ville",
-                  "Pays",
-                  "Téléphone",
-                  "Souhaite reçu fiscal",
-                  "Souhaite être informé",
-                  "Date don",
-                  "ID Campagne",
-                  "Titre de la campagne");
+  $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"));
 
   /* Utilisation de la fonction exporter_csv de Bonux */
   $exporter_csv = charger_fonction('exporter_csv', 'inc/', true);