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.

111 lines
5.3 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. for (my $i=0;$i<3;$i++){
  24. my $number=$data{"cardnumber_child_$i"};
  25. my $firstname=$data{"firstname_child_$i"};
  26. my $surname=$data{"surname_child_$i"};
  27. my $dob=$data{"dateofbirth_child_$i"};
  28. my $sex=$data{"sex_child_$i"};
  29. if ($number eq ''){
  30. if ($i == 0){
  31. $string.=" Cardnumber<br>";
  32. $ok=1;
  33. }
  34. } else {
  35. if ($firstname eq ''){
  36. $string.=" Given Names<br>";
  37. $ok=1;
  38. }
  39. if ($surname eq ''){
  40. $string.=" Surname<br>";
  41. $ok=1;
  42. }
  43. if ($dob eq ''){
  44. $string.=" Date Of Birth<br>";
  45. $ok=1;
  46. }
  47. if ($sex eq ''){
  48. $string.=" Gender <br>";
  49. $ok=1;
  50. }
  51. my $valid=checkdigit(\%env,$data{"cardnumber_child_$i"});
  52. if ($valid != 1){
  53. $ok=1;
  54. $string.=" Invalid Cardnumber $number<br>";
  55. }
  56. }
  57. }
  58. print startpage();
  59. print startmenu('member');
  60. if ($ok == 0){
  61. print mkheadr(1,'Confirm Record');
  62. my $main="#99cc33";
  63. my $image="/images/background-mem.gif";
  64. for (my $i=0;$i<3;$i++){
  65. if ($data{"cardnumber_child_$i"} ne ''){
  66. print mktablehdr;
  67. print mktablerow(2,$main,bold('NEW MEMBER'),"",$image);
  68. my $name=$data{"firstname_child_$i"}.$data{"surname_child_$i"};
  69. print mktablerow(2,'white',bold('Name'),$name);
  70. print mktablerow(2,$main,bold('MEMBERSHIP DETAILS'),"",$image);
  71. print mktablerow(2,'white',bold('Membership Number'),$data{"bornumber_child_$i"});
  72. print mktablerow(2,'white',bold('Date of Birth'),$data{"dateofbirth_child_$i"});
  73. my $sex;
  74. if ($data{"sex_child_$i"} eq 'M'){
  75. $sex="Male";
  76. } else {
  77. $sex="Female";
  78. }
  79. print mktablerow(2,'white',bold('Sex'),$sex);
  80. print mktablerow(2,'white',bold('School'),$data{"school_child_$i"});
  81. print mktablerow(2,'white',bold('General Notes'),$data{"altnotes_child_$i"});
  82. print mktableft;
  83. print "<p>";
  84. }
  85. }
  86. my $i=0;
  87. my @inputs;
  88. while (my ($key, $value) = each %data) {
  89. $value=~ s/\"/%22/g;
  90. $inputs[$i]=["hidden","$key","$value"];
  91. $i++;
  92. }
  93. $inputs[$i]=["submit","submit","submit"];
  94. print mkformnotable("/cgi-bin/koha/insertjdata.pl",@inputs);
  95. } else {
  96. #print $input->dump;
  97. print $string;
  98. }
  99. print endmenu('member');
  100. print endpage();