koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/acqui.simple additem.pl,1.32,1.33


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/acqui.simple additem.pl,1.32,1.33
Date: Thu, 11 Aug 2005 02:00:17 -0700

Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7753/acqui.simple

Modified Files:
        additem.pl 
Log Message:
Ok guys, this time, it seems that item add and modif begin working as 
expected...
Still a lot of bugs to fix, of course

Index: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** additem.pl  9 Aug 2005 14:10:28 -0000       1.32
--- additem.pl  11 Aug 2005 09:00:07 -0000      1.33
***************
*** 51,57 ****
  my $error = $input->param('error');
  my $biblionumber = $input->param('biblionumber');
! 
  my $op = $input->param('op');
- my $itemnum = $input->param('itemnum');
  
  # find itemtype
--- 51,57 ----
  my $error = $input->param('error');
  my $biblionumber = $input->param('biblionumber');
! my $biblioitemnumber = find_biblioitemnumber($dbh,$biblionumber);
! my $itemnumber = $input->param('itemnumber');
  my $op = $input->param('op');
  
  # find itemtype
***************
*** 59,64 ****
  
  my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
! my $record = MARCgetbiblio($dbh,$biblionumber);
! my $oldrecord = MARCmarc2koha($dbh,$record);
  my $itemrecord;
  my $nextop="additem";
--- 59,63 ----
  
  my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
! 
  my $itemrecord;
  my $nextop="additem";
***************
*** 78,100 ****
                $indicators{$ind_tag[$i]} = $indicator[$i];
        }
!       my $record = 
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
  # check for item barcode # being unique
!       my $oldbibid = MARCmarc2koha($dbh,$record);
!       my $exists = itemdata($oldbibid->{'barcode'});
        push @errors,"barcode_not_unique" if($exists);
- # MARC::Record builded => now, record in DB
        # if barcode exists, don't create, but report The problem.
!       my ($biblionumber,$oldbibnum,$oldbibitemnum) = 
NEWnewitem($dbh,$record,$biblionumber) unless ($exists);
!       if ($exists) {
!               $nextop = "additem";
!               $itemrecord = $record;
!       } else {
!               $nextop = "additem";
!       }
  
#------------------------------------------------------------------------------------------------------------------------------
  } elsif ($op eq "edititem") {
  
#------------------------------------------------------------------------------------------------------------------------------
  # retrieve item if exist => then, it's a modif
!       $itemrecord = MARCgetitem($dbh,$biblionumber,$itemnum);
        $nextop="saveitem";
  
#------------------------------------------------------------------------------------------------------------------------------
--- 77,93 ----
                $indicators{$ind_tag[$i]} = $indicator[$i];
        }
!       my $addeditem = 
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
  # check for item barcode # being unique
!       my $addedolditem = MARCmarc2koha($dbh,$addeditem);
!       my $exists = itemdata($addedolditem->{'barcode'});
        push @errors,"barcode_not_unique" if($exists);
        # if barcode exists, don't create, but report The problem.
!       $itemnumber = 
NEWnewitem($dbh,$addeditem,$biblionumber,$biblioitemnumber) unless ($exists);
!       $nextop = "additem";
  
#------------------------------------------------------------------------------------------------------------------------------
  } elsif ($op eq "edititem") {
  
#------------------------------------------------------------------------------------------------------------------------------
  # retrieve item if exist => then, it's a modif
!       $itemrecord = MARCgetitem($dbh,$biblionumber,$itemnumber);
        $nextop="saveitem";
  
#------------------------------------------------------------------------------------------------------------------------------
***************
*** 102,106 ****
  
#------------------------------------------------------------------------------------------------------------------------------
  # retrieve item if exist => then, it's a modif
!       &NEWdelitem($dbh,$biblionumber,$itemnum);
        $nextop="additem";
  
#------------------------------------------------------------------------------------------------------------------------------
--- 95,99 ----
  
#------------------------------------------------------------------------------------------------------------------------------
  # retrieve item if exist => then, it's a modif
!       &NEWdelitem($dbh,$biblionumber,$itemnumber);
        $nextop="additem";
  
#------------------------------------------------------------------------------------------------------------------------------
***************
*** 119,127 ****
                $indicators{$ind_tag[$i]} = $indicator[$i];
        }
!       my $record = 
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
  # MARC::Record builded => now, record in DB
! # warn "R: ".$record->as_formatted;
!       my ($biblionumber,$oldbibnum,$oldbibitemnum) = 
NEWmoditem($dbh,$record,$biblionumber,$itemnum,0);
!       $itemnum="";
        $nextop="additem";
  }
--- 112,120 ----
                $indicators{$ind_tag[$i]} = $indicator[$i];
        }
!       my $itemrecord = 
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
  # MARC::Record builded => now, record in DB
! # warn "ITEM TO MODIFY : ".$itemrecord->as_formatted;
!       NEWmoditem($dbh, $itemrecord, $biblionumber, $biblioitemnumber, 
$itemnumber,0);
!       $itemnumber="";
        $nextop="additem";
  }
***************
*** 140,148 ****
                             });
  
  my %indicators;
  $indicators{995}='  ';
  # now, build existiing item list
- # my $temp = MARCgetbiblio($dbh,$bibid);
- # my @fields = $temp->fields();
  my @fields = $record->fields();
  my %witness; #---- stores the list of subfields used at least once, with the 
"meaning" of the code
--- 133,145 ----
                             });
  
+ # load the biblio to have the title, the biblioitemnumber & any other useful 
field
+ my $record = MARCgetbiblio($dbh,$biblionumber);
+ # warn $record ->as_formatted;
+ # warn "REC ".$record->as_formatted;
+ my $oldrecord = MARCmarc2koha($dbh,$record);
+ 
  my %indicators;
  $indicators{995}='  ';
  # now, build existiing item list
  my @fields = $record->fields();
  my %witness; #---- stores the list of subfields used at least once, with the 
"meaning" of the code
***************
*** 193,197 ****
        my %row_data;
        $row_data{item_value} = $items_data;
!       $row_data{itemnum} = $itemnums[$i];
        #reporting this_row values
        $row_data{'nomod'} = $big_array[$i]{'nomod'};
--- 190,194 ----
        my %row_data;
        $row_data{item_value} = $items_data;
!       $row_data{itemnumber} = $itemnums[$i];
        #reporting this_row values
        $row_data{'nomod'} = $big_array[$i]{'nomod'};
***************
*** 318,325 ****
                                                item_header_loop => 
address@hidden,
                                                biblionumber =>$biblionumber,
                                                title => $oldrecord->{title},
                                                author => $oldrecord->{author},
                                                item => address@hidden,
!                                               itemnum => $itemnum,
                                                itemtagfield => $itemtagfield,
                                                itemtagsubfield 
=>$itemtagsubfield,
--- 315,323 ----
                                                item_header_loop => 
address@hidden,
                                                biblionumber =>$biblionumber,
+                                               biblioitemnumber => 
$oldrecord->{biblioitemnumber},
                                                title => $oldrecord->{title},
                                                author => $oldrecord->{author},
                                                item => address@hidden,
!                                               itemnumber => $itemnumber,
                                                itemtagfield => $itemtagfield,
                                                itemtagsubfield 
=>$itemtagsubfield,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]