Author: benj
Date: Thu Apr 20 15:03:51 2017
New Revision: 2046

URL: http://svn.gna.org/viewcvs/gdtc?rev=2046&view=rev
Log:
Remove lines


Modified:
    branches/production/include/SympaSession.php
    branches/production/include/coherence.php
    branches/production/include/operators.php

Modified: branches/production/include/SympaSession.php
URL: 
http://svn.gna.org/viewcvs/gdtc/branches/production/include/SympaSession.php?rev=2046&r1=2045&r2=2046&view=diff
==============================================================================
--- branches/production/include/SympaSession.php        (original)
+++ branches/production/include/SympaSession.php        Thu Apr 20 15:03:51 2017
@@ -288,3 +288,4 @@
     return $string;
   }
 }
+?>

Modified: branches/production/include/coherence.php
URL: 
http://svn.gna.org/viewcvs/gdtc/branches/production/include/coherence.php?rev=2046&r1=2045&r2=2046&view=diff
==============================================================================
--- branches/production/include/coherence.php   (original)
+++ branches/production/include/coherence.php   Thu Apr 20 15:03:51 2017
@@ -63,6 +63,7 @@
                    check_prelevement_renewal_date_is_fucked ($filter),
                    check_prelevement_start_date_is_fucked ($filter),
                    check_prelevement_periodicity_is_fucked ($filter),
+                   check_prelevement_amount_is_null ($filter),
                    check_prelevement_not_created($filter),
                    check_cbrecur_not_created($filter),
                    check_no_current_membership($filter),
@@ -123,6 +124,9 @@
   if ( $test == 'key_is_fucked' )
       return fix_key_is_fucked ( $id );
 
+  if ( $test == 'fix_prelevement_amount_is_null' )
+      return fix_prelevement_amount_is_null ( $id );
+
   print 'FAIL';
   return;
 }
@@ -207,9 +211,51 @@
 }
 
 
+/***** prevelement amount is null */
+function check_prelevement_amount_is_null ($filter = '')
+{
+  $results = basic_query ( $filter, "AND ( subscription.payment_mode = 
'cbweb_recur' OR subscription.payment_mode = 'prelevement' ) " .
+                          "AND ( subscription.prelevement_amount = 0 OR 
subscription.prelevement_amount IS NULL )" );
+  if ( ! $results ) return;
+
+  $output = Array ( "Montant du prélèvement nul : " . sizeof($results). " 
résultat(s)", 'fix_prelevement_amount_is_null', 1 );
+  foreach ( $results as $result )
+    {
+      $name = actor_get_clickable_name ( $result );
+      $output[3][] = Array ( $result [ 'actor_id' ], 
+                            $name,
+                            sprintf ( "%s, montant annuel: %s€", ucfirst 
( $result [ 'payment_mode' ] ), $result [ 'amount' ] ) );
+    }
+    
+  return $output;
+}
+
+
+
+function fix_prelevement_amount_is_null ($id)
+{
+  $result = get_all_actor_details ( $id );
+
+  if ( $result [ 'subscription' ] [ 'payment_mode' ] == 'prelevement' )
+    {
+      $commit = commit ( 'subscription', 'subscription_id', 
+                        $result [ 'subscription' ] [ 'subscription_id' ],
+                        Array ( 'prelevement_amount' => $result [ 
'subscription' ] [ 'amount' ] / 12 ),
+                        "Fix auto incoherence"  );
+      if ( $commit )
+       print 'good';
+      else
+       print 'Impossible de corriger';
+    }
+  else
+    {
+      printf ( 'Impossible de corriger un paiement %s',
+              $result [ 'subscription' ] [ 'payment_mode' ] );
+    }
+}
+
 
 /***** prevelement and start_date not synced */
-
 function check_prelevement_periodicity_is_fucked ($filter = '')
 {
   $results = basic_query ( $filter, "AND ( subscription.payment_mode = 
'cbweb_recur' OR subscription.payment_mode = 'prelevement' ) " .

Modified: branches/production/include/operators.php
URL: 
http://svn.gna.org/viewcvs/gdtc/branches/production/include/operators.php?rev=2046&r1=2045&r2=2046&view=diff
==============================================================================
--- branches/production/include/operators.php   (original)
+++ branches/production/include/operators.php   Thu Apr 20 15:03:51 2017
@@ -857,4 +857,3 @@
 /* c-basic-offset: 4 */
 /* End: */
 ?>
-


_______________________________________________
Gdtc-commits mailing list
Gdtc-commits@gna.org
https://mail.gna.org/listinfo/gdtc-commits

Reply via email to