|
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, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); |
104 |
|
| 105 |
my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); |
105 |
my $sth_insert = $dbh->prepare(' |
|
|
106 |
INSERT INTO issuingrules ( |
| 107 |
branchcode, |
| 108 |
categorycode, |
| 109 |
itemtype, |
| 110 |
maxissueqty, |
| 111 |
renewalsallowed, |
| 112 |
renewalperiod, |
| 113 |
reservesallowed, |
| 114 |
issuelength, |
| 115 |
lengthunit, |
| 116 |
hardduedate, |
| 117 |
hardduedatecompare, |
| 118 |
fine, |
| 119 |
finedays, |
| 120 |
firstremind, |
| 121 |
chargeperiod, |
| 122 |
rentaldiscount, |
| 123 |
overduefinescap, |
| 124 |
cap_fine_to_replacement_price |
| 125 |
) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
| 126 |
'); |
| 127 |
|
| 128 |
my $sth_update=$dbh->prepare(' |
| 129 |
UPDATE issuingrules |
| 130 |
SET |
| 131 |
fine = ?, |
| 132 |
finedays = ?, |
| 133 |
firstremind = ?, |
| 134 |
chargeperiod = ?, |
| 135 |
maxissueqty = ?, |
| 136 |
renewalsallowed = ?, |
| 137 |
renewalperiod = ?, |
| 138 |
reservesallowed = ?, |
| 139 |
issuelength = ?, |
| 140 |
lengthunit = ?, |
| 141 |
hardduedate = ?, |
| 142 |
hardduedatecompare = ?, |
| 143 |
rentaldiscount = ?, |
| 144 |
overduefinescap = ?, |
| 145 |
cap_fine_to_replacement_price = ? |
| 146 |
WHERE branchcode=? |
| 147 |
AND categorycode=? |
| 148 |
AND itemtype=? |
| 149 |
'); |
| 106 |
|
150 |
|
| 107 |
my $br = $branch; # branch |
151 |
my $br = $branch; # branch |
| 108 |
my $bor = $input->param('categorycode'); # borrower category |
152 |
my $bor = $input->param('categorycode'); # borrower category |
|
Lines 124-137
elsif ($op eq 'add') {
Link Here
|
| 124 |
my $hardduedatecompare = $input->param('hardduedatecompare'); |
168 |
my $hardduedatecompare = $input->param('hardduedatecompare'); |
| 125 |
my $rentaldiscount = $input->param('rentaldiscount'); |
169 |
my $rentaldiscount = $input->param('rentaldiscount'); |
| 126 |
my $overduefinescap = $input->param('overduefinescap') || undef; |
170 |
my $overduefinescap = $input->param('overduefinescap') || undef; |
|
|
171 |
my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on'; |
| 127 |
$debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty"; |
172 |
$debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty"; |
| 128 |
|
173 |
|
| 129 |
$sth_search->execute($br,$bor,$cat); |
174 |
$sth_search->execute($br,$bor,$cat); |
| 130 |
my $res = $sth_search->fetchrow_hashref(); |
175 |
my $res = $sth_search->fetchrow_hashref(); |
| 131 |
if ($res->{total}) { |
176 |
if ( $res->{total} ) { |
| 132 |
$sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); |
177 |
$sth_update->execute( |
| 133 |
} else { |
178 |
$fine, $finedays, |
| 134 |
$sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); |
179 |
$firstremind, $chargeperiod, |
|
|
180 |
$maxissueqty, $renewalsallowed, |
| 181 |
$renewalperiod, $reservesallowed, |
| 182 |
$issuelength, $lengthunit, |
| 183 |
$hardduedate, $hardduedatecompare, |
| 184 |
$rentaldiscount, $overduefinescap, |
| 185 |
$cap_fine_to_replacement_price, $br, |
| 186 |
$bor, $cat |
| 187 |
); |
| 188 |
} |
| 189 |
else { |
| 190 |
$sth_insert->execute( |
| 191 |
$br, $bor, |
| 192 |
$cat, $maxissueqty, |
| 193 |
$renewalsallowed, $renewalperiod, |
| 194 |
$reservesallowed, $issuelength, |
| 195 |
$lengthunit, $hardduedate, |
| 196 |
$hardduedatecompare, $fine, |
| 197 |
$finedays, $firstremind, |
| 198 |
$chargeperiod, $rentaldiscount, |
| 199 |
$overduefinescap, $cap_fine_to_replacement_price |
| 200 |
); |
| 135 |
} |
201 |
} |
| 136 |
} |
202 |
} |
| 137 |
elsif ($op eq "set-branch-defaults") { |
203 |
elsif ($op eq "set-branch-defaults") { |