Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 665dd6ea

Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt

  • ID 665dd6eac511a776369aa338e0a240f31681dd15
  • Vorgänger fdbdd0b1
  • Nachfolger 4cb932ab

ActionBar: Umstellung von Dialogbuchung und Berichtsfunktion in gl.pl

Unterschiede anzeigen:

bin/mozilla/gl.pl
338 338
  $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
339 339
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
340 340

  
341
  setup_gl_search_action_bar();
342

  
341 343
  $::form->header;
342 344
  print $::form->parse_html_template('gl/search', {
343 345
    employee_label => sub { "$_[0]{id}--$_[0]{name}" },
......
630 632

  
631 633
  $report->set_options('raw_bottom_info_text' => $raw_bottom_info_text);
632 634

  
633
  $report->generate_with_headers();
635
  setup_gl_transactions_action_bar(num_rows => scalar(@{$form->{GL}}));
636

  
637
  $report->generate_with_headers(action_bar => 1);
634 638

  
635 639
  $main::lxdebug->leave_sub();
636 640
}
......
949 953
  return ($::instance_conf->get_gl_changeable == 2) ? ($::form->current_date(\%::myconfig) eq $::form->{gldate}) : ($::instance_conf->get_gl_changeable == 1);
950 954
}
951 955

  
956
sub setup_gl_action_bar {
957
  my %params = @_;
958
  my $form   = $::form;
959
  my $change_never            = $::instance_conf->get_gl_changeable == 0;
960
  my $change_on_same_day_only = $::instance_conf->get_gl_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate});
961

  
962
  for my $bar ($::request->layout->get('actionbar')) {
963
    $bar->add(
964
      action => [
965
        t8('Update'),
966
        submit    => [ '#form', { action => 'update' } ],
967
        id        => 'update_button',
968
        accesskey => 'enter',
969
      ],
970
      action => [
971
        t8('Post'),
972
        submit   => [ '#form', { action => 'post' } ],
973
        disabled => $form->{locked}                           ? t8('The billing period has already been locked.')
974
                  : $form->{storno}                           ? t8('A canceled general ledger transaction cannot be posted.')
975
                  : ($form->{id} && $change_never)            ? t8('Changing general ledger transaction has been disabled in the configuration.')
976
                  : ($form->{id} && $change_on_same_day_only) ? t8('General ledger transactions can only be changed on the day they are posted.')
977
                  :                                             undef,
978
        ],
979
      combobox => [
980
        action => [ t8('Storno'),
981
          submit   => [ '#form', { action => 'storno' } ],
982
          confirm  => t8('Do you really want to cancel this general ledger transaction?'),
983
          disabled => !$form->{id} ? t8('This general ledger transaction has not been posted yet.') : undef,
984
        ],
985
        action => [ t8('Delete'),
986
          submit   => [ '#form', { action => 'delete' } ],
987
          confirm  => t8('Do you really want to delete this object?'),
988
          disabled => !$form->{id}             ? t8('This invoice has not been posted yet.')
989
                    : $form->{locked}          ? t8('The billing period has already been locked.')
990
                    : $change_never            ? t8('Changing invoices has been disabled in the configuration.')
991
                    : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.')
992
                    :                            undef,
993
        ],
994
      ], # end of combobox "Storno"
995

  
996
      combobox => [
997
        action => [ t8('more') ],
998
        action => [
999
          t8('History'),
1000
          call     => [ 'set_history_window', $form->{id} * 1, 'id' ],
1001
          disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
1002
        ],
1003
        action => [
1004
          t8('Follow-Up'),
1005
          call     => [ 'follow_up_window' ],
1006
          disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef,
1007
        ],
1008
        action => [
1009
          t8('Record templates'),
1010
          call => [ 'kivi.RecordTemplate.popup', 'gl_transaction' ],
1011
        ],
1012
        action => [
1013
          t8('Drafts'),
1014
          call     => [ 'kivi.Draft.popup', 'gl', 'unknown', $form->{draft_id}, $form->{draft_description} ],
1015
          disabled => $form->{id}     ? t8('This invoice has already been posted.')
1016
                    : $form->{locked} ? t8('The billing period has already been locked.')
1017
                    :                   undef,
1018
        ],
1019
      ], # end of combobox "more"
1020
    );
1021
  }
1022
}
1023

  
1024
sub setup_gl_search_action_bar {
1025
  my %params = @_;
1026

  
1027
  for my $bar ($::request->layout->get('actionbar')) {
1028
    $bar->add(
1029
      action => [
1030
        t8('Search'),
1031
        submit    => [ '#form', { action => 'continue', nextsub => 'generate_report' } ],
1032
        accesskey => 'enter',
1033
      ],
1034
    );
1035
  }
1036
}
1037

  
1038
sub setup_gl_transactions_action_bar {
1039
  my %params = @_;
1040

  
1041
  for my $bar ($::request->layout->get('actionbar')) {
1042
    $bar->add(
1043
      combobox => [
1044
        action => [ $::locale->text('Create new') ],
1045
        action => [
1046
          $::locale->text('GL Transaction'),
1047
          submit => [ '#create_new_form', { action => 'gl_transaction' } ],
1048
        ],
1049
        action => [
1050
          $::locale->text('AR Transaction'),
1051
          submit => [ '#create_new_form', { action => 'ar_transaction' } ],
1052
        ],
1053
        action => [
1054
          $::locale->text('AP Transaction'),
1055
          submit => [ '#create_new_form', { action => 'ap_transaction' } ],
1056
        ],
1057
        action => [
1058
          $::locale->text('Sales Invoice'),
1059
          submit => [ '#create_new_form', { action => 'sales_invoice'  } ],
1060
        ],
1061
        action => [
1062
          $::locale->text('Vendor Invoice'),
1063
          submit => [ '#create_new_form', { action => 'vendor_invoice' } ],
1064
        ],
1065
      ], # end of combobox "Create new"
1066
    );
1067
  }
1068
}
1069

  
952 1070
sub form_header {
953 1071
  $::lxdebug->enter_sub;
954 1072
  $::auth->assert('gl_transactions');
......
986 1104
  $::form->{previous_id}     ||= "--";
987 1105
  $::form->{previous_gldate} ||= "--";
988 1106

  
1107
  setup_gl_action_bar();
1108

  
989 1109
  $::form->header;
990 1110
  print $::form->parse_html_template('gl/form_header', {
991 1111
    hide_title => $title,
......
1019 1139
sub delete {
1020 1140
  $main::lxdebug->enter_sub();
1021 1141

  
1022
  my $form     = $main::form;
1023
  my $locale   = $main::locale;
1024

  
1025
  $form->header;
1026

  
1027
  print qq|
1028
<form method=post action=gl.pl>
1029
|;
1030

  
1031
  map { $form->{$_} =~ s/\"/&quot;/g } qw(reference description);
1032

  
1033
  delete $form->{header};
1034

  
1035
  foreach my $key (keys %$form) {
1036
    next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
1037
    print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
1038
  }
1039

  
1040
  print qq|
1041
<h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1042

  
1043
<h4>|
1044
    . $locale->text('Are you sure you want to delete Transaction')
1045
    . qq| $form->{reference}</h4>
1046

  
1047
<input name=action class=submit type=submit value="|
1048
    . $locale->text('Yes') . qq|">
1049
</form>
1050
|;
1051
  $main::lxdebug->leave_sub();
1052

  
1053
}
1054

  
1055
sub yes {
1056
  $main::lxdebug->enter_sub();
1057

  
1058 1142
  my $form     = $main::form;
1059 1143
  my %myconfig = %main::myconfig;
1060 1144
  my $locale   = $main::locale;

Auch abrufbar als: Unified diff