Lines 101-108
elsif ($op eq 'delete-branch-item') {
Link Here
|
101 |
# save the values entered |
101 |
# save the values entered |
102 |
elsif ($op eq 'add') { |
102 |
elsif ($op eq 'add') { |
103 |
my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?'); |
103 |
my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?'); |
104 |
my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, norenewalbefore, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, maxsuspensiondays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); |
104 |
my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, norenewalbefore, auto_renew, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, maxsuspensiondays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); |
105 |
my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, maxsuspensiondays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); |
105 |
my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, maxsuspensiondays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, auto_renew=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); |
106 |
|
106 |
|
107 |
my $br = $branch; # branch |
107 |
my $br = $branch; # branch |
108 |
my $bor = $input->param('categorycode'); # borrower category |
108 |
my $bor = $input->param('categorycode'); # borrower category |
Lines 118-123
elsif ($op eq 'add') {
Link Here
|
118 |
my $renewalperiod = $input->param('renewalperiod'); |
118 |
my $renewalperiod = $input->param('renewalperiod'); |
119 |
my $norenewalbefore = $input->param('norenewalbefore'); |
119 |
my $norenewalbefore = $input->param('norenewalbefore'); |
120 |
$norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/; |
120 |
$norenewalbefore = undef if $norenewalbefore eq '0' or $norenewalbefore =~ /^\s*$/; |
|
|
121 |
my $auto_renew = $input->param('auto_renew') eq 'yes' ? 1 : 0; |
121 |
my $reservesallowed = $input->param('reservesallowed'); |
122 |
my $reservesallowed = $input->param('reservesallowed'); |
122 |
$maxissueqty =~ s/\s//g; |
123 |
$maxissueqty =~ s/\s//g; |
123 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
124 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
Lines 133-141
elsif ($op eq 'add') {
Link Here
|
133 |
$sth_search->execute($br,$bor,$cat); |
134 |
$sth_search->execute($br,$bor,$cat); |
134 |
my $res = $sth_search->fetchrow_hashref(); |
135 |
my $res = $sth_search->fetchrow_hashref(); |
135 |
if ($res->{total}) { |
136 |
if ($res->{total}) { |
136 |
$sth_update->execute($fine, $finedays, $maxsuspensiondays, $firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); |
137 |
$sth_update->execute($fine, $finedays, $maxsuspensiondays, $firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); |
137 |
} else { |
138 |
} else { |
138 |
$sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays, $maxsuspensiondays, $firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); |
139 |
$sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays, $maxsuspensiondays, $firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); |
139 |
} |
140 |
} |
140 |
} |
141 |
} |
141 |
elsif ($op eq "set-branch-defaults") { |
142 |
elsif ($op eq "set-branch-defaults") { |