From tipaul@users.sourceforge.net Tue Mar 5 12:48:52 2002 From: Paul POULAIN To: koha-devel@lists.koha-community.org Subject: [Koha-devel] CVS: koha/admin aqbookfund.pl,NONE,1.1 aqbudget.pl,NONE,1.1 branches.pl,NONE,1.1 categorie.pl,NONE,1.1 categoryitem.pl,NONE,1.1 currency.pl,NONE,1.1 itemtypes.pl,NONE,1.1 printers.pl,NONE,1.1 stopwords.pl,NONE,1.1 systempreferences.pl,NONE,1.1 Date: Tue, 05 Mar 2002 13:38:03 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6202719671662161188==" --===============6202719671662161188== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update of /cvsroot/koha/koha/admin In directory usw-pr-cvs1:/tmp/cvs-serv20545/admin Added Files: aqbookfund.pl aqbudget.pl branches.pl categorie.pl=20 categoryitem.pl currency.pl itemtypes.pl printers.pl=20 stopwords.pl systempreferences.pl=20 Log Message: scripts to manage parameters tables --- NEW FILE --- #!/usr/bin/perl #script to administer the aqbudget table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select aqbudget.bookfundid,startdate,enddate,budgetamount,bookf= undname from aqbudget,aqbookfund where aqbudget.bookfundid=3Daqbookfund.bookf= undid and (aqbudget.bookfundid like \"$data[0]%\") order by bookfundid"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('searchfield'); my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/aqbookfund.pl"; my $bookfundid=3D$input->param('bookfundid'); my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($bookfundid) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select bookfundid,bookfundname,bookfundgroup from = aqbookfund where bookfundid=3D'$bookfundid'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.bookfundid.value.length=3D=3D0) { _alertString +=3D "- bookfundid missing\\n"; } if (f.bookfundname.value.length=3D=3D0) { _alertString +=3D "- bookfundname missing\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($bookfundid) { print "

Modify book fund

"; } else { print "

Add book fund

"; } print "
"; print ""; print ""; print ""; if ($bookfundid) { print ""; } else { print ""; } print ""; print ""; print ""; print "
Book fund$bookfundid
Book fund
Name{'bookfundname'}'> 
Group{'bookfundgroup'}'>
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace aqbookfund (bookfundid,bookfundname,bookfundgroup) va= lues ("; $query.=3D $dbh->quote($input->param('bookfundid')).","; $query.=3D $dbh->quote($input->param('bookfundname')).","; $query.=3D $dbh->quote($input->param('bookfundgroup')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; # my $sth=3D$dbh->prepare("select count(*) as total from categoryitem where i= temtype=3D'$itemtype'"); # $sth->execute; # my $total =3D $sth->fetchrow_hashref; # $sth->finish; my $sth=3D$dbh->prepare("select bookfundid,bookfundname,bookfundgroup from a= qbookfund where bookfundid=3D'$bookfundid'"); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Book fund'),bold("$bookfundid"),'/images/= background-mem.gif'); print "
"; print "Name$data->{'bookfundname'}"; print "Group$data->{'bookfundgroup'}"; # if ($total->{'total'} >0) { # print "This record is used $total->{= 'total'} times. Deletion not possible"; # print "
"; # } else { print "CONFIRM DELETION"; print "
"; # } # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; my $bookfundid=3Duc($input->param('bookfundid')); my $query =3D "delete from aqbookfund where bookfundid=3D'$bookfundid'"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","searchfield",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'bookfund admin'); print mkformnotable("$script_name",@inputs); print <$searchfield

"; } print mktablehdr; print mktablerow(6,'#99cc33',bold('Book fund'),bold('Start date'),bold('End = date'),bold('Budget amount'), ' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ #find out stats # my ($od,$issue,$fines)=3Dcategdata2($env,$results->[$i]{'borrowernumber'= }); # $fines=3D$fines+0; if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(6,$toggle,$results->[$i]{'bookfundid'}, $results->[$i]{'bookfundname'},$results->[$i]{'bookfundgroup'}, mklink("$script_name?op=3Dadd_form&bookfundid=3D".$results->[$i]{'bookfundi= d'},'Edit'), mklink("$script_name?op=3Ddelete_confirm&bookfundid=3D".$results->[$i]{'boo= kfundid'},'Delete','')); } print mktableft; print "

"; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

"; print "
"; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the aqbudget table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select aqbudget.bookfundid,startdate,enddate,budgetamount,bookf= undname from aqbudget,aqbookfund where aqbudget.bookfundid=3Daqbookfund.bookf= undid and (aqbudget.bookfundid like \"$data[0]%\") order by bookfundid"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('searchfield'); my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/aqbudget.pl"; my $bookfundid=3D$input->param('bookfundid'); my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($bookfundid) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select bookfundid,startdate,enddate,budgetamount,b= ookfundname from aqbudget,aqbookfund where aqbudget.bookfundid=3Daqbookfund.b= ookfundid and bookfundid=3D'$bookfundid'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.bookfundid.value.length=3D=3D0) { _alertString +=3D "- bookfundid missing\\n"; } if (!(isNotNull(window.document.Aform.budgetamount,1))) { _alertString +=3D "- Budget missing\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($bookfundid) { print "

Modify budget

"; } else { print "

Add budget

"; } print "
"; print ""; print ""; print ""; if ($bookfundid) { print ""; } else { print ""; } print ""; print ""; print ""; print ""; print "
Book fund$bookfundid
Book fund
Start date{'startdate'}'> 
End date{'enddate'}'>
Budget amount{'budgetamount'}'>
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace aqbudget (bookfundid,startdate,enddate,budgetamount) = values ("; $query.=3D $dbh->quote($input->param('bookfundid')).","; $query.=3D $dbh->quote($input->param('startdate')).","; $query.=3D $dbh->quote($input->param('enddate')).","; $query.=3D $dbh->quote($input->param('budgetamount')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; # my $sth=3D$dbh->prepare("select count(*) as total from categoryitem where i= temtype=3D'$itemtype'"); # $sth->execute; # my $total =3D $sth->fetchrow_hashref; # $sth->finish; my $sth=3D$dbh->prepare("select bookfundid,startdate,enddate,budgetamount fr= om aqbudget where bookfundid=3D'$bookfundid'"); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Book fund'),bold("$bookfundid"),'/images/= background-mem.gif'); print "
"; print "Start date$data->{'startdate'}"; print "End date$data->{'enddate'}"; print "budgetamount$data->{'budgetamount'}"; # if ($total->{'total'} >0) { # print "This record is used $total->{= 'total'} times. Deletion not possible"; # print "
"; # } else { print "CONFIRM DELETION"; print "
"; # } # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; my $bookfundid=3Duc($input->param('bookfundid')); my $query =3D "delete from aqbudget where bookfundid=3D'$bookfundid'"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","searchfield",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'bookfund admin'); print mkformnotable("$script_name",@inputs); print <$searchfield

"; } print mktablehdr; print mktablerow(6,'#99cc33',bold('Book fund'),bold('Start date'),bold('End = date'),bold('Budget amount'), ' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ #find out stats # my ($od,$issue,$fines)=3Dcategdata2($env,$results->[$i]{'borrowernumber'= }); # $fines=3D$fines+0; if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(6,$toggle,$results->[$i]{'bookfundid'}.' ('.$results->[$i]= {'bookfundname'}.')', $results->[$i]{'startdate'},$results->[$i]{'enddate'}, $results->[$i]{'budgetamount'}, mklink("$script_name?op=3Dadd_form&bookfundid=3D".$results->[$i]{'bookfundi= d'},'Edit'), mklink("$script_name?op=3Ddelete_confirm&bookfundid=3D".$results->[$i]{'boo= kfundid'},'Delete','')); } print mktableft; print "

"; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

"; print "
"; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the aqbudget table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select branchcode,branchname,branchaddress1,branchaddress2,bran= chaddress3,branchphone,branchfax,branchemail,issuing from branches where (bra= nchcode like \"$data[0]%\") order by branchcode"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('searchfield'); my $pkfield=3D"branchcode"; my $reqsel=3D"select branchcode,branchname,branchaddress1,branchaddress2,bran= chaddress3,branchphone,branchfax,branchemail,issuing from branches where bran= chcode=3D'$searchfield'"; my $reqdel=3D"delete from branches where branchcode=3D'$searchfield'"; #my $branchcode=3D$input->param('branchcode'); my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/branches.pl"; my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($searchfield) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select branchcode,branchname,branchaddress1,branch= address2,branchaddress3,branchphone,branchfax,branchemail,issuing from branc= hes where branchcode=3D'$searchfield'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.searchfield.value.length=3D=3D0) { _alertString +=3D "- branch code missing\\n"; } if (f.branchname.value.length=3D=3D0) { _alertString +=3D "- branch name missing\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($searchfield) { print "

Modify branch

"; } else { print "

Add branch

"; } print "
"; print ""; print ""; if ($searchfield) { print ""; } else { print ""; } print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
Branch code$searchfield
Branch code
Name{'branchname'}'> 
Adress{'branchaddress1'}'>
 {'branchaddress2'}'>
 {'branchaddress3'}'>
Phone{'branchphone'}'>
Fax{'branchfax'}'>
E-mail{'branchemail'}'>
Issuing{'issuing'}'>
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace branches (branchcode,branchname,branchaddress1,branch= address2,branchaddress3,branchphone,branchfax,branchemail,issuing) values ("; $query.=3D $dbh->quote($input->param('branchcode')).","; $query.=3D $dbh->quote($input->param('branchname')).","; $query.=3D $dbh->quote($input->param('branchaddress1')).","; $query.=3D $dbh->quote($input->param('branchaddress2')).","; $query.=3D $dbh->quote($input->param('branchaddress3')).","; $query.=3D $dbh->quote($input->param('branchphone')).","; $query.=3D $dbh->quote($input->param('branchfax')).","; $query.=3D $dbh->quote($input->param('branchemail')).","; $query.=3D $dbh->quote($input->param('issuing')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select count(*) as total from borrowers where branc= hcode=3D'$searchfield'"); $sth->execute; my $total =3D $sth->fetchrow_hashref; $sth->finish; print "$reqsel"; my $sth=3D$dbh->prepare($reqsel); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Branch code'),bold("$searchfield"),'/imag= es/background-mem.gif'); print "
"; print "Branch code$data->{'branchcode'}"; print "  name$data->{'branchname'}"; print "  adress$data->{'branchaddress1'}"; print " $data->{'branchaddress2'}"; print " $data->{'branchaddress3'}"; print " phone$data->{'branchphone'}"; print "  fax$data->{'branchfax'}"; print "  e-mail$data->{'branchemail'}"; print "  issuing$data->{'issuing'}"; if ($total->{'total'} >0) { print "This record is used $total->{'= total'} times. Deletion not possible"; print "
"; } else { print "CONFIRM DELETION"; print "
"; } # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; # my $searchfield=3D$input->param('branchcode'); my $sth=3D$dbh->prepare($reqdel); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","searchfield",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'branches admin'); print mkformnotable("$script_name",@inputs); print <$searchfield

"; } print mktablehdr; print mktablerow(9,'#99cc33',bold('Branch code'),bold('name'),bold('adress'), bold('phone'),bold('fax'),bold('mail'),bold('issuing'), ' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ #find out stats # my ($od,$issue,$fines)=3Dcategdata2($env,$results->[$i]{'borrowernumber'= }); # $fines=3D$fines+0; if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(9,$toggle,$results->[$i]{'branchcode'},$results->[$i]{'bra= nchname'}, $results->[$i]{'branchaddress1'}.$results->[$i]{'branchaddress2'}.$results-= >[$i]{'branchaddress3'}, $results->[$i]{'branchphone'},,$results->[$i]{'branchfax'},,$results->[$i]{= 'branchmail'},,$results->[$i]{'issuing'}, mklink("$script_name?op=3Dadd_form&searchfield=3D".$results->[$i]{'branchco= de'},'Edit'), mklink("$script_name?op=3Ddelete_confirm&searchfield=3D".$results->[$i]{'br= anchcode'},'Delete','')); } print mktableft; print "

"; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

"; print "
"; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the categories table #written 20/02/2002 by paul.poulain@free.fr # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select * from categories where (description like \"$data[0]%\")= "; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('description'); my $script_name=3D"/cgi-bin/koha/admin/categorie.pl"; my $categorycode=3D$input->param('categorycode'); my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($categorycode) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select categorycode,description,enrolmentperiod,up= peragelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reserve= fee,overduenoticerequired from categories where categorycode=3D'$categorycode= '"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.categorycode.value.length=3D=3D0) { _alertString +=3D "- categorycode missing\\n"; } // alert(window.document.Aform.description.value); if (!(isNotNull(window.document.Aform.description,1))) { _alertString +=3D "- description missing\\n"; } if (!isNum(f.upperagelimit,0)) { _alertString +=3D "- upperagelimit is not a number\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($categorycode) { print "

Modify category

"; } else { print "

Add category

"; } print "
"; print ""; print ""; print ""; if ($categorycode) { print ""; } else { print ""; } print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
Category code$categorycode
Category code
Description{'description'}'> 
Enrolment period{'enrolmentperiod'}'>
Upperage limit{'upperagelimit'}'>
Date of birth Required{'dateofbirthrequired'}'> (14/02/2002)
Fine type{'finetype'}'>
Bulk{= 'bulk'}'>
Enrolment fee{'enrolmentfee'}'>
Overdue notice required{'overduenoticerequired'}'>
Issue limit{'issuelimit'}'>
Reserve fee{'reservefee'}'>
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace categories (categorycode,description,enrolmentperiod,= upperagelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reser= vefee,overduenoticerequired) values ("; $query.=3D $dbh->quote($input->param('categorycode')).","; $query.=3D $dbh->quote($input->param('description')).","; $query.=3D $dbh->quote($input->param('enrolmentperiod')).","; $query.=3D $dbh->quote($input->param('upperagelimit')).","; $query.=3D $dbh->quote($input->param('dateofbirthrequired')).","; $query.=3D $dbh->quote($input->param('finetype')).","; $query.=3D $dbh->quote($input->param('bulk')).","; $query.=3D $dbh->quote($input->param('enrolmentfee')).","; $query.=3D $dbh->quote($input->param('issuelimit')).","; $query.=3D $dbh->quote($input->param('reservefee')).","; $query.=3D $dbh->quote($input->param('overduenoticerequired')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select count(*) as total from categoryitem where ca= tegorycode=3D'$categorycode'"); $sth->execute; my $total =3D $sth->fetchrow_hashref; print "TOTAL : $categorycode : $total->{'total'}
"; $sth->finish; my $sth=3D$dbh->prepare("select categorycode,description,enrolmentperiod,upp= eragelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reservef= ee,overduenoticerequired from categories where categorycode=3D'$categorycode'= "); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Category code'),bold("$categorycode"),'/i= mages/background-mem.gif'); print "
"; print "Description$data->{'description'}"; print "Enrolment period$data->{'enrolmentperiod'}= "; print "Upperage limit$data->{'upperagelimit'}"; print "Date of birth Required$data->{'dateofbirthrequired'}= "; print "Fine type$data->{'finetype'}"; print "Bulk$data->{'bulk'}"; print "Enrolment fee$data->{'enrolmentfee'}"; print "Overdue notice required$data->{'overduenoticerequire= d'}"; print "Issue limit$data->{'issuelimit'}"; print "Reserve fee$data->{'reservefee'}"; if ($total->{'total'} >0) { print "This record is used $total->{'= total'} times. Deletion not possible"; print "
"; } else { print "CONFIRM DELETION"; print "
"; } # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; my $categorycode=3Duc($input->param('categorycode')); my $query =3D "delete from categories where categorycode=3D'$categorycode'"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED } else { # DEFAULT my @inputs=3D(["text","description",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'Category admin'); print mkformnotable("$script_name",@inputs); print <"; } print mktablehdr; print mktablerow(13,'#99cc33',bold('Category'),bold('Description'),bold('Enr= olment'),bold('age max') ,bold('birth needed'),bold('Fine'),bold('Bulk'),bold('fee'),bold('overdue'),= bold('Issue limit'),bold('Reserve'),' ',' ','/images/background-mem= .gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D0; $i < $count; $i++){ #find out stats # my ($od,$issue,$fines)=3Dcategdata2($env,$results->[$i]{'borrowernumber'= }); # $fines=3D$fines+0; if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(13,$toggle,$results->[$i]{'categorycode'}, $results->[$i]{'description'},$results->[$i]{'enrolmentperiod'}, $results->[$i]{'upperagelimit'},$results->[$i]{'dateofbirthrequired'},$resu= lts->[$i]{'finetype'}, $results->[$i]{'bulk'},$results->[$i]{'enrolmentfee'},$results->[$i]{'overd= uenoticerequired'},$results->[$i]{'issuelimit'},$results->[$i]{'reservefee'},= mklink("$script_name?op=3Dadd_form&categorycode=3D".$results->[$i]{'categoryc= ode'},'Edit'), mklink("$script_name?op=3Ddelete_confirm&categorycode=3D".$results->[$i]{'c= ategorycode'},'Delete')); } print mktableft; print <
printend ; } #---- END $OP eq DEFAULT print endmenu('categorie'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the categories table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select * from categories where (description like \"$data[0]%\")= "; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('description'); my $script_name=3D"/cgi-bin/koha/admin/categorie.pl"; my $categorycode=3D$input->param('categorycode'); my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($categorycode) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select categorycode,description,enrolmentperiod,up= peragelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reserve= fee,overduenoticerequired from categories where categorycode=3D'$categorycode= '"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.categorycode.value.length=3D=3D0) { _alertString +=3D "- categorycode missing\\n"; } // alert(window.document.Aform.description.value); if (!(isNotNull(window.document.Aform.description,1))) { _alertString +=3D "- description missing\\n"; } if (!isNum(f.upperagelimit,0)) { _alertString +=3D "- upperagelimit is not a number\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($categorycode) { print "

Modify category

"; } else { print "

Add category

"; } print "
"; print ""; print ""; print ""; if ($categorycode) { print ""; } else { print ""; } print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
Category code$categorycode
Category code
Description{'description'}'> 
Enrolment period{'enrolmentperiod'}'>
Upperage limit{'upperagelimit'}'>
Date of birth Required{'dateofbirthrequired'}'> (14/02/2002)
Fine type{'finetype'}'>
Bulk{= 'bulk'}'>
Enrolment fee{'enrolmentfee'}'>
Overdue notice required{'overduenoticerequired'}'>
Issue limit{'issuelimit'}'>
Reserve fee{'reservefee'}'>
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace categories (categorycode,description,enrolmentperiod,= upperagelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reser= vefee,overduenoticerequired) values ("; $query.=3D $dbh->quote($input->param('categorycode')).","; $query.=3D $dbh->quote($input->param('description')).","; $query.=3D $dbh->quote($input->param('enrolmentperiod')).","; $query.=3D $dbh->quote($input->param('upperagelimit')).","; $query.=3D $dbh->quote($input->param('dateofbirthrequired')).","; $query.=3D $dbh->quote($input->param('finetype')).","; $query.=3D $dbh->quote($input->param('bulk')).","; $query.=3D $dbh->quote($input->param('enrolmentfee')).","; $query.=3D $dbh->quote($input->param('issuelimit')).","; $query.=3D $dbh->quote($input->param('reservefee')).","; $query.=3D $dbh->quote($input->param('overduenoticerequired')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select count(*) as total from categoryitem where ca= tegorycode=3D'$categorycode'"); $sth->execute; my $total =3D $sth->fetchrow_hashref; print "TOTAL : $categorycode : $total->{'total'}
"; $sth->finish; my $sth=3D$dbh->prepare("select categorycode,description,enrolmentperiod,upp= eragelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reservef= ee,overduenoticerequired from categories where categorycode=3D'$categorycode'= "); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Category code'),bold("$categorycode"),'/i= mages/background-mem.gif'); print "
"; print "Description$data->{'description'}"; print "Enrolment period$data->{'enrolmentperiod'}= "; print "Upperage limit$data->{'upperagelimit'}"; print "Date of birth Required$data->{'dateofbirthrequired'}= "; print "Fine type$data->{'finetype'}"; print "Bulk$data->{'bulk'}"; print "Enrolment fee$data->{'enrolmentfee'}"; print "Overdue notice required$data->{'overduenoticerequire= d'}"; print "Issue limit$data->{'issuelimit'}"; print "Reserve fee$data->{'reservefee'}"; if ($total->{'total'} >0) { print "This record is used $total->{'= total'} times. Deletion not possible"; print "
"; } else { print "CONFIRM DELETION"; print "
"; } # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; my $categorycode=3Duc($input->param('categorycode')); my $query =3D "delete from categories where categorycode=3D'$categorycode'"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED } else { # DEFAULT my @inputs=3D(["text","description",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'Category admin'); print mkformnotable("$script_name",@inputs); print <"; } print mktablehdr; print mktablerow(13,'#99cc33',bold('Category'),bold('Description'),bold('Enr= olment'),bold('age max') ,bold('birth needed'),bold('Fine'),bold('Bulk'),bold('fee'),bold('overdue'),= bold('Issue limit'),bold('Reserve'),' ',' ','/images/background-mem= .gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D0; $i < $count; $i++){ #find out stats # my ($od,$issue,$fines)=3Dcategdata2($env,$results->[$i]{'borrowernumber'= }); # $fines=3D$fines+0; if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(13,$toggle,$results->[$i]{'categorycode'}, $results->[$i]{'description'},$results->[$i]{'enrolmentperiod'}, $results->[$i]{'upperagelimit'},$results->[$i]{'dateofbirthrequired'},$resu= lts->[$i]{'finetype'}, $results->[$i]{'bulk'},$results->[$i]{'enrolmentfee'},$results->[$i]{'overd= uenoticerequired'},$results->[$i]{'issuelimit'},$results->[$i]{'reservefee'},= mklink("$script_name?op=3Dadd_form&categorycode=3D".$results->[$i]{'categoryc= ode'},'Edit'), mklink("$script_name?op=3Ddelete_confirm&categorycode=3D".$results->[$i]{'c= ategorycode'},'Delete')); } print mktableft; print <
printend ; } #---- END $OP eq DEFAULT print endmenu('categorie'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the aqbudget table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select currency,rate from currency where (currency like \"$data= [0]%\") order by currency"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('searchfield'); my $pkfield=3D"currency"; my $reqsel=3D"select currency,rate from currency where $pkfield=3D'$searchfie= ld'"; my $reqdel=3D"delete from currency where $pkfield=3D'$searchfield'"; #my $branchcode=3D$input->param('branchcode'); my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/currency.pl"; my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($searchfield) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select currency,rate from currency where currency= =3D'$searchfield'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.currency.value.length=3D=3D0) { _alertString +=3D "- currency missing\\n"; } if (!isNum(f.rate)) { _alertString +=3D "- Rate not numeric\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($searchfield) { print "

Modify currency

"; } else { print "

Add currency

"; } print "
"; print ""; print ""; if ($searchfield) { print ""; } else { print ""; } print ""; print ""; print "
Currency$searchfield
Currency
Rate{'rate'}'> 
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace currency (currency,rate) values ("; $query.=3D $dbh->quote($input->param('currency')).","; $query.=3D $dbh->quote($input->param('rate')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select count(*) as total from aqbooksellers where c= urrency=3D'$searchfield'"); $sth->execute; my $total =3D $sth->fetchrow_hashref; $sth->finish; my $sth=3D$dbh->prepare($reqsel); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Currency'),bold("$searchfield"),'/images/= background-mem.gif'); print "
"; print "Rate$data->{'rate'}"; if ($total->{'total'} >0) { print "This record is used $total->{'= total'} times. Deletion not possible"; print "
"; } else { print "CONFIRM DELETION"; print "
"; } # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; # my $searchfield=3D$input->param('branchcode'); my $sth=3D$dbh->prepare($reqdel); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","searchfield",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'Currencies admin'); print mkformnotable("$script_name",@inputs); print <$searchfield

"; } print mktablehdr; print mktablerow(4,'#99cc33',bold('Currency'),bold('Rate'), ' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ #find out stats # my ($od,$issue,$fines)=3Dcategdata2($env,$results->[$i]{'borrowernumber'= }); # $fines=3D$fines+0; if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(4,$toggle,$results->[$i]{'currency'},$results->[$i]{'rate'= }, mklink("$script_name?op=3Dadd_form&searchfield=3D".$results->[$i]{'currency= '},'Edit'), mklink("$script_name?op=3Ddelete_confirm&searchfield=3D".$results->[$i]{'cu= rrency'},'Delete','')); } print mktableft; print "

"; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

"; print "
"; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the categories table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select * from itemtypes where (description like \"$data[0]%\") = order by itemtype"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('description'); my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/itemtypes.pl"; my $itemtype=3D$input->param('itemtype'); my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($itemtype) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select itemtype,description,loanlength,renewalsall= owed,rentalcharge from itemtypes where itemtype=3D'$itemtype'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.itemtype.value.length=3D=3D0) { _alertString +=3D "- itemtype missing\\n"; } if (!(isNotNull(window.document.Aform.description,1))) { _alertString +=3D "- description missing\\n"; } if (!isNum(f.loanlength,0)) { _alertString +=3D "- loan length is not a number\\n"; } if (!isNum(f.rentalcharge,0)) { _alertString +=3D "- loan length is not a number\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($itemtype) { print "

Modify item type

"; } else { print "

Add item type

"; } print "
"; print ""; print ""; print ""; if ($itemtype) { print ""; } else { print ""; } print ""; print ""; if ($data->{'renewalsallowed'} eq 1) { print ""; } else { print ""; } # print ""; print ""; print ""; print "
Item type$itemtype
Item type
Description{'description'}'> 
loan length{'loanlength'}'>
Renewals allowed
Renewals allowed
Renewals allowed{'renewalsallowed'}'>
Rental charge{'rentalcharge'}'>
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace itemtypes (itemtype,description,loanlength,renewalsal= lowed,rentalcharge) values ("; $query.=3D $dbh->quote($input->param('itemtype')).","; $query.=3D $dbh->quote($input->param('description')).","; $query.=3D $dbh->quote($input->param('loanlength')).","; if ($input->param('renewalsallowed') ne 1) { $query.=3D "0,"; } else { $query.=3D "1,"; } $query.=3D $dbh->quote($input->param('rentalcharge')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select count(*) as total from categoryitem where it= emtype=3D'$itemtype'"); $sth->execute; my $total =3D $sth->fetchrow_hashref; $sth->finish; my $sth=3D$dbh->prepare("select itemtype,description,loanlength,renewalsallo= wed,rentalcharge from itemtypes where itemtype=3D'$itemtype'"); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Item type'),bold("$itemtype"),'/images/ba= ckground-mem.gif'); print "
"; print "Description$data->{'description'}"; print "Loan length$data->{'loanlength'}"; print "Renewals allowed$data->{'renewalsallowed'}= "; print "Rental charge$data->{'rentalcharge'}"; if ($total->{'total'} >0) { print "This record is used $total->{'= total'} times. Deletion not possible"; print "
"; } else { print "CONFIRM DELETION"; print "
"; } # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; my $itemtype=3Duc($input->param('itemtype')); my $query =3D "delete from itemtypes where itemtype=3D'$itemtype'"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","description",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'Item types admin'); print mkformnotable("$script_name",@inputs); print <$searchfield

"; } print mktablehdr; print mktablerow(7,'#99cc33',bold('Code'),bold('Description'),bold('loan
= length'),bold('Renewals
allowed') ,bold('Rental
charge'),' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ #find out stats # my ($od,$issue,$fines)=3Dcategdata2($env,$results->[$i]{'borrowernumber'= }); # $fines=3D$fines+0; if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(7,$toggle,$results->[$i]{'itemtype'}, $results->[$i]{'description'},$results->[$i]{'loanlength'}, $results->[$i]{'renewalsallowed'}=3D=3D1?'Yes':'No',$results->[$i]{'rentalc= harge'}, mklink("$script_name?op=3Dadd_form&itemtype=3D".$results->[$i]{'itemtype'},= 'Edit'), mklink("$script_name?op=3Ddelete_confirm&itemtype=3D".$results->[$i]{'itemt= ype'},'Delete','')); } print mktableft; print "

"; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

"; print "
"; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the aqbudget table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select printername,printqueue,printtype from printers where (pr= intername like \"$data[0]%\") order by printername"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('searchfield'); my $pkfield=3D"printername"; my $reqsel=3D"select printername,printqueue,printtype from printers where $pk= field=3D'$searchfield'"; my $reqdel=3D"delete from printers where $pkfield=3D'$searchfield'"; #my $branchcode=3D$input->param('branchcode'); my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/printers.pl"; my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($searchfield) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select printername,printqueue,printtype from print= ers where printername=3D'$searchfield'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.printername.value.length=3D=3D0) { _alertString +=3D "- printer name missing\\n"; } if (f.printqueue.value.length=3D=3D0) { _alertString +=3D "- Queue missing\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($searchfield) { print "

Modify printer

"; } else { print "

Add printer

"; } print "
"; print ""; print ""; if ($searchfield) { print ""; } else { print ""; } print ""; print ""; print ""; print "
Printer$searchfield
Printer
Queue{'printqueue'}'> 
Type{'printtype'}'> 
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace printers (printername,printqueue,printtype) values ("; $query.=3D $dbh->quote($input->param('printername')).","; $query.=3D $dbh->quote($input->param('printqueue')).","; $query.=3D $dbh->quote($input->param('printtype')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare($reqsel); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Printer'),bold("$searchfield"),'/images/b= ackground-mem.gif'); print "
"; print "Queue$data->{'printqueue'}"; print "Type$data->{'printtype'}"; print "CONFIRM DELETION"; print "
"; # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; # my $searchfield=3D$input->param('branchcode'); my $sth=3D$dbh->prepare($reqdel); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","searchfield",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'Currencies admin'); print mkformnotable("$script_name",@inputs); print <$searchfield

"; } print mktablehdr; print mktablerow(5,'#99cc33',bold('Name'),bold('Queue'),bold('Type'), ' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(5,$toggle,$results->[$i]{'printername'},$results->[$i]{'pr= intqueue'},$results->[$i]{'printtype'}, mklink("$script_name?op=3Dadd_form&searchfield=3D".$results->[$i]{'printern= ame'},'Edit'), mklink("$script_name?op=3Ddelete_confirm&searchfield=3D".$results->[$i]{'pr= intername'},'Delete','')); } print mktableft; print "

"; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

"; print "
"; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the stopwords table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select word from stopwords where (word like \"$data[0]%\") orde= r by word"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('searchfield'); my $pkfield=3D"word"; my $reqsel=3D"select word from stopwords where $pkfield=3D'$searchfield'"; my $reqdel=3D"delete from stopwords where $pkfield=3D'$searchfield'"; my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/stopwords.pl"; my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($searchfield) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select word from stopwords where word=3D'$searchfi= eld'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.word.value.length=3D=3D0) { _alertString +=3D "- word missing\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($searchfield) { print "

Modify word

"; } else { print "

Add word

"; } print "
"; print ""; print ""; if ($searchfield) { print ""; } else { print ""; } print ""; print "
Word$searchfield
Word
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace stopwords (word) values ("; $query.=3D $dbh->quote($input->param('word')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare($reqsel); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Word'),bold("$searchfield"),'/images/back= ground-mem.gif'); print "
"; print "CONFIRM DELETION"; print "
"; # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; # my $searchfield=3D$input->param('branchcode'); my $sth=3D$dbh->prepare($reqdel); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","searchfield",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'Currencies admin'); print mkformnotable("$script_name",@inputs); print <$searchfield

"; } print mktablehdr; print mktablerow(2,'#99cc33',bold('Word'), ' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(2,$toggle,$results->[$i]{'word'}, mklink("$script_name?op=3Ddelete_confirm&searchfield=3D".$results->[$i]{'wo= rd'},'Delete','')); } print mktableft; print "

"; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

"; print "
"; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --- NEW FILE --- #!/usr/bin/perl #script to administer the systempref table #written 20/02/2002 by paul.poulain@free.fr # This software is placed under the gnu General Public License, v2 (http://ww= w.gnu.org/licenses/gpl.html) # ALGO : # this script use an $op to know what to do. # if $op is empty or none of the above values, # - the default screen is build (with all records, or filtered datas). # - the user can clic on add, modify or delete record. # if $op=3Dadd_form # - if primkey exists, this is a modification,so we read the $primkey record # - builds the add/modify form # if $op=3Dadd_validate # - the user has just send datas, so we create/modify the record # if $op=3Ddelete_form # - we show the record having primkey=3D$primkey and ask for deletion validat= ion form # if $op=3Ddelete_confirm # - we delete the record having primkey=3D$primkey use strict; use C4::Output; use CGI; use C4::Search; use C4::Database; sub StringSearch { my ($env,$searchstring,$type)=3D@_; my $dbh =3D &C4Connect; $searchstring=3D~ s/\'/\\\'/g; my @data=3Dsplit(' ',$searchstring); my $count=3D@data; my $query=3D"Select variable,value from systempreferences where (variable li= ke \"$data[0]%\") order by variable"; my $sth=3D$dbh->prepare($query); $sth->execute; my @results; my $cnt=3D0; while (my $data=3D$sth->fetchrow_hashref){ push(@results,$data); $cnt ++; } # $sth->execute; $sth->finish; $dbh->disconnect; return ($cnt,\@results); } my $input =3D new CGI; my $searchfield=3D$input->param('searchfield'); my $pkfield=3D"variable"; my $reqsel=3D"select variable,value from systempreferences where $pkfield=3D'= $searchfield'"; my $reqdel=3D"delete from systempreferences where $pkfield=3D'$searchfield'"; my $offset=3D$input->param('offset'); my $script_name=3D"/cgi-bin/koha/admin/systempreferences.pl"; my $pagesize=3D20; my $op =3D $input->param('op'); $searchfield=3D~ s/\,//g; print $input->header; #start the page and read in includes print startpage(); print startmenu('admin'); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($searchfield) { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare("select variable,value from systempreferences where= variable=3D'$searchfield'"); $sth->execute; $data=3D$sth->fetchrow_hashref; $sth->finish; } print < ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNotNull(f,noalert) { if (f.value.length =3D=3D0) { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function toUC(f) { var x=3Df.value.toUpperCase(); f.value=3Dx; return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isNum(v,maybenull) { var n =3D new Number(v.value); if (isNaN(n)) { return false; } if (maybenull=3D=3D0 && v.value=3D=3D'') { return false; } return true; } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function isDate(f) { var t =3D Date.parse(f.value); if (isNaN(t)) { return false; } } ////////////////////////////////////////////////////////////////////////////= ///////////////////////////////////// function Check(f) { var ok=3D1; var _alertString=3D""; var alertString2; if (f.variable.value.length=3D=3D0) { _alertString +=3D "- variable missing\\n"; } if (f.value.value.length=3D=3D0) { _alertString +=3D "- value missing\\n"; } if (_alertString.length=3D=3D0) { document.Aform.submit(); } else { alertString2 =3D "Form not submitted because of the following problem(s)\\= n"; alertString2 +=3D "-------------------------------------------------------= -----------------------------\\n\\n"; alertString2 +=3D _alertString; alert(alertString2); } } printend ;#/ if ($searchfield) { print "

Modify pref

"; } else { print "

Add pref

"; } print "
"; print ""; print ""; if ($searchfield) { print ""; } else { print ""; } print ""; print ""; print "
Variable$searchfield
Variable
Value{'value'}'>
 
"; print "
"; ; # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh=3DC4Connect; my $query =3D "replace systempreferences (variable,value) values ("; $query.=3D $dbh->quote($input->param('variable')).","; $query.=3D $dbh->quote($input->param('value')).")"; my $sth=3D$dbh->prepare($query); $sth->execute; $sth->finish; print "data recorded"; print "
"; print ""; print "
"; # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { my $dbh =3D &C4Connect; my $sth=3D$dbh->prepare($reqsel); $sth->execute; my $data=3D$sth->fetchrow_hashref; $sth->finish; print mktablehdr; print mktablerow(2,'#99cc33',bold('Variable'),bold("$searchfield"),'/images/= background-mem.gif'); print "Value$data->{'value'}"; print "
"; print "CONFIRM DELETION"; print "
"; # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { my $dbh=3DC4Connect; # my $searchfield=3D$input->param('branchcode'); my $sth=3D$dbh->prepare($reqdel); $sth->execute; $sth->finish; print "data deleted"; print "
"; print ""; print "
"; # END $OP eq DELETE_CONFIRMED ################## DEFAULT ################################## } else { # DEFAULT my @inputs=3D(["text","searchfield",$searchfield], ["reset","reset","clr"]); print mkheadr(2,'System preferences admin'); print mkformnotable("$script_name",@inputs); print <Hints :
2 variables are useful in this table :
  • acquisitions, which value may be "simple" or "normal"
  • autoMemberNum which may be 1 or 0


  • printend ; if ($searchfield ne '') { print "You Searched for $searchfield

    "; } print mktablehdr; print mktablerow(4,'#99cc33',bold('Variable'),bold('Value'), ' ',' ','/images/background-mem.gif'); my $env; my ($count,$results)=3DStringSearch($env,$searchfield,'web'); my $toggle=3D"white"; for (my $i=3D$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$coun= t); $i++){ if ($toggle eq 'white'){ $toggle=3D"#ffffcc"; } else { $toggle=3D"white"; } print mktablerow(4,$toggle,$results->[$i]{'variable'},$results->[$i]{'value= '}, mklink("$script_name?op=3Dadd_form&searchfield=3D".$results->[$i]{'variable= '},'Edit'), mklink("$script_name?op=3Ddelete_confirm&searchfield=3D".$results->[$i]{'va= riable'},'Delete','')); } print mktableft; print "

    "; print ""; if ($offset>0) { my $prevpage =3D $offset-$pagesize; print mklink("$script_name?offset=3D".$prevpage,'<< Prev'); } print "      "; if ($offset+$pagesize<$count) { my $nextpage =3D$offset+$pagesize; print mklink("$script_name?offset=3D".$nextpage,'Next >>'); } print "

    "; print "
    "; } #---- END $OP eq DEFAULT print endmenu('admin'); print endpage(); --===============6202719671662161188==-- From nsr@etome.net Wed Mar 6 08:43:34 2002 From: Nicholas Rosasco To: koha-devel@lists.koha-community.org Subject: [Koha-devel] Useful addition to MARC stuff? Date: Wed, 06 Mar 2002 08:44:03 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8190267952605086380==" --===============8190267952605086380== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit http://freshmeat.net/projects/simpleserver/ "Net::Z3950::SimpleServer is a Perl module which implements the server side of the Z39.50 (information retrieval) protocol. It hides the complexity of network exchanges, packet serialization, and session handling. You are required only to implement simple callbacks to support searching and record retrieval. " Possibly useful? Nick --===============8190267952605086380==-- From tonnesen@cmsd.bc.ca Wed Mar 6 08:54:42 2002 From: Tonnesen Steve To: koha-devel@lists.koha-community.org Subject: Re: [Koha-devel] Useful addition to MARC stuff? Date: Wed, 06 Mar 2002 08:55:12 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8108570166839189482==" --===============8108570166839189482== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Wed, 6 Mar 2002, Nicholas Rosasco wrote: > http://freshmeat.net/projects/simpleserver/ > "Net::Z3950::SimpleServer is a Perl module which implements the server side > of the Z39.50 (information retrieval) protocol. It hides the complexity of > network exchanges, packet serialization, and session handling. You are > required only to implement simple callbacks to support searching and record > retrieval. " > > Possibly useful? Definitely. We'll need MARC support first, though, of course. I use the Net::Z3950 module in my Z3950 client already. Works great. Haven't played with the SimpleServer yet. Steve. --===============8108570166839189482==--