Lines 82-88
my $dbh = DBI->connect(
Link Here
|
82 |
); |
82 |
); |
83 |
|
83 |
|
84 |
#Store the value of the template input name='op' in the variable $op so we can check if the user has pressed the button with the name="op" and value="finish" meaning the user has finished the onboarding tool. |
84 |
#Store the value of the template input name='op' in the variable $op so we can check if the user has pressed the button with the name="op" and value="finish" meaning the user has finished the onboarding tool. |
85 |
my $op = $input->param('op'); |
85 |
my $op = $input->param('op') || ''; |
86 |
$template->param( 'op' => $op ); |
86 |
$template->param( 'op' => $op ); |
87 |
|
87 |
|
88 |
my $schema = Koha::Database->new()->schema(); |
88 |
my $schema = Koha::Database->new()->schema(); |
Lines 277-286
elsif ( $step && $step == 3 ) {
Link Here
|
277 |
|
277 |
|
278 |
my $existing_cardnumber = $schema->resultset('Borrower')->get_column('cardnumber')->max(); |
278 |
my $existing_cardnumber = $schema->resultset('Borrower')->get_column('cardnumber')->max(); |
279 |
|
279 |
|
280 |
warn $existing_cardnumber; |
|
|
281 |
|
282 |
#my $exisiting_cardnumber = my $sth_search = |
283 |
# $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers"); |
284 |
my $new_cardnumber = $existing_cardnumber + 1; |
280 |
my $new_cardnumber = $existing_cardnumber + 1; |
285 |
$template->param( "newcardnumber" => $new_cardnumber ); |
281 |
$template->param( "newcardnumber" => $new_cardnumber ); |
286 |
|
282 |
|
Lines 563-660
elsif ( $step && $step == 5 ) {
Link Here
|
563 |
|
559 |
|
564 |
my @messages; |
560 |
my @messages; |
565 |
|
561 |
|
566 |
#New code from smart-rules.tt starts here. Needs to be added to library |
|
|
567 |
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to. |
562 |
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to. |
568 |
if ( $branch eq "*" ) { |
563 |
if ( $branch eq "*" ) { |
569 |
my $search_default_rules = $schema->resultset('DefaultCircRule')->count(); |
564 |
my $search_default_rules = $schema->resultset('DefaultCircRule')->count(); |
570 |
# my $sth_search = $dbh->prepare( |
565 |
my $insert_default_rules = $schema->resultset('Issuingrule')->new( |
571 |
# "SELECT count(*) AS total |
566 |
{ maxissueqty => $maxissueqty, onshelfholds => $onshelfholds } |
572 |
# FROM default_circ_rules" |
567 |
); |
573 |
# ); |
|
|
574 |
# my $sth_insert = $dbh->prepare( |
575 |
# "INSERT INTO default_circ_rules |
576 |
# (maxissueqty, onshelfholds) |
577 |
# VALUES (?, ?)" |
578 |
# ); |
579 |
# my $sth_update = $dbh->prepare( |
580 |
# "UPDATE default_circ_rules |
581 |
# SET maxissueqty = ?, onshelfholds = ?" |
582 |
# ); |
583 |
|
584 |
|
585 |
# my $search_default_rules = $schema->resultset('DefaultCircRule')->count(); |
586 |
# warn $search_default_rules; |
587 |
|
588 |
# my $res = $search_default_rules->fetchrow_hashref(); |
589 |
# if ( $res->{total} ) { |
590 |
# $sth_update->execute( $maxissueqty, $onshelfholds ); |
591 |
|
592 |
# my $update_default_rules = $schema->resultset('DefaultCircrule')->set({maxissueqty => $maxissueqty}, {onshelfholds => $onshelfholds }); |
593 |
# } |
594 |
# else { |
595 |
# $sth_insert->execute( $maxissueqty, $onshelfholds ); |
596 |
my $insert_default_rules = $schema->resultset('Issuingrule')->set([ |
597 |
{ maxissueqty => $maxissueqty, onshelfholds => $onshelfholds }, |
598 |
]); |
599 |
# } |
600 |
} |
568 |
} |
601 |
|
|
|
602 |
#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to. |
569 |
#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to. |
603 |
if ( $bor eq "*" ) { |
570 |
elsif ( $bor eq "*" ) { |
604 |
my $sth_search = $dbh->prepare( |
|
|
605 |
"SELECT count(*) AS total |
606 |
FROM default_circ_rules" |
607 |
); |
608 |
my $sth_insert = $dbh->prepare( |
609 |
q| |
610 |
INSERT INTO default_circ_rules |
611 |
(maxissueqty) |
612 |
VALUES (?) |
613 |
| |
614 |
); |
615 |
my $sth_update = $dbh->prepare( |
616 |
q| |
617 |
UPDATE default_circ_rules |
618 |
SET maxissueqty = ? |
619 |
| |
620 |
); |
621 |
|
571 |
|
622 |
$sth_search->execute(); |
572 |
my $search_default_rules = $schema->resultset('DefaultCircRule')->count(); |
623 |
my $res = $sth_search->fetchrow_hashref(); |
573 |
my $insert_default_rules = $schema->resultset('Issuingrule')->new( |
624 |
if ( $res->{total} ) { |
574 |
{ maxissueqty => $maxissueqty} |
625 |
$sth_update->execute($maxissueqty); |
575 |
); |
626 |
} |
|
|
627 |
else { |
628 |
$sth_insert->execute($maxissueqty); |
629 |
} |
630 |
} |
576 |
} |
631 |
|
577 |
|
632 |
#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to |
578 |
#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to |
633 |
if ( $itemtype eq "*" ) { |
579 |
elsif ( $itemtype eq "*" ) { |
634 |
my $sth_search = $dbh->prepare( |
580 |
my $search_default_rules = $schema->resultset('DefaultCircRule')->search({},{ |
635 |
"SELECT count(*) AS total |
581 |
branchcode => $branch |
636 |
FROM default_branch_circ_rules |
582 |
} |
637 |
WHERE branchcode = ?" |
583 |
|
638 |
); |
|
|
639 |
my $sth_insert = $dbh->prepare( |
640 |
"INSERT INTO default_branch_circ_rules |
641 |
(branchcode, onshelfholds) |
642 |
VALUES (?, ?)" |
643 |
); |
644 |
my $sth_update = $dbh->prepare( |
645 |
"UPDATE default_branch_circ_rules |
646 |
SET onshelfholds = ? |
647 |
WHERE branchcode = ?" |
648 |
); |
584 |
); |
649 |
$sth_search->execute($branch); |
|
|
650 |
my $res = $sth_search->fetchrow_hashref(); |
651 |
|
585 |
|
652 |
if ( $res->{total} ) { |
586 |
my $insert_default_rules = $schema->resultset('Issuingrule')->new( |
653 |
$sth_update->execute( $onshelfholds, $branch ); |
587 |
{ branchcode => $branch, onshelfholds => $onshelfholds } |
654 |
} |
588 |
); |
655 |
else { |
|
|
656 |
$sth_insert->execute( $branch, $onshelfholds ); |
657 |
} |
658 |
} |
589 |
} |
659 |
|
590 |
|
660 |
my $issuingrule = Koha::IssuingRules->find( |
591 |
my $issuingrule = Koha::IssuingRules->find( |
661 |
- |
|
|