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.

122 lines
3.3 KiB

  1. #!/usr/bin/perl
  2. use C4::Database;
  3. use CGI;
  4. use strict;
  5. use C4::Acquisitions;
  6. use C4::Output;
  7. use C4::Search;
  8. my $input= new CGI;
  9. #print $input->header;
  10. #print $input->dump;
  11. my $bibitemnum=checkinp($input->param('bibitemnum'));
  12. my $bibnum=checkinp($input->param('bibnum'));
  13. my $itemtype=checkinp($input->param('Item'));
  14. my $isbn=checkinp($input->param('ISBN'));
  15. my $publishercode=checkinp($input->param('Publisher'));
  16. my $publicationdate=checkinp($input->param('Publication'));
  17. my $class=checkinp($input->param('Class'));
  18. my $classification;
  19. my $dewey;
  20. my $subclass;
  21. if ($itemtype ne 'NF'){
  22. $classification=$class;
  23. }
  24. if ($class =~/[0-9]+/){
  25. # print $class;
  26. $dewey= $class;
  27. $dewey=~ s/[a-z]+//gi;
  28. my @temp;
  29. if ($class =~ /\./){
  30. @temp=split(/[0-9]+\.[0-9]+/,$class);
  31. } else {
  32. @temp=split(/[0-9]+/,$class);
  33. }
  34. $classification=$temp[0];
  35. $subclass=$temp[1];
  36. # print $classification,$dewey,$subclass;
  37. }else{
  38. $dewey='';
  39. }
  40. my $illus=checkinp($input->param('Illustrations'));
  41. my $pages=checkinp($input->param('Pages'));
  42. my $volumeddesc=checkinp($input->param('Volume'));
  43. my $notes=checkinp($input->param('Notes'));
  44. my $size=checkinp($input->param('Size'));
  45. my $place=checkinp($input->param('Place'));
  46. my (@items)=itemissues($bibitemnum);
  47. #print @items;
  48. my $count=@items;
  49. #print $count;
  50. my @barcodes;
  51. my $existing=$input->param('existing');
  52. if ($existing eq 'YES'){
  53. # print "yes";
  54. my $group=$input->param('existinggroup');
  55. #go thru items assing selected ones to group
  56. for (my $i=0;$i<$count;$i++){
  57. my $temp="check_group_".$items[$i]->{'barcode'};
  58. my $barcode=$input->param($temp);
  59. if ($barcode ne ''){
  60. moditem($items[$i]->{'notforloan'},$items[$i]->{'itemnumber'},$group);
  61. # print "modify $items[$i]->{'itemnumber'} $group";
  62. }
  63. }
  64. $bibitemnum=$group;
  65. } else {
  66. my $flag;
  67. my $flag2;
  68. for (my $i=0;$i<$count;$i++){
  69. my $temp="check_group_".$items[$i]->{'barcode'};
  70. $barcodes[$i]=$input->param($temp);
  71. if ($barcodes[$i] eq ''){
  72. $flag="notall";
  73. } else {
  74. $flag2="leastone";
  75. }
  76. }
  77. my $loan;
  78. if ($flag eq 'notall' && $flag2 eq 'leastone'){
  79. $bibitemnum=newbiblioitem($bibnum,$itemtype,$volumeddesc,$classification);
  80. modbibitem($bibitemnum,$itemtype,$isbn,$publishercode,$publicationdate,$classification,$dewey,$subclass,$illus,$pages,$volumeddesc,$notes,$size,$place);
  81. if ($itemtype =~ /REF/){
  82. $loan=1;
  83. } else {
  84. $loan=0;
  85. }
  86. for (my $i=0;$i<$count;$i++){
  87. if ($barcodes[$i] ne ''){
  88. moditem($loan,$items[$i]->{'itemnumber'},$bibitemnum);
  89. }
  90. }
  91. } elsif ($flag2 eq 'leastone') {
  92. modbibitem($bibitemnum,$itemtype,$isbn,$publishercode,$publicationdate,$classification,$dewey,$subclass,$illus,$pages,$volumeddesc,$notes,$size,$place);
  93. if ($itemtype =~ /REF/){
  94. $loan=1;
  95. } else {
  96. $loan=0;
  97. }
  98. for (my $i=0;$i<$count;$i++){
  99. if ($barcodes[$i] ne ''){
  100. moditem($loan,$items[$i]->{'itemnumber'},$bibitemnum);
  101. }
  102. }
  103. }
  104. }
  105. print $input->redirect("moredetail.pl?type=intra&bib=$bibnum&bi=$bibitemnum");
  106. sub checkinp{
  107. my ($inp)=@_;
  108. $inp=~ s/\'/\\\'/g;
  109. $inp=~ s/\"/\\\"/g;
  110. return($inp);
  111. }