package Ernad::IssueSelect; use strict; use warnings; use Carp qw(confess); use Data::Dumper; use Ernad::Common; use Ernad::ReportState; use Ernad::IssueState; ## form issue nucleus sub Show { my $wepas=shift or die "no wepas"; my $rs=shift or die "no report state"; my $e=$rs->{'e'} or die "no erimp in report state"; my $repcode=$wepas->{'Report'}; my $password=$wepas->{'Password'}; my $issue_doc=&Ernad::IssueState::state_summary_doc($repcode,$e,0); my $time=time; #open(F,"> /tmp/wepas"); #my $web_string=Dumper $wepas; #print F $web_string; #close F; #$issue_doc->toFile('/tmp/issues_new.xml'); my $html_doc=$e->{'t'}->transform($issue_doc,'issue_selection_screen'); my $out=$html_doc->toString or die; return $out; } ## checks params and if Select=Select then does processing things and ## returns true sub Process { my $wepas=shift or die "no wepas"; my $rs=shift or die "no report state"; my $e=$rs->{'e'} or die 'Where is my erimp?'; ## issuedate _ stosta _ delete my $id_sosta_del=$wepas->{'id_sosta_del'} // ''; if(not $id_sosta_del) { confess "I have no id_sosta_del."; } $id_sosta_del =~ m|^(\d{4}-\d{2}-\d{2})_([a-z]+)$| or confess "invalid id_sosta_del '$id_sosta_del'"; my $issuedate=$1; my $sosta_del=$2; my @sostas=keys %{$e->{'const'}->{'source_states'}}; foreach my $sosta (@sostas) { if($sosta_del eq $sosta) { $rs->create_from_source( $e->{'const'}->{$sosta.'_dir'}, $issuedate); ## I add a not-need sosta argument to see the sosta in a bug report $rs->update_editor($sosta); return 1; } } #if($sosta_del eq 'delete') { # $rs->delete_from_source($issuedate); # ## fixme: find out if we need this here. # my $state_file = $rs->{'path'}.'/'.$e->{'const'}->{'state_file'}; # unlink $state_file; # #&Process($wepas,$rs); # #my $out=Dumper $rs; # #die Dumper $rs; # return 0; #} #else { ## assume it is presorted because of nep-pbe $rs->create_from_source( $e->{'const'}->{'presorted_dir'},$issuedate); $rs->update_editor(); #} return 0; } 1;