Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dd2ee66b

Von Kivitendo Admin vor mehr als 7 Jahren hinzugefügt

  • ID dd2ee66b1d04c3644c48c32b33673463af223077
  • Vorgänger ffd06003
  • Nachfolger dec270d2

Aufträge - Abteilung per ALL_DEPARTMENTS und L.select_tag

Unterschiede anzeigen:

SL/OE.pm
138 138
    qq|WHERE (o.quotation = ?) |;
139 139
  push(@values, $quotation);
140 140

  
141
  my ($null, $split_department_id) = split /--/, $form->{department};
142
  my $department_id = $form->{department_id} || $split_department_id;
143
  if ($department_id) {
141
  if ($form->{department_id}) {
144 142
    $query .= qq| AND o.department_id = ?|;
145
    push(@values, $department_id);
143
    push(@values, $form->{department_id});
146 144
  }
147 145

  
148 146
  if ($form->{"project_id"}) {
......
722 720

  
723 721
  my $quotation = $form->{type} =~ /_order$/ ? 'f' : 't';
724 722

  
725
  ($null, $form->{department_id}) = split(/--/, $form->{department}) if $form->{department};
726

  
727 723
  # save OE record
728 724
  $query =
729 725
    qq|UPDATE oe SET
......
1282 1278

  
1283 1279
  push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"});
1284 1280

  
1285
  $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS',
1286
                   'departments'   => 'ALL_DEPARTMENTS');
1281
  $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
1282
  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
1287 1283
  my %price_factors;
1288 1284

  
1289 1285
  foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) {
......
1292 1288
    $pfac->{formatted_factor}    = $form->format_amount($myconfig, $pfac->{factor});
1293 1289
  }
1294 1290

  
1295
  # lookup department
1296
  foreach my $dept (@{ $form->{ALL_DEPARTMENTS} }) {
1297
    next unless $dept->{id} eq $form->{department_id};
1298
    $form->{department} = $dept->{description};
1299
    last;
1300
  }
1301

  
1302 1291
  # sort items by partsgroup
1303 1292
  for $i (1 .. $form->{rowcount}) {
1304 1293
    $partsgroup = "";
bin/mozilla/oe.pl
354 354
  $form->get_lists("taxzones"      => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
355 355
                   "payments"      => "ALL_PAYMENTS",
356 356
                   "currencies"    => "ALL_CURRENCIES",
357
                   "departments"   => "ALL_DEPARTMENTS",
358 357
                   $vc             => { key   => "ALL_" . uc($vc),
359 358
                                        limit => $myconfig{vclimit} + 1 },
360 359
                   "price_factors" => "ALL_PRICE_FACTORS");
361 360

  
361
  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
362

  
362 363
  # Projects
363 364
  my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
364 365
  my @old_ids_cond    = @old_project_ids ? (id => \@old_project_ids) : ();
......
396 397
    ]
397 398
  ]);
398 399
  $TMPL_VAR{sales_employee_labels} = sub { $_[0]->{name} || $_[0]->{login} };
399
  $TMPL_VAR{department_labels}     = sub { "$_[0]->{description}--$_[0]->{id}" };
400 400

  
401 401
  # vendor/customer
402 402
  $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
......
775 775
  # setup vendor / customer data
776 776
  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
777 777
  $form->get_lists("projects"     => { "key" => "ALL_PROJECTS", "all" => 1 },
778
                   "departments"  => "ALL_DEPARTMENTS",
779 778
                   "$form->{vc}s" => "ALL_VC",
780 779
                   "taxzones"     => "ALL_TAXZONES",
781 780
                   "business_types" => "ALL_BUSINESS_TYPES",);
782 781
  $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
782
  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
783 783

  
784 784
  $form->{CT_CUSTOM_VARIABLES}                  = CVar->get_configs('module' => 'CT');
785 785
  ($form->{CT_CUSTOM_VARIABLES_FILTER_CODE},
......
980 980
                                       'data'           => $form->{OE});
981 981

  
982 982
  my @options;
983
  my ($department) = split m/--/, $form->{department};
984 983

  
985 984
  push @options, $locale->text('Customer')                . " : $form->{customer}"                        if $form->{customer};
986 985
  push @options, $locale->text('Vendor')                  . " : $form->{vendor}"                          if $form->{vendor};
987 986
  push @options, $locale->text('Contact Person')          . " : $form->{cp_name}"                         if $form->{cp_name};
988
  push @options, $locale->text('Department')              . " : $department"                              if $form->{department};
989
  if ($form->{department_id}) {
990
    unless ($form->{department}) {
991
      require SL::DB::Department;
992
      my $department = SL::DB::Manager::Department->find_by(id => $::form->{department_id});
993
      push @options, $locale->text('Department') . " : " . $department->description if $department;
994
    }
995
  }
987
  push @options, $locale->text('Department')              . " : $form->{department}"                      if $form->{department};
996 988
  push @options, $locale->text('Order Number')            . " : $form->{ordnumber}"                       if $form->{ordnumber};
997 989
  push @options, $locale->text('Customer Order Number')   . " : $form->{cusordnumber}"                    if $form->{cusordnumber};
998 990
  push @options, $locale->text('Notes')                   . " : $form->{notes}"                           if $form->{notes};
......
1031 1023
    push @options, $locale->text('Steuersatz') . " : " . SL::DB::TaxZone->new(id => $form->{taxzone_id})->load->description;
1032 1024
  }
1033 1025

  
1026
  if ($form->{department_id}) {
1027
    push @options, $locale->text('Department') . " : " . SL::DB::Department->new(id => $form->{department_id})->load->description;
1028
  }
1029

  
1034 1030
  if (($form->{order_probability_value} || '') ne '') {
1035 1031
    push @options, $::locale->text('Order probability') . ' ' . ($form->{order_probability_op} eq 'le' ? '<=' : '>=') . ' ' . $form->{order_probability_value} . '%';
1036 1032
  }
templates/webpages/oe/form_header.html
112 112
                      [% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES), default=taxzone_id, title_key='description', style='width: 250px') %]
113 113
                    </td>
114 114
                  </tr>
115
[%- IF ALL_DEPARTMENTS %]
115
[%- IF ALL_DEPARTMENTS.size %]
116 116
                  <tr>
117 117
                    <th align="right" nowrap>[% 'Department' | $T8 %]</th>
118 118
                    <td colspan="3">
119
                      [% L.select_tag('department_id', ALL_DEPARTMENTS, default=department_id, title_sub=\department_labels, with_empty=1, style='width:250px') %]
119
                      [% L.select_tag('department_id', ALL_DEPARTMENTS, default=department_id, title_key = 'description', with_empty=1, style='width:250px') %]
120 120
                    </td>
121 121
                  </tr>
122 122
[%- END %]
templates/webpages/oe/search.html
39 39
[%- IF ALL_DEPARTMENTS.size %]
40 40
    <tr>
41 41
     <th align="right" nowrap>[% 'Department' | $T8 %]</th>
42
     <td colspan="3">
43
            [%- INCLUDE 'generic/multibox.html'
44
                 name          = 'department_id',
45
                 style         = 'width: 250px',
46
                 DATA          = ALL_DEPARTMENTS,
47
                 id_key        = 'id',
48
                 label_key     = 'description',
49
                 limit         = MYCONFIG.vclimit,
50
                 show_empty    = 1,
51
                 allow_textbox = 1,
52
            -%]
53
     </td>
42
     <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style="width: 250px") %]</td>
54 43
    </tr>
55 44
[%- END %]
56 45
    <tr>

Auch abrufbar als: Unified diff