Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f0747a2f

Von Kivitendo Admin vor fast 8 Jahren hinzugefügt

  • ID f0747a2f9c8d7a9d261c20b0d2a9d5911a6ad9b5
  • Vorgänger 359506e5
  • Nachfolger 40cfb5ee

Dialogbuchen - Abteilung nutzt immer L.select_tag als Dropdown

Unterschiede anzeigen:

SL/GL.pm
113 113
    do_query($form, $dbh, $query, @values);
114 114
  }
115 115

  
116
  my ($null, $department_id) = split(/--/, $form->{department});
117

  
118 116
  $form->{ob_transaction} *= 1;
119 117
  $form->{cb_transaction} *= 1;
120 118

  
......
126 124
       WHERE id = ?|;
127 125

  
128 126
  @values = ($form->{reference}, $form->{description}, $form->{notes},
129
             conv_date($form->{transdate}), conv_i($department_id), $form->{taxincluded} ? 't' : 'f',
127
             conv_date($form->{transdate}), conv_i($form->{department_id}), $form->{taxincluded} ? 't' : 'f',
130 128
             $form->{storno} ? 't' : 'f', conv_i($form->{storno_id}), $form->{ob_transaction} ? 't' : 'f', $form->{cb_transaction} ? 't' : 'f',
131 129
             conv_i($form->{id}));
132 130
  do_query($form, $dbh, $query, @values);
......
233 231
    push(@apvalues, like($form->{reference}));
234 232
  }
235 233

  
236
  if ($form->{department}) {
237
    my ($null, $department) = split /--/, $form->{department};
234
  if ($form->{department_id}) {
238 235
    $glwhere .= qq| AND g.department_id = ?|;
239 236
    $arwhere .= qq| AND a.department_id = ?|;
240 237
    $apwhere .= qq| AND a.department_id = ?|;
241
    push(@glvalues, $department);
242
    push(@arvalues, $department);
243
    push(@apvalues, $department);
238
    push(@glvalues, $form->{department_id});
239
    push(@arvalues, $form->{department_id});
240
    push(@apvalues, $form->{department_id});
244 241
  }
245 242

  
246 243
  if ($form->{source}) {
......
639 636
  if ($form->{id}) {
640 637
    $query =
641 638
      qq|SELECT g.reference, g.description, g.notes, g.transdate, g.storno, g.storno_id,
642
           d.description AS department, e.name AS employee, g.taxincluded, g.gldate,
639
           g.department_id, d.description AS department,
640
           e.name AS employee, g.taxincluded, g.gldate,
643 641
         g.ob_transaction, g.cb_transaction
644 642
         FROM gl g
645 643
         LEFT JOIN department d ON (d.id = g.department_id)
bin/mozilla/gl.pl
99 99
  $form->{credit} = 0;
100 100
  $form->{tax}    = 0;
101 101

  
102
  # departments
103
  $form->all_departments(\%myconfig);
104
  if (@{ $form->{all_departments} || [] }) {
105
    $form->{selectdepartment} = "<option>\n";
106

  
107
    map {
108
      $form->{selectdepartment} .=
109
        "<option>$_->{description}--$_->{id}\n"
110
    } (@{ $form->{all_departments} || [] });
111
  }
102
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
112 103

  
113 104
  $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details};
114 105

  
......
129 120

  
130 121
  $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
131 122

  
132
  # departments
133
  $form->all_departments(\%myconfig);
134
  if (@{ $form->{all_departments} || [] }) {
135
    $form->{selectdepartment} = "<option>\n";
136

  
137
    map {
138
      $form->{selectdepartment} .=
139
        "<option>$_->{description}--$_->{id}\n"
140
    } (@{ $form->{all_departments} || [] });
141
  }
123
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
142 124

  
143 125
  my $i        = 1;
144 126
  my $tax      = 0;
......
226 208
  $::lxdebug->enter_sub;
227 209
  $::auth->assert('general_ledger | gl_transactions');
228 210

  
229
  $::form->all_departments(\%::myconfig);
230 211
  $::form->get_lists(
231 212
    projects  => { key => "ALL_PROJECTS", all => 1 },
232 213
  );
233 214
  $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
215
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
234 216

  
235 217
  $::form->header;
236 218
  print $::form->parse_html_template('gl/search', {
237
    department_label => sub { ("$_[0]{description}--$_[0]{id}")x2 },
238 219
    employee_label => sub { "$_[0]{id}--$_[0]{name}" },
239 220
  });
240 221

  
......
316 297
  );
317 298

  
318 299
  # add employee here, so that variable is still known and passed in url when choosing a different sort order in resulting table
319
  my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto employee_id datesort category l_subtotal);
300
  my @hidden_variables = qw(accno source reference description notes project_id datefrom dateto employee_id datesort category l_subtotal);
320 301
  push @hidden_variables, map { "l_${_}" } @columns;
321 302

  
322 303
  my $employee = $form->{employee_id} ? SL::DB::Employee->new(id => $form->{employee_id})->load->name : '';
......
334 315
  push @date_options, $locale->text('Bis'),  $locale->date(\%myconfig, $form->{dateto},   1)          if ($form->{dateto});
335 316
  push @options,      join(' ', @date_options)                                                        if (scalar @date_options);
336 317

  
337
  if ($form->{department}) {
338
    my ($department) = split /--/, $form->{department};
339
    push @options, $locale->text('Department') . " : $department";
318
  if ($form->{department_id}) {
319
    my $department = SL::DB::Manager::Department->find_by( id => $form->{department_id} );
320
    push @options, $locale->text('Department') . " : " . $department->description;
340 321
  }
341 322

  
342

  
343 323
  my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
344 324

  
345 325
  $form->{l_credit_accno}     = 'Y';
......
877 857
  $::form->get_lists("projects"  => { "key"       => "ALL_PROJECTS",
878 858
                                    "all"       => 0,
879 859
                                    "old_id"    => \@old_project_ids },
860

  
880 861
                   "charts"    => { "key"       => "ALL_CHARTS",
881 862
                                    "transdate" => $::form->{transdate} });
882 863

  
864
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
865

  
883 866
  GL->get_chart_balances('charts' => $::form->{ALL_CHARTS});
884 867

  
885 868
  my $title      = $::form->{title};
......
890 873
  map { $::form->{$_} =~ s/\"/&quot;/g }
891 874
    qw(chart taxchart);
892 875

  
893
  $::form->{selectdepartment} =~ s/ selected//;
894
  $::form->{selectdepartment} =~
895
    s/option>\Q$::form->{department}\E/option selected>$::form->{department}/;
896

  
897 876
  if ($init) {
898 877
    $::request->{layout}->focus("#reference");
899 878
    $::form->{taxincluded} = "1";
......
1172 1151
  my $form     = $main::form;
1173 1152
  my $locale   = $main::locale;
1174 1153

  
1175
  if ($::myconfig{mandatory_departments} && !$form->{department}) {
1154
  if ($::myconfig{mandatory_departments} && !$form->{department_id}) {
1176 1155
    $form->{saved_message} = $::locale->text('You have to specify a department.');
1177 1156
    update();
1178 1157
    exit;
templates/webpages/gl/form_header.html
99 99
        </tr>
100 100
[%- END %]
101 101

  
102
[%- IF selectdepartment %]
102
[%- IF ALL_DEPARTMENTS %]
103 103
        <tr>
104 104
          <th align=right nowrap>[% 'Department' | $T8 %]</th>
105
          <td colspan=3><select name=department>[% selectdepartment %]</select></td>
106
          <input type=hidden name=selectdepartment value="[% selectdepartment | html %]">
105
          <td>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1) %]</td>
107 106
        </tr>
108 107
[%- END %]
109 108

  
templates/webpages/gl/search.html
18 18
          <th align=right>[% 'Source' | $T8 %]</th>
19 19
          <td><input name=source size=20></td>
20 20
        </tr>
21
        [%- IF all_departments %]
21
        [%- IF ALL_DEPARTMENTS %]
22 22
        <tr>
23 23
          <th align=right nowrap>[% 'Department' | $T8 %]</th>
24
          <td colspan=3>[% L.select_tag('department', all_departments, value_title_sub = \department_label, with_empty = 1) %]</td>
24
          <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, title_key = 'description', with_empty = 1) %]</td>
25 25
        </tr>
26 26
        [%- END %]
27 27
        <tr>

Auch abrufbar als: Unified diff