Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7f8599c0

Von Moritz Bunkus vor fast 12 Jahren hinzugefügt

  • ID 7f8599c0909affd56ad82fd842015bb51c6a3dbf
  • Vorgänger 5c5c1eef
  • Nachfolger 95eb8f3c

Projektverwaltung auf Rose- und Controller-Code umgestellt

Unterschiede anzeigen:

bin/mozilla/arap.pl
30 30
# common routines for gl, ar, ap, is, ir, oe
31 31
#
32 32

  
33
use SL::Projects;
34

  
35 33
use strict;
36 34

  
37 35
# any custom scripts for this one
......
298 296
  $::form->{salesman_id} = $current_employee->id if $current_employee && exists $::form->{salesman_id};
299 297
}
300 298

  
301
sub check_project {
302
  $main::lxdebug->enter_sub();
303

  
304
  my $form     = $main::form;
305
  my $locale   = $main::locale;
306

  
307
  $main::auth->assert('general_ledger         | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
308
                'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash         | report');
309

  
310
  my $nextsub = shift || 'update';
311

  
312
  for my $i (1 .. $form->{rowcount}) {
313
    my $suffix = $i ? "_$i" : "";
314
    my $prefix = $i ? "" : "global";
315
    $form->{"${prefix}project_id${suffix}"} = "" unless $form->{"${prefix}projectnumber$suffix"};
316
    if ($form->{"${prefix}projectnumber${suffix}"} ne $form->{"old${prefix}projectnumber${suffix}"}) {
317
      if ($form->{"${prefix}projectnumber${suffix}"}) {
318

  
319
        # get new project
320
        $form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"};
321
        my %params             = map { $_ => $form->{$_} } qw(projectnumber description active);
322
        my $rows;
323
        if (($rows = Projects->search_projects(%params)) > 1) {
324

  
325
          # check form->{project_list} how many there are
326
          $form->{rownumber} = $i;
327
          &select_project($i ? undef : 1, $nextsub);
328
          ::end_of_request();
329
        }
330

  
331
        if ($rows == 1) {
332
          $form->{"${prefix}project_id${suffix}"}       = $form->{project_list}->[0]->{id};
333
          $form->{"${prefix}projectnumber${suffix}"}    = $form->{project_list}->[0]->{projectnumber};
334
          $form->{"old${prefix}projectnumber${suffix}"} = $form->{project_list}->[0]->{projectnumber};
335
        } else {
336

  
337
          # not on file
338
          $form->error($locale->text('Project not on file!'));
339
        }
340
      } else {
341
        $form->{"old${prefix}projectnumber${suffix}"} = "";
342
      }
343
    }
344
  }
345

  
346
  $main::lxdebug->leave_sub();
347
}
348

  
349 299
sub select_project {
350 300
  $::lxdebug->enter_sub;
351 301

  
......
420 370
=head1 SYNOPSIS
421 371

  
422 372
 check_name('vendor')
423
 check_project();
424 373

  
425 374
=head1 DESCRIPTION
426 375

  

Auch abrufbar als: Unified diff