/[papo]/papo/zot/zot2gfd.pl
ViewVC logotype

Diff of /papo/zot/zot2gfd.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by jlenton, Tue Dec 3 20:53:47 2002 UTC revision 1.6 by jlenton, Thu Feb 13 16:12:08 2003 UTC
# Line 103  sub expand_vars Line 103  sub expand_vars
103  }  }
104    
105    
106    sub fkey_join
107    {
108        my $from = shift;
109        my $to = shift;
110    
111        return qq'
112            <!-- permite buscar por nombre simbólico -->
113            <eq>
114              <cfield name="$from"/>
115              <cfield name="$to"/>
116            </eq>
117    ';
118    }
119    
120  sub fkey_datasource  sub fkey_datasource
121  {  {
122      my $database = shift;      my $database = shift;
# Line 171  foreach (@tables) Line 185  foreach (@tables)
185    
186  my %results = ($config->varlist('.'));  my %results = ($config->varlist('.'));
187  $results{'histables'} = join ', ', @histables;  $results{'histables'} = join ', ', @histables;
188  $results{'tables'} = join( ', ', map( $_->name, @tables ), $results{'histables'});  # $results{'tables'} = join( ', ', map( $_->name, @tables ), $results{'histables'});
189  $results{'conditions'} = "@conditions";  # $results{'conditions'} = "@conditions";
190  $results{'id'} = $results{table}.'.id';  $results{'id'} = $results{table}.'.id';
191    
192  $zot->add_history;  $zot->add_history;
193  push @tables, map $zot->table($_), @histables;  push @tables, map $zot->table($_), @histables;
194    
195  my $tmp=0;  my $tmp=0;
196    my @result_conditions = @conditions;
197  foreach my $i (0..$#{ $results{'search_by'}})  foreach my $i (0..$#{ $results{'search_by'}})
198  {  {
199      my $field = $results{'search_by'}[$i];      my $field = $results{'search_by'}[$i];
# Line 186  foreach my $i (0..$#{ $results{'search_b Line 201  foreach my $i (0..$#{ $results{'search_b
201      if (!$table)      if (!$table)
202      {      {
203          ($table) = grep $_->rel($field), @tables;          ($table) = grep $_->rel($field), @tables;
204            die ('Aieee!') if (!$table);
205          my $fkey_desc = shift @{$config->fkey_desc};          my $fkey_desc = shift @{$config->fkey_desc};
206          $results{'fkey'}[$i] = sprintf( 'foreign_key="%sDataSource._table" foreign_key_description="%s" style="dropdown"',          $results{'fkey'}[$i] = sprintf( 'foreign_key="%sDataSource._table" foreign_key_description="%s" style="dropdown"',
207                                          $field,                                          $field,
208                                          $fkey_desc );                                          $fkey_desc );
209          push @datasources, fkey_datasource($config->database, $table->rel($field));          push @datasources, fkey_datasource($config->database, $table->rel($field));
210            push @result_conditions, fkey_join($table->name . ".$field", '_' . $table->rel($field) . '_data._table');
211      }      }
212      my $attr = $table->attr($field) || $zot->table($table->rel($field))->attr('id');      my $attr = $table->attr($field) || $zot->table($table->rel($field))->attr('id');
213      my $width = 0;      my $width = 0;
# Line 217  $results{'search_x'}[$_] = $results{'sea Line 234  $results{'search_x'}[$_] = $results{'sea
234      foreach (1..$#{ $results{'search_width'} });      foreach (1..$#{ $results{'search_width'} });
235  $results{'datasources'} = join '', @datasources;  $results{'datasources'} = join '', @datasources;
236    
237    $results{'result_conditions'} = join '', @result_conditions;
238    $results{'edit_conditions'} = join '', @conditions;
239    $results{'tables'} = join ', ', map $_->name, @tables;
240    
241  foreach my $i (0..$#{ $results{'field'} })  foreach my $i (0..$#{ $results{'field'} })
242  {  {
243      $results{'fkey'}[$i] ||= '';      $results{'fkey'}[$i] ||= '';

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26