File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,26 @@ public function view(){
207
207
}
208
208
209
209
static public function request_handler (){
210
- if ($ _POST ['Function ' ]=='MergeDonor ' && $ _POST ['DonorId ' ]){
210
+ if ($ _POST ['table ' ]=='Donor ' && $ _POST ['DonorId ' ] && $ _POST ['Function ' ]=="Delete " ){
211
+ //check if any donations connected to this account or merged ids..
212
+ $ donations =Donation::get (array ('DonorId= ' .$ _POST ['DonorId ' ]));
213
+ if (sizeof ($ donations )>0 ){
214
+ self ::display_error ("Can't delete Donor # " .$ _POST ['DonorId ' ].". There are " .sizeof ($ donations )." donation(s) attached to this. " );
215
+ return false ;
216
+ }
217
+ $ donors =Donation::get (array ('MergedId= ' .$ _POST ['DonorId ' ]));
218
+ if (sizeof ($ donors )>0 ){
219
+ self ::display_error ("Can't delete Donor # " .$ _POST ['DonorId ' ].". There are " .sizeof ($ donors )." donors merged to this entry. " );
220
+ return false ;
221
+ }else {
222
+ $ dSQL ="DELETE FROM " .Donor::get_table_name ()." WHERE `DonorId`=' " .$ _POST ['DonorId ' ]."' " ;
223
+ self ::db ()->query ($ dSQL );
224
+ self ::display_notice ("Deleted Donor # " .$ _POST ['DonorId ' ].". " );
225
+ return true ;
226
+ }
227
+
228
+
229
+ }elseif ($ _POST ['Function ' ]=='MergeDonor ' && $ _POST ['DonorId ' ]){
211
230
//self::dump($_POST);
212
231
$ data =array ();
213
232
foreach (self ::s ()->fillable as $ field ){
You can’t perform that action at this time.
0 commit comments