|
Lines 29-35
use C4::Form::MessagingPreferences;
Link Here
|
| 29 |
use Koha::Borrowers; |
29 |
use Koha::Borrowers; |
| 30 |
use Koha::Database; |
30 |
use Koha::Database; |
| 31 |
use Koha::DateUtils; |
31 |
use Koha::DateUtils; |
| 32 |
use Koha::PatronCategories; |
32 |
use Koha::Patron::Categories; |
| 33 |
|
33 |
|
| 34 |
my $input = new CGI; |
34 |
my $input = new CGI; |
| 35 |
my $searchfield = $input->param('description') // q||; |
35 |
my $searchfield = $input->param('description') // q||; |
|
Lines 51-57
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
| 51 |
if ( $op eq 'add_form' ) { |
51 |
if ( $op eq 'add_form' ) { |
| 52 |
my ( $category, $selected_branches ); |
52 |
my ( $category, $selected_branches ); |
| 53 |
if ($categorycode) { |
53 |
if ($categorycode) { |
| 54 |
$category = Koha::PatronCategories->find($categorycode); |
54 |
$category = Koha::Patron::Categories->find($categorycode); |
| 55 |
$selected_branches = $category->branch_limitations; |
55 |
$selected_branches = $category->branch_limitations; |
| 56 |
} |
56 |
} |
| 57 |
|
57 |
|
|
Lines 100-106
elsif ( $op eq 'add_validate' ) {
Link Here
|
| 100 |
} |
100 |
} |
| 101 |
|
101 |
|
| 102 |
if ($is_a_modif) { |
102 |
if ($is_a_modif) { |
| 103 |
my $category = Koha::PatronCategories->find( $categorycode ); |
103 |
my $category = Koha::Patron::Categories->find( $categorycode ); |
| 104 |
$category->categorycode($categorycode); |
104 |
$category->categorycode($categorycode); |
| 105 |
$category->description($description); |
105 |
$category->description($description); |
| 106 |
$category->enrolmentperiod($enrolmentperiod); |
106 |
$category->enrolmentperiod($enrolmentperiod); |
|
Lines 125-131
elsif ( $op eq 'add_validate' ) {
Link Here
|
| 125 |
} |
125 |
} |
| 126 |
} |
126 |
} |
| 127 |
else { |
127 |
else { |
| 128 |
my $category = Koha::PatronCategory->new({ |
128 |
my $category = Koha::Patron::Category->new({ |
| 129 |
categorycode => $categorycode, |
129 |
categorycode => $categorycode, |
| 130 |
description => $description, |
130 |
description => $description, |
| 131 |
enrolmentperiod => $enrolmentperiod, |
131 |
enrolmentperiod => $enrolmentperiod, |
|
Lines 166-172
elsif ( $op eq 'delete_confirm' ) {
Link Here
|
| 166 |
categorycode => $categorycode |
166 |
categorycode => $categorycode |
| 167 |
})->count; |
167 |
})->count; |
| 168 |
|
168 |
|
| 169 |
my $category = Koha::PatronCategories->find($categorycode); |
169 |
my $category = Koha::Patron::Categories->find($categorycode); |
| 170 |
|
170 |
|
| 171 |
$template->param( |
171 |
$template->param( |
| 172 |
category => $category, |
172 |
category => $category, |
|
Lines 177-183
elsif ( $op eq 'delete_confirm' ) {
Link Here
|
| 177 |
elsif ( $op eq 'delete_confirmed' ) { |
177 |
elsif ( $op eq 'delete_confirmed' ) { |
| 178 |
my $categorycode = uc( $input->param('categorycode') ); |
178 |
my $categorycode = uc( $input->param('categorycode') ); |
| 179 |
|
179 |
|
| 180 |
my $category = Koha::PatronCategories->find( $categorycode ); |
180 |
my $category = Koha::Patron::Categories->find( $categorycode ); |
| 181 |
my $deleted = eval { $category->delete; }; |
181 |
my $deleted = eval { $category->delete; }; |
| 182 |
|
182 |
|
| 183 |
if ( $@ or not $deleted ) { |
183 |
if ( $@ or not $deleted ) { |
|
Lines 190-196
elsif ( $op eq 'delete_confirmed' ) {
Link Here
|
| 190 |
} |
190 |
} |
| 191 |
|
191 |
|
| 192 |
if ( $op eq 'list' ) { |
192 |
if ( $op eq 'list' ) { |
| 193 |
my $categories = Koha::PatronCategories->search( |
193 |
my $categories = Koha::Patron::Categories->search( |
| 194 |
{ |
194 |
{ |
| 195 |
description => { -like => "$searchfield%" } |
195 |
description => { -like => "$searchfield%" } |
| 196 |
}, |
196 |
}, |
| 197 |
- |
|
|