function frosso_estimated_cost_handle_on_after_object_save(ApplicationObject &$object)
{
    if ($object instanceof Milestone && !$object instanceof RemediaMilestone) {
        if (isset($_POST['milestone']['custom_field_1']) && $_POST['milestone']['custom_field_1'] != '') {
            $remedia_mil = new RemediaMilestone($object->getId());
            $remedia_mil->customFields()->setValue('custom_field_1', $_POST['milestone']['custom_field_1']);
            $remedia_mil->setNew(false);
            $remedia_mil->save();
        }
    }
}
 function set_percent()
 {
     if ($this->request->isAsyncCall() || $this->request->isSubmitted()) {
         $milestone_id = $this->request->get('milestone_id', -1);
         $milestone = new RemediaMilestone($milestone_id);
         if ($milestone) {
             if ($this->request->isSubmitted()) {
                 $percent = $this->request->post('percent', -1);
                 if ($percent >= 0 && $percent <= 100) {
                     $milestone->setPercentDone($percent);
                     $milestone->save();
                     $this->response->respondWithData($milestone, array('as' => 'milestone', 'detailed' => true));
                 } else {
                     $this->response->exception(new ValidationErrors(array('percent' => lang("Value must be between 0 and 100"))));
                 }
             }
             $this->smarty->assign(array('milestone' => $milestone, 'form_action' => Router::assemble('frosso_ec_set_milestone_percent', array('project_slug' => $this->request->get('project_slug'), 'milestone_id' => $milestone_id))));
         } else {
             $this->response->notFound();
         }
     } else {
         $this->response->badRequest("");
     }
 }