<commit_before>use strict;

my $individual_detail_page = CXGN::Phenome::IndividualDetailPage->new();

package CXGN::Phenome::IndividualDetailPage;


use CXGN::Page;
use CXGN::Page::FormattingHelpers qw /info_section_html 
                                      page_title_html
                                      columnar_table_html 
                                      html_optional_show 
                                      info_table_html
                                      tooltipped_text
                                      html_alternate_show
                                      /;
use SGN::Image;
use CXGN::Phenome::Individual;
use CXGN::Phenome::Population;
use CXGN::Chado::Publication;
use CXGN::People::PageComment;
use CXGN::People::Person;
use CXGN::Cview::Map_overviews;
use CXGN::Contact;
use CXGN::Feed;
use CXGN::Tools::Organism;
use JSAN::ServerSide;
use HTML::Entities;
use Number::Format;
use Statistics::Descriptive;

use base qw / CXGN::Page::Form::SimpleFormPage /;

sub new { 
    my $class = shift;
    my $self = $class->SUPER::new(@_);
    $self->set_script_name("individual.pl");
    
    return $self; 
}

sub define_object { 
    my $self = shift;
    
    # call set_object_id, set_object and set_primary_key here
    # with the appropriate parameters.
    #
    $self->set_dbh(CXGN::DB::Connection->new('phenome'));
    my %args = $self->get_args();
    my $individual_id= $args{individual_id};
    my $individual_name= $args{individual_name};
    if ($individual_name && !$individual_id ) {
	my $individual_by_name = (CXGN::Phenome::Individual->new_with_name($self->get_dbh(), $individual_name))[0];
	if ($individual_by_name) { $individual_id = $individual_by_name->get_individual_id(); }
    }
   
    unless ( ( $individual_id =~ m /^\d+$/  ) || ($args{action} eq 'new' && !$individual_id) ) 
    {
	$c->throw(is_error=>0,
		  message=>"No accession exists for identifier $individual_id",
	    );
    }
    my $individual=CXGN::Phenome::Individual->new($self->get_dbh(),$individual_id ) ;
    $self->set_object_id($individual_id);
    $self->set_object($individual);
    $self->set_primary_key("individual_id");	
    
    
    if ( $individual->get_obsolete() eq 't' && $self->get_user()->get_user_type() ne 'curator' ) 
    {
	$c->throw(is_error=>0, 
		  title => 'Obsolete accession',
		  message=>"Accession $individual_id is obsolete!",
		  developer_message => 'only curators can see obsolete accessions',
		  notify => 0,   #< does not send an error email
	    );
    }
    my $action= $args{action};
    if ( !$individual->get_individual_id() && $action ne 'new'  ) {
	$c->throw(is_error=>0, message=>'No accession exists for this identifier',);
    }
    
    $self->set_owners($self->get_object()->get_owners());
}
<commit_msg>fixed #1113 . Loading new accessions works now<commit_after>use strict;

my $individual_detail_page = CXGN::Phenome::IndividualDetailPage->new();

package CXGN::Phenome::IndividualDetailPage;


use CXGN::Page;
use CXGN::Page::FormattingHelpers qw /info_section_html 
                                      page_title_html
                                      columnar_table_html 
                                      html_optional_show 
                                      info_table_html
                                      tooltipped_text
                                      html_alternate_show
                                      /;
use SGN::Image;
use CXGN::Phenome::Individual;
use CXGN::Phenome::Population;
use CXGN::Chado::Publication;
use CXGN::People::PageComment;
use CXGN::People::Person;
use CXGN::Cview::Map_overviews;
use CXGN::Contact;
use CXGN::Feed;
use CXGN::Tools::Organism;
use JSAN::ServerSide;
use HTML::Entities;
use Number::Format;
use Statistics::Descriptive;

use base qw / CXGN::Page::Form::SimpleFormPage /;

sub new { 
    my $class = shift;
    my $self = $class->SUPER::new(@_);
    $self->set_script_name("individual.pl");
    
    return $self; 
}

sub define_object { 
    my $self = shift;
    
    # call set_object_id, set_object and set_primary_key here
    # with the appropriate parameters.
    #
    $self->set_dbh(CXGN::DB::Connection->new('phenome'));
    my %args = $self->get_args();
    my $individual_id= $args{individual_id};
    my $individual_name= $args{individual_name};
    if ($individual_name && !$individual_id ) {
	my $individual_by_name = (CXGN::Phenome::Individual->new_with_name($self->get_dbh(), $individual_name))[0];
	if ($individual_by_name) { $individual_id = $individual_by_name->get_individual_id(); }
    }
   
    unless ( ( $individual_id =~ m /^\d+$/  ) || ($args{action} eq 'new' && !$individual_id) || ($args{action} eq 'store' && !$individual_id) ) 
    {
	$c->throw(is_error=>0,
		  message=>"No accession exists for identifier $individual_id",
	    );
    }
    my $individual=CXGN::Phenome::Individual->new($self->get_dbh(),$individual_id ) ;
    $self->set_object_id($individual_id);
    $self->set_object($individual);
    $self->set_primary_key("individual_id");	
    
    
    if ( $individual->get_obsolete() eq 't' && $self->get_user()->get_user_type() ne 'curator' ) 
    {
	$c->throw(is_error=>0, 
		  title => 'Obsolete accession',
		  message=>"Accession $individual_id is obsolete!",
		  developer_message => 'only curators can see obsolete accessions',
		  notify => 0,   #< does not send an error email
	    );
    }
    my $action= $args{action};
       
    $self->set_owners($self->get_object()->get_owners());
}

{'fraction_non_alphanumeric': 0.14293507910529188, 'fraction_numerical': 0.002364066193853428, 'mean_word_length': 2.90347764371895, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3686172', 'n_tokens_mistral': 1967, 'n_tokens_neox': 1736, 'n_words': 326}