4 use CXGN
::Scrap
::AjaxPage
;
6 use CXGN
::Chado
::Stock
;
7 use CXGN
::People
::Person
;
10 use CatalystX
::GlobalContext
'$c';
12 my $doc = CXGN
::Scrap
::AjaxPage
->new();
13 $doc->send_http_header();
15 my $dbh = $c->dbc->dbh;
16 my $schema = $c->dbic_schema('Bio::Chado::Schema' , 'sgn_chado');
17 my($login_person_id,$login_user_type)=CXGN
::Login
->new($dbh)->verify_session();
19 if ($login_user_type eq 'curator' || $login_user_type eq 'submitter' || $login_user_type eq 'sequencer') {
21 my $doc = CXGN
::Scrap
::AjaxPage
->new();
22 my ($stock_id, $allele_id, $sp_person_id) = $doc->get_encoded_arguments("stock_id", "allele_id", "sp_person_id");
25 my $json = JSON
->new();
28 my $stock = CXGN
::Chado
::Stock
->new($schema, $stock_id);
29 $stock->associate_allele($allele_id, $sp_person_id);
30 $error{"response"} = "Associated allele $allele_id with stock $stock_id!";
33 $error{"error"} = "Associate allele failed! " . $@
;
34 CXGN
::Contact
::send_email
('associate_allele.pl died',$error{"error"}, 'sgn-bugs@sgn.cornell.edu');
36 my $subject="[New stock associated] allele $allele_id";
37 my $person= CXGN
::People
::Person
->new($dbh, $login_person_id);
38 my $user=$person->get_first_name()." ".$person->get_last_name();
39 my $user_link = qq |http
://www
.sgn
.cornell
.edu
/solpeople/personal
-info
.pl?sp_person_id
=$sp_person_id|;
41 my $fdbk_body="$user ($user_link has associated stock $stock_id with allele $allele_id \n
42 http://www.sgn.cornell.edu/stock/$stock_id/view";
43 CXGN
::Contact
::send_email
($subject,$fdbk_body, 'sgn-db-curation@sgn.cornell.edu');
44 CXGN
::Feed
::update_feed
($subject,$fdbk_body);
46 my $jobj = $json->objToJson(\
%error);