Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.7 KiB

  1. #!/usr/bin/perl
  2. #script to print confirmation screen, then if accepted calls itself to insert data
  3. use strict;
  4. use C4::Output;
  5. use C4::Input;
  6. use CGI;
  7. use Date::Manip;
  8. my %env;
  9. my $input = new CGI;
  10. #get varibale that tells us whether to show confirmation page
  11. #or insert data
  12. my $insert=$input->param('insert');
  13. print $input->header;
  14. #get rest of data
  15. my %data;
  16. my @names=$input->param;
  17. foreach my $key (@names){
  18. $data{$key}=$input->param($key);
  19. }
  20. my $ok=0;
  21. my $string="The following compulsary fields have been left blank. Please push the back button
  22. and try again<p>";
  23. if ($data{'cardnumber_institution'} eq ''){
  24. $string.="Cardnumber<br>";
  25. $ok=1;
  26. }
  27. if ($data{'institution_name'} eq ''){
  28. $string.="Institution Name<br>";
  29. $ok=1;
  30. }
  31. if ($data{'address'} eq ''){
  32. $string.="Postal Address<br>";
  33. $ok=1;
  34. }
  35. if ($data{'city'} eq ''){
  36. $string.="City<br>";
  37. $ok=1;
  38. }
  39. if ($data{'contactname'} eq ''){
  40. $string.="Contact Name";
  41. $ok=1;
  42. }
  43. #print $input->Dump;
  44. #print $string;
  45. print startmenu('member');
  46. if ($ok ==1){
  47. print $string;
  48. } else {
  49. my $valid=checkdigit(\%env,$data{"cardnumber_institution"});
  50. if ($valid != 1){
  51. print "Invalid cardnumber";
  52. } else {
  53. my @inputs;
  54. my $i=0;
  55. while (my ($key, $value) = each %data) {
  56. $value=~ s/\"/%22/g;
  57. $inputs[$i]=["hidden","$key","$value"];
  58. $i++;
  59. }
  60. $inputs[$i]=["submit","submit","submit"];
  61. print mkformnotable("/cgi-bin/koha/insertidata.pl",@inputs);
  62. }
  63. }
  64. print endmenu('member');
  65. print endpage();