|
Lines 4-14
use strict;
Link Here
|
| 4 |
use warnings; |
4 |
use warnings; |
| 5 |
use diagnostics; |
5 |
use diagnostics; |
| 6 |
|
6 |
|
| 7 |
|
|
|
| 8 |
use Modern::Perl; |
7 |
use Modern::Perl; |
| 9 |
use C4::InstallAuth; |
8 |
use C4::InstallAuth; |
| 10 |
|
|
|
| 11 |
#External modules |
| 12 |
use CGI qw ( -utf8 ); |
9 |
use CGI qw ( -utf8 ); |
| 13 |
use List::MoreUtils qw/uniq/; |
10 |
use List::MoreUtils qw/uniq/; |
| 14 |
use Digest::MD5 qw(md5_base64); |
11 |
use Digest::MD5 qw(md5_base64); |
|
Lines 44-53
use Module::Load;
Link Here
|
| 44 |
use Koha::IssuingRule; |
41 |
use Koha::IssuingRule; |
| 45 |
use Koha::IssuingRules; |
42 |
use Koha::IssuingRules; |
| 46 |
|
43 |
|
| 47 |
|
|
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
#Setting variables |
44 |
#Setting variables |
| 52 |
my $input = new CGI; |
45 |
my $input = new CGI; |
| 53 |
my $query = new CGI; |
46 |
my $query = new CGI; |
|
Lines 92-98
if ( $op && $op eq 'finish' ) { #If the value of $op equals 'finish' then redire
Link Here
|
| 92 |
} |
85 |
} |
| 93 |
|
86 |
|
| 94 |
|
87 |
|
| 95 |
#Store the value of the template input name='start' in the variable $start so we can check if the user has pressed this button and starting the onboarding tool process |
88 |
#Store the value of the template input name='start' in the variable $start so we can check if the user has pressed this button and started the onboarding tool process |
| 96 |
my $start = $query->param('start'); |
89 |
my $start = $query->param('start'); |
| 97 |
$template->param('start'=>$start); #Hand the start variable back to the template |
90 |
$template->param('start'=>$start); #Hand the start variable back to the template |
| 98 |
if ( $start && $start eq 'Start setting up my Koha' ){ |
91 |
if ( $start && $start eq 'Start setting up my Koha' ){ |
|
Lines 108-115
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 108 |
] |
101 |
] |
| 109 |
); |
102 |
); |
| 110 |
|
103 |
|
| 111 |
|
|
|
| 112 |
#Select any library records from the database and hand them back to the template in the libraries variable. |
| 113 |
}elsif ( $start && $start eq 'Add a patron category' ){ |
104 |
}elsif ( $start && $start eq 'Add a patron category' ){ |
| 114 |
|
105 |
|
| 115 |
#Select all the patron category records in the categories database table and store them in the newly declared variable $categories |
106 |
#Select all the patron category records in the categories database table and store them in the newly declared variable $categories |
|
Lines 122-133
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 122 |
my $itemtypes = Koha::ItemTypes->search(); |
113 |
my $itemtypes = Koha::ItemTypes->search(); |
| 123 |
$template->param( |
114 |
$template->param( |
| 124 |
itemtypes => $itemtypes, |
115 |
itemtypes => $itemtypes, |
| 125 |
); |
116 |
);#Hand the variable itemtypes back to the template |
| 126 |
|
117 |
|
| 127 |
#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1 |
118 |
#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1 |
| 128 |
}elsif ( $step && $step == 1 ) { |
119 |
}elsif ( $step && $step == 1 ) { |
| 129 |
|
120 |
my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary variable |
| 130 |
my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary |
|
|
| 131 |
$template->param('createlibrary'=>$createlibrary); # Hand the library values back to the template in the createlibrary variable |
121 |
$template->param('createlibrary'=>$createlibrary); # Hand the library values back to the template in the createlibrary variable |
| 132 |
|
122 |
|
| 133 |
#store inputted parameters in variables |
123 |
#store inputted parameters in variables |
|
Lines 136-155
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 136 |
my $op = $input->param('op') || 'list'; |
126 |
my $op = $input->param('op') || 'list'; |
| 137 |
my $message; |
127 |
my $message; |
| 138 |
my $library; |
128 |
my $library; |
| 139 |
#my @messages; |
|
|
| 140 |
|
129 |
|
| 141 |
#Take the text 'branchname' and store it in the @fields array |
130 |
#Take the text 'branchname' and store it in the @fields array |
| 142 |
my @fields = qw( |
131 |
my @fields = qw( |
| 143 |
branchname |
132 |
branchname |
| 144 |
); |
133 |
); |
| 145 |
|
134 |
|
| 146 |
|
|
|
| 147 |
#test |
| 148 |
$template->param('branchcode'=>$branchcode); |
135 |
$template->param('branchcode'=>$branchcode); |
| 149 |
|
|
|
| 150 |
$branchcode =~ s|\s||g; # Use a regular expression to check the value of the inputted branchcode |
136 |
$branchcode =~ s|\s||g; # Use a regular expression to check the value of the inputted branchcode |
| 151 |
|
137 |
|
| 152 |
#Create a new library object and store the branchcode and @fields array values in this new library object |
138 |
#Create a new library object and store the branchcode and @fields array values in this new library object |
| 153 |
$library = Koha::Library->new( |
139 |
$library = Koha::Library->new( |
| 154 |
{ branchcode => $branchcode, |
140 |
{ branchcode => $branchcode, |
| 155 |
( map { $_ => scalar $input->param($_) || undef } @fields ) |
141 |
( map { $_ => scalar $input->param($_) || undef } @fields ) |
|
Lines 157-185
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 157 |
); |
143 |
); |
| 158 |
|
144 |
|
| 159 |
eval { $library->store; }; #Use the eval{} function to store the library object |
145 |
eval { $library->store; }; #Use the eval{} function to store the library object |
| 160 |
|
|
|
| 161 |
if($library){ |
146 |
if($library){ |
| 162 |
$message = 'success_on_insert'; |
147 |
$message = 'success_on_insert'; |
| 163 |
}else{ |
148 |
}else{ |
| 164 |
$message = 'error_on_insert'; |
149 |
$message = 'error_on_insert'; |
| 165 |
} |
150 |
} |
| 166 |
|
151 |
|
| 167 |
$template->param('message' => $message); |
152 |
$template->param('message' => $message); |
| 168 |
|
153 |
|
| 169 |
|
154 |
|
| 170 |
#Check if the $step vairable equals 2 i.e. the user has clicked to create a patron category in the create patron category screen 1 |
155 |
#Check if the $step variable equals 2 i.e. the user has clicked to create a patron category in the create patron category screen 1 |
| 171 |
}elsif ( $step && $step == 2 ){ |
156 |
}elsif ( $step && $step == 2 ){ |
| 172 |
my $createcat = $query->param('createcat'); #Store the inputted library branch code and name in $createlibrary |
157 |
my $createcat = $query->param('createcat'); #Store the inputted category code and name in $createcat |
| 173 |
$template->param('createcat'=>$createcat); # Hand the library values back to the template in the createlibrary variable |
158 |
$template->param('createcat'=>$createcat); |
| 174 |
|
|
|
| 175 |
|
159 |
|
| 176 |
#Initialising values |
160 |
#Initialising values |
| 177 |
my $input = new CGI; |
|
|
| 178 |
my $searchfield = $input->param('description') // q||; |
161 |
my $searchfield = $input->param('description') // q||; |
| 179 |
my $categorycode = $input->param('categorycode'); |
162 |
my $categorycode = $input->param('categorycode'); |
| 180 |
my $op = $input->param('op') // 'list'; |
163 |
my $op = $input->param('op') // 'list'; |
| 181 |
my $message; |
164 |
my $message; |
| 182 |
my $category; |
165 |
my $category; |
|
|
166 |
$template->param('categorycode' =>$categorycode); |
| 183 |
|
167 |
|
| 184 |
my ( $template, $loggedinuser, $cookie ) = C4::InstallAuth::get_template_and_user( |
168 |
my ( $template, $loggedinuser, $cookie ) = C4::InstallAuth::get_template_and_user( |
| 185 |
{ |
169 |
{ |
|
Lines 194-200
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 194 |
|
178 |
|
| 195 |
#Once the user submits the page, this code validates the input and adds it |
179 |
#Once the user submits the page, this code validates the input and adds it |
| 196 |
#to the database as a new patron category |
180 |
#to the database as a new patron category |
| 197 |
my $categorycode = $input->param('categorycode'); |
181 |
$categorycode = $input->param('categorycode'); |
| 198 |
my $description = $input->param('description'); |
182 |
my $description = $input->param('description'); |
| 199 |
my $overduenoticerequired = $input->param('overduenoticerequired'); |
183 |
my $overduenoticerequired = $input->param('overduenoticerequired'); |
| 200 |
my $category_type = $input->param('category_type'); |
184 |
my $category_type = $input->param('category_type'); |
|
Lines 204-243
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 204 |
|
188 |
|
| 205 |
#Converts the string into a date format |
189 |
#Converts the string into a date format |
| 206 |
if ( $enrolmentperioddate) { |
190 |
if ( $enrolmentperioddate) { |
| 207 |
$enrolmentperioddate = output_pref( |
191 |
$enrolmentperioddate = output_pref( |
| 208 |
{ |
192 |
{ |
| 209 |
dt => dt_from_string($enrolmentperioddate), |
193 |
dt => dt_from_string($enrolmentperioddate), |
| 210 |
dateformat => 'iso', |
194 |
dateformat => 'iso', |
| 211 |
dateonly => 1, |
195 |
dateonly => 1, |
| 212 |
} |
196 |
} |
| 213 |
); |
197 |
); |
| 214 |
} |
198 |
} |
| 215 |
|
199 |
|
| 216 |
#Adds to the database |
200 |
#Adds a new patron category to the database |
| 217 |
$category = Koha::Patron::Category->new({ |
201 |
$category = Koha::Patron::Category->new({ |
| 218 |
categorycode=> $categorycode, |
202 |
categorycode=> $categorycode, |
| 219 |
description => $description, |
203 |
description => $description, |
| 220 |
overduenoticerequired => $overduenoticerequired, |
204 |
overduenoticerequired => $overduenoticerequired, |
| 221 |
category_type=> $category_type, |
205 |
category_type=> $category_type, |
| 222 |
default_privacy => $default_privacy, |
206 |
default_privacy => $default_privacy, |
| 223 |
enrolmentperiod => $enrolmentperiod, |
207 |
enrolmentperiod => $enrolmentperiod, |
| 224 |
enrolmentperioddate => $enrolmentperioddate, |
208 |
enrolmentperioddate => $enrolmentperioddate, |
| 225 |
}); |
209 |
}); |
|
|
210 |
|
| 226 |
eval { |
211 |
eval { |
| 227 |
$category->store; |
212 |
$category->store; |
| 228 |
}; |
213 |
}; |
| 229 |
|
214 |
|
| 230 |
#Error messages |
215 |
#Error messages |
| 231 |
if($category){ |
216 |
if($category){ |
| 232 |
$message = 'success_on_insert'; |
217 |
$message = 'success_on_insert'; |
| 233 |
}else{ |
218 |
}else{ |
| 234 |
$message = 'error_on_insert'; |
219 |
$message = 'error_on_insert'; |
| 235 |
} |
220 |
} |
| 236 |
|
221 |
|
| 237 |
$template->param('message' => $message); |
222 |
$template->param('message' => $message); |
| 238 |
|
223 |
|
| 239 |
#Create a patron |
224 |
#Create a patron |
| 240 |
}elsif ( $step && $step == 3 ){ |
225 |
}elsif ( $step && $step == 3 ){ |
|
|
226 |
my $firstpassword = $input->param('password'); |
| 227 |
my $secondpassword = $input->param('password2'); |
| 228 |
|
| 229 |
|
| 230 |
if ($firstpassword ne $secondpassword){ |
| 231 |
my $DisplayError='Please rewrite the password'; |
| 232 |
warn $DisplayError; |
| 233 |
$template->param(DisplayError=>$DisplayError, |
| 234 |
); |
| 235 |
} |
| 236 |
|
| 237 |
#Find all library records in the database and hand them to the template to display in the library dropdown box |
| 241 |
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); |
238 |
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); |
| 242 |
$template->param(libraries => $libraries, |
239 |
$template->param(libraries => $libraries, |
| 243 |
group_types => [ |
240 |
group_types => [ |
|
Lines 250-267
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 250 |
] |
247 |
] |
| 251 |
); |
248 |
); |
| 252 |
|
249 |
|
| 253 |
my $categories; |
250 |
#Find all patron categories in the database and hand them to the template to display in the patron category dropdown box |
| 254 |
$categories= Koha::Patron::Categories->search(); |
251 |
my $categories= Koha::Patron::Categories->search(); |
| 255 |
$template->param( |
252 |
$template->param( |
| 256 |
categories => $categories, |
253 |
categories => $categories, |
| 257 |
); |
254 |
); |
| 258 |
|
255 |
|
| 259 |
my $input = new CGI; |
|
|
| 260 |
my $op = $input->param('op') // 'list'; |
256 |
my $op = $input->param('op') // 'list'; |
|
|
257 |
my $minpw = C4::Context->preference("minPasswordLength"); |
| 258 |
$template->param("minPasswordLength" => $minpw); |
| 261 |
|
259 |
|
| 262 |
my @messages; |
260 |
my @messages; |
| 263 |
my @errors; |
261 |
my @errors; |
|
|
262 |
my $nok = $input->param('nok'); |
| 264 |
|
263 |
|
|
|
264 |
my $firstpassword = $input->param('password'); |
| 265 |
my $secondpassword = $input->param('password2'); |
| 266 |
my $cardnumber= $input->param('cardnumber'); |
| 267 |
my $borrowernumber= $input->param('borrowernumber'); |
| 268 |
my $userid=$input->param('userid'); |
| 269 |
|
| 270 |
if(my $error_code = checkcardnumber($cardnumber, $borrowernumber)){ |
| 271 |
push @errors, $error_code == 1 |
| 272 |
? 'ERROR_cardnumber_already_exists' |
| 273 |
:$error_code == 2 |
| 274 |
? 'ERROR_cardnumber_length' |
| 275 |
:() |
| 276 |
} |
| 277 |
|
| 278 |
# unless(Check_Userid($userid, $borrowernumber)){ |
| 279 |
# push @errors, "ERROR_login_exist"; |
| 280 |
# } |
| 281 |
push @errors, "ERROR_password_mismatch" if $firstpassword ne $secondpassword; |
| 282 |
push @errors, "ERROR_short_password" if ($firstpassword && $minpw && $firstpassword ne '****' && (length($firstpassword) < $minpw)); |
| 283 |
# |
| 284 |
#Passing errors to template |
| 285 |
$nok = $nok || scalar(@errors); |
| 286 |
|
| 287 |
if($nok){ |
| 288 |
|
| 289 |
foreach my $error (@errors){ |
| 290 |
if ($error eq 'ERROR_password_mismatch'){ |
| 291 |
$template->param(errorpasswordmismatch => 1); |
| 292 |
} |
| 293 |
if ($error eq 'ERROR_login_exist'){ |
| 294 |
$template->param(errorloginexists =>1); |
| 295 |
} |
| 296 |
if ($error eq 'ERROR_cardnumber_already_exists'){ |
| 297 |
$template->param(errorcardnumberexists => 1); |
| 298 |
} |
| 299 |
if ($error eq 'ERROR_cardnumber_length'){ |
| 300 |
$template->param(errorcardnumberlength => 1); |
| 301 |
} |
| 302 |
if ($error eq 'ERROR_short_password'){ |
| 303 |
$template->param(errorshortpassword => 1); |
| 304 |
} |
| 305 |
} |
| 306 |
$template->param('nok' => 1); |
| 307 |
warn $nok; |
| 308 |
}else{ |
| 265 |
my ($template, $loggedinuser, $cookie)= C4::InstallAuth::get_template_and_user({ |
309 |
my ($template, $loggedinuser, $cookie)= C4::InstallAuth::get_template_and_user({ |
| 266 |
template_name => "/onboarding/onboardingstep3.tt", |
310 |
template_name => "/onboarding/onboardingstep3.tt", |
| 267 |
query => $input, |
311 |
query => $input, |
|
Lines 287-307
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 287 |
$newdata{dateexpiry} = '12/10/2016'; |
331 |
$newdata{dateexpiry} = '12/10/2016'; |
| 288 |
$newdata{privacy} = "default"; |
332 |
$newdata{privacy} = "default"; |
| 289 |
|
333 |
|
| 290 |
if(my $error_code = checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ |
|
|
| 291 |
push @errors, $error_code == 1 |
| 292 |
? 'ERROR_cardnumber_already_exists' |
| 293 |
:$error_code == 2 |
| 294 |
? 'ERROR_cardnumber_length' |
| 295 |
:() |
| 296 |
} |
| 297 |
|
| 298 |
|
| 299 |
#Hand the newdata hash to the AddMember subroutine in the C4::Members module and it creates a patron and hands back a borrowernumber which is being stored |
334 |
#Hand the newdata hash to the AddMember subroutine in the C4::Members module and it creates a patron and hands back a borrowernumber which is being stored |
| 300 |
my $borrowernumber = &AddMember(%newdata); |
335 |
my $borrowernumber = &AddMember(%newdata); |
| 301 |
#Create a hash named member2 and fillit with the borrowernumber of the borrower that has just been created |
336 |
|
|
|
337 |
#Create a hash named member2 and fill it with the borrowernumber of the borrower that has just been created |
| 302 |
my %member2; |
338 |
my %member2; |
| 303 |
$member2{'borrowernumber'}=$borrowernumber; |
339 |
$member2{'borrowernumber'}=$borrowernumber; |
| 304 |
|
340 |
|
|
|
341 |
#Perform data validation on the flag that has been handed to onboarding.pl by the template |
| 305 |
my $flag = $input->param('flag'); |
342 |
my $flag = $input->param('flag'); |
| 306 |
if ($input->param('newflags')) { |
343 |
if ($input->param('newflags')) { |
| 307 |
my $dbh=C4::Context->dbh(); |
344 |
my $dbh=C4::Context->dbh(); |
|
Lines 317-349
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 317 |
} |
354 |
} |
| 318 |
} |
355 |
} |
| 319 |
|
356 |
|
|
|
357 |
# construct flags |
| 358 |
my $module_flags = 0; |
| 359 |
my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); |
| 360 |
$sth->execute(); |
| 361 |
while (my ($bit, $flag) = $sth->fetchrow_array) { |
| 362 |
if (exists $all_module_perms{$flag}) { |
| 363 |
$module_flags += 2**$bit; |
| 364 |
} |
| 365 |
} |
| 320 |
|
366 |
|
| 321 |
# construct flags |
367 |
#Set the superlibrarian permission of the newly created patron to superlibrarian |
| 322 |
my $module_flags = 0; |
368 |
$sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); |
| 323 |
my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); |
369 |
$sth->execute($module_flags, $borrowernumber); |
| 324 |
$sth->execute(); |
370 |
|
| 325 |
while (my ($bit, $flag) = $sth->fetchrow_array) { |
371 |
#Error handling checking if the patron was created successfully |
| 326 |
if (exists $all_module_perms{$flag}) { |
372 |
if(!$borrowernumber){ |
| 327 |
$module_flags += 2**$bit; |
373 |
push @messages, {type=> 'error', code => 'error_on_insert'}; |
| 328 |
} |
374 |
}else{ |
| 329 |
} |
375 |
push @messages, {type=> 'message', code => 'success_on_insert'}; |
| 330 |
|
376 |
} |
| 331 |
$sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); |
377 |
} |
| 332 |
$sth->execute($module_flags, $borrowernumber); |
378 |
} |
| 333 |
|
|
|
| 334 |
#Error handling checking if the patron was created successfully |
| 335 |
if(!$borrowernumber){ |
| 336 |
push @messages, {type=> 'error', code => 'error_on_insert'}; |
| 337 |
}else{ |
| 338 |
push @messages, {type=> 'message', code => 'success_on_insert'}; |
| 339 |
} |
| 340 |
} |
| 341 |
} |
379 |
} |
| 342 |
}elsif ( $step && $step == 4){ |
380 |
}elsif ( $step && $step == 4){ |
| 343 |
my $createitemtype = $input->param('createitemtype'); |
381 |
my $createitemtype = $input->param('createitemtype'); |
| 344 |
$template->param('createitemtype'=> $createitemtype ); |
382 |
$template->param('createitemtype'=> $createitemtype ); |
| 345 |
|
383 |
|
| 346 |
my $input = new CGI; |
|
|
| 347 |
my $itemtype_code = $input->param('itemtype'); |
384 |
my $itemtype_code = $input->param('itemtype'); |
| 348 |
my $op = $input->param('op') // 'list'; |
385 |
my $op = $input->param('op') // 'list'; |
| 349 |
my $message; |
386 |
my $message; |
|
Lines 358-379
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 358 |
} |
395 |
} |
| 359 |
); |
396 |
); |
| 360 |
|
397 |
|
| 361 |
if($op eq 'add_form'){ |
398 |
if($op eq 'add_validate'){ |
| 362 |
my $itemtype = Koha::ItemTypes->find($itemtype_code); |
|
|
| 363 |
$template->param(itemtype=> $itemtype,); |
| 364 |
}elsif($op eq 'add_validate'){ |
| 365 |
my $itemtype = Koha::ItemTypes->find($itemtype_code); |
| 366 |
my $description = $input->param('description'); |
399 |
my $description = $input->param('description'); |
| 367 |
|
400 |
|
| 368 |
#store the input from the form - only 2 fields |
401 |
#store the input from the form - only 2 fields |
| 369 |
my $thisitemtype= Koha::ItemType->new( |
402 |
my $itemtype= Koha::ItemType->new( |
| 370 |
{ itemtype => $itemtype_code, |
403 |
{ itemtype => $itemtype_code, |
| 371 |
description => $description, |
404 |
description => $description, |
| 372 |
} |
405 |
} |
| 373 |
); |
406 |
); |
| 374 |
eval{ $thisitemtype->store; }; |
407 |
eval{ $itemtype->store; }; |
| 375 |
#Error messages |
408 |
#Error messages |
| 376 |
if($thisitemtype){ |
409 |
if($itemtype){ |
| 377 |
$message = 'success_on_insert'; |
410 |
$message = 'success_on_insert'; |
| 378 |
}else{ |
411 |
}else{ |
| 379 |
$message = 'error_on_insert'; |
412 |
$message = 'error_on_insert'; |
|
Lines 382-401
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 382 |
$template->param('message' => $message); |
415 |
$template->param('message' => $message); |
| 383 |
} |
416 |
} |
| 384 |
}elsif ( $step && $step == 5){ |
417 |
}elsif ( $step && $step == 5){ |
| 385 |
|
418 |
#Find all the existing categories to display in a dropdown box in the template |
| 386 |
#Fetching all the existing categories to display in a drop down box |
|
|
| 387 |
my $categories; |
419 |
my $categories; |
| 388 |
$categories= Koha::Patron::Categories->search(); |
420 |
$categories= Koha::Patron::Categories->search(); |
| 389 |
$template->param( |
421 |
$template->param( |
| 390 |
categories => $categories, |
422 |
categories => $categories, |
| 391 |
); |
423 |
); |
| 392 |
|
424 |
|
|
|
425 |
#Find all the exisiting item types to display in a dropdown box in the template |
| 393 |
my $itemtypes; |
426 |
my $itemtypes; |
| 394 |
$itemtypes= Koha::ItemTypes->search(); |
427 |
$itemtypes= Koha::ItemTypes->search(); |
| 395 |
$template->param( |
428 |
$template->param( |
| 396 |
itemtypes => $itemtypes, |
429 |
itemtypes => $itemtypes, |
| 397 |
); |
430 |
); |
| 398 |
|
431 |
|
|
|
432 |
#Find all the exisiting libraries to display in a dropdown box in the template |
| 399 |
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); |
433 |
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); |
| 400 |
$template->param(libraries => $libraries, |
434 |
$template->param(libraries => $libraries, |
| 401 |
group_types => [ |
435 |
group_types => [ |
|
Lines 412-427
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 412 |
my $dbh = C4::Context->dbh; |
446 |
my $dbh = C4::Context->dbh; |
| 413 |
|
447 |
|
| 414 |
my ($template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user({template_name => "/onboarding/onboardingstep5.tt", |
448 |
my ($template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user({template_name => "/onboarding/onboardingstep5.tt", |
| 415 |
query => $input, |
449 |
query => $input, |
| 416 |
type => "intranet", |
450 |
type => "intranet", |
| 417 |
authnotrequired => 0, |
451 |
authnotrequired => 0, |
| 418 |
flagsrequired => {parameters => 'manage_circ_rules'}, |
452 |
flagsrequired => {parameters => 'manage_circ_rules'}, |
| 419 |
debug => 1, |
453 |
debug => 1, |
| 420 |
}); |
454 |
}); |
| 421 |
|
455 |
|
| 422 |
my $branch = $input->param('branch'); |
456 |
my $branch = $input->param('branch'); |
| 423 |
unless ( $branch ) { |
457 |
unless ( $branch ) { |
| 424 |
if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) { |
458 |
if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) { |
| 425 |
$branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch(); |
459 |
$branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch(); |
| 426 |
} |
460 |
} |
| 427 |
else { |
461 |
else { |