name = 'MandatoryFilelds'; $this->description = 'Mandatory fields severity, projection'; $this->page = ''; $this->version = '1.0'; $this->requires = array( 'MantisCore' => '1.3.0', ); $this->author = 'carlos proensa'; } function hooks() { return array( 'EVENT_VIEW_BUG_DETAILS' => 'viewBugDetails', 'EVENT_UPDATE_BUG_STATUS_FORM' => 'updateBugStatusForm', 'EVENT_UPDATE_BUG_DATA' => 'updateBugData' ); } function updateBugStatusForm($p_event,$p_bug_id){ $f_bug = bug_get( $p_bug_id, false ); ?> > * > * status == RESOLVED ){ $t_severity= $p_bug_upd_data->severity; $t_projection= $p_bug_upd_data->projection; if ($t_severity == 0) { error_parameters(lang_get('severity')); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } if ($t_projection == 0) { error_parameters(lang_get('projection')); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } } return $p_bug_upd_data; } # # Evento al escribir la pagina de view_bug, para escrbir informacion extra # function viewBugDetails($p_event, $p_bug_id){ $f_bug = bug_get( $p_bug_id, false ); $f_user_id = auth_get_current_user_id(); $f_access_level = user_get_access_level($f_user_id, $f_bug->project_id); $f_severity = $f_bug->severity; $f_projection= $f_bug->projection; # # Muestra un aviso si falta rellenar campos de severity o projection # y si el usuario tiene permisos > informador # if ( $f_access_level > REPORTER && ($f_severity==0 || $f_projection==0) ){ $str= ''; $num_err= 0; if ($f_severity == 0) { $valid= false; $str= $str . lang_get( 'severity' ); $num_err++; } if ($f_projection == 0) { $valid= false; if ($num_err>0) $str= $str . ', '; $str= $str . lang_get( 'projection' ); $num_err++; } if ($num_err>1) $str = "Recuerde que los campos: $str, deben estar informados antes de resolver"; else $str = "Recuerde que el campo $str debe estar informado antes de resolver"; echo ''; echo '' . $str . ''; echo ''; } } }