bug 1316: split the revoke_assurance-function to have a function to recalculate the...
authorFelix Dörre <felix@dogcraft.de>
Tue, 12 May 2015 20:29:51 +0000 (22:29 +0200)
committerFelix Dörre <felix@dogcraft.de>
Tue, 12 May 2015 20:44:26 +0000 (22:44 +0200)
includes/notary.inc.php

index b6565b9..176f078 100644 (file)
@@ -2153,7 +2153,15 @@ function revoke_assurance($assuranceid, $toid){
 
        $query = "update `notary` set `deleted` = NOW() where `id` = '$assuranceid' LIMIT 1";
        mysql_query($query);
+       recalculate_old_assurance_points($toid);
+       fix_assurer_flag($toid);
+}
 
+/**
+ * recalculates the old points of an assuree
+ * @param int $toid        - id of the assuree
+ */
+function recalculate_old_assurance_points($toid){
        $query = "select * from `notary` where `to` = '$toid' and `method` != 'Administrative Increase' and `deleted` = 0 order by `when`";
        $res = mysql_query($query);
        while($row = mysql_fetch_assoc($res)){
@@ -2166,5 +2174,4 @@ function revoke_assurance($assuranceid, $toid){
                mysql_query($query);
        }
 
-       fix_assurer_flag($toid);
 }