Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 86b6ff8a

Von Bernd Bleßmann vor mehr als 10 Jahren hinzugefügt

  • ID 86b6ff8a570d2fdc5fa53ba3dc9b3833e657e2e6
  • Vorgänger 915e14b7
  • Nachfolger 25b85515

Benutzerdef. Variablen f. Waren per Voreinstellung für Belege aktivieren/deaktivieren.

Unterschiede anzeigen:

SL/CVar.pm
132 132
      $act_var = $h_var->fetchrow_hashref();
133 133

  
134 134
      $valid = $self->get_custom_variables_validity(config_id => $cvar->{id}, trans_id => $params{trans_id});
135
    } else {
136
      $valid = !$cvar->{flag_defaults_to_invalid};
135 137
    }
136 138

  
137 139
    if ($act_var) {
......
145 147
                     :                                $act_var->{text_value};
146 148
      $cvar->{valid} = $valid;
147 149
    } else {
148
      $cvar->{valid}  =  1;
150
      $cvar->{valid} = $valid // 1;
149 151

  
150 152
      if ($cvar->{type} eq 'date') {
151 153
        if ($cvar->{default_value} eq 'NOW') {
SL/Controller/CustomVariableConfig.pm
7 7
use List::Util qw(first);
8 8

  
9 9
use SL::DB::CustomVariableConfig;
10
use SL::DB::CustomVariableValidity;
10 11
use SL::Helper::Flash;
11 12
use SL::Locale::String;
12 13
use Data::Dumper;
......
103 104

  
104 105
  SL::DB::CustomVariableConfig->reorder_list(@{ $::form->{cvarcfg_id} || [] });
105 106

  
106
  $self->render(\'', { type => 'json' });
107
  $self->render(\'', { type => 'json' }); # ' make emacs happy
107 108
}
108 109

  
109 110
#
......
179 180
    return;
180 181
  }
181 182

  
183
  my $dbh = $self->config->db;
184
  $dbh->begin_work;
185

  
182 186
  $self->config->save;
187
  $self->_set_cvar_validity() if $is_new;
188

  
189
  $dbh->commit;
183 190

  
184 191
  flash_later('info', $is_new ? t8('The custom variable has been created.') : t8('The custom variable has been saved.'));
185 192
  $self->redirect_to(action => 'list', module => $self->module);
186 193
}
187 194

  
195
sub _set_cvar_validity {
196
  my ($self) = @_;
197

  
198
  my $flags = {
199
    map { split m/=/, $_, 2 }
200
    split m/:/, ($self->config->flags || '')
201
  };
202

  
203
  # nothing to do to set valid
204
  return if !$flags->{defaults_to_invalid};
205

  
206
  my $all_parts  = SL::DB::Manager::Part->get_all(where => [ or => [ obsolete => 0, obsolete => undef ] ]);
207
  foreach my $part (@{ $all_parts }) {
208
    SL::DB::CustomVariableValidity->new(config_id => $self->config->id, trans_id => $part->id)->save;
209
  }
210
}
211

  
188 212
1;
locale/de/all
52 52
  'A transaction description is required.' => 'Die Vorgangsbezeichnung muss eingegeben werden.',
53 53
  'A unit with this name does already exist.' => 'Eine Einheit mit diesem Namen existiert bereits.',
54 54
  'A valid taxkey is missing!'  => 'Einen gültiger Steuerschlüssel fehlt!',
55
  'A variable marked as \'Deactivate by default\' isn\'t automatically added to all articles, and has to be explicitly added for each desired article in its master data tab. Only then can the variable be used for that article in the records.' => 'Eine als \'Deaktiviert als Voreinstellung\' markierte Variable wird nicht automatisch bei allen Artikeln hinzugefügt, sondern muß explizit für jeden gewünschten Artikel in den Stammdaten aktiviert werden. Erst danach ist die Variable für den Artikel in Belegen bearbeitbar.',
55 56
  'A variable marked as \'editable\' can be changed in each quotation, order, invoice etc.' => 'Eine als \'Bearbeitbar\' markierte Variable kann in jedem Angebot, Auftrag, jeder Rechnung etc für jede Position geändert werden.',
56 57
  'ADDED'                       => 'Hinzugefügt',
57 58
  'AP'                          => 'Einkauf',
......
720 721
  'Date the payment is due with discount' => 'Das Datum, bis die Rechnung unter Abzug von Skonto bezahlt werden kann',
721 722
  'Datevautomatik'              => 'Datev-Automatik',
722 723
  'Datum von'                   => 'Datum von',
724
  'Deactivate by default'       => 'Deaktiviert als Voreinstellung',
723 725
  'Debit'                       => 'Soll',
724 726
  'Debit (one letter abbreviation)' => 'S',
725 727
  'Debit Account'               => 'Sollkonto',
locale/en/all
45 45
  'A special character is required (valid characters: #1).' => '',
46 46
  'A unit with this name does already exist.' => '',
47 47
  'A valid taxkey is missing!'  => '',
48
  'A variable marked as \'Deactivate by default\' isn\'t automatically added to all articles, and has to be explicitly added for each desired article in its master data tab. Only then can the variable be used for that article in the records.' => '',
48 49
  'A variable marked as \'editable\' can be changed in each quotation, order, invoice etc.' => '',
49 50
  'ADDED'                       => '',
50 51
  'AP'                          => 'Purchases',
......
633 634
  'Date the payment is due with discount' => '',
634 635
  'Datevautomatik'              => '',
635 636
  'Datum von'                   => '',
637
  'Deactivate by default'       => '',
636 638
  'Debit'                       => '',
637 639
  'Debit (one letter abbreviation)' => '',
638 640
  'Debit Account'               => '',
templates/webpages/custom_variable_config/form.html
67 67
     [% L.radio_button_tag('config.flag_editable', value='0', id='config.flag_editable_0', label=LxERP.t8('No'),  checked=(SELF.flags.editable ? '' :  1)) %]
68 68
    </td>
69 69
   </tr>
70
   <tr data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
71
    <td align="right">[% 'Deactivate by default' | $T8 %]<sup><span class="small-text">(7)</span></sup></td>
72
    <td>
73
     [% L.radio_button_tag('config.flag_defaults_to_invalid', value='1', id='config.flag_defaults_to_invalid_1', label=LxERP.t8('Yes'), checked=(SELF.flags.defaults_to_invalid ?  1 : '')) %]
74
     [% L.radio_button_tag('config.flag_defaults_to_invalid', value='0', id='config.flag_defaults_to_invalid_0', label=LxERP.t8('No'),  checked=(SELF.flags.defaults_to_invalid ? '' :  1)) %]
75
    </td>
76
   </tr>
70 77
  </table>
71 78
 </p>
72 79

  
......
126 133
  [% 'Otherwise the variable is only available for printing.' | $T8 %]
127 134
 </p>
128 135

  
136
 <p data-show-for="IC"[% UNLESS SELF.module == 'IC' %] style="display: none;"[% END %]>
137
  (7)
138

  
139
  [%- 'A variable marked as \'Deactivate by default\' isn\'t automatically added to all articles, and has to be explicitly added for each desired article in its master data tab. Only then can the variable be used for that article in the records.' | $T8 %]
140
 </p>
141

  
129 142
</form>
130 143

  
131 144
<script type="text/javascript">
templates/webpages/custom_variable_config/list.html
19 19
    <th width="20%">[% 'Includeable in reports' | $T8 %]</th>
20 20
    [%- IF SELF.module == 'IC' %]
21 21
     <th width="20%">[% 'Editable' | $T8 %]</th>
22
     <th width="20%">[% 'Deactivate by default' | $T8 %]</th>
22 23
    [%- END %]
23 24
   </tr>
24 25
  </thead>
......
39 40

  
40 41
     [%- IF SELF.module == 'IC' %]
41 42
      <td>[%- IF cfg.flags.match('editable=1') %][% 'Yes' | $T8 %][%- ELSE %][% 'No' | $T8 %][%- END %]</td>
43
      <td>[%- IF cfg.flags.match('defaults_to_invalid=1') %][% 'Yes' | $T8 %][%- ELSE %][% 'No' | $T8 %][%- END %]</td>
42 44
     [%- END %]
43 45
    </tr>
44 46
    [%- END %]

Auch abrufbar als: Unified diff