Bug 28924: Add new columns to UI and controller

This patch adds the columns in the table and also updates the controller to allow these fields to be updated in the database from the UI form

Sponsored-by: Cuyahoga County Public Library <https://cuyahogalibrary.org/>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-07-15 14:17:40 +00:00 committed by Katrin Fischer
parent eed4bc2379
commit 64783a6f10
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 86 additions and 45 deletions

View File

@ -57,28 +57,31 @@ if ( $op eq 'add_form' ) {
}
}
elsif ( $op eq 'cud-add_validate' ) {
my $categorycode = $input->param('categorycode');
my $description = $input->param('description');
my $enrolmentperiod = $input->param('enrolmentperiod');
my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
my $password_expiry_days = $input->param('password_expiry_days') || undef;
my $upperagelimit = $input->param('upperagelimit');
my $dateofbirthrequired = $input->param('dateofbirthrequired');
my $enrolmentfee = $input->param('enrolmentfee');
my $reservefee = $input->param('reservefee');
my $hidelostitems = $input->param('hidelostitems');
my $overduenoticerequired = $input->param('overduenoticerequired');
my $category_type = $input->param('category_type');
my $BlockExpiredPatronOpacActions = join( ',', $input->multi_param('BlockExpiredPatronOpacActions') );
my $checkPrevCheckout = $input->param('checkprevcheckout');
my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1;
my $default_privacy = $input->param('default_privacy');
my $reset_password = $input->param('reset_password');
my $change_password = $input->param('cud-change_password');
my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
my $min_password_length = $input->param('min_password_length');
my $require_strong_password = $input->param('require_strong_password');
my $noissuescharge = $input->param('noissuescharge') || undef;
my $noissueschargeguarantees = $input->param('noissueschargeguarantees') || undef;
my $noissueschargeguarantorswithguarantees = $input->param('noissueschargeguarantorswithguarantees') || undef;
my $categorycode = $input->param('categorycode');
my $description = $input->param('description');
my $enrolmentperiod = $input->param('enrolmentperiod');
my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
my $password_expiry_days = $input->param('password_expiry_days') || undef;
my $upperagelimit = $input->param('upperagelimit');
my $dateofbirthrequired = $input->param('dateofbirthrequired');
my $enrolmentfee = $input->param('enrolmentfee');
my $reservefee = $input->param('reservefee');
my $hidelostitems = $input->param('hidelostitems');
my $overduenoticerequired = $input->param('overduenoticerequired');
my $category_type = $input->param('category_type');
my $BlockExpiredPatronOpacActions = join( ',', $input->multi_param('BlockExpiredPatronOpacActions') );
my $checkPrevCheckout = $input->param('checkprevcheckout');
my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1;
my $default_privacy = $input->param('default_privacy');
my $reset_password = $input->param('reset_password');
my $change_password = $input->param('cud-change_password');
my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
my $min_password_length = $input->param('min_password_length');
my $require_strong_password = $input->param('require_strong_password');
my @branches = grep { $_ ne q{} } $input->multi_param('branches');
my $can_be_guarantee = $input->param('can_be_guarantee');
@ -113,6 +116,9 @@ elsif ( $op eq 'cud-add_validate' ) {
$category->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
$category->min_password_length($min_password_length);
$category->require_strong_password($require_strong_password);
$category->noissuescharge($noissuescharge);
$category->noissueschargeguarantees($noissueschargeguarantees);
$category->noissueschargeguarantorswithguarantees($noissueschargeguarantorswithguarantees);
eval {
$category->store;
$category->replace_library_limits( \@branches );
@ -124,30 +130,35 @@ elsif ( $op eq 'cud-add_validate' ) {
}
}
else {
my $category = Koha::Patron::Category->new({
categorycode => $categorycode,
description => $description,
enrolmentperiod => $enrolmentperiod,
enrolmentperioddate => $enrolmentperioddate,
password_expiry_days => $password_expiry_days,
upperagelimit => $upperagelimit,
dateofbirthrequired => $dateofbirthrequired,
enrolmentfee => $enrolmentfee,
reservefee => $reservefee,
hidelostitems => $hidelostitems,
overduenoticerequired => $overduenoticerequired,
category_type => $category_type,
can_be_guarantee => $can_be_guarantee,
BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
checkprevcheckout => $checkPrevCheckout,
can_place_ill_in_opac => $can_place_ill_in_opac,
default_privacy => $default_privacy,
reset_password => $reset_password,
change_password => $change_password,
exclude_from_local_holds_priority => $exclude_from_local_holds_priority,
min_password_length => $min_password_length,
require_strong_password => $require_strong_password,
});
my $category = Koha::Patron::Category->new(
{
categorycode => $categorycode,
description => $description,
enrolmentperiod => $enrolmentperiod,
enrolmentperioddate => $enrolmentperioddate,
password_expiry_days => $password_expiry_days,
upperagelimit => $upperagelimit,
dateofbirthrequired => $dateofbirthrequired,
enrolmentfee => $enrolmentfee,
reservefee => $reservefee,
hidelostitems => $hidelostitems,
overduenoticerequired => $overduenoticerequired,
category_type => $category_type,
can_be_guarantee => $can_be_guarantee,
BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
checkprevcheckout => $checkPrevCheckout,
can_place_ill_in_opac => $can_place_ill_in_opac,
default_privacy => $default_privacy,
reset_password => $reset_password,
change_password => $change_password,
exclude_from_local_holds_priority => $exclude_from_local_holds_priority,
min_password_length => $min_password_length,
require_strong_password => $require_strong_password,
noissuescharge => $noissuescharge,
noissueschargeguarantees => $noissueschargeguarantees,
noissueschargeguarantorswithguarantees => $noissueschargeguarantorswithguarantees,
}
);
eval {
$category->store;
$category->replace_library_limits( \@branches );

View File

@ -445,6 +445,18 @@
</select>
<div class="hint">If <i>Yes</i>, holds placed by patrons of this category will not be given priority</div>
</li>
<li>
<label for="noissuescharge">No issues charge: </label>
<input type="text" name="noissuescharge" id="noissuescharge" value="[% category.noissuescharge | html %]" size="3" maxlength="3" />
</li>
<li>
<label for="noissueschargeguarantees">No issues charge guarantees: </label>
<input type="text" name="noissueschargeguarantees" id="noissueschargeguarantees" value="[% category.noissueschargeguarantees | html %]" size="3" maxlength="3" />
</li>
<li>
<label for="noissueschargeguarantorswithguarantees">No issues charge guarantors with guarantees: </label>
<input type="text" name="noissueschargeguarantorswithguarantees" id="noissueschargeguarantorswithguarantees" value="[% category.noissueschargeguarantorswithguarantees | html %]" size="3" maxlength="3" />
</li>
</ol>
</fieldset>
@ -590,6 +602,9 @@
<th scope="col">Can be guarantee</th>
<th scope="col">Default privacy</th>
<th scope="col">Exclude from local holds priority</th>
<th scope="col">No issues charge</th>
<th scope="col">No issues charge guarantees</th>
<th scope="col">No issues charge guarantors with guarantees</th>
<th scope="col">Actions</th>
</tr>
</thead>
@ -727,6 +742,21 @@
<span>No</span>
[% END %]
</td>
[% IF (category.noissuescharge) %]
<td>[% category.noissuescharge | html %]</td>
[% ELSE %]
<td>0.00</td>
[% END %]
[% IF (category.noissueschargeguarantees) %]
<td>[% category.noissueschargeguarantees | html %]</td>
[% ELSE %]
<td>0.00</td>
[% END %]
[% IF (category.noissueschargeguarantorswithguarantees) %]
<td>[% category.noissueschargeguarantorswithguarantees | html %]</td>
[% ELSE %]
<td>0.00</td>
[% END %]
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=delete_confirm&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-trash-can"></i> Delete</a>