protected function populate(int $project_id, &$project)
 {
     if ($project == null) {
         $project = new logistic_project((int) $project_id);
         $project->set_name($this->unmarshal($this->db->f('name'), 'string'));
         $project->set_description($this->unmarshal($this->db->f('description'), 'string'));
         $project->set_project_type_id($this->unmarshal($this->db->f('project_type_id'), 'int'));
         if ($project->get_project_type_id() && $project->get_project_type_id() > 0) {
             $project->set_project_type_label($this->get_project_type_label($this->unmarshal($this->db->f('project_type_id'), 'int')));
         }
         $project->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
         $project->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
     }
     return $project;
 }
 public function edit($project = null)
 {
     $project_id = phpgw::get_var('id');
     if ($project_id && is_numeric($project_id)) {
         $project = $this->so->get_single($project_id);
     } else {
         if ($project == null) {
             $project = new logistic_project();
         }
     }
     $project_types = $this->so->get_project_types();
     foreach ($project_types as &$p_type) {
         if ($project->get_project_type_id() == $p_type['id']) {
             $p_type['selected'] = 1;
         }
     }
     $data = array('project' => $project, 'options' => $project_types, 'editable' => true);
     $this->use_yui_editor('description');
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('logistic') . '::' . lang('Project type');
     $GLOBALS['phpgw']->jqcal->add_listener('start_date');
     $GLOBALS['phpgw']->jqcal->add_listener('end_date');
     phpgwapi_jquery::load_widget('core');
     self::add_javascript('logistic', 'logistic', 'project.js');
     self::render_template_xsl(array('project/project_item'), $data);
 }