|
Lines 184-190
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 184 |
debug => 1, |
184 |
debug => 1, |
| 185 |
} |
185 |
} |
| 186 |
); |
186 |
); |
| 187 |
|
|
|
| 188 |
|
187 |
|
| 189 |
#Once the user submits the page, this code validates the input and adds it |
188 |
#Once the user submits the page, this code validates the input and adds it |
| 190 |
#to the database as a new patron category |
189 |
#to the database as a new patron category |
|
Lines 233-239
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 233 |
|
232 |
|
| 234 |
#Create a patron |
233 |
#Create a patron |
| 235 |
}elsif ( $step && $step == 3 ){ |
234 |
}elsif ( $step && $step == 3 ){ |
| 236 |
|
|
|
| 237 |
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); |
235 |
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); |
| 238 |
$template->param(libraries => $libraries, |
236 |
$template->param(libraries => $libraries, |
| 239 |
group_types => [ |
237 |
group_types => [ |
|
Lines 252-262
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 252 |
categories => $categories, |
250 |
categories => $categories, |
| 253 |
); |
251 |
); |
| 254 |
|
252 |
|
| 255 |
|
|
|
| 256 |
my $input = new CGI; |
253 |
my $input = new CGI; |
| 257 |
my $op = $input->param('op') // 'list'; |
254 |
my $op = $input->param('op') // 'list'; |
| 258 |
|
255 |
|
| 259 |
my @messages; |
256 |
my @messages; |
|
|
257 |
my @errors; |
| 260 |
|
258 |
|
| 261 |
my ($template, $loggedinuser, $cookie)= get_template_and_user({ |
259 |
my ($template, $loggedinuser, $cookie)= get_template_and_user({ |
| 262 |
template_name => "/onboarding/onboardingstep3.tt", |
260 |
template_name => "/onboarding/onboardingstep3.tt", |
|
Lines 267-282
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 267 |
debug => 1, |
265 |
debug => 1, |
| 268 |
}); |
266 |
}); |
| 269 |
|
267 |
|
| 270 |
if($op eq 'add_form'){ |
268 |
if($op eq 'add_validate'){ |
| 271 |
my $member; |
269 |
my %newdata; |
| 272 |
$template->param( |
|
|
| 273 |
member => $member, |
| 274 |
); |
| 275 |
} |
| 276 |
|
| 277 |
elsif($op eq 'add_validate'){ |
| 278 |
|
| 279 |
my %newdata; |
| 280 |
|
270 |
|
| 281 |
#Store the template form values in the newdata hash |
271 |
#Store the template form values in the newdata hash |
| 282 |
$newdata{borrowernumber} = $input->param('borrowernumber'); |
272 |
$newdata{borrowernumber} = $input->param('borrowernumber'); |
|
Lines 289-302
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 289 |
$newdata{password} = $input->param('password'); |
279 |
$newdata{password} = $input->param('password'); |
| 290 |
$newdata{password2} = $input->param('password2'); |
280 |
$newdata{password2} = $input->param('password2'); |
| 291 |
$newdata{dateexpiry} = '12/10/2016'; |
281 |
$newdata{dateexpiry} = '12/10/2016'; |
|
|
282 |
$newdata{privacy} = "default"; |
| 283 |
|
| 284 |
if(my $error_code = checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ |
| 285 |
push @errors, $error_code == 1 |
| 286 |
? 'ERROR_cardnumber_already_exists' |
| 287 |
:$error_code == 2 |
| 288 |
? 'ERROR_cardnumber_length' |
| 289 |
:() |
| 290 |
} |
| 291 |
|
| 292 |
|
| 292 |
|
293 |
|
| 293 |
#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 |
294 |
#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 |
| 294 |
my $borrowernumber = &AddMember(%newdata); |
295 |
my $borrowernumber = &AddMember(%newdata); |
|
|
296 |
|
| 297 |
#Create a hash named member2 and fillit with the borrowernumber of the borrower that has just been created |
| 295 |
my %member2; |
298 |
my %member2; |
| 296 |
$member2{'borrowernumber'}=$borrowernumber; |
299 |
$member2{'borrowernumber'}=$borrowernumber; |
| 297 |
|
300 |
|
| 298 |
my $flag = $input->param('flag'); |
301 |
my $flag = $input->param('flag'); |
| 299 |
|
|
|
| 300 |
if ($input->param('newflags')) { |
302 |
if ($input->param('newflags')) { |
| 301 |
my $dbh=C4::Context->dbh(); |
303 |
my $dbh=C4::Context->dbh(); |
| 302 |
my @perms = $input->multi_param('flag'); |
304 |
my @perms = $input->multi_param('flag'); |
|
Lines 312-338
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 312 |
} |
314 |
} |
| 313 |
|
315 |
|
| 314 |
|
316 |
|
| 315 |
# construct flags |
317 |
# construct flags |
| 316 |
my $module_flags = 0; |
318 |
my $module_flags = 0; |
| 317 |
my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); |
319 |
my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); |
| 318 |
$sth->execute(); |
320 |
$sth->execute(); |
| 319 |
while (my ($bit, $flag) = $sth->fetchrow_array) { |
321 |
while (my ($bit, $flag) = $sth->fetchrow_array) { |
| 320 |
if (exists $all_module_perms{$flag}) { |
322 |
if (exists $all_module_perms{$flag}) { |
| 321 |
$module_flags += 2**$bit; |
323 |
$module_flags += 2**$bit; |
| 322 |
} |
324 |
} |
| 323 |
} |
325 |
} |
| 324 |
|
326 |
|
| 325 |
$sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); |
327 |
$sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); |
| 326 |
$sth->execute($module_flags, $borrowernumber); |
328 |
$sth->execute($module_flags, $borrowernumber); |
| 327 |
|
329 |
|
| 328 |
|
330 |
|
| 329 |
#Error handling checking if the patron was created successfully |
331 |
#Error handling checking if the patron was created successfully |
| 330 |
if(!$borrowernumber){ |
332 |
if(!$borrowernumber){ |
| 331 |
push @messages, {type=> 'error', code => 'error_on_insert'}; |
333 |
push @messages, {type=> 'error', code => 'error_on_insert'}; |
| 332 |
}else{ |
334 |
}else{ |
| 333 |
push @messages, {type=> 'message', code => 'success_on_insert'}; |
335 |
push @messages, {type=> 'message', code => 'success_on_insert'}; |
| 334 |
} |
336 |
} |
| 335 |
} |
337 |
} |
|
|
338 |
} |
| 336 |
}elsif ( $step && $step == 4){ |
339 |
}elsif ( $step && $step == 4){ |
| 337 |
my $createitemtype = $input->param('createitemtype'); |
340 |
my $createitemtype = $input->param('createitemtype'); |
| 338 |
$template->param('createitemtype'=> $createitemtype ); |
341 |
$template->param('createitemtype'=> $createitemtype ); |
|
Lines 360-373
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 360 |
my $description = $input->param('description'); |
363 |
my $description = $input->param('description'); |
| 361 |
|
364 |
|
| 362 |
#store the input from the form - only 2 fields |
365 |
#store the input from the form - only 2 fields |
| 363 |
my $itemtype= Koha::ItemType->new( |
366 |
my $thisitemtype= Koha::ItemType->new( |
| 364 |
{ itemtype => $itemtype_code, |
367 |
{ itemtype => $itemtype_code, |
| 365 |
description => $description, |
368 |
description => $description, |
| 366 |
} |
369 |
} |
| 367 |
); |
370 |
); |
| 368 |
eval{ $itemtype->store; }; |
371 |
eval{ $thisitemtype->store; }; |
| 369 |
#Error messages |
372 |
#Error messages |
| 370 |
if($itemtype){ |
373 |
if($thisitemtype){ |
| 371 |
$message = 'success_on_insert'; |
374 |
$message = 'success_on_insert'; |
| 372 |
}else{ |
375 |
}else{ |
| 373 |
$message = 'error_on_insert'; |
376 |
$message = 'error_on_insert'; |
|
Lines 375-382
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 375 |
|
378 |
|
| 376 |
$template->param('message' => $message); |
379 |
$template->param('message' => $message); |
| 377 |
} |
380 |
} |
| 378 |
|
|
|
| 379 |
}elsif ( $step && $step == 5){ |
381 |
}elsif ( $step && $step == 5){ |
|
|
382 |
my $test="a"; |
| 383 |
warn $test; |
| 384 |
|
| 380 |
#Fetching all the existing categories to display in a drop down box |
385 |
#Fetching all the existing categories to display in a drop down box |
| 381 |
my $categories; |
386 |
my $categories; |
| 382 |
$categories= Koha::Patron::Categories->search(); |
387 |
$categories= Koha::Patron::Categories->search(); |
|
Lines 403-416
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 403 |
my $type = $input->param('type'); |
408 |
my $type = $input->param('type'); |
| 404 |
my $branch = $input->param('branch'); |
409 |
my $branch = $input->param('branch'); |
| 405 |
|
410 |
|
| 406 |
|
411 |
if($op eq 'add_validate'){ |
| 407 |
|
|
|
| 408 |
if($op eq 'add_form'){ |
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
} |
| 413 |
elsif($op eq 'add_validate'){ |
| 414 |
my $bor = $input->param('categorycode'); |
412 |
my $bor = $input->param('categorycode'); |
| 415 |
my $itemtype = $input->param('itemtype'); |
413 |
my $itemtype = $input->param('itemtype'); |
| 416 |
my $maxissueqty = $input->param('maxissueqty'); |
414 |
my $maxissueqty = $input->param('maxissueqty'); |
|
Lines 435-448
if ( $start && $start eq 'Start setting up my Koha' ){
Link Here
|
| 435 |
$issuingrule->set($params)->store(); |
433 |
$issuingrule->set($params)->store(); |
| 436 |
}else{ |
434 |
}else{ |
| 437 |
Koha::IssuingRule->new()->set($params)->store(); |
435 |
Koha::IssuingRule->new()->set($params)->store(); |
| 438 |
} |
436 |
} |
| 439 |
} |
437 |
} |
|
|
438 |
} |
| 440 |
|
439 |
|
| 441 |
my $createcirculationrule = $query->param('createcirculationrule'); |
|
|
| 442 |
$template->param('createcirculationrule'=>$createcirculationrule); |
| 443 |
} |
| 444 |
|
| 445 |
} |
| 446 |
|
440 |
|
| 447 |
output_html_with_http_headers $input, $cookie, $template->output; |
441 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 448 |
|
442 |
|