Browse Source

working

master
chris 21 years ago
parent
commit
f9f1bcb3ec
5 changed files with 53 additions and 13 deletions
  1. +22
    -2
      C4/Database.pm
  2. +17
    -1
      C4/Output.pm
  3. +3
    -3
      C4/Search.pm
  4. +8
    -6
      addbiblio.pl
  5. +3
    -1
      search.pl

+ 22
- 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);
@EXPORT = qw(&C4Connect &sqlinsert);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@@ -56,5 +56,25 @@ sub C4Connect {

return $dbh;
}

sub sqlinsert {
my ($table,%data)=@_;
my $dbh=C4Connect;
my $query="INSERT INTO $table \(";
while (my ($key,$value) = each %data){
if ($key ne 'type'){
$query=$query."$key,";
}
}
$query=$query." VALUES (";
while (my ($key,$value) = each %data){
if ($key ne 'type'){
$query=$query."$value,";
}
}
$query=~ s/\,$/\)/;
print $query;
$dbh->disconnect;
}

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

+ 17
- 1
C4/Output.pm View File

@@ -100,7 +100,23 @@ sub mkform{
$string=$string.mktablehdr();
my $key;
while ( my ($key, $value) = each %inputs) {
$string=$string.mktablerow(2,'white',$key,"<input type=text name=$key value=\"$value\">");
my @data=split('\t',$value);
if ($data[0] eq 'hidden'){
$string=$string."<input type=hidden name=$key value=\"$data[1]\">\n";
} else {
my $text;
if ($data[0] eq 'radio'){
$text="<input type=radio name=$key value=$data[1]>$data[1]
<input type=radio name=$key value=$data[2]>$data[2]";
}
if ($data[0] eq 'text'){
$text="<input type=$data[0] name=$key value=\"$data[1]\">";
}
if ($data[0] eq 'textarea'){
$text="<textarea name=$key>$data[1]</textarea>";
}
$string=$string.mktablerow(2,'white',$key,$text);
}
}
$string=$string.mktablerow(2,'white','<input type=submit>','<input type=reset>');
$string=$string.mktableft;


+ 3
- 3
C4/Search.pm View File

@@ -99,9 +99,9 @@ sub CatSearch {
and (catalogueentry.catalogueentry like '$search->{'author'}%')
and (entrytype = 'a'))";
if ($search->{'title'} ne ''){
$query= "Select biblionumber from biblio,catalogueentry where ((catalogueentry.catalogueentry = biblio.author)
$query= "Select biblionumber,title from biblio,catalogueentry where ((catalogueentry.catalogueentry = biblio.author)
and (catalogueentry.catalogueentry like '$search->{'author'}%')
and (entrytype = 'a')) intersect select biblionumber from
and (entrytype = 'a')) intersect select biblionumber,title from
biblio,catalogueentry where ((catalogueentry.catalogueentry = biblio.title)
and (catalogueentry.catalogueentry like '%$search->{'title'}%')
and (entrytype = 't'))";
@@ -143,7 +143,7 @@ sub CatSearch {
and biblioitems.biblionumber=biblio.biblionumber";
}
}
#print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
my $count2=0;


+ 8
- 6
addbiblio.pl View File

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

$inputs{'Title'}='';
$inputs{'Unititle'}='';
$inputs{'Notes'}='';
$inputs{'Author'}='';
$inputs{'Series Title'}='';
print mkform('wah',%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{'type'}="hidden\tbiblio";
print mkform('/cgi-bin/kumara/insertdata.pl',%inputs);
#print mktablehdr();
#print mktableft();
print endmenu();


+ 3
- 1
search.pl View File

@@ -10,7 +10,7 @@ use C4::Output;

my $input = new CGI;
print $input->header;
#print $input->dump;
print $input->dump;
my $blah;
my %search;
#build hash of users input
@@ -26,6 +26,8 @@ my $itemnumber=$input->param('item');
$search{'item'}=$itemnumber;
my $isbn=$input->param('isbn');
$search{'isbn'}=$isbn;
my $date-before=$input->param('date-before');
$search{'date-before'};
my @results;
my $offset=$input->param('offset');
if ($offset eq ''){


Loading…
Cancel
Save