sync'ing with rel_2_0 (mostly prepare/execute pb, bug #662)
This commit is contained in:
parent
cc8a40b48a
commit
f8bde9b034
13 changed files with 85 additions and 122 deletions
|
@ -135,7 +135,6 @@ sub shiftgroup{
|
||||||
my $sth=$dbh->prepare("update biblioitems set biblionumber=? where biblioitemnumber=?");
|
my $sth=$dbh->prepare("update biblioitems set biblionumber=? where biblioitemnumber=?");
|
||||||
$sth->execute($bib,$bi);
|
$sth->execute($bib,$bi);
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$query="";
|
|
||||||
$sth=$dbh->prepare("update items set biblionumber=? where biblioitemnumber=?");
|
$sth=$dbh->prepare("update items set biblionumber=? where biblioitemnumber=?");
|
||||||
$sth->execute($bib,$bi);
|
$sth->execute($bib,$bi);
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
|
|
|
@ -28,8 +28,8 @@ use C4::Context;
|
||||||
use C4::Format;
|
use C4::Format;
|
||||||
use C4::Accounts;
|
use C4::Accounts;
|
||||||
use C4::Stats;
|
use C4::Stats;
|
||||||
use C4::InterfaceCDK;
|
#use C4::InterfaceCDK;
|
||||||
use C4::Interface::ReserveentCDK;
|
#use C4::Interface::ReserveentCDK;
|
||||||
use C4::Circulation::Main;
|
use C4::Circulation::Main;
|
||||||
use C4::Circulation::Borrower;
|
use C4::Circulation::Borrower;
|
||||||
use C4::Search;
|
use C4::Search;
|
||||||
|
@ -116,14 +116,13 @@ sub EnterReserves{
|
||||||
my @items = GetItems($env,$biblionumber);
|
my @items = GetItems($env,$biblionumber);
|
||||||
my $cnt_it = @items;
|
my $cnt_it = @items;
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $query = "Select * from biblio where biblionumber = $biblionumber";
|
my $query = "";
|
||||||
my $sth = $dbh->prepare($query);
|
my $sth = $dbh->prepare("Select * from biblio where biblionumber = ?");
|
||||||
$sth->execute;
|
$sth->execute($biblionumber);
|
||||||
my $data=$sth->fetchrow_hashref;
|
my $data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
my @branches;
|
my @branches;
|
||||||
my $query = "select * from branches where issuing=1 order by branchname";
|
my $sth=$dbh->prepare("select * from branches where issuing=1 order by branchname");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute;
|
$sth->execute;
|
||||||
while (my $branchrec=$sth->fetchrow_hashref) {
|
while (my $branchrec=$sth->fetchrow_hashref) {
|
||||||
my $branchdet =
|
my $branchdet =
|
||||||
|
@ -164,11 +163,10 @@ sub CalcReserveFee {
|
||||||
#check for issues;
|
#check for issues;
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $const = lc substr($constraint,0,1);
|
my $const = lc substr($constraint,0,1);
|
||||||
my $query = "select * from borrowers,categories
|
my $sth = $dbh->prepare("select * from borrowers,categories
|
||||||
where (borrowernumber = '$borrnum')
|
where (borrowernumber = ?)
|
||||||
and (borrowers.categorycode = categories.categorycode)";
|
and (borrowers.categorycode = categories.categorycode)");
|
||||||
my $sth = $dbh->prepare($query);
|
$sth->execute($borrnum);
|
||||||
$sth->execute;
|
|
||||||
my $data = $sth->fetchrow_hashref;
|
my $data = $sth->fetchrow_hashref;
|
||||||
$sth->finish();
|
$sth->finish();
|
||||||
my $fee = $data->{'reservefee'};
|
my $fee = $data->{'reservefee'};
|
||||||
|
@ -177,11 +175,10 @@ sub CalcReserveFee {
|
||||||
# check for items on issue
|
# check for items on issue
|
||||||
# first find biblioitem records
|
# first find biblioitem records
|
||||||
my @biblioitems;
|
my @biblioitems;
|
||||||
my $query1 = "select * from biblio,biblioitems
|
my $sth1 = $dbh->prepare("select * from biblio,biblioitems
|
||||||
where (biblio.biblionumber = '$biblionumber')
|
where (biblio.biblionumber = ?)
|
||||||
and (biblio.biblionumber = biblioitems.biblionumber)";
|
and (biblio.biblionumber = biblioitems.biblionumber)");
|
||||||
my $sth1 = $dbh->prepare($query1);
|
$sth1->execute($biblionumber);
|
||||||
$sth1->execute();
|
|
||||||
while (my $data1=$sth1->fetchrow_hashref) {
|
while (my $data1=$sth1->fetchrow_hashref) {
|
||||||
if ($const eq "a") {
|
if ($const eq "a") {
|
||||||
push @biblioitems,$data1;
|
push @biblioitems,$data1;
|
||||||
|
@ -205,24 +202,21 @@ sub CalcReserveFee {
|
||||||
my $allissued = 1;
|
my $allissued = 1;
|
||||||
while ($x < $cntitemsfound) {
|
while ($x < $cntitemsfound) {
|
||||||
my $bitdata = @biblioitems[$x];
|
my $bitdata = @biblioitems[$x];
|
||||||
my $query2 = "select * from items
|
my $sth2 = $dbh->prepare("select * from items
|
||||||
where biblioitemnumber = '$bitdata->{'biblioitemnumber'}'";
|
where biblioitemnumber = ?");
|
||||||
my $sth2 = $dbh->prepare($query2);
|
$sth2->execute($bitdata->{'biblioitemnumber'});
|
||||||
$sth2->execute;
|
|
||||||
while (my $itdata=$sth2->fetchrow_hashref) {
|
while (my $itdata=$sth2->fetchrow_hashref) {
|
||||||
my $query3 = "select * from issues
|
my $sth3 = $dbh->prepare("select * from issues
|
||||||
where itemnumber = '$itdata->{'itemnumber'}' and returndate is null";
|
where itemnumber = ? and returndate is null");
|
||||||
my $sth3 = $dbh->prepare($query3);
|
$sth3->execute($itdata->{'itemnumber'});
|
||||||
$sth3->execute();
|
|
||||||
if (my $isdata=$sth3->fetchrow_hashref) { } else {$allissued = 0; }
|
if (my $isdata=$sth3->fetchrow_hashref) { } else {$allissued = 0; }
|
||||||
}
|
}
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
if ($allissued == 0) {
|
if ($allissued == 0) {
|
||||||
my $rquery = "select * from reserves
|
my $rsth = $dbh->prepare("select * from reserves
|
||||||
where biblionumber = '$biblionumber'";
|
where biblionumber = ?");
|
||||||
my $rsth = $dbh->prepare($rquery);
|
$rsth->execute($biblionumber);
|
||||||
$rsth->execute();
|
|
||||||
if (my $rdata = $rsth->fetchrow_hashref) { } else {
|
if (my $rdata = $rsth->fetchrow_hashref) { } else {
|
||||||
$fee = 0;
|
$fee = 0;
|
||||||
}
|
}
|
||||||
|
@ -245,26 +239,23 @@ sub CreateReserve {
|
||||||
# updates take place here
|
# updates take place here
|
||||||
if ($fee > 0) {
|
if ($fee > 0) {
|
||||||
my $nextacctno = &getnextacctno($env,$borrnum,$dbh);
|
my $nextacctno = &getnextacctno($env,$borrnum,$dbh);
|
||||||
my $updquery = "insert into accountlines
|
my $usth = $dbh->prepare("insert into accountlines
|
||||||
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
|
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
|
||||||
values ($borrnum,$nextacctno,now(),$fee,'Reserve Charge','Res',$fee)";
|
values (?,?,now(),?,'Reserve Charge','Res',?)");
|
||||||
my $usth = $dbh->prepare($updquery);
|
$usth->execute($borrnum,$nextacctno,$fee,$fee);
|
||||||
$usth->execute;
|
|
||||||
$usth->finish;
|
$usth->finish;
|
||||||
}
|
}
|
||||||
my $query="insert into reserves (borrowernumber,biblionumber,reservedate,branchcode,constrainttype) values ('$borrnum','$biblionumber','$resdate','$branch','$const')";
|
my $sth = $dbh->prepare("insert into reserves (borrowernumber,biblionumber,reservedate,branchcode,constrainttype) values (?,?,?,?,?)");
|
||||||
my $sth = $dbh->prepare($query);
|
$sth->execute($borrnum,$biblionumber,$resdate,$branch,$const);
|
||||||
$sth->execute();
|
|
||||||
if (($const eq "o") || ($const eq "e")) {
|
if (($const eq "o") || ($const eq "e")) {
|
||||||
my $numitems = @$bibitems;
|
my $numitems = @$bibitems;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
while ($i < $numitems) {
|
while ($i < $numitems) {
|
||||||
my $biblioitem = @$bibitems[$i];
|
my $biblioitem = @$bibitems[$i];
|
||||||
my $query = "insert into reserveconstraints
|
my $sth = $dbh->prepare("insert into reserveconstraints
|
||||||
(borrowernumber,biblionumber,reservedate,biblioitemnumber)
|
(borrowernumber,biblionumber,reservedate,biblioitemnumber)
|
||||||
values ('$borrnum','$biblionumber','$resdate','$biblioitem')";
|
values (?,?,?,?)");
|
||||||
my $sth = $dbh->prepare($query);
|
$sth->execute($borrnum,$biblionumber,$resdate,$biblioitem);
|
||||||
$sth->execute();
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,8 @@ sub build_tabs ($$$$) {
|
||||||
foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
|
foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
|
||||||
next if subfield_is_koha_internal_p($subfield);
|
next if subfield_is_koha_internal_p($subfield);
|
||||||
next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
|
next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
|
||||||
next if (defined($record->field($tag)->subfield($subfield)));
|
next if ($tag > 10 && defined($record->field($tag)->subfield($subfield)));
|
||||||
|
next if ($tag < 10 && defined($record->field($tag)->data()));
|
||||||
push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$record,$authorised_values_sth));
|
push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$record,$authorised_values_sth));
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,7 @@ my ($template, $loggedinuser, $cookie)
|
||||||
|
|
||||||
$template->param($count);
|
$template->param($count);
|
||||||
if ($count == 1){
|
if ($count == 1){
|
||||||
my $query="Select itemtype,description from itemtypes order by description";
|
my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute;
|
$sth->execute;
|
||||||
my @itemtype;
|
my @itemtype;
|
||||||
my %itemtypes;
|
my %itemtypes;
|
||||||
|
|
|
@ -78,8 +78,7 @@ for (my $i=0;$i<$count;$i++){
|
||||||
push @loop_currency, \%line;
|
push @loop_currency, \%line;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $query="Select itemtype,description from itemtypes order by description";
|
my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute;
|
$sth->execute;
|
||||||
my @itemtype;
|
my @itemtype;
|
||||||
my %itemtypes;
|
my %itemtypes;
|
||||||
|
|
|
@ -53,9 +53,8 @@ sub StringSearch {
|
||||||
$searchstring=~ s/\'/\\\'/g;
|
$searchstring=~ s/\'/\\\'/g;
|
||||||
my @data=split(' ',$searchstring);
|
my @data=split(' ',$searchstring);
|
||||||
my $count=@data;
|
my $count=@data;
|
||||||
my $query="Select aqbudgetid,bookfundid,startdate,enddate,budgetamount from aqbudget where (bookfundid like \"$data[0]%\") order by bookfundid,aqbudgetid";
|
my $sth=$dbh->prepare("Select aqbudgetid,bookfundid,startdate,enddate,budgetamount from aqbudget where (bookfundid like ?) order by bookfundid,aqbudgetid");
|
||||||
my $sth=$dbh->prepare($query);
|
$sth->execute("$data[0]%");
|
||||||
$sth->execute;
|
|
||||||
my @results;
|
my @results;
|
||||||
my $cnt=0;
|
my $cnt=0;
|
||||||
while (my $data=$sth->fetchrow_hashref){
|
while (my $data=$sth->fetchrow_hashref){
|
||||||
|
@ -103,10 +102,8 @@ if ($op eq 'add_form') {
|
||||||
my $dataaqbookfund;
|
my $dataaqbookfund;
|
||||||
if ($aqbudgetid) {
|
if ($aqbudgetid) {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $query="select aqbudgetid,bookfundname,aqbookfund.bookfundid,startdate,enddate,budgetamount from aqbudget,aqbookfund where aqbudgetid='$aqbudgetid' and aqbudget.bookfundid=aqbookfund.bookfundid";
|
my $sth=$dbh->prepare("select aqbudgetid,bookfundname,aqbookfund.bookfundid,startdate,enddate,budgetamount from aqbudget,aqbookfund where aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid");
|
||||||
# print $query;
|
$sth->execute($aqbudgetid);
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute;
|
|
||||||
$dataaqbudget=$sth->fetchrow_hashref;
|
$dataaqbudget=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
@ -136,8 +133,7 @@ if ($op eq 'add_form') {
|
||||||
# called by add_form, used to insert/modify data in DB
|
# called by add_form, used to insert/modify data in DB
|
||||||
} elsif ($op eq 'add_validate') {
|
} elsif ($op eq 'add_validate') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $query = "replace aqbudget (aqbudgetid,bookfundid,startdate,enddate,budgetamount) values (?,?,?,?,?)";
|
my $sth=$dbh->prepare("replace aqbudget (aqbudgetid,bookfundid,startdate,enddate,budgetamount) values (?,?,?,?,?)");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($input->param('aqbudgetid'),$input->param('bookfundid'),
|
$sth->execute($input->param('aqbudgetid'),$input->param('bookfundid'),
|
||||||
format_date_in_iso($input->param('startdate')),
|
format_date_in_iso($input->param('startdate')),
|
||||||
format_date_in_iso($input->param('enddate')),
|
format_date_in_iso($input->param('enddate')),
|
||||||
|
@ -151,8 +147,8 @@ if ($op eq 'add_form') {
|
||||||
# called by default form, used to confirm deletion of data in DB
|
# called by default form, used to confirm deletion of data in DB
|
||||||
} elsif ($op eq 'delete_confirm') {
|
} elsif ($op eq 'delete_confirm') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare("select aqbudgetid,bookfundid,startdate,enddate,budgetamount from aqbudget where aqbudgetid='$aqbudgetid'");
|
my $sth=$dbh->prepare("select aqbudgetid,bookfundid,startdate,enddate,budgetamount from aqbudget where aqbudgetid=?");
|
||||||
$sth->execute;
|
$sth->execute($aqbudgetid);
|
||||||
my $data=$sth->fetchrow_hashref;
|
my $data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$template->param(bookfundid => $bookfundid);
|
$template->param(bookfundid => $bookfundid);
|
||||||
|
@ -166,9 +162,8 @@ if ($op eq 'add_form') {
|
||||||
} elsif ($op eq 'delete_confirmed') {
|
} elsif ($op eq 'delete_confirmed') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $aqbudgetid=uc($input->param('aqbudgetid'));
|
my $aqbudgetid=uc($input->param('aqbudgetid'));
|
||||||
my $query = "delete from aqbudget where aqbudgetid='$aqbudgetid'";
|
my $sth=$dbh->prepare("delete from aqbudget where aqbudgetid=?");
|
||||||
my $sth=$dbh->prepare($query);
|
$sth->execute($aqbudgetid);
|
||||||
$sth->execute;
|
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
print $input->redirect("aqbookfund.pl");
|
print $input->redirect("aqbookfund.pl");
|
||||||
return;
|
return;
|
||||||
|
@ -189,9 +184,7 @@ if ($op eq 'add_form') {
|
||||||
# $fines=$fines+0;
|
# $fines=$fines+0;
|
||||||
my $dataaqbookfund;
|
my $dataaqbookfund;
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $query="select bookfundid,bookfundname from aqbookfund where bookfundid=?";
|
my $sth=$dbh->prepare("select bookfundid,bookfundname from aqbookfund where bookfundid=?");
|
||||||
# print $query;
|
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($results->[$i]{'bookfundid'});
|
$sth->execute($results->[$i]{'bookfundid'});
|
||||||
$dataaqbookfund=$sth->fetchrow_hashref;
|
$dataaqbookfund=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
|
|
|
@ -34,9 +34,8 @@ sub StringSearch {
|
||||||
$searchstring=~ s/\'/\\\'/g;
|
$searchstring=~ s/\'/\\\'/g;
|
||||||
my @data=split(' ',$searchstring);
|
my @data=split(' ',$searchstring);
|
||||||
my $count=@data;
|
my $count=@data;
|
||||||
my $query="Select id,category,authorised_value,lib from authorised_values where (category like \"$data[0]%\") order by category,authorised_value";
|
my $sth=$dbh->prepare("Select id,category,authorised_value,lib from authorised_values where (category like ?) order by category,authorised_value");
|
||||||
my $sth=$dbh->prepare($query);
|
$sth->execute("$data[0]%");
|
||||||
$sth->execute;
|
|
||||||
my @results;
|
my @results;
|
||||||
my $cnt=0;
|
my $cnt=0;
|
||||||
while (my $data=$sth->fetchrow_hashref){
|
while (my $data=$sth->fetchrow_hashref){
|
||||||
|
@ -51,8 +50,6 @@ my $input = new CGI;
|
||||||
my $searchfield=$input->param('searchfield');
|
my $searchfield=$input->param('searchfield');
|
||||||
$searchfield=~ s/\,//g;
|
$searchfield=~ s/\,//g;
|
||||||
my $id = $input->param('id');
|
my $id = $input->param('id');
|
||||||
my $reqsel="select category,authorised_value,lib from authorised_values where id='$id'";
|
|
||||||
my $reqdel="delete from authorised_values where id='$id'";
|
|
||||||
my $offset=$input->param('offset');
|
my $offset=$input->param('offset');
|
||||||
my $script_name="/cgi-bin/koha/admin/authorised_values.pl";
|
my $script_name="/cgi-bin/koha/admin/authorised_values.pl";
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
|
@ -81,8 +78,8 @@ if ($op eq 'add_form') {
|
||||||
my $data;
|
my $data;
|
||||||
if ($id) {
|
if ($id) {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare("select id,category,authorised_value,lib from authorised_values where id='$id'");
|
my $sth=$dbh->prepare("select id,category,authorised_value,lib from authorised_values where id=?");
|
||||||
$sth->execute;
|
$sth->execute($id);
|
||||||
$data=$sth->fetchrow_hashref;
|
$data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,8 +118,8 @@ if ($op eq 'add_form') {
|
||||||
# called by default form, used to confirm deletion of data in DB
|
# called by default form, used to confirm deletion of data in DB
|
||||||
} elsif ($op eq 'delete_confirm') {
|
} elsif ($op eq 'delete_confirm') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare($reqsel);
|
my $sth=$dbh->prepare("select category,authorised_value,lib from authorised_values where id=?");
|
||||||
$sth->execute;
|
$sth->execute($id);
|
||||||
my $data=$sth->fetchrow_hashref;
|
my $data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$template->param(searchfield => $searchfield,
|
$template->param(searchfield => $searchfield,
|
||||||
|
@ -135,8 +132,8 @@ if ($op eq 'add_form') {
|
||||||
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
||||||
} elsif ($op eq 'delete_confirmed') {
|
} elsif ($op eq 'delete_confirmed') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare($reqdel);
|
my $sth=$dbh->prepare("delete from authorised_values where id=?");
|
||||||
$sth->execute;
|
$sth->execute($id);
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=authorised_values.pl?searchfield=$searchfield\"></html>";
|
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=authorised_values.pl?searchfield=$searchfield\"></html>";
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -82,8 +82,8 @@ while (($res,$res2,$field) = $sth->fetchrow) {
|
||||||
$subtotal++;
|
$subtotal++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sth = $dbh->prepare("select kohafield from marc_subfield_structure where tagfield=$tagfield");
|
$sth = $dbh->prepare("select kohafield from marc_subfield_structure where tagfield=?");
|
||||||
$sth->execute;
|
$sth->execute($tagfield);
|
||||||
while (($res2) = $sth->fetchrow) {
|
while (($res2) = $sth->fetchrow) {
|
||||||
if (!$res2 || $res2 =~ /^items/) {
|
if (!$res2 || $res2 =~ /^items/) {
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -54,9 +54,8 @@ sub StringSearch {
|
||||||
$searchstring=~ s/\'/\\\'/g;
|
$searchstring=~ s/\'/\\\'/g;
|
||||||
my @data=split(' ',$searchstring);
|
my @data=split(' ',$searchstring);
|
||||||
my $count=@data;
|
my $count=@data;
|
||||||
my $query="Select variable,value,explanation,type,options from systempreferences where (variable like \"$data[0]%\") order by variable";
|
my $sth=$dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable");
|
||||||
my $sth=$dbh->prepare($query);
|
$sth->execute("$data[0]%");
|
||||||
$sth->execute;
|
|
||||||
my @results;
|
my @results;
|
||||||
my $cnt=0;
|
my $cnt=0;
|
||||||
while (my $data=$sth->fetchrow_hashref){
|
while (my $data=$sth->fetchrow_hashref){
|
||||||
|
@ -69,9 +68,6 @@ sub StringSearch {
|
||||||
|
|
||||||
my $input = new CGI;
|
my $input = new CGI;
|
||||||
my $searchfield=$input->param('searchfield');
|
my $searchfield=$input->param('searchfield');
|
||||||
my $pkfield="variable";
|
|
||||||
my $reqsel="select variable,value,explanation,type,options from systempreferences where $pkfield='$searchfield'";
|
|
||||||
my $reqdel="delete from systempreferences where $pkfield='$searchfield'";
|
|
||||||
my $offset=$input->param('offset');
|
my $offset=$input->param('offset');
|
||||||
my $script_name="/cgi-bin/koha/admin/systempreferences.pl";
|
my $script_name="/cgi-bin/koha/admin/systempreferences.pl";
|
||||||
|
|
||||||
|
@ -135,15 +131,13 @@ if ($op eq 'update_and_reedit') {
|
||||||
$sth->execute($input->param('variable'));
|
$sth->execute($input->param('variable'));
|
||||||
if ($sth->rows) {
|
if ($sth->rows) {
|
||||||
unless (C4::Context->config('demo') eq 1) {
|
unless (C4::Context->config('demo') eq 1) {
|
||||||
my $query = "update systempreferences set value=?,explanation=? where variable=?";
|
my $sth=$dbh->prepare("update systempreferences set value=?,explanation=? where variable=?");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($value, $input->param('explanation'), $input->param('variable'));
|
$sth->execute($value, $input->param('explanation'), $input->param('variable'));
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unless (C4::Context->config('demo') eq 1) {
|
unless (C4::Context->config('demo') eq 1) {
|
||||||
my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
|
my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?)");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
|
$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
@ -160,8 +154,8 @@ if ($op eq 'add_form') {
|
||||||
my $data;
|
my $data;
|
||||||
if ($searchfield) {
|
if ($searchfield) {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare("select variable,value,explanation,type,options from systempreferences where variable='$searchfield'");
|
my $sth=$dbh->prepare("select variable,value,explanation,type,options from systempreferences where variable=?");
|
||||||
$sth->execute;
|
$sth->execute($searchfield);
|
||||||
$data=$sth->fetchrow_hashref;
|
$data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$template->param(modify => 1);
|
$template->param(modify => 1);
|
||||||
|
@ -236,20 +230,17 @@ if ($op eq 'add_form') {
|
||||||
# called by add_form, used to insert/modify data in DB
|
# called by add_form, used to insert/modify data in DB
|
||||||
} elsif ($op eq 'add_validate') {
|
} elsif ($op eq 'add_validate') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $query="select * from systempreferences where variable=?";
|
my $sth=$dbh->prepare("select * from systempreferences where variable=?");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($input->param('variable'));
|
$sth->execute($input->param('variable'));
|
||||||
if ($sth->rows) {
|
if ($sth->rows) {
|
||||||
unless (C4::Context->config('demo') eq 1) {
|
unless (C4::Context->config('demo') eq 1) {
|
||||||
my $query = "update systempreferences set value=?,explanation=? where variable=?";
|
my $sth=$dbh->prepare("update systempreferences set value=?,explanation=? where variable=?");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($input->param('value'), $input->param('explanation'), $input->param('variable'));
|
$sth->execute($input->param('value'), $input->param('explanation'), $input->param('variable'));
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unless (C4::Context->config('demo') eq 1) {
|
unless (C4::Context->config('demo') eq 1) {
|
||||||
my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
|
my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?)");
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
|
$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
@ -259,8 +250,8 @@ if ($op eq 'add_form') {
|
||||||
# called by default form, used to confirm deletion of data in DB
|
# called by default form, used to confirm deletion of data in DB
|
||||||
} elsif ($op eq 'delete_confirm') {
|
} elsif ($op eq 'delete_confirm') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare($reqsel);
|
my $sth=$dbh->prepare("select variable,value,explanation,type,options from systempreferences where variable=?");
|
||||||
$sth->execute;
|
$sth->execute($searchfield);
|
||||||
my $data=$sth->fetchrow_hashref;
|
my $data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$template->param(searchfield => $searchfield,
|
$template->param(searchfield => $searchfield,
|
||||||
|
@ -272,8 +263,8 @@ if ($op eq 'add_form') {
|
||||||
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
||||||
} elsif ($op eq 'delete_confirmed') {
|
} elsif ($op eq 'delete_confirmed') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare($reqdel);
|
my $sth=$dbh->prepare("delete from systempreferences where variable=?");
|
||||||
$sth->execute;
|
$sth->execute($searchfield);
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
# END $OP eq DELETE_CONFIRMED
|
# END $OP eq DELETE_CONFIRMED
|
||||||
################## DEFAULT ##################################
|
################## DEFAULT ##################################
|
||||||
|
|
|
@ -38,7 +38,7 @@ my $id = $input->param('id');
|
||||||
my $offset=$input->param('offset');
|
my $offset=$input->param('offset');
|
||||||
my $father=$input->param('father');
|
my $father=$input->param('father');
|
||||||
|
|
||||||
my $reqsel="select category,stdlib,freelib from bibliothesaurus where id='$id'";
|
my $reqsel="";
|
||||||
my $reqdel="delete from bibliothesaurus where id='$id'";
|
my $reqdel="delete from bibliothesaurus where id='$id'";
|
||||||
my $script_name="/cgi-bin/koha/admin/thesaurus.pl";
|
my $script_name="/cgi-bin/koha/admin/thesaurus.pl";
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
|
@ -73,8 +73,8 @@ if ($op eq 'add_form') {
|
||||||
my $data;
|
my $data;
|
||||||
if ($id) {
|
if ($id) {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare("select id,category,freelib,stdlib from bibliothesaurus where id='$id'");
|
my $sth=$dbh->prepare("select id,category,freelib,stdlib from bibliothesaurus where id=?");
|
||||||
$sth->execute;
|
$sth->execute($id);
|
||||||
$data=$sth->fetchrow_hashref;
|
$data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,8 +123,8 @@ if ($op eq 'add_form') {
|
||||||
# called by default form, used to confirm deletion of data in DB
|
# called by default form, used to confirm deletion of data in DB
|
||||||
} elsif ($op eq 'delete_confirm') {
|
} elsif ($op eq 'delete_confirm') {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth=$dbh->prepare($reqsel);
|
my $sth=$dbh->prepare("select category,stdlib,freelib from bibliothesaurus where id=?");
|
||||||
$sth->execute;
|
$sth->execute($id);
|
||||||
my $data=$sth->fetchrow_hashref;
|
my $data=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$template->param(search_category => $search_category,
|
$template->param(search_category => $search_category,
|
||||||
|
|
|
@ -845,7 +845,7 @@ sub checkperlmodules {
|
||||||
|
|
||||||
if (@missing > 0) {
|
if (@missing > 0) {
|
||||||
my $missing='';
|
my $missing='';
|
||||||
if (POSIX::setlocale(LC_ALL) != "C") {
|
if (POSIX::setlocale(LC_ALL) ne "C") {
|
||||||
$missing.=" export LC_ALL=C\n";
|
$missing.=" export LC_ALL=C\n";
|
||||||
}
|
}
|
||||||
foreach my $module (@missing) {
|
foreach my $module (@missing) {
|
||||||
|
|
|
@ -80,7 +80,6 @@ while ( my $record = $batch->next() ) {
|
||||||
$i++;
|
$i++;
|
||||||
#now, parse the record, extract the item fields, and store them in somewhere else.
|
#now, parse the record, extract the item fields, and store them in somewhere else.
|
||||||
|
|
||||||
# $record = MARC::File::USMARC::decode(char_decode($record->as_usmarc(),$char_encoding));
|
|
||||||
## create an empty record object to populate
|
## create an empty record object to populate
|
||||||
my $newRecord = MARC::Record->new();
|
my $newRecord = MARC::Record->new();
|
||||||
|
|
||||||
|
@ -98,8 +97,9 @@ while ( my $record = $batch->next() ) {
|
||||||
|
|
||||||
# go through each subfield code/data pair
|
# go through each subfield code/data pair
|
||||||
foreach my $pair ( $oldField->subfields() ) {
|
foreach my $pair ( $oldField->subfields() ) {
|
||||||
# upper case the data portion and store
|
$pair->[1] =~ s/\<//g;
|
||||||
push( @newSubfields, $pair->[0], char_decode($pair->[1],$char_encoding) );
|
$pair->[1] =~ s/\>//g;
|
||||||
|
push( @newSubfields, $pair->[0], char_decode($pair->[1],$char_encoding) );
|
||||||
}
|
}
|
||||||
|
|
||||||
# add the new field to our new record
|
# add the new field to our new record
|
||||||
|
|
|
@ -109,9 +109,8 @@ for (my $i=0;$i<$numOverdueItems;$i++){
|
||||||
# separate function
|
# separate function
|
||||||
#
|
#
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $query="Select * from borrowers where borrowernumber='$borrower->{'guarantor'}'";
|
my $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
|
||||||
my $sth=$dbh->prepare($query);
|
$sth->execute($borrower->{'guarantor'});
|
||||||
$sth->execute;
|
|
||||||
my $tdata=$sth->fetchrow_hashref;
|
my $tdata=$sth->fetchrow_hashref;
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$borrower->{'phone'}=$tdata->{'phone'};
|
$borrower->{'phone'}=$tdata->{'phone'};
|
||||||
|
@ -137,22 +136,16 @@ for (my $i=0;$i<$numOverdueItems;$i++){
|
||||||
# FIXME
|
# FIXME
|
||||||
# this should be a separate function
|
# this should be a separate function
|
||||||
#
|
#
|
||||||
$item->{'title'}=~ s/\'/\\'/g;
|
my $sth=$dbh->prepare("Insert into accountlines
|
||||||
my $query="Insert into accountlines
|
|
||||||
(borrowernumber,itemnumber,accountno,date,amount,
|
(borrowernumber,itemnumber,accountno,date,amount,
|
||||||
description,accounttype,amountoutstanding) values
|
description,accounttype,amountoutstanding) values
|
||||||
($data->[$i]->{'borrowernumber'},$data->[$i]->{'itemnumber'},
|
(?,?,?,now(),?,?,'L',?)");
|
||||||
'$accountno',now(),'$cost','Lost item $item->{'title'} $item->{'barcode'} $due','L','$cost')";
|
$sth->execute($data->[$i]->{'borrowernumber'},$data->[$i]->{'itemnumber'},
|
||||||
my $sth=$dbh->prepare($query);
|
$accountno,$cost,"Lost item $item->{'title'} $item->{'barcode'} $due",$cost);
|
||||||
$sth->execute;
|
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$query="update items set itemlost=2 where itemnumber='$data->[$i]->{'itemnumber'}'";
|
$sth=$dbh->prepare("update items set itemlost=2 where itemnumber=?");
|
||||||
$sth=$dbh->prepare($query);
|
$sth->execute($data->[$i]->{'itemnumber'});
|
||||||
$sth->execute;
|
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
} else { # FIXME
|
|
||||||
# this should be deleted
|
|
||||||
#
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue