working
This commit is contained in:
parent
c22ad6a283
commit
f9f1bcb3ec
5 changed files with 53 additions and 13 deletions
|
@ -12,7 +12,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
||||||
$VERSION = 0.01;
|
$VERSION = 0.01;
|
||||||
|
|
||||||
@ISA = qw(Exporter);
|
@ISA = qw(Exporter);
|
||||||
@EXPORT = qw(&C4Connect);
|
@EXPORT = qw(&C4Connect &sqlinsert);
|
||||||
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
|
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
|
||||||
|
|
||||||
# your exported package globals go here,
|
# your exported package globals go here,
|
||||||
|
@ -57,4 +57,24 @@ sub C4Connect {
|
||||||
return $dbh;
|
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)
|
END { } # module clean-up code here (global destructor)
|
||||||
|
|
18
C4/Output.pm
18
C4/Output.pm
|
@ -100,7 +100,23 @@ sub mkform{
|
||||||
$string=$string.mktablehdr();
|
$string=$string.mktablehdr();
|
||||||
my $key;
|
my $key;
|
||||||
while ( my ($key, $value) = each %inputs) {
|
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.mktablerow(2,'white','<input type=submit>','<input type=reset>');
|
||||||
$string=$string.mktableft;
|
$string=$string.mktableft;
|
||||||
|
|
|
@ -99,9 +99,9 @@ sub CatSearch {
|
||||||
and (catalogueentry.catalogueentry like '$search->{'author'}%')
|
and (catalogueentry.catalogueentry like '$search->{'author'}%')
|
||||||
and (entrytype = 'a'))";
|
and (entrytype = 'a'))";
|
||||||
if ($search->{'title'} ne ''){
|
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 (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)
|
biblio,catalogueentry where ((catalogueentry.catalogueentry = biblio.title)
|
||||||
and (catalogueentry.catalogueentry like '%$search->{'title'}%')
|
and (catalogueentry.catalogueentry like '%$search->{'title'}%')
|
||||||
and (entrytype = 't'))";
|
and (entrytype = 't'))";
|
||||||
|
@ -143,7 +143,7 @@ sub CatSearch {
|
||||||
and biblioitems.biblionumber=biblio.biblionumber";
|
and biblioitems.biblionumber=biblio.biblionumber";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#print $query;
|
||||||
my $sth=$dbh->prepare($query);
|
my $sth=$dbh->prepare($query);
|
||||||
$sth->execute;
|
$sth->execute;
|
||||||
my $count2=0;
|
my $count2=0;
|
||||||
|
|
14
addbiblio.pl
14
addbiblio.pl
|
@ -14,12 +14,14 @@ print startpage();
|
||||||
print startmenu();
|
print startmenu();
|
||||||
my %inputs;
|
my %inputs;
|
||||||
|
|
||||||
$inputs{'Title'}='';
|
$inputs{'Title'}="text\t";
|
||||||
$inputs{'Unititle'}='';
|
$inputs{'Unititle'}="text\t";
|
||||||
$inputs{'Notes'}='';
|
$inputs{'Notes'}="textarea\t";
|
||||||
$inputs{'Author'}='';
|
$inputs{'Author'}="text\t";
|
||||||
$inputs{'Series Title'}='';
|
$inputs{'Serial'}="radio\tYes\tNo";
|
||||||
print mkform('wah',%inputs);
|
$inputs{'Series Title'}="text\t";
|
||||||
|
$inputs{'type'}="hidden\tbiblio";
|
||||||
|
print mkform('/cgi-bin/kumara/insertdata.pl',%inputs);
|
||||||
#print mktablehdr();
|
#print mktablehdr();
|
||||||
#print mktableft();
|
#print mktableft();
|
||||||
print endmenu();
|
print endmenu();
|
||||||
|
|
|
@ -10,7 +10,7 @@ use C4::Output;
|
||||||
|
|
||||||
my $input = new CGI;
|
my $input = new CGI;
|
||||||
print $input->header;
|
print $input->header;
|
||||||
#print $input->dump;
|
print $input->dump;
|
||||||
my $blah;
|
my $blah;
|
||||||
my %search;
|
my %search;
|
||||||
#build hash of users input
|
#build hash of users input
|
||||||
|
@ -26,6 +26,8 @@ my $itemnumber=$input->param('item');
|
||||||
$search{'item'}=$itemnumber;
|
$search{'item'}=$itemnumber;
|
||||||
my $isbn=$input->param('isbn');
|
my $isbn=$input->param('isbn');
|
||||||
$search{'isbn'}=$isbn;
|
$search{'isbn'}=$isbn;
|
||||||
|
my $date-before=$input->param('date-before');
|
||||||
|
$search{'date-before'};
|
||||||
my @results;
|
my @results;
|
||||||
my $offset=$input->param('offset');
|
my $offset=$input->param('offset');
|
||||||
if ($offset eq ''){
|
if ($offset eq ''){
|
||||||
|
|
Loading…
Reference in a new issue