Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2ff2f6c9

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID 2ff2f6c9c9f95845ddb83d1cef264e580977759c
  • Vorgänger f631da56
  • Nachfolger a609123f

Verwaltung von Abteilungen auf Controller umgestellt

Unterschiede anzeigen:

SL/AM.pm
250 250

  
251 251
    # if charttype is heading make sure certain values are empty
252 252
    # specifically, if charttype is changed from an existing account, empty the
253
    # fields unnecessary for headings, so that e.g. heading doesn't appear in 
253
    # fields unnecessary for headings, so that e.g. heading doesn't appear in
254 254
    # drop-down menues due to still having a valid "link" entry
255 255

  
256 256
    if ( $form->{charttype} eq 'H' ) {
......
474 474
  return $rc;
475 475
}
476 476

  
477
sub departments {
478
  $main::lxdebug->enter_sub();
479

  
480
  my ($self, $myconfig, $form) = @_;
481

  
482
  # connect to database
483
  my $dbh = $form->dbconnect($myconfig);
484

  
485
  my $query = qq|SELECT d.id, d.description, d.role
486
                 FROM department d
487
                 ORDER BY 2|;
488

  
489
  my $sth = $dbh->prepare($query);
490
  $sth->execute || $form->dberror($query);
491

  
492
  $form->{ALL} = [];
493
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
494
    push @{ $form->{ALL} }, $ref;
495
  }
496

  
497
  $sth->finish;
498
  $dbh->disconnect;
499

  
500
  $main::lxdebug->leave_sub();
501
}
502

  
503
sub get_department {
504
  $main::lxdebug->enter_sub();
505

  
506
  my ($self, $myconfig, $form) = @_;
507

  
508
  # connect to database
509
  my $dbh = $form->dbconnect($myconfig);
510

  
511
  my $query = qq|SELECT d.description, d.role
512
                 FROM department d
513
                 WHERE d.id = ?|;
514
  my $sth = $dbh->prepare($query);
515
  $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
516

  
517
  my $ref = $sth->fetchrow_hashref("NAME_lc");
518

  
519
  map { $form->{$_} = $ref->{$_} } keys %$ref;
520

  
521
  $sth->finish;
522

  
523
  # see if it is in use
524
  $query = qq|SELECT count(*) FROM dpt_trans d
525
              WHERE d.department_id = ?|;
526
  ($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id});
527

  
528
  $form->{orphaned} = !$form->{orphaned};
529
  $sth->finish;
530

  
531
  $dbh->disconnect;
532

  
533
  $main::lxdebug->leave_sub();
534
}
535

  
536
sub save_department {
537
  $main::lxdebug->enter_sub();
538

  
539
  my ($self, $myconfig, $form) = @_;
540
  my ($query);
541

  
542
  # connect to database
543
  my $dbh = $form->dbconnect($myconfig);
544

  
545
  my @values = ($form->{description}, $form->{role});
546
  if ($form->{id}) {
547
    $query = qq|UPDATE department SET
548
                description = ?, role = ?
549
                WHERE id = ?|;
550
    push(@values, $form->{id});
551
  } else {
552
    $query = qq|INSERT INTO department
553
                (description, role)
554
                VALUES (?, ?)|;
555
  }
556
  do_query($form, $dbh, $query, @values);
557

  
558
  $dbh->disconnect;
559

  
560
  $main::lxdebug->leave_sub();
561
}
562

  
563
sub delete_department {
564
  $main::lxdebug->enter_sub();
565

  
566
  my ($self, $myconfig, $form) = @_;
567
  my ($query);
568

  
569
  # connect to database
570
  my $dbh = $form->dbconnect($myconfig);
571

  
572
  $query = qq|DELETE FROM department
573
              WHERE id = ?|;
574
  do_query($form, $dbh, $query, $form->{id});
575

  
576
  $dbh->disconnect;
577

  
578
  $main::lxdebug->leave_sub();
579
}
580

  
581 477
sub lead {
582 478
  $main::lxdebug->enter_sub();
583 479

  
SL/Controller/Department.pm
1
package SL::Controller::Department;
2

  
3
use strict;
4

  
5
use parent qw(SL::Controller::Base);
6

  
7
use SL::DB::Department;
8
use SL::Helper::Flash;
9

  
10
use Rose::Object::MakeMethods::Generic
11
(
12
 scalar => [ qw(department) ],
13
);
14

  
15
__PACKAGE__->run_before('check_auth');
16
__PACKAGE__->run_before('load_department', only => [ qw(edit update destroy) ]);
17

  
18
#
19
# actions
20
#
21

  
22
sub action_list {
23
  my ($self) = @_;
24

  
25
  $self->render('department/list',
26
                title       => $::locale->text('Departments'),
27
                DEPARTMENTS => SL::DB::Manager::Department->get_all_sorted);
28
}
29

  
30
sub action_new {
31
  my ($self) = @_;
32

  
33
  $self->{department} = SL::DB::Department->new(role => 'P');
34
  $self->render('department/form', title => $::locale->text('Create a new department'));
35
}
36

  
37
sub action_edit {
38
  my ($self) = @_;
39
  $self->render('department/form', title => $::locale->text('Edit department'));
40
}
41

  
42
sub action_create {
43
  my ($self) = @_;
44

  
45
  $self->{department} = SL::DB::Department->new;
46
  $self->create_or_update;
47
}
48

  
49
sub action_update {
50
  my ($self) = @_;
51
  $self->create_or_update;
52
}
53

  
54
sub action_destroy {
55
  my ($self) = @_;
56

  
57
  if (eval { $self->{department}->delete; 1; }) {
58
    flash_later('info',  $::locale->text('The department has been deleted.'));
59
  } else {
60
    flash_later('error', $::locale->text('The department is in use and cannot be deleted.'));
61
  }
62

  
63
  $self->redirect_to(action => 'list');
64
}
65

  
66
#
67
# filters
68
#
69

  
70
sub check_auth {
71
  $::auth->assert('config');
72
}
73

  
74
#
75
# helpers
76
#
77

  
78
sub create_or_update {
79
  my $self   = shift;
80
  my $is_new = !$self->{department}->id;
81
  my $params = delete($::form->{department}) || { };
82

  
83
  $self->{department}->assign_attributes(%{ $params });
84

  
85
  my @errors = $self->{department}->validate;
86

  
87
  if (@errors) {
88
    flash('error', @errors);
89
    $self->render('department/form', title => $is_new ? $::locale->text('Create a new department') : $::locale->text('Edit department'));
90
    return;
91
  }
92

  
93
  $self->{department}->save;
94

  
95
  flash_later('info', $is_new ? $::locale->text('The department has been created.') : $::locale->text('The department has been saved.'));
96
  $self->redirect_to(action => 'list');
97
}
98

  
99
sub load_department {
100
  my ($self) = @_;
101
  $self->{department} = SL::DB::Department->new(id => $::form->{id})->load;
102
}
103

  
104
1;
SL/DB/Department.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::Department;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::Department;
6
use SL::DB::Manager::Department;
7

  
8
use SL::DB::DptTrans;
9

  
10
sub validate {
11
  my ($self) = @_;
12

  
13
  my @errors;
14
  push @errors, $::locale->text('The description is missing.') if !$self->description;
15

  
16
  return @errors;
17
}
18

  
19
sub is_used {
20
  my ($self) = @_;
9 21

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11
__PACKAGE__->meta->make_manager_class;
22
  return undef if !$self->id;
23
  my $is_used = SL::DB::Manager::DptTrans->find_by(department_id => $self->id);
24
  return !!$is_used;
25
}
12 26

  
13 27
1;
SL/DB/Manager/Department.pm
1
package SL::DB::Manager::Department;
2

  
3
use strict;
4

  
5
use SL::DB::Helper::Manager;
6
use base qw(SL::DB::Helper::Manager);
7

  
8
use SL::DB::Helper::Sorted;
9

  
10
sub object_class { 'SL::DB::Department' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
sub _sort_spec {
15
  return ( default => [ 'description', 1 ],
16
           columns => { SIMPLE => 'ALL',
17
                        map { ( $_ => "lower(department.$_)" ) } qw(description)
18
                      });
19
}
20

  
21
1;
bin/mozilla/am.pl
620 620
  $main::lxdebug->leave_sub();
621 621
}
622 622

  
623
sub add_department {
624
  $main::lxdebug->enter_sub();
625

  
626
  my $form     = $main::form;
627

  
628
  $main::auth->assert('config');
629

  
630
  $form->{title} = "Add";
631
  $form->{role}  = "P";
632

  
633
  $form->{callback} = "am.pl?action=add_department" unless $form->{callback};
634

  
635
  &department_header;
636
  &form_footer;
637

  
638
  $main::lxdebug->leave_sub();
639
}
640

  
641
sub edit_department {
642
  $main::lxdebug->enter_sub();
643

  
644
  my $form     = $main::form;
645
  my %myconfig = %main::myconfig;
646

  
647
  $main::auth->assert('config');
648

  
649
  $form->{title} = "Edit";
650

  
651
  AM->get_department(\%myconfig, \%$form);
652

  
653
  &department_header;
654
  &form_footer;
655

  
656
  $main::lxdebug->leave_sub();
657
}
658

  
659
sub list_department {
660
  $main::lxdebug->enter_sub();
661

  
662
  my $form     = $main::form;
663
  my %myconfig = %main::myconfig;
664
  my $locale   = $main::locale;
665

  
666
  $main::auth->assert('config');
667

  
668
  AM->departments(\%myconfig, \%$form);
669

  
670
  $form->{callback} = "am.pl?action=list_department";
671

  
672
  my $callback = $form->escape($form->{callback});
673

  
674
  $form->{title} = $locale->text('Departments');
675

  
676
  my @column_index = qw(description cost profit);
677
  my %column_header;
678
  $column_header{description} =
679
      qq|<th class=listheading width=90%>|
680
    . $locale->text('Description')
681
    . qq|</th>|;
682
  $column_header{cost} =
683
      qq|<th class=listheading nowrap>|
684
    . $locale->text('Cost Center')
685
    . qq|</th>|;
686
  $column_header{profit} =
687
      qq|<th class=listheading nowrap>|
688
    . $locale->text('Profit Center')
689
    . qq|</th>|;
690

  
691
  $form->header;
692

  
693
  print qq|
694
<body>
695

  
696
<table width=100%>
697
  <tr>
698
    <th class=listtop>$form->{title}</th>
699
  </tr>
700
  <tr height="5"></tr>
701
  <tr>
702
    <td>
703
      <table width=100%>
704
        <tr class=listheading>
705
|;
706

  
707
  map { print "$column_header{$_}\n" } @column_index;
708

  
709
  print qq|
710
        </tr>
711
|;
712

  
713
  my ($i, %column_data);
714
  foreach my $ref (@{ $form->{ALL} }) {
715

  
716
    $i++;
717
    $i %= 2;
718

  
719
    print qq|
720
        <tr valign=top class=listrow$i>
721
|;
722

  
723
    my $costcenter   = ($ref->{role} eq "C") ? "X" : "";
724
    my $profitcenter = ($ref->{role} eq "P") ? "X" : "";
725

  
726
    $column_data{description} =
727
      qq|<td><a href="am.pl?action=edit_department&id=$ref->{id}&callback=$callback">$ref->{description}</td>|;
728
    $column_data{cost}   = qq|<td align=center>$costcenter</td>|;
729
    $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
730

  
731
    map { print "$column_data{$_}\n" } @column_index;
732

  
733
    print qq|
734
        </tr>
735
|;
736
  }
737

  
738
  print qq|
739
      </table>
740
    </td>
741
  </tr>
742
  <tr>
743
  <td><hr size=3 noshade></td>
744
  </tr>
745
</table>
746

  
747
<br>
748
<form method=post action=am.pl>
749

  
750
<input name=callback type=hidden value="$form->{callback}">
751

  
752
<input type=hidden name=type value=department>
753

  
754
<input class=submit type=submit name=action value="|
755
    . $locale->text('Add') . qq|">
756

  
757
  </form>
758

  
759
  </body>
760
  </html>
761
|;
762

  
763
  $main::lxdebug->leave_sub();
764
}
765

  
766
sub department_header {
767
  $main::lxdebug->enter_sub();
768

  
769
  my $form     = $main::form;
770
  my $locale   = $main::locale;
771

  
772
  $main::auth->assert('config');
773

  
774
  $form->{title} = $locale->text("$form->{title} Department");
775

  
776
  # $locale->text('Add Department')
777
  # $locale->text('Edit Department')
778

  
779
  $form->{description} =~ s/\"/&quot;/g;
780

  
781
  my ($rows, $description);
782
  if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
783
    $description =
784
      qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
785
  } else {
786
    $description =
787
      qq|<input name=description size=60 value="$form->{description}">|;
788
  }
789

  
790
  my $costcenter   = "checked" if $form->{role} eq "C";
791
  my $profitcenter = "checked" if $form->{role} eq "P";
792

  
793
  $form->header;
794

  
795
  print qq|
796
<body>
797

  
798
<form method=post action=am.pl>
799

  
800
<input type=hidden name=id value=$form->{id}>
801
<input type=hidden name=type value=department>
802

  
803
<table width=100%>
804
  <tr>
805
    <th class=listtop colspan=2>$form->{title}</th>
806
  </tr>
807
  <tr height="5"></tr>
808
  <tr>
809
    <th align=right>| . $locale->text('Description') . qq|</th>
810
    <td>$description</td>
811
  </tr>
812
  <tr>
813
    <td></td>
814
    <td><input type=radio style=radio name=role value="C" $costcenter> |
815
    . $locale->text('Cost Center') . qq|
816
        <input type=radio style=radio name=role value="P" $profitcenter> |
817
    . $locale->text('Profit Center') . qq|
818
    </td>
819
  <tr>
820
    <td colspan=2><hr size=3 noshade></td>
821
  </tr>
822
</table>
823
|;
824

  
825
  $main::lxdebug->leave_sub();
826
}
827

  
828
sub save_department {
829
  $main::lxdebug->enter_sub();
830

  
831
  my $form     = $main::form;
832
  my %myconfig = %main::myconfig;
833
  my $locale   = $main::locale;
834

  
835
  $main::auth->assert('config');
836

  
837
  $form->isblank("description", $locale->text('Description missing!'));
838
  AM->save_department(\%myconfig, \%$form);
839
  $form->redirect($locale->text('Department saved!'));
840

  
841
  $main::lxdebug->leave_sub();
842
}
843

  
844
sub delete_department {
845
  $main::lxdebug->enter_sub();
846

  
847
  my $form     = $main::form;
848
  my %myconfig = %main::myconfig;
849
  my $locale   = $main::locale;
850

  
851
  $main::auth->assert('config');
852

  
853
  AM->delete_department(\%myconfig, \%$form);
854
  $form->redirect($locale->text('Department deleted!'));
855

  
856
  $main::lxdebug->leave_sub();
857
}
858

  
859 623
sub add_lead {
860 624
  $main::lxdebug->enter_sub();
861 625

  
locale/de/all
196 196
  'Are you sure you want to delete Order Number' => 'Soll der Auftrag mit folgender Nummer wirklich gelöscht werden:',
197 197
  'Are you sure you want to delete Quotation Number' => 'Sind Sie sicher, dass Angebotnummer gelöscht werden soll?',
198 198
  'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?',
199
  'Are you sure you want to delete this department?' => 'Sind Sie sicher, dass Sie diese Abteilung löschen wollen?',
199 200
  'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?',
200 201
  'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?',
201 202
  'Are you sure you want to update the prices' => 'Sind Sie sicher, dass Sie die Preise aktualisieren wollen?',
......
430 431
  'Create Chart of Accounts'    => 'Zu verwendender Kontenplan',
431 432
  'Create Dataset'              => 'Neue Datenbank anlegen',
432 433
  'Create Date'                 => 'Erstelldatum',
434
  'Create a new department'     => 'Eine neue Abteilung erfassen',
433 435
  'Create a new payment term'   => 'Neue Zahlungsbedingungen anlegen',
434 436
  'Create a standard group'     => 'Eine Standard-Benutzergruppe anlegen',
435 437
  'Create and edit RFQs'        => 'Lieferantenanfragen erfassen und bearbeiten',
......
450 452
  'Create bank transfer via SEPA XML' => 'Überweisung via SEPA XML erzeugen',
451 453
  'Create invoice?'             => 'Rechnung erstellen?',
452 454
  'Create new'                  => 'Neu erfassen',
455
  'Create new department'       => 'Neue Abteilung erfassen',
453 456
  'Create new payment term'     => 'Neue Zahlungsbedingung anlegen',
454 457
  'Create tables'               => 'Tabellen anlegen',
455 458
  'Created by'                  => 'Erstellt von',
......
570 573
  'Department 1'                => 'Abteilung (1)',
571 574
  'Department 2'                => 'Abteilung (2)',
572 575
  'Department Id'               => 'Reservierung',
573
  'Department deleted!'         => 'Abteilung gelöscht.',
574
  'Department saved!'           => 'Abteilung gespeichert.',
575 576
  'Departments'                 => 'Abteilungen',
576 577
  'Dependency loop detected:'   => 'Schleife in den Abh&auml;ngigkeiten entdeckt:',
577 578
  'Deposit'                     => 'Gutschrift',
......
672 673
  'Edit Business'               => 'Kunden-/Lieferantentyp bearbeiten',
673 674
  'Edit Credit Note'            => 'Gutschrift bearbeiten',
674 675
  'Edit Customer'               => 'Kunde editieren',
675
  'Edit Department'             => 'Abteilung bearbeiten',
676 676
  'Edit Dunning'                => 'Mahnungen konfigurieren',
677 677
  'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten',
678 678
  'Edit Follow-Up'              => 'Wiedervorlage bearbeiten',
......
705 705
  'Edit and delete a group'     => 'Gruppen bearbeiten und l&ouml;schen',
706 706
  'Edit bank account'           => 'Bankkonto bearbeiten',
707 707
  'Edit custom variable'        => 'Benutzerdefinierte Variable bearbeiten',
708
  'Edit department'             => 'Abteilung bearbeiten',
708 709
  'Edit file'                   => 'Datei bearbeiten',
709 710
  'Edit greetings'              => 'Anreden bearbeiten',
710 711
  'Edit group '                 => 'Gruppe bearbeiten',
......
1161 1162
  'No data was found.'          => 'Es wurden keine Daten gefunden.',
1162 1163
  'No databases have been found on this server.' => 'Auf diesem Server wurden keine Datenbanken gefunden.',
1163 1164
  'No datasets have been selected.' => 'Es wurden keine Datenbanken ausgew&auml;hlt.',
1165
  'No department has been created yet.' => 'Es wurde noch keine Abteilung erfasst.',
1164 1166
  'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgew&auml;hlt.',
1165 1167
  'No entries were found which had no unit assigned to them.' => 'Es wurden keine Eintr&auml;ge gefunden, denen keine Einheit zugeordnet war.',
1166 1168
  'No file has been uploaded yet.' => 'Es wurde noch keine Datei hochgeladen.',
......
1746 1748
  'The deductible amount'       => 'Der abziehbare Skontobetrag',
1747 1749
  'The default value depends on the variable type:' => 'Die Bedeutung des Standardwertes h&auml;ngt vom Variablentypen ab:',
1748 1750
  'The delivery order has not been marked as delivered. The warehouse contents have not changed.' => 'Der Lieferschein wurde nicht als geliefert markiert. Der Lagerinhalt wurde nicht verändert.',
1751
  'The department has been created.' => 'Die Abteilung wurde angelegt.',
1752
  'The department has been deleted.' => 'Die Abteiltung wurde gelöscht.',
1753
  'The department has been saved.' => 'Die abteilung wurde gespeichert.',
1754
  'The department is in use and cannot be deleted.' => 'Die Abteilung wird benutzt und kann nicht gelöscht werden.',
1749 1755
  'The description is missing.' => 'Die Beschreibung fehlt.',
1750 1756
  'The description is shown on the form. Chose something short and descriptive.' => 'Die Beschreibung wird in der jeweiligen Maske angezeigt. Sie sollte kurz und pr&auml;gnant sein.',
1751 1757
  'The directory "%s" could not be created:\n%s' => 'Das Verzeichnis "%s" konnte nicht erstellt werden:\n%s',
menu.ini
633 633
submenu=1
634 634

  
635 635
[System--Departments--Add Department]
636
module=am.pl
637
action=add_department
636
module=controller.pl
637
action=Department/new
638 638

  
639 639
[System--Departments--List Departments]
640
module=am.pl
641
action=list_department
640
module=controller.pl
641
action=Department/list
642 642

  
643 643
[System--Type of Business]
644 644
module=menu.pl
templates/webpages/department/form.html
1
[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
2
[% SET is_used = SELF.department.is_used %]
3
<body>
4

  
5
 <form method="post" action="controller.pl">
6
  <div class="listtop">[% FORM.title %]</div>
7

  
8
[%- INCLUDE 'common/flash.html' %]
9

  
10
  <table>
11
   <tr>
12
    <td>[%- 'Description' | $T8 %]</td>
13
    <td>[% L.input_tag("department.description", SELF.department.description) %]</td>
14
   </tr>
15

  
16
   <tr>
17
    <td valign="top">[%- 'Type' | $T8 %]</td>
18
    <td valign="top">
19
     [%- IF is_used %]
20
      [% L.hidden_tag("role", SELF.department.role) %]
21
      [%- IF SELF.department.role == "C" %][%- LxERP.t8('Cost Center') %][%- ELSE %][%- LxERP.t8('Profit Center') %][%- END %]
22
     [%- ELSE %]
23
      [% L.radio_button_tag("department.role", "value", "C", "label", LxERP.t8("Cost Center"), "checked", SELF.department.role == "C") %]
24
      <br>
25
      [% L.radio_button_tag("department.role", "value", "P", "label", LxERP.t8("Profit Center"), "checked", SELF.department.role == "P") %]
26
     [%- END %]
27
    </td>
28
   </tr>
29
  </table>
30

  
31
  <p>
32
   [% L.hidden_tag("id", SELF.department.id) %]
33
   [% L.hidden_tag("action", "Department/dispatch") %]
34
   <input type="submit" class="submit" name="action_[% IF SELF.department.id %]update[% ELSE %]create[% END %]" value="[% 'Save' | $T8 %]">
35
   [%- IF SELF.department.id && !is_used %]
36
    [% L.submit_tag("action_destroy", LxERP.t8("Delete"), "confirm", LxERP.t8("Are you sure you want to delete this department?")) %]
37
   [%- END %]
38
   <a href="[% SELF.url_for(action => 'list') %]">[%- 'Abort' | $T8 %]</a>
39
  </p>
40
 </form>
41
</body>
42
</html>
templates/webpages/department/list.html
1
[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
2

  
3
<body>
4
 <div class="listtop">[% FORM.title %]</div>
5

  
6
[%- INCLUDE 'common/flash.html' %]
7

  
8
 <form method="post" action="controller.pl">
9
  [% IF !DEPARTMENTS.size %]
10
   <p>
11
    [%- 'No department has been created yet.' | $T8 %]
12
   </p>
13

  
14
  [%- ELSE %]
15
   <table id="department_list" width="100%">
16
    <thead>
17
    <tr class="listheading">
18
     <th width="100%">[%- 'Description' | $T8 %]</th>
19
     <th>[%- 'Cost Center' | $T8 %]</th>
20
     <th>[%- 'Profit Center' | $T8 %]</th>
21
    </tr>
22
    </thead>
23

  
24
    <tbody>
25
    [%- FOREACH department = DEPARTMENTS %]
26
    <tr class="listrow[% loop.count % 2 %]" id="department_id_[% department.id %]">
27
     <td>
28
      <a href="[% SELF.url_for(action => 'edit', id => department.id) %]">
29
       [%- HTML.escape(department.description) %]
30
      </a>
31
     </td>
32
     <td align="center">[%- IF department.role == 'C' %]X[%- END %]</td>
33
     <td align="center">[%- IF department.role == 'P' %]X[%- END %]</td>
34
    </tr>
35
    [%- END %]
36
    </tbody>
37
   </table>
38
  [%- END %]
39

  
40
  <hr size="3" noshade>
41

  
42
  <p>
43
   <a href="[% SELF.url_for(action => 'new') %]">[%- 'Create new department' | $T8 %]</a>
44
  </p>
45
 </form>
46
</body>
47
</html>

Auch abrufbar als: Unified diff