# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
my $cotedigits = $input->param("cotedigits");
my $output = $input->param("output");
my $basename = $input->param("basename");
my $cotedigits = $input->param("cotedigits");
my $output = $input->param("output");
my $basename = $input->param("basename");
if ($output eq "screen"){
$template->param(mainloop => $results);
output_html_with_http_headers $input, $cookie, $template->output;
if ($output eq "screen"){
$template->param(mainloop => $results);
output_html_with_http_headers $input, $cookie, $template->output;
- my $strsth;
- $strsth .= "select distinctrow $linefield from biblioitems left join items on (items.biblioitemnumber = biblioitems.biblioitemnumber) where barcode $not LIKE ? AND $line is not null ";
+ my $strsth = "SELECT DISTINCTROW $linefield FROM biblioitems
+ INNER JOIN items USING (biblioitemnumber)
+ WHERE $line IS NOT NULL ";
+ $strsth .= " AND barcode $not LIKE ? " if ($barcodefilter);
my $sth = $dbh->prepare( $strsth );
if (( @linefilter ) and ($linefilter[1])){
$sth->execute($barcodefilter,$linefilter[0],$linefilter[1]);
} elsif ($barcodefilter,$linefilter[0]) {
$sth->execute($barcodefilter,$linefilter[0]);
my $sth = $dbh->prepare( $strsth );
if (( @linefilter ) and ($linefilter[1])){
$sth->execute($barcodefilter,$linefilter[0],$linefilter[1]);
} elsif ($barcodefilter,$linefilter[0]) {
$sth->execute($barcodefilter,$linefilter[0]);
- LEFT JOIN items
- ON (items.biblioitemnumber = biblioitems.biblioitemnumber)
- WHERE barcode $not LIKE ? AND $column IS NOT NULL ";
+ INNER JOIN items
+ USING (biblioitemnumber)
+ WHERE $column IS NOT NULL ";
+ $strsth2 .= " AND barcode $not LIKE ?" if $barcodefilter;
+
$debug and print STDERR "SQL: $strsth2";
my $sth2 = $dbh->prepare( $strsth2 );
if ((@colfilter) and ($colfilter[1])) {
$sth2->execute($barcodefilter,$colfilter[0],$colfilter[1]);
} elsif ($colfilter[0]){
$sth2->execute($barcodefilter,$colfilter[0]);
$debug and print STDERR "SQL: $strsth2";
my $sth2 = $dbh->prepare( $strsth2 );
if ((@colfilter) and ($colfilter[1])) {
$sth2->execute($barcodefilter,$colfilter[0],$colfilter[1]);
} elsif ($colfilter[0]){
$sth2->execute($barcodefilter,$colfilter[0]);
- my $strcalc .= "SELECT $linefield, $colfield, count(*) FROM biblioitems LEFT JOIN items ON (items.biblioitemnumber = biblioitems.biblioitemnumber) WHERE 1 AND barcode $not like ? ";
+ my $strcalc = "SELECT $linefield, $colfield, count(*) FROM biblioitems INNER JOIN items ON (items.biblioitemnumber = biblioitems.biblioitemnumber) WHERE 1 ";
+ $strcalc .= "AND barcode $not like ? " if ($barcodefilter);
+
$strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
$debug and warn "SQL: $strcalc";
my $dbcalc = $dbh->prepare($strcalc);
$strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
$debug and warn "SQL: $strcalc";
my $dbcalc = $dbh->prepare($strcalc);