|
Lines 95-101
sub plugin {
Link Here
|
| 95 |
); |
95 |
); |
| 96 |
} |
96 |
} |
| 97 |
# If a prefix is submited, we look for the highest itemcallnumber with this prefix, and return it incremented |
97 |
# If a prefix is submited, we look for the highest itemcallnumber with this prefix, and return it incremented |
| 98 |
} elsif ( $code =~ m/^[A-Z.\-]+$/ ) { |
98 |
} elsif ( $code =~ m/^[A-Z.\-']+$/ ) { |
| 99 |
my $sth = $dbh->prepare("SELECT MAX(CAST(SUBSTRING_INDEX(itemcallnumber,' ',-1) AS SIGNED)) FROM items WHERE itemcallnumber LIKE ?"); |
99 |
my $sth = $dbh->prepare("SELECT MAX(CAST(SUBSTRING_INDEX(itemcallnumber,' ',-1) AS SIGNED)) FROM items WHERE itemcallnumber LIKE ?"); |
| 100 |
$sth->execute($code.' %'); |
100 |
$sth->execute($code.' %'); |
| 101 |
if ( my $max = $sth->fetchrow ) { |
101 |
if ( my $max = $sth->fetchrow ) { |
|
Lines 103-112
sub plugin {
Link Here
|
| 103 |
return => $code.' '.($max+1) |
103 |
return => $code.' '.($max+1) |
| 104 |
); |
104 |
); |
| 105 |
} |
105 |
} |
|
|
106 |
else { |
| 107 |
$template->param( |
| 108 |
return => $code.' 1' |
| 109 |
); |
| 110 |
} |
| 111 |
|
| 106 |
# The user entered a custom value, we don't touch it, this could be handled in js |
112 |
# The user entered a custom value, we don't touch it, this could be handled in js |
| 107 |
} else { |
113 |
} else { |
| 108 |
$template->param( |
114 |
$template->param( |
| 109 |
return => $code, |
115 |
return => $code |
| 110 |
); |
116 |
); |
| 111 |
} |
117 |
} |
| 112 |
output_html_with_http_headers $input, $cookie, $template->output; |
118 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 113 |
- |
|
|