Created
June 5, 2012 15:22
-
-
Save SebDeclercq/2875643 to your computer and use it in GitHub Desktop.
Code moche mais fonctionnel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
any [ 'get', 'post' ] => '/law/:numid' => sub { | |
my $numid = params->{numid}; | |
my ($lawid); | |
my $rs = schema->resultset('Law')->search(); | |
while (my $law = $rs->next) { | |
my @lawvs = $law->law_versions; | |
for (@lawvs) { | |
if ($_->numid() eq $numid ) { | |
my @lawids = $_->lawid(); | |
$lawid = $_->id for $lawids[0]; | |
} | |
} | |
} | |
my @laws = schema->resultset('Law')->search ( { id => $lawid } ); | |
my @lawvs = schema->resultset('LawVersion')->search ( { numid => $numid } ); | |
my @preambles = schema->resultset('Preamble')->search ( { numid => $numid } ); | |
my @articles = schema->resultset('Article')->search ( { numid => $numid }, { order_by => { -asc => 'numord' } } ); | |
my @appendixes = schema->resultset('Appendix')->search ( { numid => $numid}, { order_by => { -asc => 'numart' } } ); | |
template 'law',{laws => \@laws, | |
lawvs => \@lawvs, | |
preambles => \@preambles, | |
articles => \@articles, | |
appendixes => \@appendixes, | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment