Przeglądaj źródła

Adding biblios is working

master
chris 25 lat temu
rodzic
commit
16dc7b35aa
  1. 20
      C4/Database.pm
  2. 2
      C4/Output.pm
  3. 30
      C4/Search.pm
  4. 12
      addbiblio.pl

20
C4/Database.pm

@ -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)

2
C4/Output.pm

@ -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);
}

30
C4/Search.pm

@ -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;

12
addbiblio.pl

@ -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();

Ładowanie…
Anuluj
Zapisz