Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 59f8f1fa

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID 59f8f1fad78635c084328f8bf726f107cbb5bba2
  • Vorgänger 82c78486
  • Nachfolger cfc6a60d

Bei Projekten ein Flag "aktiv" hinzugefügt.

Unterschiede anzeigen:

SL/Form.pm
1425 1425
  $main::lxdebug->leave_sub();
1426 1426
}
1427 1427

  
1428
sub get_projects {
1429
  $main::lxdebug->enter_sub();
1430

  
1431
  my ($self, $dbh, $key) = @_;
1432

  
1433
  my ($all, $old_id, $where, @values);
1434

  
1435
  if (ref($key) eq "HASH") {
1436
    my $params = $key;
1437

  
1438
    $key = "ALL_PROJECTS";
1439

  
1440
    foreach my $p (keys(%{$params})) {
1441
      if ($p eq "all") {
1442
        $all = $params->{$p};
1443
      } elsif ($p eq "old_id") {
1444
        $old_id = $params->{$p};
1445
      } elsif ($p eq "key") {
1446
        $key = $params->{$p};
1447
      }
1448
    }
1449
  }
1450

  
1451
  if (!$all) {
1452
    $where = "WHERE active ";
1453
    if ($old_id) {
1454
      $where .= " OR (id = ?) ";
1455
      push(@values, $old_id);
1456
    }
1457
  }
1458

  
1459
  my $query =
1460
    qq|SELECT id, projectnumber, description, active | .
1461
    qq|FROM project | .
1462
    $where .
1463
    qq|ORDER BY lower(projectnumber)|;
1464
  my $sth = $dbh->prepare($query);
1465
  $sth->execute(@values) ||
1466
    $self->dberror($query . " (" . join(", ", @values) . ")");
1467

  
1468
  $self->{$key} = [];
1469
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
1470
    push(@{ $self->{$key} }, $ref);
1471
  }
1472

  
1473
  $sth->finish;
1474
  $main::lxdebug->leave_sub();
1475
}
1476

  
1428 1477
sub get_lists {
1429 1478
  $main::lxdebug->enter_sub();
1430 1479

  
......
1457 1506
    $sth->finish;
1458 1507
  }
1459 1508

  
1509
  if ($params{"projects"} || $params{"all_projects"}) {
1510
    $self->get_projects($dbh, $params{"all_projects"} ?
1511
                        $params{"all_projects"} : $params{"projects"},
1512
                        $params{"all_projects"} ? 1 : 0);
1513
  }
1514

  
1460 1515
  $dbh->disconnect();
1461 1516

  
1462 1517
  $main::lxdebug->leave_sub();
SL/PE.pm
37 37

  
38 38
use Data::Dumper;
39 39

  
40
use SL::DBUtils;
41

  
40 42
sub projects {
41 43
  $main::lxdebug->enter_sub();
42 44

  
......
47 49

  
48 50
  my $sortorder = ($form->{sort}) ? $form->{sort} : "projectnumber";
49 51

  
50
  my $query = qq|SELECT p.id, p.projectnumber, p.description
52
  my $query = qq|SELECT p.id, p.projectnumber, p.description, p.active
51 53
                 FROM project p
52 54
		 WHERE 1 = 1|;
53 55

  
......
70 72
		               FROM project p, orderitems o
71 73
			       WHERE p.id = o.project_id)";
72 74
  }
75
  if ($form->{active} eq "active") {
76
    $query .= " AND p.active";
77
  } elsif ($form->{active} eq "inactive") {
78
    $query .= " AND NOT p.active";
79
  }
73 80

  
74 81
  $query .= qq|
75 82
		 ORDER BY $sortorder|;
......
136 143
  # connect to database
137 144
  my $dbh = $form->dbconnect($myconfig);
138 145

  
139
  map { $form->{$_} =~ s/\'/\'\'/g } qw(projectnumber description);
146
  my @values = ($form->{projectnumber}, $form->{description});
140 147

  
141 148
  if ($form->{id}) {
142
    $query = qq|UPDATE project SET
143
                projectnumber = '$form->{projectnumber}',
144
		description = '$form->{description}'
145
		WHERE id = $form->{id}|;
149
    $query =
150
      qq|UPDATE project SET projectnumber = ?, description = ?, active = ? | .
151
      qq|WHERE id = ?|;
152
    push(@values, $form->{active} ? 't' : 'f', $form->{id});
146 153
  } else {
147
    $query = qq|INSERT INTO project
148
                (projectnumber, description)
149
                VALUES ('$form->{projectnumber}', '$form->{description}')|;
154
    $query =
155
      qq|INSERT INTO project (projectnumber, description, active) | .
156
      qq|VALUES (?, ?, 't')|;
150 157
  }
151
  $dbh->do($query) || $form->dberror($query);
158
  do_query($form, $dbh, $query, @values);
152 159

  
153 160
  $dbh->disconnect;
154 161

  
bin/mozilla/oe.pl
408 408
  $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
409 409

  
410 410
  $form->get_lists("contacts" => "ALL_CONTACTS",
411
                   "shipto" => "ALL_SHIPTO");
411
                   "shipto" => "ALL_SHIPTO",
412
                   "projects" => { "key" => "ALL_PROJECTS",
413
                                   "all" => 0,
414
                                   "old_id" => $form->{"globalproject_id"} });
412 415

  
413 416
  my (%labels, @values);
414 417
  foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
......
428 431
      $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
429 432
  }
430 433

  
434
  %labels = ();
435
  @values = ("");
436
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
437
    push(@values, $item->{"id"});
438
    $labels{$item->{"id"}} = $item->{"projectnumber"};
439
  }
440
  my $globalprojectnumber =
441
    $cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
442
                     '-labels' => \%labels,
443
                     '-default' => $form->{"globalproject_id"});
444

  
431 445
  my $shipto = qq|
432 446
		<th align=right>| . $locale->text('Shipping Address') . qq|</th>
433 447
		<td>| .
......
783 797
	      $ordnumber
784 798
	      <tr>
785 799
          <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
786
          <td>
787
            <input name="globalprojectnumber" size="11" value="| . Q($form->{globalprojectnumber}) . qq|">
788
            <input type="hidden" name="oldglobalprojectnumber" value="| . Q($form->{globalprojectnumber}) . qq|">
789
            <input type="hidden" name="globalproject_id" value="| . Q($form->{globalproject_id}) . qq|">
790
          </td>
800
          <td>$globalprojectnumber</td>
791 801
	      </tr>
792 802
	    </table>
793 803
	  </td>
bin/mozilla/pe.pl
34 34

  
35 35
use SL::PE;
36 36

  
37
require "bin/mozilla/common.pl";
38

  
37 39
1;
38 40

  
39 41
# end of main
......
85 87
    $number = qq|
86 88
	<tr>
87 89
	  <th align=right width=1%>| . $locale->text('Number') . qq|</th>
88
	  <td><input name=projectnumber size=20></td>
90
	  <td>| . $cgi->textfield('-name' => 'projectnumber', '-size' => 20) . qq|</td>
89 91
	</tr>
90 92
	<tr>
91 93
	  <th align=right>| . $locale->text('Description') . qq|</th>
92
	  <td><input name=description size=60></td>
94
	  <td>| . $cgi->textfield('-name' => 'description', '-size' => 60) . qq|</td>
93 95
	</tr>
96
  <tr>
97
    <th>&nbsp;</th>
98
    <td>| .
99
    $cgi->radio_group('-name' => 'active', '-default' => 'active',
100
                      '-values' => ['active', 'inactive', 'both'],
101
                      '-labels' => { 'active' => ' ' . $locale->text("Active"),
102
                                     'inactive' => ' ' . $locale->text("Inactive"),
103
                                     'both' => ' ' . $locale->text("Both") })
104
    . qq|</td>
105
  </tr>
94 106
|;
95 107

  
96 108
  }
......
183 195
  PE->projects(\%myconfig, \%$form);
184 196

  
185 197
  $callback =
186
    "$form->{script}?action=project_report&type=$form->{type}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
198
    "$form->{script}?action=project_report&type=$form->{type}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}&active=" .
199
    E($form->{active});
187 200
  $href = $callback;
188 201

  
189 202
  if ($form->{status} eq 'all') {
......
205 218
      "\n<br>" . $locale->text('Description') . " : $form->{description}";
206 219
  }
207 220

  
208
  @column_index = $form->sort_columns(qw(projectnumber description));
221
  @column_index = qw(projectnumber description);
222

  
223
  push(@column_index, "active") if ("both" eq $form->{active});
209 224

  
210 225
  $column_header{projectnumber} =
211 226
      qq|<th><a class=listheading href=$href&sort=projectnumber>|
......
215 230
      qq|<th><a class=listheading href=$href&sort=description>|
216 231
    . $locale->text('Description')
217 232
    . qq|</a></th>|;
233
  $column_header{active} =
234
      qq|<th class="listheading">| . $locale->text('Active') . qq|</th>|;
218 235

  
219 236
  $form->{title} = $locale->text('Projects');
220 237

  
......
261 278
    $column_data{projectnumber} =
262 279
      qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{projectnumber}</td>|;
263 280
    $column_data{description} = qq|<td>$ref->{description}&nbsp;</td>|;
281
    $column_data{active} =
282
      qq|<td>| .
283
      ($ref->{active} ? $locale->text("Yes") : $locale->text("No")) .
284
      qq|</td>|;
264 285

  
265 286
    map { print "$column_data{$_}\n" } @column_index;
266 287

  
......
311 332

  
312 333
  $form->{description} =~ s/\"/&quot;/g;
313 334

  
335
  my $projectnumber =
336
    $cgi->textfield('-name' => 'projectnumber', '-size' => 20,
337
                    '-default' => $form->{projectnumber});
338

  
339
  my $description;
314 340
  if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
315 341
    $description =
316
      qq|<textarea name="description" rows=$rows cols=60 style="width: 100%" wrap=soft>$form->{description}</textarea>|;
342
      $cgi->textarea('-name' => 'description', '-rows' => $rows, '-cols' => 60,
343
                     '-style' => 'width: 100%', '-wrap' => 'soft',
344
                     '-default' => $form->{description});
317 345
  } else {
318 346
    $description =
319
      qq|<input name=description size=60 value="$form->{description}">|;
347
      $cgi->textfield('-name' => 'description', '-size' => 60,
348
                      '-default' => $form->{description});
349
  }
350

  
351
  my $active;
352
  if ($form->{id}) {
353
    $active =
354
      qq|
355
  <tr>
356
    <th>&nbsp;</th>
357
    <td>| .
358
      $cgi->radio_group('-name' => 'active',
359
                        '-values' => [1, 0],
360
                        '-default' => $form->{active} * 1,
361
                        '-labels' => { 1 => $locale->text("Active"),
362
                                       0 => $locale->text("Inactive") })
363
      . qq|</td>
364
  </tr>
365
|;
320 366
  }
321 367

  
322 368
  $form->header;
......
339 385
      <table>
340 386
	<tr>
341 387
	  <th align=right>| . $locale->text('Number') . qq|</th>
342
	  <td><input name=projectnumber size=20 value="$form->{projectnumber}"></td>
388
	  <td>$projectnumber</td>
343 389
	</tr>
344 390
	<tr>
345 391
	  <th align=right>| . $locale->text('Description') . qq|</th>
346 392
	  <td>$description</td>
347 393
	</tr>
394
      $active
348 395
      </table>
349 396
    </td>
350 397
  </tr>
locale/de/all
188 188
  'Bis Konto: '                 => 'bis Konto: ',
189 189
  'Body:'                       => 'Text:',
190 190
  'Books are open'              => 'Die B?cher sind ge?ffnet.',
191
  'Both'                        => 'Sowohl als auch',
191 192
  'Bought'                      => 'Gekauft',
192 193
  'Buchungsdatum'               => 'Buchungsdatum',
193 194
  'Buchungsgruppe'              => 'Buchungsgruppe',
......
513 514
  'Import CSV'                  => '',
514 515
  'In Lx-Office 2.4.0 the administrator has to enter a list of units in the administrative section.' => 'In Lx-Office 2.4.0 muss der Administrator in den Systemeinstellungen eine Liste von verwendbaren Einheiten angeben.',
515 516
  'In-line'                     => 'im Text',
517
  'Inactive'                    => 'Inaktiv',
516 518
  'Include Exchangerate Difference' => 'Wechselkursunterschied einbeziehen',
517 519
  'Include in Report'           => 'In Bericht aufnehmen',
518 520
  'Include in drop-down menus'  => 'In Aufklappmen? aufnehmen',
locale/de/cn
241 241
  'post'                        => 'post',
242 242
  'post_as_new'                 => 'post_as_new',
243 243
  'prepare_credit_note'         => 'prepare_credit_note',
244
  'preset_projectnumber'        => 'preset_projectnumber',
245 244
  'preview'                     => 'preview',
246 245
  'print'                       => 'print',
247 246
  'print_and_post'              => 'print_and_post',
locale/de/dn
228 228
  'order'                       => 'order',
229 229
  'part_selection_internal'     => 'part_selection_internal',
230 230
  'post_as_new'                 => 'post_as_new',
231
  'preset_projectnumber'        => 'preset_projectnumber',
232 231
  'print'                       => 'print',
233 232
  'print_dunning'               => 'print_dunning',
234 233
  'print_form'                  => 'print_form',
locale/de/ic
279 279
  'parts_language_selection'    => 'parts_language_selection',
280 280
  'parts_subtotal'              => 'parts_subtotal',
281 281
  'post_as_new'                 => 'post_as_new',
282
  'preset_projectnumber'        => 'preset_projectnumber',
283 282
  'price_row'                   => 'price_row',
284 283
  'print'                       => 'print',
285 284
  'print_form'                  => 'print_form',
locale/de/io
162 162
  'order'                       => 'order',
163 163
  'part_selection_internal'     => 'part_selection_internal',
164 164
  'post_as_new'                 => 'post_as_new',
165
  'preset_projectnumber'        => 'preset_projectnumber',
166 165
  'print'                       => 'print',
167 166
  'print_form'                  => 'print_form',
168 167
  'print_options'               => 'print_options',
locale/de/ir
236 236
  'post_as_new'                 => 'post_as_new',
237 237
  'post_payment'                => 'post_payment',
238 238
  'prepare_invoice'             => 'prepare_invoice',
239
  'preset_projectnumber'        => 'preset_projectnumber',
240 239
  'print'                       => 'print',
241 240
  'print_form'                  => 'print_form',
242 241
  'print_options'               => 'print_options',
locale/de/is
262 262
  'post_as_new'                 => 'post_as_new',
263 263
  'post_payment'                => 'post_payment',
264 264
  'prepare_invoice'             => 'prepare_invoice',
265
  'preset_projectnumber'        => 'preset_projectnumber',
266 265
  'preview'                     => 'preview',
267 266
  'print'                       => 'print',
268 267
  'print_and_post'              => 'print_and_post',
locale/de/oe
279 279
  'poso'                        => 'poso',
280 280
  'post_as_new'                 => 'post_as_new',
281 281
  'prepare_order'               => 'prepare_order',
282
  'preset_projectnumber'        => 'preset_projectnumber',
283 282
  'print'                       => 'print',
284 283
  'print_form'                  => 'print_form',
285 284
  'print_options'               => 'print_options',
locale/de/pe
1 1
$self->{texts} = {
2
  'Active'                      => 'Aktiv',
2 3
  'Add'                         => 'Erfassen',
3 4
  'Add Group'                   => 'Warengruppe erfassen',
4 5
  'Add Pricegroup'              => 'Preisgruppe erfassen',
5 6
  'Add Project'                 => 'Projekt erfassen',
6 7
  'All'                         => 'Alle',
8
  'Both'                        => 'Sowohl als auch',
7 9
  'Continue'                    => 'Weiter',
8 10
  'Delete'                      => 'L?schen',
9 11
  'Description'                 => 'Beschreibung',
......
15 17
  'Group missing!'              => 'Warengruppe fehlt!',
16 18
  'Group saved!'                => 'Warengruppe gespeichert!',
17 19
  'Groups'                      => 'Warengruppen',
20
  'Inactive'                    => 'Inaktiv',
21
  'No'                          => 'Nein',
18 22
  'Number'                      => 'Nummer',
19 23
  'Orphaned'                    => 'Nie benutzt',
20 24
  'Preisgruppe'                 => 'Preisgruppe',
......
28 32
  'Project saved!'              => 'Projekt gespeichert!',
29 33
  'Projects'                    => 'Projekte',
30 34
  'Save'                        => 'Speichern',
35
  'Yes'                         => 'Ja',
31 36
};
32 37

  
33 38
$self->{subs} = {
sql/Pg-upgrade2/project_flag_active.sql
1
-- @tag: project
2
-- @description: Spalte bei den Projekten zur Markierung auf aktiv/inaktiv
3
-- @depends: release_2_4_1
4
ALTER TABLE project ADD COLUMN active boolean;
5
ALTER TABLE project ALTER COLUMN active SET DEFAULT 't';
6
UPDATE project SET active = 't';

Auch abrufbar als: Unified diff