Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b181d7ab

Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt

  • ID b181d7ab6dc3d043be9f27c4209c230c14c90991
  • Vorgänger 128fab1c
  • Nachfolger 863eb430

PDF Helper Erweiterungen: Formatkorrektur nach perltidy

Unterschiede anzeigen:

SL/Helper/CreatePDF.pm
56 56
    'kivitendo-printXXXXXX',
57 57
    SUFFIX => ".${suffix}",
58 58
    DIR    => $form->{tmpdir},
59
    UNLINK =>
60
      ($::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files})? 0 : 1,
59
    UNLINK => $::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files},
61 60
  );
62 61

  
63 62
  $form->{tmpfile} = $tmpfile;
64 63
  (undef, undef, $form->{template_meta}{tmpfile}) = File::Spec->splitpath($tmpfile);
65 64

  
66
  my $parser = SL::Template::create(
67
    type => ($params{template_type} || 'LaTeX'),
65
  my $parser               = SL::Template::create(
66
    type                   => ($params{template_type} || 'LaTeX'),
68 67
    source                 => $form->{IN},
69 68
    form                   => $form,
70 69
    myconfig               => \%::myconfig,
......
128 127

  
129 128
  if ($params{inp_content}) {
130 129
    return $params{inp_content} if $filecount == 0 && !$params{out_path};
131
  }
132
  elsif ($params{out_path}) {
130
  } elsif ($params{out_path}) {
133 131
    return 0 if $filecount == 0;
134 132
    if ($filecount == 1) {
135 133
      if (!rename($params{file_names}->[0], $params{out_path})) {
......
138 136
      }
139 137
      return 1;
140 138
    }
141
  }
142
  else {
139
  } else {
143 140
    return '' if $filecount == 0;
144 141
    return scalar(File::Slurp::read_file($params{file_names}->[0])) if $filecount == 1;
145 142
  }
......
148 145
    'kivitendo-printXXXXXX',
149 146
    SUFFIX => '.pdf',
150 147
    DIR    => $::lx_office_conf{paths}->{userspath},
151
    UNLINK => ($::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files})? 0 : 1,
148
    UNLINK => $::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files},
152 149
  );
153 150
  close $temp_fh;
154 151

  
......
167 164
      'kivitendo-contentXXXXXX',
168 165
      SUFFIX => '.pdf',
169 166
      DIR    => $::lx_office_conf{paths}->{userspath},
170
      UNLINK => (
171
        $::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files}
172
      )
173
        ? 0
174
        : 1,
167
      UNLINK => $::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files},
175 168
    );
176 169
    binmode $temp_fh;
177 170
    print $temp_fh $params{inp_content};
178 171
    close $temp_fh;
179 172
    $input_names = $inp_name . ' ';
180
    $hasodd =
181
      ($params{bothsided} && __PACKAGE__->has_odd_pages($inp_name)
182
       ? 1
183
       : 0
184
     );
173
    $hasodd = $params{bothsided} && __PACKAGE__->has_odd_pages($inp_name);
185 174
  }
186 175
  foreach (@{ $params{file_names} }) {
187 176
    $input_names .= $emptypage . ' ' if $hasodd;
188 177
    $input_names .= String::ShellQuote::shell_quote($_) . ' ';
189
    $hasodd =
190
      ($params{bothsided} && __PACKAGE__->has_odd_pages($_)
191
       ? 1
192
       : 0
193
     );
178
    $hasodd = $params{bothsided} && __PACKAGE__->has_odd_pages($_);
194 179
  }
195 180
  my $exe = $::lx_office_conf{applications}->{ghostscript} || 'gs';
196 181
  my $output =
......
215 200

  
216 201
  $params{name} or croak "Missing parameter 'name'";
217 202

  
218
  my $path      = $::instance_conf->get_templates;
219
  my $extension = $params{extension} || "tex";
203
  my $path                 = $::instance_conf->get_templates;
204
  my $extension            = $params{extension} || "tex";
220 205
  my ($printer, $language) = ('', '');
221 206

  
222 207
  if ($params{printer} || $params{printer_id}) {
223 208
    if ($params{printer} && !ref $params{printer}) {
224 209
      $printer = '_' . $params{printer};
225
    }
226
    else {
210
    } else {
227 211
      $printer = $params{printer} || SL::DB::Printer->new(id => $params{printer_id})->load;
228 212
      $printer = $printer->template_code ? '_' . $printer->template_code : '';
229 213
    }
......
232 216
  if ($params{language} || $params{language_id}) {
233 217
    if ($params{language} && !ref $params{language}) {
234 218
      $language = '_' . $params{language};
235
    }
236
    else {
219
    } else {
237 220
      $language = $params{language} || SL::DB::Language->new(id => $params{language_id})->load;
238 221
      $language = $language->template_code ? '_' . $language->template_code : '';
239 222
    }
......
247 230
  );
248 231

  
249 232
  if ($params{email}) {
250
    unshift @template_files,
251
      (
233
    unshift @template_files, (
252 234
      $params{name} . "_email${language}${printer}",
253 235
      $params{name} . "_email${language}",
254
      );
236
    );
255 237
  }
256 238

  
257 239
  @template_files = map { "${_}.${extension}" } uniq grep { $_ } @template_files;

Auch abrufbar als: Unified diff