예제 #1
0
 case 'delete':
     validate_security($security_level, 4);
     // check for errors and prepare extra values
     if (!$glEntry->id) {
         $error = true;
     } else {
         $delGL = new journal();
         $delGL->journal($glEntry->id);
         // load the posted record based on the id submitted
         $recur_id = db_prepare_input($_POST['recur_id']);
         $recur_frequency = db_prepare_input($_POST['recur_frequency']);
         // *************** START TRANSACTION *************************
         $db->transStart();
         if ($recur_id > 0) {
             // will contain recur_id
             $affected_ids = $delGL->get_recur_ids($recur_id, $delGL->id);
             for ($i = 0; $i < count($affected_ids); $i++) {
                 $delGL->id = $affected_ids[$i]['id'];
                 $delGL->journal($delGL->id);
                 // load the posted record based on the id submitted
                 if (!$delGL->unPost('delete')) {
                     $error = true;
                     break;
                 }
                 // test for single post versus rolling into future posts, terminate loop if single post
                 if (!$recur_frequency) {
                     break;
                 }
             }
         } else {
             if (!$delGL->unPost('delete')) {