/**
  * Update custom plugin fields
  *
  * @param $event
  * @param BugData $bug
  */
 function bugUpdateFields($event, BugData $bug)
 {
     require_once STORYBOARD_CORE_URI . 'storyboard_db_api.php';
     $storyboard_db_api = new storyboard_db_api();
     if (substr(MANTIS_VERSION, 0, 4) > '1.2.') {
         $bug_id = $bug->id;
     } else {
         $bug_id = gpc_get_int('bug_id', null);
     }
     $card_type = gpc_get_string('card_type', '');
     $card_type_id = null;
     if (!is_null($card_type)) {
         $card_type_id = $storyboard_db_api->select_typeid_by_typestring($card_type);
     }
     $card_risk = gpc_get_string('card_risk', '');
     $card_story_pt = gpc_get_string('card_story_pt', '');
     $card_story_pt_post = gpc_get_string('card_story_pt_post', '');
     $card_acc_crit = gpc_get_string('card_acc_crit', '');
     switch ($event) {
         case 'EVENT_REPORT_BUG':
             $storyboard_db_api->insert_story_card($bug_id, $card_type_id, $card_risk, $card_story_pt, $card_story_pt_post, $card_acc_crit);
             break;
         case 'EVENT_UPDATE_BUG':
             $storyboard_db_api->update_story_card($bug_id, $card_type_id, $card_risk, $card_story_pt, $card_story_pt_post, $card_acc_crit);
             break;
     }
 }