Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0a2fb69e

Von Moritz Bunkus vor fast 10 Jahren hinzugefügt

  • ID 0a2fb69e21af67fdc5d162294c08b1847c9aa021
  • Vorgänger fb84ef15
  • Nachfolger 8b9174e8

Pflichtenhefte: benutzerdefinierte Variablen anzeigen und bearbeiten

Unterschiede anzeigen:

SL/Controller/RequirementSpec.pm
373 373
  my $self   = shift;
374 374
  my $is_new = !$self->requirement_spec->id;
375 375
  my $params = delete($::form->{requirement_spec}) || { };
376
  my $cvars  = delete($::form->{cvars})            || { };
376 377

  
377 378
  $self->requirement_spec->assign_attributes(%{ $params });
378 379

  
380
  foreach my $var (@{ $self->requirement_spec->cvars_by_config }) {
381
    my $value = $cvars->{ $var->config->name };
382
    $value    = $::form->parse_amount(\%::myconfig, $value) if $var->config->type eq 'number';
383

  
384
    $var->value($value);
385
  }
386

  
379 387
  my $title  = $is_new && $self->requirement_spec->is_template ? t8('Create a new requirement spec template')
380 388
             : $is_new                                         ? t8('Create a new requirement spec')
381 389
             :            $self->requirement_spec->is_template ? t8('Edit requirement spec template')
......
396 404
    if ($self->copy_source) {
397 405
      $self->requirement_spec($self->copy_source->create_copy(%{ $params }));
398 406
    } else {
399
      $self->requirement_spec->save;
407
      $self->requirement_spec->save(cascade => 1);
400 408
    }
401 409
  })) {
402 410
    $::lxdebug->message(LXDebug::WARN(), "Error: " . $db->error);
SL/DB/RequirementSpec.pm
9 9
use SL::DB::MetaSetup::RequirementSpec;
10 10
use SL::DB::Manager::RequirementSpec;
11 11
use SL::DB::Helper::AttrDuration;
12
use SL::DB::Helper::CustomVariables (
13
  module      => 'RequirementSpecs',
14
  cvars_alias => 1,
15
);
12 16
use SL::DB::Helper::LinkedRecords;
13 17
use SL::Locale::String;
14 18
use SL::Util qw(_hashify);
css/requirement_spec.css
3 3
/* ------------------------------------------------------------ */
4 4

  
5 5
input.rs_input_field, select.rs_input_field,
6
table.rs_input_field input, table.rs_input_field select {
6
table.rs_input_field input[type=text], table.rs_input_field input[type=password], table.rs_input_field select {
7 7
  width: 300px;
8 8
}
9 9

  
templates/webpages/common/render_cvar_value_readonly.html
1
[%- USE T8 %]
2
[%- USE HTML %]
3
[%- USE L %]
4
[%- USE LxERP %]
5

  
6
[%- IF ( var.config .type == 'bool' ) %]
7
  [% IF var.value %]
8
   [% LxERP.t8("Yes") %]
9
  [% ELSE %]
10
   [% LxERP.t8("No") %]
11
  [% END %]
12
[%- ELSIF ( var.config .type == 'textfield' ) %]
13
  <pre>[% HTML.escape(var.value) %]</pre>
14
[%- ELSIF ( var.config.type == 'number' ) %]
15
  [%- LxERP.format_amount(var.value, -2) %]
16
[%- ELSE %]
17
  [% HTML.escape(var.value) %]
18
[%- END %]
templates/webpages/requirement_spec/_form.html
1
[%- USE LxERP -%][%- USE L -%]
1
[%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
2 2
[%- DEFAULT id_prefix = 'basic_settings_form'
3 3
            submit_as = 'post'
4 4
%]
......
39 39

  
40 40
[%- END %]
41 41

  
42
  [% cvars = SELF.requirement_spec.cvars_by_config %]
43

  
44
  [% FOREACH var = cvars %]
45
   <tr>
46
    <td>[% HTML.escape(var.config.description) %]</td>
47

  
48
    <td>
49
      [% INCLUDE 'common/render_cvar_input.html'
50
                 cvar_name_prefix = 'cvars.'
51
      %]
52
    </td>
53
   </tr>
54
  [% END %]
55

  
42 56
 </table>
43 57

  
44 58
[%- IF SELF.copy_source %]
templates/webpages/requirement_spec/_show_basic_settings.html
36 36
   <td>[% HTML.escape(SELF.requirement_spec.hourly_rate_as_number) %]</td>
37 37
  </tr>
38 38

  
39
  [% cvars = SELF.requirement_spec.cvars_by_config %]
40

  
41
  [% FOREACH var = cvars %]
42
   <tr class="listrow">
43
    <td>[% HTML.escape(var.config.description) %]</td>
44
    <td>[% INCLUDE 'common/render_cvar_value_readonly.html' %]</td>
45
   </tr>
46
  [% END %]
47

  
39 48
[%- END %]
40 49

  
41 50
 </table>

Auch abrufbar als: Unified diff