my $self = shift;
my $is_new = !$self->requirement_spec->id;
my $params = delete($::form->{requirement_spec}) || { };
+ my $cvars = delete($::form->{cvars}) || { };
$self->requirement_spec->assign_attributes(%{ $params });
+ foreach my $var (@{ $self->requirement_spec->cvars_by_config }) {
+ my $value = $cvars->{ $var->config->name };
+ $value = $::form->parse_amount(\%::myconfig, $value) if $var->config->type eq 'number';
+
+ $var->value($value);
+ }
+
my $title = $is_new && $self->requirement_spec->is_template ? t8('Create a new requirement spec template')
: $is_new ? t8('Create a new requirement spec')
: $self->requirement_spec->is_template ? t8('Edit requirement spec template')
if ($self->copy_source) {
$self->requirement_spec($self->copy_source->create_copy(%{ $params }));
} else {
- $self->requirement_spec->save;
+ $self->requirement_spec->save(cascade => 1);
}
})) {
$::lxdebug->message(LXDebug::WARN(), "Error: " . $db->error);
use SL::DB::MetaSetup::RequirementSpec;
use SL::DB::Manager::RequirementSpec;
use SL::DB::Helper::AttrDuration;
+use SL::DB::Helper::CustomVariables (
+ module => 'RequirementSpecs',
+ cvars_alias => 1,
+);
use SL::DB::Helper::LinkedRecords;
use SL::Locale::String;
use SL::Util qw(_hashify);
/* ------------------------------------------------------------ */
input.rs_input_field, select.rs_input_field,
-table.rs_input_field input, table.rs_input_field select {
+table.rs_input_field input[type=text], table.rs_input_field input[type=password], table.rs_input_field select {
width: 300px;
}
--- /dev/null
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE L %]
+[%- USE LxERP %]
+
+[%- IF ( var.config .type == 'bool' ) %]
+ [% IF var.value %]
+ [% LxERP.t8("Yes") %]
+ [% ELSE %]
+ [% LxERP.t8("No") %]
+ [% END %]
+[%- ELSIF ( var.config .type == 'textfield' ) %]
+ <pre>[% HTML.escape(var.value) %]</pre>
+[%- ELSIF ( var.config.type == 'number' ) %]
+ [%- LxERP.format_amount(var.value, -2) %]
+[%- ELSE %]
+ [% HTML.escape(var.value) %]
+[%- END %]
-[%- USE LxERP -%][%- USE L -%]
+[%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
[%- DEFAULT id_prefix = 'basic_settings_form'
submit_as = 'post'
%]
[%- END %]
+ [% cvars = SELF.requirement_spec.cvars_by_config %]
+
+ [% FOREACH var = cvars %]
+ <tr>
+ <td>[% HTML.escape(var.config.description) %]</td>
+
+ <td>
+ [% INCLUDE 'common/render_cvar_input.html'
+ cvar_name_prefix = 'cvars.'
+ %]
+ </td>
+ </tr>
+ [% END %]
+
</table>
[%- IF SELF.copy_source %]
<td>[% HTML.escape(SELF.requirement_spec.hourly_rate_as_number) %]</td>
</tr>
+ [% cvars = SELF.requirement_spec.cvars_by_config %]
+
+ [% FOREACH var = cvars %]
+ <tr class="listrow">
+ <td>[% HTML.escape(var.config.description) %]</td>
+ <td>[% INCLUDE 'common/render_cvar_value_readonly.html' %]</td>
+ </tr>
+ [% END %]
+
[%- END %]
</table>