Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 74fca575

Von Sven Schöling vor fast 13 Jahren hinzugefügt

  • ID 74fca575d438232002756175338c23f55b8a6c12
  • Vorgänger 4000444b
  • Nachfolger 45970e73

Fixes für das "my $var if $cond;" pattern.

Unterschiede anzeigen:

SL/CA.pm
84 84
    $amount{ $ref->{accno} } = $ref->{amount};
85 85
  }
86 86

  
87
  my $where = "AND c.id = $chart_id" if ($chart_id ne '');
87
  my $where = $chart_id ne '' ? "AND c.id = $chart_id" : '';
88 88

  
89 89
  $query = qq{
90 90
    SELECT
SL/Common.pm
496 496

  
497 497
  $intnotes .= "\n\n" if ($intnotes);
498 498

  
499
  my $cc  = $main::locale->text('Cc') . ": $form->{cc}\n"   if $form->{cc};
500
  my $bcc = $main::locale->text('Bcc') . ": $form->{bcc}\n" if $form->{bcc};
499
  my $cc  = $form->{cc}  ? $main::locale->text('Cc') . ": $form->{cc}\n"   : '';
500
  my $bcc = $form->{bcc} ? $main::locale->text('Bcc') . ": $form->{bcc}\n" : '';
501 501
  my $now = scalar localtime;
502 502

  
503 503
  $intnotes .= $main::locale->text('[email]') . "\n"
SL/DATEV.pm
942 942
    push @values, $form->{accnoto};
943 943
  }
944 944

  
945
  my $where_str = ' WHERE ' . join(' AND ', map { "($_)" } @where) if (scalar @where);
945
  my $where_str = @where ? ' WHERE ' . join(' AND ', map { "($_)" } @where) : '';
946 946

  
947 947
  my $query     = qq|SELECT c.accno, c.description
948 948
                     FROM chart c
SL/DB/Helper/Sorted.pm
47 47
sub _make_sort_spec {
48 48
  my ($class) = @_;
49 49

  
50
  my %sort_spec = $class->_sort_spec if defined &{ "${class}::_sort_spec" };
50
  my %sort_spec = defined &{ "${class}::_sort_spec" } ? $class->_sort_spec : ();
51 51

  
52 52
  my $meta = $class->object_class->meta;
53 53

  
SL/DO.pm
408 408
                                        'to_table'   => 'delivery_orders',
409 409
                                        'to_id'      => $params{do_id});
410 410

  
411
  my ($oe_id)  = $links[0]->{from_id} if (scalar @links);
411
  my $oe_id  = @links ? $links[0]->{from_id} : undef;
412 412

  
413 413
  return $main::lxdebug->leave_sub() if (!$oe_id);
414 414

  
SL/Form.pm
2341 2341
    $key = $params;
2342 2342
  }
2343 2343

  
2344
  my $where = ' WHERE ' . join(' AND ', map { "($_)" } @where) if (@where);
2344
  my $where = @where ? ' WHERE ' . join(' AND ', map { "($_)" } @where) : '';
2345 2345

  
2346 2346
  my $query = qq|SELECT * FROM tax $where ORDER BY taxkey|;
2347 2347

  
......
2456 2456

  
2457 2457
  my $options        = ref $key eq 'HASH' ? $key : { key => $key };
2458 2458
  $options->{key}  ||= "all_customers";
2459
  my $limit_clause   = "LIMIT $options->{limit}" if $options->{limit};
2459
  my $limit_clause   = $options->{limit} ? "LIMIT $options->{limit}" : '';
2460 2460

  
2461 2461
  my @where;
2462 2462
  push @where, qq|business_id IN (SELECT id FROM business WHERE salesman)| if  $options->{business_is_salesman};
......
3665 3665
    $extension            = 'xls';
3666 3666
  }
3667 3667

  
3668
  my $printer_code    = '_' . $self->{printer_code} if $self->{printer_code};
3669
  my $email_extension = '_email' if -f "$self->{templates}/$self->{formname}_email${language}${printer_code}.${extension}";
3668
  my $printer_code    = $self->{printer_code} ? '_' . $self->{printer_code} : '';
3669
  my $email_extension = -f "$::myconfig{templates}/$self->{formname}_email${language}.${extension}" ? '_email' : '';
3670 3670
  $self->{IN}         = "$self->{formname}${email_extension}${language}${printer_code}.${extension}";
3671 3671

  
3672 3672
  # Format dates.
SL/IC.pm
1048 1048
  my $select_clause = join ', ',    map { $token_builder->($_, 1) } @select_tokens;
1049 1049
  my $join_clause   = join ' ',     @joins{ grep $joins_needed{$_}, @join_order };
1050 1050
  my $where_clause  = join ' AND ', map { "($_)" } @where_tokens;
1051
  my $group_clause  = ' GROUP BY ' . join ', ',    map { $token_builder->($_) } @group_tokens if scalar @group_tokens;
1051
  my $group_clause  = @group_tokens ? ' GROUP BY ' . join ', ',    map { $token_builder->($_) } @group_tokens : '';
1052 1052

  
1053 1053
  my %oe_flag_to_cvar = (
1054 1054
    bought   => 'invoice',
SL/IS.pm
1440 1440

  
1441 1441
  my ($sth, $ref, $query);
1442 1442

  
1443
  my $query_transdate = ", current_date AS invdate" if !$form->{id};
1443
  my $query_transdate = !$form->{id} ? ", current_date AS invdate" : '';
1444 1444

  
1445 1445
  $query =
1446 1446
    qq|SELECT
SL/OE.pm
190 190
  }
191 191

  
192 192
  if ($form->{periodic_invoices_active} ne $form->{periodic_invoices_inactive}) {
193
    my $not  = 'NOT' if ($form->{periodic_invoices_inactive});
193
    my $not  = $form->{periodic_invoices_inactive} ? 'NOT' : '';
194 194
    $query  .= qq| AND ${not} COALESCE(pcfg.active, 'f')|;
195 195
  }
196 196

  
SL/Projects.pm
104 104
  }
105 105

  
106 106

  
107
  my $where = 'WHERE ' . join(' AND ', map { "($_)" } @filters) if (scalar @filters);
107
  my $where = @filters ? 'WHERE ' . join(' AND ', map { "($_)" } @filters) : '';
108 108

  
109 109
  my $sortorder =  $params{sort} ? $params{sort} : "projectnumber";
110 110
  $sortorder    =~ s/[^a-z_]//g;
SL/RecordLinks.pm
193 193
    add_token(\@where_tokens, \@where_values, col => $col, val => $params{$col}) if $params{$col};
194 194
  }
195 195

  
196
  my $where = "WHERE ". join ' AND ', map { "($_)" } @where_tokens if scalar @where_tokens;
196
  my $where = @where_tokens ? "WHERE ". join ' AND ', map { "($_)" } @where_tokens : '';
197 197
  my $query = "DELETE FROM record_links $where";
198 198

  
199 199
  do_query($form, $dbh, $query, @where_values);
SL/ReportGenerator.pm
564 564
  my $font_height       = $font_size + 2 * $padding;
565 565
  my $title_font_height = $font_size + 2 * $padding;
566 566

  
567
  my $header_height     = 2 * $title_font_height if ($opts->{title});
568
  my $footer_height     = 2 * $font_height       if ($pdfopts->{number});
567
  my $header_height     = $opts->{title}     ? 2 * $title_font_height : undef;
568
  my $footer_height     = $pdfopts->{number} ? 2 * $font_height       : undef;
569 569

  
570 570
  my $top_text_height   = 0;
571 571

  
SL/SEPA.pm
305 305
  push @where,  'se.vc = ?';
306 306
  push @values, $vc;
307 307

  
308
  my $where = ' WHERE ' . join(' AND ', map { "(${_})" } @where) if (@where);
308
  my $where = @where ? ' WHERE ' . join(' AND ', map { "(${_})" } @where) : '';
309 309

  
310 310
  my $query =
311 311
    qq|SELECT se.id, se.employee_id, se.executed, se.closed, itime::date AS export_date,
SL/USTVA.pm
113 113
  my $attribute  = $arg_ref->{attribute}; #
114 114
  my $dec_places = (defined $arg_ref->{dec_places}) ? $arg_ref->{dec_places}:undef;
115 115

  
116
  my $where_type = "AND tax.report_headings.type = '$type'" if ( $type );
117
  my $where_dcp  = "AND tax.report_variables.dec_places = '$dec_places'" if ( defined $dec_places );
116
  my $where_type = $type ? "AND tax.report_headings.type = '$type'" : '';
117
  my $where_dcp  = defined $dec_places ? "AND tax.report_variables.dec_places = '$dec_places'" : '';
118 118

  
119 119
  my $query = qq|
120 120
    SELECT $attribute
SL/WH.pm
351 351
  $sort_order    = $filter{order}        unless $sort_order;
352 352
  my $sort_spec  = "${sort_col} " . ($sort_order ? " DESC" : " ASC");
353 353

  
354
  my $where_clause = join(" AND ", @filter_ary) . " AND " if (@filter_ary);
354
  my $where_clause = @filter_ary ? join(" AND ", @filter_ary) . " AND " : '';
355 355

  
356 356
  $select_tokens{'trans'} = {
357 357
     "parts_id"             => "i1.parts_id",
bin/mozilla/am.pl
2051 2051

  
2052 2052
  my $dbh = $form->dbconnect(\%myconfig);
2053 2053

  
2054
  my $restriction  = qq| AND (| . join(' OR ', map { " addition = " . $dbh->quote($_) } split(m/\,/, $form->{einschraenkungen})) . qq|)| if $form->{einschraenkungen};
2054
  my $restriction;
2055
  $restriction     = qq| AND (| . join(' OR ', map { " addition = " . $dbh->quote($_) } split(m/\,/, $form->{einschraenkungen})) . qq|)| if $form->{einschraenkungen};
2055 2056
  $restriction    .= qq| AND h.itime::date >= | . conv_dateq($form->{fromdate})                                                          if $form->{fromdate};
2056 2057
  $restriction    .= qq| AND h.itime::date <= | . conv_dateq($form->{todate})                                                            if $form->{todate};
2057 2058
  if ($form->{mitarbeiter} =~ m/^\d+$/) {
bin/mozilla/ap.pl
285 285
  my $notes =
286 286
    qq|<textarea name=notes rows=$rows cols=50 wrap=soft $readonly>$form->{notes}</textarea>|;
287 287

  
288
  my $department = qq|
288
  my $department;
289
  $department = qq|
289 290
              <tr>
290 291
                <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
291 292
                <td colspan=3><select name=department>$form->{selectdepartment}</select>
bin/mozilla/gl.pl
234 234
    } (@{ $form->{all_departments} || [] });
235 235
  }
236 236

  
237
  my $department = qq|
237
  my $department;
238
  $department = qq|
238 239
        <tr>
239 240
          <th align=right nowrap>| . $locale->text('Department') . qq|</th>
240 241
          <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
......
1017 1018
    my $projectnumber_hidden = qq|
1018 1019
    <input type="hidden" name="project_id_$i" value="$form->{"project_id_$i"}">|;
1019 1020

  
1020
    my $copy2credit = 'onkeyup="copy_debit_to_credit()"' if $i == 1;
1021
    my $copy2credit = $i == 1 ? 'onkeyup="copy_debit_to_credit()"' : '';
1021 1022

  
1022 1023
    print qq|<tr valign=top>
1023 1024
    $accno
......
1079 1080
  $form->{title} = $locale->text("$title General Ledger Transaction");
1080 1081
  my $readonly   = ($form->{id}) ? "readonly" : "";
1081 1082

  
1082
  my $show_details_checked = "checked" if $form->{show_details};
1083

  
1084
  my $ob_transaction_checked = "checked" if $form->{ob_transaction};
1085
  my $cb_transaction_checked = "checked" if $form->{cb_transaction};
1083
  my $show_details_checked   = $form->{show_details}   ? "checked" : '';
1084
  my $ob_transaction_checked = $form->{ob_transaction} ? "checked" : '';
1085
  my $cb_transaction_checked = $form->{cb_transaction} ? "checked" : '';
1086 1086

  
1087 1087
  # $locale->text('Add General Ledger Transaction')
1088 1088
  # $locale->text('Edit General Ledger Transaction')
......
1410 1410

  
1411 1411
  } else {
1412 1412
    if ($form->{draft_id}) {
1413
      my $remove_draft_checked = 'checked' if ($form->{remove_draft});
1413
      my $remove_draft_checked = $form->{remove_draft} ? 'checked' : '';
1414 1414
      print qq|<p>\n|
1415 1415
        . qq|  <input name="remove_draft" id="remove_draft" type="checkbox" class="checkbox" ${remove_draft_checked}>|
1416 1416
        . qq|  <label for="remove_draft">| . $locale->text('Remove Draft') . qq|</label>\n|
bin/mozilla/ic.pl
1273 1273
  my %subtotals = map { $_ => 0 } ('onhand', @subtotal_columns);
1274 1274
  my %totals    = map { $_ => 0 } @subtotal_columns;
1275 1275
  my $idx       = 0;
1276
  my $same_item = $form->{parts}[0]{ $form->{sort} } if (scalar @{ $form->{parts} });
1276
  my $same_item = @{ $form->{parts} } ? $form->{parts}[0]{ $form->{sort} } : undef;
1277 1277

  
1278 1278
  my $defaults  = AM->get_defaults();
1279 1279

  
bin/mozilla/io.pl
359 359
# calculate onhand
360 360
    if ($form->{"id_$i"}) {
361 361
      my $part         = IC->get_basic_part_info(id => $form->{"id_$i"});
362
      my $onhand_color = 'color="#ff0000"' if  $part->{onhand} < $part->{rop};
362
      my $onhand_color = $part->{onhand} < $part->{rop} ? 'color="#ff0000"' : '';
363 363
      push @ROW2, { value => sprintf "<b>%s</b> <font %s>%s %s</font>",
364 364
                      $locale->text('On Hand'),
365 365
                      $onhand_color,
......
1457 1457
    $extension            = 'xls';
1458 1458
  }
1459 1459

  
1460
  my $email_extension = '_email' if (($form->{media} eq 'email') && (-f "$myconfig{templates}/$form->{formname}_email$form->{language}${printer_code}.${extension}"));
1460
  my $email_extension = (($form->{media} eq 'email') && (-f "$myconfig{templates}/$form->{formname}_email$form->{language}${printer_code}.${extension}")) ? '_email' : '';
1461 1461

  
1462 1462
  $form->{IN}         = "$form->{formname}${email_extension}$form->{language}${printer_code}.${extension}";
1463 1463

  
bin/mozilla/is.pl
489 489
  $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call;
490 490

  
491 491
  $form->{print_and_post} = 0         if $form->{second_run};
492
  my $taxincluded            = "checked" if $form->{taxincluded};
492
  my $taxincluded         = $form->{taxincluded} ? "checked" : '';
493 493
  $form->{update} = 1;
494 494

  
495 495
  &check_name("customer");
bin/mozilla/oe.pl
1301 1301
    $form->{quodate}      = $form->{transdate};
1302 1302
  }
1303 1303

  
1304
  my $payment_id = $form->{payment_id} if $form->{payment_id};
1304
  my $payment_id;
1305
  if ($form->{payment_id}) {
1306
    $payment_id = $form->{payment_id};
1307
  }
1305 1308

  
1306 1309
  # if the name changed get new values
1307 1310
  if (&check_name($form->{vc})) {
bin/mozilla/rp.pl
158 158
    map { $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } @{ $form->{all_departments} || [] };
159 159
  }
160 160

  
161
  my $department = qq|
161
  my $department;
162
  $department = qq|
162 163
        <tr>
163 164
          <th align=right nowrap>| . $locale->text('Department') . qq|</th>
164 165
          <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
bin/mozilla/todo.pl
37 37
  my $form     = $main::form;
38 38

  
39 39
  my %params   = @_;
40
  my $postfix  = '_login' if ($params{login_screen});
40
  my $postfix  = $params{login_screen} ? '_login' : '';
41 41

  
42 42
  my %todo_cfg = TODO->get_user_config('login' => $form->{login});
43 43

  
bin/mozilla/ustva.pl
1107 1107
  $::form->{title} = $::locale->text('Tax Office Preferences');
1108 1108

  
1109 1109

  
1110
  my $select_tax_office = $ustva->fa_auswahl($land, $amt, $ustva->query_finanzamt(\%::myconfig, $::form));
1111
  my $checked_accrual = q|checked="checked"| if ($::form->{method} eq 'accrual');
1112
  my $checked_cash = q|checked="checked"| if ($::form->{method} eq 'cash');
1113
  my $checked_monthly = "checked" if ($::form->{FA_voranmeld} eq 'month');
1114
  my $checked_quarterly = "checked" if ($::form->{FA_voranmeld} eq 'quarter');
1115
  my $checked_dauerfristverlaengerung = "checked" if ($::form->{FA_dauerfrist} eq '1');
1116
  my $checked_kz_71 = "checked" if ($::form->{FA_71} eq 'X');
1110
  my $select_tax_office               = $ustva->fa_auswahl($land, $amt, $ustva->query_finanzamt(\%::myconfig, $::form));
1111
  my $checked_accrual                 = $::form->{method}        eq 'accrual' ? q|checked="checked"| : '';
1112
  my $checked_cash                    = $::form->{method}        eq 'cash'    ? q|checked="checked"| : '';
1113
  my $checked_monthly                 = $::form->{FA_voranmeld}  eq 'month'   ? "checked"            : '';
1114
  my $checked_quarterly               = $::form->{FA_voranmeld}  eq 'quarter' ? "checked"            : '';
1115
  my $checked_dauerfristverlaengerung = $::form->{FA_dauerfrist} eq '1'       ? "checked"            : '';
1116
  my $checked_kz_71                   = $::form->{FA_71}         eq 'X'       ? "checked"            : '';
1117 1117

  
1118 1118
  my $_hidden_variables_ref;
1119 1119

  
......
1255 1255
  my $patterncount   = $form->{patterncount};
1256 1256
  my $elster_pattern = $form->{elster_pattern};
1257 1257
  my $delimiter      = $form->{delimiter};
1258
  my $steuernummer = $form->{steuernummer} if ($stnr eq '');
1258
  my $steuernummer   = $stnr eq '' ? $form->{steuernummer} : '';
1259 1259

  
1260 1260
  $form->{FA_Oeffnungszeiten} =~ s/\\\\n/\n/g;
1261 1261

  
t/structure/no_lexicals_in_postif.t
25 25

  
26 26
foreach my $file (@testitems) {
27 27
  my $clean = 1;
28
  my $doc = PPI::Document->new($file) or do {
28
  my $source;
29
  {
30
    # due to a bug in PPI it cannot determine the encoding of a source file by
31
    # use utf8; normaly this would be no problem but some people instist on
32
    # putting strange stuff into the source. as a workaround read in the source
33
    # with :utf8 layer and pass it to PPI by reference
34
    # there are still some latin chars, but it's not the purpose of this test
35
    # to find them, so warnings about it will be ignored
36
    local $^W = 0; # don't care about invalid chars in comments
37
    local $/ = undef;
38
    open my $fh, '<:utf8', $file or die $!;
39
    $source = <$fh>;
40
  }
41

  
42
  my $doc = PPI::Document->new(\$source) or do {
29 43
    print $fh "?: PPI error for file $file: " . PPI::Document::errstr() . "\n";
30 44
    ok 0, $file;
31 45
    next;

Auch abrufbar als: Unified diff