Bug 35044: Admin: New additional fields 'repeatable' field
There is now a new 'repeatable' checkbox when configuring (adding or editing) an additional field for a specific table. It is also displayed in a column in the additional fields panel for a given tablename. MARC fields are not allowed to be repeatable. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
53a50118ae
commit
e4ce13c945
2 changed files with 22 additions and 1 deletions
|
@ -53,6 +53,7 @@ if ( $op eq 'cud-add' ) {
|
|||
my $marcfield = $input->param('marcfield') // q{};
|
||||
my $marcfield_mode = $input->param('marcfield_mode') // 'get';
|
||||
my $searchable = $input->param('searchable') ? 1 : 0;
|
||||
my $repeatable = $input->param('repeatable') ? 1 : 0;
|
||||
if ( $field_id and $name ) {
|
||||
my $updated = 0;
|
||||
my $set_fields = {
|
||||
|
@ -60,6 +61,7 @@ if ( $op eq 'cud-add' ) {
|
|||
marcfield => $marcfield,
|
||||
marcfield_mode => $marcfield_mode,
|
||||
searchable => $searchable,
|
||||
repeatable => $repeatable,
|
||||
};
|
||||
$set_fields->{authorised_value_category} = $authorised_value_category if $authorised_value_category;
|
||||
|
||||
|
@ -80,6 +82,7 @@ if ( $op eq 'cud-add' ) {
|
|||
marcfield => $marcfield,
|
||||
marcfield_mode => $marcfield_mode,
|
||||
searchable => $searchable,
|
||||
repeatable => $repeatable,
|
||||
};
|
||||
$set_fields->{authorised_value_category} = $authorised_value_category if $authorised_value_category;
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@
|
|||
[% IF show_searchable %]
|
||||
<th>Searchable</th>
|
||||
[% END %]
|
||||
<th>Repeatable</th>
|
||||
<th class="noExport">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -178,6 +179,9 @@
|
|||
[% IF field.searchable %]Yes[% ELSE %]No[% END %]
|
||||
</td>
|
||||
[% END %]
|
||||
<td>
|
||||
[% IF field.repeatable %]Yes[% ELSE %]No[% END %]
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a class="btn btn-default btn-xs" href="?op=add_form&field_id=[% field.id | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
||||
<a class="confirmdelete btn btn-default btn-xs" href="?op=delete&field_id=[% field.id | uri %]&tablename=[% tablename | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
|
||||
|
@ -212,6 +216,14 @@
|
|||
[% PROCESS options_for_authorised_value_categories authorised_value_categories = AuthorisedValues.GetCategories({selected => field.authorised_value_category}) %]
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label for="repeatable">Repeatable: </label>
|
||||
[% IF field.repeatable %]
|
||||
<input type="checkbox" name="repeatable" id="repeatable" checked="checked" />
|
||||
[% ELSE %]
|
||||
<input type="checkbox" name="repeatable" id="repeatable" />
|
||||
[% END %]
|
||||
</li>
|
||||
[% IF show_marcfield %]
|
||||
<li>
|
||||
<label for="marcfield">MARC field: </label>
|
||||
|
@ -299,6 +311,12 @@
|
|||
alert(_("You cannot select an authorised value category and a MARC field") );
|
||||
return false;
|
||||
}
|
||||
} $("#repeatable").prop('checked') == true
|
||||
if ( $("#marcfield").length && $("#repeatable").length) {
|
||||
if ( $("#marcfield").val().length > 0 && $("#repeatable").prop('checked') == true ) {
|
||||
alert(_("You cannot set a MARC field as repeatable") );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue