debug => 1,
});
-if ($op =~ /delete-(.+)-(.+)/) {
- my $itemtype = $1;
- my $categorycode = $2;
+if ($op eq 'delete') {
+ my $itemtype = $input->param('itemtype');
+ my $categorycode = $input->param('categorycode');
$debug and warn "deleting $1 $2 $branch";
my $sth_Idelete = $dbh->prepare("delete from issuingrules where branchcode=? and categorycode=? and itemtype=?");
push @category_loop,$data;
}
-my %row = (categorycode => "*", description => 'Any');
-push @category_loop, \%row;
-
$sth->finish;
$sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes ORDER BY description");
$sth->execute;
while (my $row=$sth->fetchrow_hashref){
push @itemtypes,$row;
}
-my %row = (itemtype => '*', description => 'Any');
-push @itemtypes,\%row;
my $sth2 = $dbh->prepare("
SELECT issuingrules.*, itemtypes.description AS humanitemtype, categories.description AS humancategorycode
while (my $row = $sth2->fetchrow_hashref) {
$row->{'humanitemtype'} ||= $row->{'itemtype'};
- $row->{'humanitemtype'} = 'Any' if $row->{'humanitemtype'} eq '*';
+ $row->{'default_humanitemtype'} = 1 if $row->{'humanitemtype'} eq '*';
$row->{'humancategorycode'} ||= $row->{'categorycode'};
- $row->{'humancategorycode'} = 'Any' if $row->{'humancategorycode'} eq '*';
+ $row->{'default_humancategorycode'} = 1 if $row->{'humancategorycode'} eq '*';
$row->{'fine'} = sprintf('%.2f', $row->{'fine'});
push @row_loop, $row;
}
<form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
Select a branch :
<select name="branch" id="branch" style="width:20em;">
- <option value="">Default</option>
+ <option value="*">Default</option>
<!-- TMPL_LOOP NAME="branchloop" -->
<!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
<input type="hidden" name="op" value="add" />
<table>
<tr>
- <th>Item Type</th><th>Borrower Type</th><th>Amount</th><th>Grace<br />Period</th><th>Charging<br />Interval</th><th>Amount<br />Loanable</th><th>Loan time</th><th> </th>
+ <th>Item Type</th><th>Patron Category</th><th>Amount</th><th>Grace<br />Period</th><th>Charging<br />Interval</th><th>Amount<br />Loanable</th><th>Loan time</th><th> </th>
</tr>
<!-- TMPL_LOOP NAME="rules" -->
<tr>
- <td><!-- TMPL_VAR NAME="humanitemtype" --></td>
- <td><!-- TMPL_VAR NAME="humancategorycode" --></td>
+ <td><!-- TMPL_IF NAME="default_humanitemtype" -->
+ Any
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_VAR NAME="humanitemtype" -->
+ <!-- /TMPL_IF -->
+ </td>
+ <td><!-- TMPL_IF NAME="default_humancategorycode" -->
+ Any
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_VAR NAME="humancategorycode" -->
+ <!-- /TMPL_IF -->
+ </td>
<td>$<!-- TMPL_VAR NAME="fine" --></td>
<td><!-- TMPL_IF NAME="firstremind" --><!-- TMPL_VAR NAME="firstremind" --> day(s)<!-- /TMPL_IF --></td>
<td><!-- TMPL_IF NAME="chargeperiod" --><!-- TMPL_VAR NAME="chargeperiod" --> day(s)<!-- /TMPL_IF --></td>
<td><!-- TMPL_VAR NAME="maxissueqty" --></td>
<td><!-- TMPL_IF NAME="issuelength" --><!-- TMPL_VAR NAME="issuelength" --> day(s)<!-- /TMPL_IF --></td>
<td>
- <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-<!-- TMPL_VAR NAME="itemtype" -->-<!-- TMPL_VAR NAME="categorycode" -->&branch=<!-- TMPL_VAR NAME="branch" -->">Delete</a>
+ <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=<!-- TMPL_VAR NAME="itemtype" -->&categorycode=<!-- TMPL_VAR NAME="categorycode" -->&branch=<!-- TMPL_VAR NAME="branch" -->">Delete</a>
</td>
</tr>
<!-- /TMPL_LOOP -->
<tr>
<td>
<select name="itemtype" style="width:13em;">
+ <option value="*">Any</option>
<!-- TMPL_LOOP NAME="itemtypeloop" -->
<option value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="description" --></option>
<!-- /TMPL_LOOP -->
</td>
<td>
<select name="categorycode">
+ <option value="*">Any</option>
<!-- TMPL_LOOP NAME="categoryloop" -->
<option value="<!-- TMPL_VAR NAME="categorycode" -->"><!-- TMPL_VAR NAME="description" --></option>
<!-- /TMPL_LOOP -->