View | Details | Raw Unified | Return to bug 6679
Collapse All | Expand All

(-)a/cataloguing/value_builder/macles.pl (-56 / +72 lines)
Lines 117-180 my ($input) = @_; Link Here
117
      }
117
      }
118
#        use Data::Dumper;warn "BIGLOOP IN".Dumper(@BIGLOOP);
118
#        use Data::Dumper;warn "BIGLOOP IN".Dumper(@BIGLOOP);
119
    }
119
    }
120
    foreach my $num (sort keys %numbers){
120
    foreach my $num ( sort keys %numbers ) {
121
	my @tmpcolhdr;
121
        my @tmpcolhdr;
122
	my @tmprowhdr;
122
        my @tmprowhdr;
123
        @tmpcolhdr = @{$numbers{$num}->{'col_hdr'}} if ($numbers{$num}->{'col_hdr'});
123
        @tmpcolhdr = @{ $numbers{$num}->{'col_hdr'} }
124
        @tmprowhdr = @{$numbers{$num}->{"row_hdr"}} if ($numbers{$num}->{'row_hdr'});
124
          if ( $numbers{$num}->{'col_hdr'} );
125
      my @lines;
125
        @tmprowhdr = @{ $numbers{$num}->{"row_hdr"} }
126
      my @lists;
126
          if ( $numbers{$num}->{'row_hdr'} );
127
      my %BIGLOOPcell;
127
        my @lines;
128
      foreach my $row (@tmprowhdr){
128
        my @lists;
129
        my $tmprowvalue=$row->{rowvalue};
129
        my %BIGLOOPcell;
130
	  my $rowcode;
130
        foreach my $row (@tmprowhdr) {
131
          $rowcode=$1 if $tmprowvalue=~/[0-9]([0-9])\./;
131
            my $tmprowvalue = $row->{rowvalue};
132
        my @cells;
132
            my $rowcode;
133
        if (scalar(@tmpcolhdr)>0){
133
            $rowcode = $1 if $tmprowvalue =~ /[0-9]([0-9])\./;
134
        #cas du tableau bidim
134
            my @cells;
135
          foreach my $col (@tmpcolhdr){
135
            if ( scalar(@tmpcolhdr) > 0 ) {
136
            my $tmpcolvalue=$col->{colvalue};
136
137
	      my $colcode;
137
                #cas du tableau bidim
138
              $colcode=$1 if $tmpcolvalue=~/[0-9]\.([0-9])/;
138
                foreach my $col (@tmpcolhdr) {
139
            my %cell;
139
                    my $tmpcolvalue = $col->{colvalue};
140
            $cell{celvalue}=$num.$rowcode.$colcode;
140
                    my $colcode;
141
            $cell{rowvalue}=$tmprowvalue;
141
                    $colcode = $1 if $tmpcolvalue =~ /[0-9]\.([0-9])/;
142
            $cell{colvalue}=$tmpcolvalue;
142
                    my %cell;
143
            if ($numbers{$num}->{$num.$rowcode.$colcode}){
143
                    $cell{celvalue} = $num . $rowcode . $colcode;
144
              foreach (@{$numbers{$num}->{$num.$rowcode.$colcode}}){
144
                    $cell{rowvalue} = $tmprowvalue;
145
                push @{$cell{libs}},{'lib'=>$_};
145
                    $cell{colvalue} = $tmpcolvalue;
146
              }
146
                    if ( $numbers{$num}->{ $num . $rowcode . $colcode } ) {
147
            }else {
147
148
              push @{$cell{libs}},{'lib'=>$num.$rowcode.$colcode};
148
                        foreach (
149
                            @{ $numbers{$num}->{ $num . $rowcode . $colcode } }
150
                          )
151
                        {
152
                            push @{ $cell{libs} }, { 'lib' => $_ };
153
                        }
154
                    }
155
                    else {
156
                        push @{ $cell{libs} },
157
                          { 'lib' => $num . $rowcode . $colcode };
158
                    }
159
                    push @cells, \%cell;
160
                }
161
                if ( $numbers{$num}->{ $num . $rowcode } ) {
162
                    my @tmpliblist = @{ $numbers{$num}->{ $num . $rowcode } };
163
                    push @lists,
164
                      { 'lib' => $row->{rowlib}, 'liblist' => \@tmpliblist };
165
                }
149
            }
166
            }
150
            push @cells,\%cell;
167
            else {
151
          }
168
152
          if ($numbers{$num}->{$num.$rowcode}){
169
                #Cas de la liste simple
153
            my @tmpliblist=@{$numbers{$num}->{$num.$rowcode}};
170
                foreach my $key ( sort keys %{ $numbers{$num} } ) {
154
            push @lists,{'lib'=>$row->{rowlib},'liblist'=>\@tmpliblist};
171
                    my %cell;
155
          }
172
                    if ( $key =~ /$num$rowcode[0-9]/ ) {
156
        } else {
173
                        $cell{celvalue} = $key;
157
        #Cas de la liste simple
174
                        foreach my $lib ( @{ $numbers{$num}->{$key} } ) {
158
          foreach my $key (sort keys %{$numbers{$num}}){
175
                            push @{ $cell{'libs'} }, { 'lib' => $lib };
159
            my %cell;
176
                        }
160
            if ($key=~/$num$rowcode[0-9]/){
177
                        push @cells, \%cell;
161
              $cell{celvalue}=$key;
178
                    }
162
              foreach my $lib (@{$numbers{$num}->{$key}}){
179
                }
163
                push @{$cell{'libs'}},{'lib'=>$lib};
164
              }
165
              push @cells,\%cell;
166
            }
180
            }
167
          }
181
            push @lines,
182
              {
183
                'cells'    => \@cells,
184
                'rowvalue' => $row->{rowvalue},
185
                'rowlib'   => $row->{rowlib}
186
              };
168
        }
187
        }
169
        push @lines,{'cells'=>\@cells,'rowvalue'=>$row->{rowvalue},'rowlib'=>$row->{rowlib}};
188
        $BIGLOOPcell{'Lists'}   = \@lists     if ( scalar(@lists) > 0 );
170
      }
189
        $BIGLOOPcell{'lines'}   = \@lines     if ( scalar(@lines) > 0 );
171
      $BIGLOOPcell{'Lists'}=\@lists if (scalar(@lists)>0);
190
        $BIGLOOPcell{'col_hdr'} = \@tmpcolhdr if ( scalar(@tmpcolhdr) > 0 );
172
      $BIGLOOPcell{'lines'}=\@lines if (scalar(@lines)>0);
191
        $BIGLOOPcell{'Table'}   = $numbers{$num}->{'Table'};
173
      $BIGLOOPcell{'col_hdr'}=\@tmpcolhdr if (scalar(@tmpcolhdr)>0);
192
        $BIGLOOPcell{'hdr_tab'} = $numbers{$num}->{'hdr_tab'};
174
      $BIGLOOPcell{'Table'}=$numbers{$num}->{'Table'};
193
        $BIGLOOPcell{'number'}  = $num;
175
      $BIGLOOPcell{'hdr_tab'}=$numbers{$num}->{'hdr_tab'};
194
        push @BIGLOOP, \%BIGLOOPcell;
176
      $BIGLOOPcell{'number'}=$num;
177
      push @BIGLOOP,\%BIGLOOPcell;
178
    }
195
    }
179
#     warn "BIGLOOP OUT".Dumper(@BIGLOOP);
196
#     warn "BIGLOOP OUT".Dumper(@BIGLOOP);
180
    my ($template, $loggedinuser, $cookie)
197
    my ($template, $loggedinuser, $cookie)
181
- 

Return to bug 6679