source: trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Remote/Search.pm @ 2316

Last change on this file since 2316 was 2316, checked in by nanardon, 5 years ago

Call post-synchro in a efficient way

This patch add callback to base allowing to web part to know when
commit() were done. Then call_sync_batch is run only when commit were
successfully done.

File size: 1023 bytes
Line 
1package LATMOS::Accounts::Web::Controller::Remote::Search;
2use Moose;
3use namespace::autoclean;
4
5BEGIN { extends 'Catalyst::Controller'; }
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Remote::Search - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19
20=head2 index
21
22=cut
23
24sub index :Path :Args(0) {
25    my ( $self, $c ) = @_;
26
27    my $otype = $c->req->param('otype');
28    my @search = $c->req->param('q');
29
30    push(@search, 'oalias=NULL') unless($c->req->param('oalias'));
31
32    my $base = $c->model('Accounts')->db;
33
34    if (!$base->is_supported_object($otype)) {
35        $c->res->status('404');
36        return;
37    }
38
39    $c->stash->{data} = [
40        $c->model('Accounts')->db->search_objects($otype, @search)
41    ];   
42
43}
44
45
46
47=encoding utf8
48
49=head1 AUTHOR
50
51Olivier Thauvin,Guyancourt - B1428,+33 1 80285052,
52
53=head1 LICENSE
54
55This library is free software. You can redistribute it and/or modify
56it under the same terms as Perl itself.
57
58=cut
59
60__PACKAGE__->meta->make_immutable;
61
621;
Note: See TracBrowser for help on using the repository browser.