Browse Source

Adding biblios is working

master
chris 21 years ago
parent
commit
16dc7b35aa
4 changed files with 54 additions and 10 deletions
  1. +18
    -2
      C4/Database.pm
  2. +1
    -1
      C4/Output.pm
  3. +29
    -1
      C4/Search.pm
  4. +6
    -6
      addbiblio.pl

+ 18
- 2
C4/Database.pm View File

@@ -12,7 +12,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&C4Connect &sqlinsert);
@EXPORT = qw(&C4Connect &sqlinsert &getmax);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@@ -66,15 +66,31 @@ sub sqlinsert {
$query=$query."$key,";
}
}
$query=~ s/\,$/\)/;
$query=$query." VALUES (";
while (my ($key,$value) = each %data){
if ($key ne 'type'){
$query=$query."$value,";
$query=$query."'$value',";
}
}
$query=~ s/\,$/\)/;
print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
$sth->finish;
$dbh->disconnect;
}

sub getmax {
my ($table,$item)=@_;
my $dbh=C4Connect;
my $sth=$dbh->prepare("Select max($item) from $table");
$sth->execute;
my $data=$sth->fetchrow_hashref;
$sth->finish;
$dbh->disconnect;
return($data);
}

END { } # module clean-up code here (global destructor)

+ 1
- 1
C4/Output.pm View File

@@ -113,7 +113,7 @@ sub mkform{
$text="<input type=$data[0] name=$key value=\"$data[1]\">";
}
if ($data[0] eq 'textarea'){
$text="<textarea name=$key>$data[1]</textarea>";
$text="<textarea name=$key wrap=physical cols=40 rows=4>$data[1]</textarea>";
}
$string=$string.mktablerow(2,'white',$key,$text);
}


+ 29
- 1
C4/Search.pm View File

@@ -14,7 +14,8 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch);
@EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
&itemdata &bibdata);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@@ -242,6 +243,33 @@ $results[$i]="$data->{'title'}\t$data->{'itemnumber'}\t$datedue\t$data->{'branch
return(@results);
}

sub itemdata {
my ($barcode)=@_;
my $dbh=C4Connect;
my $query="Select * from items,biblioitems where barcode='$barcode'
and items.biblioitemnumber=biblioitems.biblioitemnumber";
# print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
my $data=$sth->fetchrow_hashref;
$sth->finish;
$dbh->disconnect;
return($data);
}

sub bibdata {
my ($title)=@_;
my $dbh=C4Connect;
my $query="Select * from biblio where title='$title'";
# print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
my $data=$sth->fetchrow_hashref;
$sth->finish;
$dbh->disconnect;
return($data);
}

sub BornameSearch {
my ($env,$searchstring,$type)=@_;
my $dbh = &C4Connect;


+ 6
- 6
addbiblio.pl View File

@@ -14,12 +14,12 @@ print startpage();
print startmenu();
my %inputs;

$inputs{'Title'}="text\t";
$inputs{'Unititle'}="text\t";
$inputs{'Notes'}="textarea\t";
$inputs{'Author'}="text\t";
$inputs{'Serial'}="radio\tYes\tNo";
$inputs{'Series Title'}="text\t";
$inputs{'title'}="text\t";
$inputs{'unititle'}="text\t";
$inputs{'notes'}="textarea\t";
$inputs{'author'}="text\t";
$inputs{'serial'}="radio\tYes\tNo";
$inputs{'seriestitle'}="text\t";
$inputs{'type'}="hidden\tbiblio";
print mkform('/cgi-bin/kumara/insertdata.pl',%inputs);
#print mktablehdr();


Loading…
Cancel
Save