[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2628] trunk/scripts/journal.pl



Revision: 2628
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2628&view=rev
Author:   einhverfr
Date:     2009-06-05 22:48:35 +0000 (Fri, 05 Jun 2009)

Log Message:
-----------
Ajax fixes

Modified Paths:
--------------
    trunk/scripts/journal.pl

Modified: trunk/scripts/journal.pl
===================================================================
--- trunk/scripts/journal.pl	2009-06-05 20:44:17 UTC (rev 2627)
+++ trunk/scripts/journal.pl	2009-06-05 22:48:35 UTC (rev 2628)
@@ -48,12 +48,16 @@
     );
     
     my $funcname = 'chart_list_search';
-    my @call_args = ($request->{'account-ac-search'});
     my %results_hash;
-    if ($request->{'account-ac-search'})
+    foreach my $r (keys %{$request})
     {
-      my @results = $request->call_procedure( procname => $funcname, args => ..hidden.., order_by => 'accno' );
-      foreach (@results) { $results_hash{$_->{'accno'}.'--'.$_->{'description'}} = $_->{'accno'}.'--'.$_->{'description'}; }
+       
+      if ($r =~ m/-ac-search$/)
+      {
+        my @call_args = ($request->{$r});
+        my @results = $request->call_procedure( procname => $funcname, args => ..hidden.., order_by => 'accno' );
+        foreach (@results) { $results_hash{$_->{'accno'}.'--'.$_->{'description'}} = $_->{'accno'}.'--'.$_->{'description'}; }
+      }
     }
     
     $request->{results} = \%results_hash;
@@ -70,144 +74,3 @@
 
 eval { do "scripts/custom/journal.pl"};
 1;
-#!/usr/bin/perl
-
-
-=head1 NAME
-
-LedgerSMB::Scripts::journal - LedgerSMB slim ajax script for journal's
-account search request.
-
-=head1 SYNOPSIS
-
-A script for journal ajax requests: accepts a search string and returns a
-list of matching accounts in a ul/li pair acceptable for scriptaculous's
-autocomplete library..
-
-=head1 METHODS
-
-=cut
-
-package LedgerSMB::Scripts::journal;
-our $VERSION = '1.0';
-
-use LedgerSMB;
-use LedgerSMB::Template;
-use strict;
-
-=pod
-
-=over
-
-=item __default
-
-Get the search string, query the database, return the results in a ul/li
-pair easily queried by scriptaculous's autocompleter.
-
-=back
-
-=cut
-
-sub __default {
-    my ($request) = @_;
-    my $template;
-    my %hits = ();
-    
-    $template = LedgerSMB::Template->new(
-            path => 'UI',
-            template => 'ajax_li',
-	    format => 'HTML',
-    );
-    
-    my $funcname = 'chart_list_search';
-    my @call_args = ($request->{'account-ac-search'});
-    my %results_hash;
-    if ($request->{'account-ac-search'})
-    {
-      my @results = $request->call_procedure( procname => $funcname, args => ..hidden.., order_by => 'accno' );
-      foreach (@results) { $results_hash{$_->{'accno'}.'--'.$_->{'description'}} = $_->{'accno'}.'--'.$_->{'description'}; }
-    }
-    
-    $request->{results} = \%results_hash;
-    $template->render($request);
-}
-
-=head1 Copyright (C) 2007 The LedgerSMB Core Team
-
-Licensed under the GNU General Public License version 2 or later (at your 
-option).  For more information please see the included LICENSE and COPYRIGHT 
-files.
-
-=cut
-
-eval { do "scripts/custom/journal.pl"};
-1;
-#!/usr/bin/perl
-
-
-=head1 NAME
-
-LedgerSMB::Scripts::journal - LedgerSMB slim ajax script for journal's
-account search request.
-
-=head1 SYNOPSIS
-
-A script for journal ajax requests: accepts a search string and returns a
-list of matching accounts in a ul/li pair acceptable for scriptaculous's
-autocomplete library..
-
-=head1 METHODS
-
-=cut
-
-package LedgerSMB::Scripts::journal;
-our $VERSION = '1.0';
-
-use LedgerSMB;
-use LedgerSMB::Template;
-use strict;
-
-=pod
-
-=over
-
-=item __default
-
-Get the search string, query the database, return the results in a ul/li
-pair easily queried by scriptaculous's autocompleter.
-
-=back
-
-=cut
-
-sub __default {
-    my ($request) = @_;
-    my $template;
-    my %hits = ();
-    
-    $template = LedgerSMB::Template->new(
-            path => 'UI',
-            template => 'ajax_li',
-	    format => 'HTML',
-    );
-    
-    my $funcname = 'chart_list_search';
-    my @call_args = ($request->{'account-ac-search'});
-    my @results = $request->call_procedure( procname => $funcname, args => ..hidden.., order_by => 'accno' );
-    my %results_hash;
-    foreach (@results) { $results_hash{$_->{'accno'}.'--'.$_->{'description'}} = $_->{'accno'}.'--'.$_->{'description'}; }
-    
-    $request->{results} = \%results_hash;
-    $template->render($request);
-}
-
-=head1 Copyright (C) 2007 The LedgerSMB Core Team
-
-Licensed under the GNU General Public License version 2 or later (at your 
-option).  For more information please see the included LICENSE and COPYRIGHT 
-files.
-
-=cut
-
-eval { do "scripts/custom/journal.pl"};
-1;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.