koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha C4/Biblio.pm C4/Serials.pm koha-tmpl/intra... [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha C4/Biblio.pm C4/Serials.pm koha-tmpl/intra... [rel_3_0]
Date: Wed, 15 Nov 2006 15:15:51 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      06/11/15 15:15:50

Modified files:
        C4             : Biblio.pm Serials.pm 
        koha-tmpl/intranet-tmpl/prog/en/serials: serials-edit.tmpl 
                                                 subscription-add.tmpl 
                                                 subscription-detail.tmpl 
        serials        : serials-edit.pl subscription-add.pl 
                         subscription-detail.pl 
        updater        : updatedatabase 

Log message:
        Final First Version for New Facility for subscription management.
        
        Now 
        use serials-collection.pl for history display
        and serials-edit.pl for serial edition 
        subscription add and detail adds a new branch information to help 
IndependantBranches Library to manage different subscriptions for a serial
        
        This is aimed at replacing serials-receive and statecollection.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.178.2.21&r2=1.178.2.22
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.5&r2=1.5.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.4&r2=1.3.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.4&r2=1.3.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/serials/serials-edit.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-add.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.4&r2=1.6.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-detail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.3&r2=1.3.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=rel_3_0&r1=1.157.2.19&r2=1.157.2.20

Patches:
Index: C4/Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.178.2.21
retrieving revision 1.178.2.22
diff -u -b -r1.178.2.21 -r1.178.2.22
--- C4/Biblio.pm        15 Nov 2006 14:49:38 -0000      1.178.2.21
+++ C4/Biblio.pm        15 Nov 2006 15:15:50 -0000      1.178.2.22
@@ -44,6 +44,7 @@
   &ModBiblio &ModItem
   &DelBiblio &DelItem
   &ModBiblioframework
+  &PrepareItemrecordDisplay
 
   &updateBiblio &updateBiblioItem &updateItem
   &itemcount &newbiblio &newbiblioitem
@@ -57,6 +58,7 @@
   &getbiblioitembybiblionumber
   &getbibliofromitemnumber
   &GetItemsInfo
+  &GetItemFromBarcode
   &getbiblioitem &getitemsbybiblioitem
   &skip &getitemtypes
   &get_itemnumbers_of
@@ -329,6 +331,7 @@
     }
     # add the item
     my $bib = &MARCadditem( $dbh, $record, $item->{'biblionumber'} );
+    return ($item->{biblionumber}, $item->{biblioitemnumber},$itemnumber);
 }
 
 =head2 ModBiblio
@@ -1462,13 +1465,6 @@
     my $xml= MARC::File::XML::header('UTF-8');
     if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
         MARC::File::XML->default_record_format( 'UNIMARC' );
-    }
-    #$xml =~ s/UTF-8/ISO-8859-1/;
-    my $prevvalue;
-    my $prevtag=-1;
-    my $first=1;
-    my $j = -1;
-#     $xml.="<leader>        a                </leader>";
     use POSIX qw(strftime);
     my $string=strftime ("%Y%m%d",localtime(time));
     $string = sprintf("%-*s",35, $string);
@@ -1476,6 +1472,11 @@
     $xml.="<datafield tag=\"100\" ind1=\"\" ind2=\"\">\n";
     $xml.="<subfield code=\"a\">$string</subfield>\n";
     $xml.="</datafield>\n";
+    }
+    my $prevvalue;
+    my $prevtag=-1;
+    my $first=1;
+    my $j = -1;
     for (my $i=0;$i<address@hidden;$i++){
         @$values[$i] =~ s/&/&amp;/g;
         @$values[$i] =~ s/</&lt;/g;
@@ -1487,7 +1488,6 @@
         }
         if ((@$tags[$i] ne $prevtag)){
             $j++ unless (@$tags[$i] eq "");
-            #warn 
"IND:".substr(@$indicator[$j],0,1).substr(@$indicator[$j],1,1)." 
"address@hidden;
             if (!$first){
                 $xml.="</datafield>\n";
                 if ((@$tags[$i] && @$tags[$i] > 10)  && (@$values[$i] ne "")){
@@ -1809,6 +1809,172 @@
     return 1;
 }
 
+=head2 PrepareItemrecordDisplay
+
+=over 4
+
+PrepareItemrecordDisplay($itemrecord,$bibnum,$itemumber);
+
+Returns a hash with all the fields for Display a given item data in a template
+
+=back
+
+=cut
+sub PrepareItemrecordDisplay{
+      
+  my ($itemnum,$bibnum)address@hidden;
+  
+  my $dbh = C4::Context->dbh;
+  my $frameworkcode = &MARCfind_frameworkcode($dbh,$bibnum);
+  my ($itemtagfield,$itemtagsubfield) = 
&MARCfind_marc_from_kohafield($dbh,"items.itemnumber",$frameworkcode);
+  my $tagslib = &MARCgettagslib($dbh,1,$frameworkcode);
+  my $itemrecord= MARCgetitem($dbh, $itemnum,$bibnum) if ($itemnum);
+  my @loop_data;
+  my $authorised_values_sth = $dbh->prepare("select authorised_value,lib from 
authorised_values where category=? order by lib");
+  foreach my $tag (sort keys %{$tagslib}) {
+       my $previous_tag = '';
+    if ($tag ne ''){
+# loop through each subfield
+    my $cntsubf;
+       foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
+               next if (subfield_is_koha_internal_p($subfield));
+               next if ($tagslib->{$tag}->{$subfield}->{'tab'}  ne "10");
+               my %subfield_data;
+               $subfield_data{tag}=$tag;
+               $subfield_data{subfield}=$subfield;
+               $subfield_data{countsubfield}=$cntsubf++;
+               
$subfield_data{kohafield}=$tagslib->{$tag}->{$subfield}->{'kohafield'};
+#              $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib};
+               $subfield_data{marc_lib}="<span id=\"error\" 
title=\"".$tagslib->{$tag}->{$subfield}->{lib}."\">".substr($tagslib->{$tag}->{$subfield}->{lib},0,12)."</span>";
+               
$subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
+               
$subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
+               $subfield_data{hidden}= "display:none" if 
$tagslib->{$tag}->{$subfield}->{hidden};
+               my ($x,$value);
+               ($x,$value) = _find_value($tag,$subfield,$itemrecord) if 
($itemrecord);
+               $value =~ s/"/&quot;/g;
+               # search for itemcallnumber if applicable
+               if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 
'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) {
+                       my $CNtag = 
substr(C4::Context->preference('itemcallnumber'),0,3);
+                       my $CNsubfield = 
substr(C4::Context->preference('itemcallnumber'),3,1);
+                       my $temp = $itemrecord->field($CNtag) if ($itemrecord);
+                       if ($temp) {
+                               $value = $temp->subfield($CNsubfield);
+                       }
+               }
+               if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
+                       my @authorised_values;
+                       my %authorised_lib;
+                       # builds list, depending on authorised value...
+                       #---- branch
+                       if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} 
eq "branches" ) {
+                               if 
((C4::Context->preference("IndependantBranches")) && 
(C4::Context->userenv->{flags} != 1)){
+                                               my $sth=$dbh->prepare("select 
branchcode,branchname from branches where branchcode = ? order by branchname");
+                                               
$sth->execute(C4::Context->userenv->{branch});
+                                               push @authorised_values, "" 
unless ($tagslib->{$tag}->{$subfield}->{mandatory});
+                                               while (my 
($branchcode,$branchname) = $sth->fetchrow_array) {
+                                                       push 
@authorised_values, $branchcode;
+                                                       
$authorised_lib{$branchcode}=$branchname;
+                                               }
+                               } else {
+                                       my $sth=$dbh->prepare("select 
branchcode,branchname from branches order by branchname");
+                                       $sth->execute;
+                                       push @authorised_values, "" unless 
($tagslib->{$tag}->{$subfield}->{mandatory});
+                                       while (my ($branchcode,$branchname) = 
$sth->fetchrow_array) {
+                                               push @authorised_values, 
$branchcode;
+                                               
$authorised_lib{$branchcode}=$branchname;
+                                       }
+                               }
+                       #----- itemtypes
+                       } elsif 
($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
+                               my $sth=$dbh->prepare("select 
itemtype,description from itemtypes order by description");
+                               $sth->execute;
+                               push @authorised_values, "" unless 
($tagslib->{$tag}->{$subfield}->{mandatory});
+                               while (my ($itemtype,$description) = 
$sth->fetchrow_array) {
+                                       push @authorised_values, $itemtype;
+                                       $authorised_lib{$itemtype}=$description;
+                               }
+                       #---- "true" authorised value
+                       } else {
+                               
$authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
+                               push @authorised_values, "" unless 
($tagslib->{$tag}->{$subfield}->{mandatory});
+                               while (my ($value,$lib) = 
$authorised_values_sth->fetchrow_array) {
+                                       push @authorised_values, $value;
+                                       $authorised_lib{$value}=$lib;
+                               }
+                       }
+                       $subfield_data{marc_value}= 
CGI::scrolling_list(-name=>'field_value',
+                                                                               
                                                                -values=> 
address@hidden,
+                                                                               
                                                                
-default=>"$value",
+                                                                               
                                                                -labels => 
\%authorised_lib,
+                                                                               
                                                                -size=>1,
+                                                                               
                                                                -tabindex=>'',
+                                                                               
                                                                -multiple=>0,
+                                                                               
                                                                );
+               } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) {
+                       $subfield_data{marc_value}="<input type=\"text\" 
name=\"field_value\"  size=47 maxlength=255> <a 
href=\"javascript:Dopop('cataloguing/thesaurus_popup.pl?category=$tagslib->{$tag}->{$subfield}->{thesaurus_category}&index=',)\">...</a>";
+                       #"
+# COMMENTED OUT because No $i is provided with this API.
+# And thus, no value_builder can be activated.
+# BUT could be thought over.
+#              } elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
+#                      my 
$plugin="value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'};
+#                      require $plugin;
+#                      my $extended_param = 
plugin_parameters($dbh,$itemrecord,$tagslib,$i,0);
+#                      my ($function_name,$javascript) = 
plugin_javascript($dbh,$record,$tagslib,$i,0);
+#                      $subfield_data{marc_value}="<input type=\"text\" 
value=\"$value\" name=\"field_value\"  size=47 maxlength=255 DISABLE READONLY 
OnFocus=\"javascript:Focus$function_name()\" 
OnBlur=\"javascript:Blur$function_name()\"> <a 
href=\"javascript:Clic$function_name()\">...</a> $javascript";
+               } else {
+                       $subfield_data{marc_value}="<input type=\"text\" 
name=\"field_value\" value=\"$value\" size=50 maxlength=255>";
+               }
+               push(@loop_data, \%subfield_data);
+       }
+    }
+  }
+  my $itemnumber=$itemrecord->subfield($itemtagfield,$itemtagsubfield) if 
($itemrecord && $itemrecord->field($itemtagfield));
+  return {'itemtagfield'=>$itemtagfield,
+          'itemtagsubfield'=>$itemtagsubfield,
+          'itemnumber'=>$itemnumber,
+          'iteminformation'=>address@hidden;
+}
+
+
+=item _find_value
+
+    ($indicators, $value) = _find_value($tag, $subfield, $record,$encoding);
+
+Find the given $subfield in the given $tag in the given
+MARC::Record $record.  If the subfield is found, returns
+the (indicators, value) pair; otherwise, (undef, undef) is
+returned.
+
+PROPOSITION :
+Such a function is used in addbiblio AND additem and serial-edit and maybe 
could be used in Authorities.
+I suggest we export it from this module.
+=cut
+
+sub _find_value {
+       my ($tagfield,$insubfield,$record,$encoding) = @_;
+       my @result;
+       my $indicator;
+       if ($tagfield <10) {
+               if ($record->field($tagfield)) {
+                       push @result, $record->field($tagfield)->data();
+               } else {
+                       push @result,"";
+               }
+       } else {
+               foreach my $field ($record->field($tagfield)) {
+                       my @subfields = $field->subfields();
+                       foreach my $subfield (@subfields) {
+                               if (@$subfield[0] eq $insubfield) {
+                                       push @result,@$subfield[1];
+                                       $indicator = 
$field->indicator(1).$field->indicator(2);
+                               }
+                       }
+               }
+       }
+       return($indicator,@result);
+}
+
 sub NEWmodbiblio {
     my ($record,$bibid,$frameworkcode) address@hidden;
     my $dbh = C4::Context->dbh;
@@ -1945,6 +2111,19 @@
 &MARCaddbiblio($dbh,$newrec,$bibid,);
 }
 
+=head2 GetItemFromBarcode
+
+=cut
+sub GetItemFromBarcode {
+    my ($barcode)address@hidden;
+    my $dbh=C4::Context->dbh;
+       my $result;
+    my $rq=$dbh->prepare("SELECT itemnumber from items where items.barcode=?");
+    $rq->execute($barcode);
+    my ($result)=$rq->fetchrow;
+       return($result);
+}
+
 =head1 INTERNAL FUNCTIONS
 
 =head2 _koha_add_biblio
@@ -3862,8 +4041,18 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.178.2.21 2006/11/15 14:49:38 tipaul Exp $
+# $Id: Biblio.pm,v 1.178.2.22 2006/11/15 15:15:50 hdl Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.178.2.22  2006/11/15 15:15:50  hdl
+# Final First Version for New Facility for subscription management.
+#
+# Now
+# use serials-collection.pl for history display
+# and serials-edit.pl for serial edition
+# subscription add and detail adds a new branch information to help 
IndependantBranches Library to manage different subscriptions for a serial
+#
+# This is aimed at replacing serials-receive and statecollection.
+#
 # Revision 1.178.2.21  2006/11/15 14:49:38  tipaul
 # in some cases, there are invalid utf8 chars in XML (at least in SANOP). this 
commit remove them on the fly.
 # Not sure it's a good idea to keep them in biblio.pm, let me know your 
opinion on koha-devel if you think it's a bad idea...

Index: C4/Serials.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Serials.pm,v
retrieving revision 1.5.2.5
retrieving revision 1.5.2.6
diff -u -b -r1.5.2.5 -r1.5.2.6
--- C4/Serials.pm       13 Nov 2006 09:33:20 -0000      1.5.2.5
+++ C4/Serials.pm       15 Nov 2006 15:15:50 -0000      1.5.2.6
@@ -17,12 +17,13 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Serials.pm,v 1.5.2.5 2006/11/13 09:33:20 hdl Exp $
+# $Id: Serials.pm,v 1.5.2.6 2006/11/15 15:15:50 hdl Exp $
 
 use strict;
 use C4::Date;
 use Date::Manip;
 use C4::Suggestions;
+use C4::Koha;
 use C4::Biblio;
 use C4::Search;
 use C4::Letters;
@@ -31,7 +32,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.5.2.5 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.5.2.6 $' =~ /\d+/g;
         shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 
@@ -61,7 +62,7 @@
     &GetNextSeq         &NewIssue           &ItemizeSerials    &GetSerials
     &GetLatestSerials   &ModSerialStatus    &GetNextDate
     &ReNewSubscription  &GetLateIssues      &GetMissingIssues
-    &GetSerialInformation
+    &GetSerialInformation                   &AddItem2Serial
     
     &GetSuppliersWithLateIssues             &getsupplierbyserialid
     &GetDistributedTo   &SetDistributedTo
@@ -230,28 +231,64 @@
     my ($serialid)address@hidden;
     my $dbh = C4::Context->dbh;
     my $query = qq|
-        SELECT serial.*,subscription.*
+        SELECT serial.*, serial.status as 
serstatus,subscription.*,subscription.subscriptionid as subsid
         FROM   serial LEFT JOIN subscription ON 
subscription.subscriptionid=serial.subscriptionid
         WHERE  serialid = ?
     |;
     my $rq=$dbh->prepare($query);
     $rq->execute($serialid);
     my $data=$rq->fetchrow_hashref;
+
     if (C4::Context->preference("serialsadditems")){
+      if ($data->{'itemnumber'}){
       my @itemnumbers= split /,/,$data->{'itemnumber'};
       foreach my $itemnum (@itemnumbers){
       #It is ASSUMED that MARCgetitem ALWAYS WORK... 
       #Maybe MARCgetitem should return values on failure
-        my 
$itemrecord=MARCgetitem($dbh,$data->{'subscription.biblionumber'},$itemnum);
-        push 
@{$data->{'items'}},{'record'=>MARCgetitem($dbh,$data->{'subscription.biblionumber'},$itemnum)};
+          my 
$itemprocessed=PrepareItemrecordDisplay($data->{'biblionumber'},$itemnum);
+          $itemprocessed->{'itemnumber'}=$itemnum;
+          $itemprocessed->{'itemid'}=$itemnum;
+          $itemprocessed->{'serialid'}=$serialid;
+          $itemprocessed->{'biblionumber'}=$data->{'biblionumber'};
+          push @{$data->{'items'}},$itemprocessed;
+        }
+      } else {
+        my $itemrecord;
+        my $itemprocessed=PrepareItemrecordDisplay($data->{'biblionumber'});
+        $itemprocessed->{'itemid'}="N$serialid";
+        $itemprocessed->{'serialid'}=$serialid;
+        $itemprocessed->{'biblionumber'}=$data->{'biblionumber'};
+        $itemprocessed->{'countitems'}=0;
+        push @{$data->{'items'}},$itemprocessed;
       }
    }
-   $data->{"status".$data->{status}}=1;
+   $data->{"status".$data->{'serstatus'}}=1;
    $data->{'subscriptionexpired'} = 
HasSubscriptionExpired($data->{'subscriptionid'});
    $data->{'subscriptionaboutexpire'} = 
abouttoexpire($data->{'subscriptionid'});
    return $data;
 }
 
+=head2 GetSerialInformation
+
+=over 4
+
+$data = AddItem2Serial($serialid,$itemnumber);
+Adds an itemnumber to Serial record
+=back
+
+=cut
+sub AddItem2Serial{
+    my ($serialid,$itemnumber)address@hidden;
+    my $dbh = C4::Context->dbh;
+    my $query = qq|
+        UPDATE serial SET itemnumber=IF(itemnumber IS NULL, $itemnumber, 
CONCAT(itemnumber,",",$itemnumber))
+        WHERE  serialid = ?
+    |;
+    my $rq=$dbh->prepare($query);
+    $rq->execute($serialid);
+   return $rq->rows;
+}
+
 =head2 GetSubscription
 
 =over 4
@@ -866,7 +903,7 @@
         $sth->execute($subscriptionid);
         my ($missinglist,$recievedlist) = $sth->fetchrow;
         if ($status eq 2) {
-            warn "receivedlist : $recievedlist serialseq :$serialseq, 
".index("$recievedlist","$serialseq");
+#             warn "receivedlist : $recievedlist serialseq :$serialseq, 
".index("$recievedlist","$serialseq");
             $recievedlist .= ",$serialseq" unless 
(index("$recievedlist","$serialseq")>=0);
         }
         warn "missinglist : $missinglist serialseq :$serialseq, 
".index("$missinglist","$serialseq");

Index: koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/Attic/serials-edit.tmpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl   13 Nov 2006 
09:33:20 -0000      1.1.2.1
+++ koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl   15 Nov 2006 
15:15:50 -0000      1.1.2.2
@@ -6,13 +6,17 @@
 
 <!--------------------------MAIN BODY OF PAGE-------------------------->
 <h1>Serial Edition: <!-- TMPL_VAR name="bibliotitle" --></h1>
-<form method="post" name="f" action="serials-edit.pl" onsubmit="return 
barcode_check()">
+<form method="post" name="f" action="serials-edit.pl" >
+<!--onsubmit="return barcode_check()">-->
 <div id="action">
-    <input type="button" value="Save"  onClick="Check(this.form)" 
accesskey="w" />
+    <input type="submit" value="Save"  class="button" accesskey="w" /> 
<!--onClick="Check(this.form)" -->
     <a href="subscription-detail.pl?subscriptionid=<!-- TMPL_VAR 
name="subscriptionid" -->" title="detail of the subscription">Subscription 
Details</a>
     <!-- <a href="/cgi-bin/koha/serials/serials-home.pl?biblionumber=<!-- 
TMPL_VAR name="biblionumber" -->" class="button" title="all subscriptions on 
<!-- TMPL_VAR name="bibliotitle" -->">Search All Subscriptions</a> -->
-    <a href="/cgi-bin/koha/detail.pl?bib=<!-- TMPL_VAR name="biblionumber" 
-->" title="go to <!-- TMPL_VAR name="bibliotitle" -->">Show Biblio</a>
+    <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?bib=<!-- TMPL_VAR 
name="biblionumber" -->" title="go to <!-- TMPL_VAR name="bibliotitle" 
-->">Show Biblio</a>
 </div>
+<!--TMPL_IF Name="barcode_not_unique" -->
+Error : Barcode Not Unique For serialseq <!--TMPL_VAR Name="errserialseq"-->
+<!--/TMPL_IF -->
 
   <input type="hidden" name="op" value="serialchangestatus">
        <table cellspacing="0" cellpadding="0" border="0" class="collapse">
@@ -50,7 +54,7 @@
             <input type="text" name="planneddate" value="<!-- TMPL_VAR 
name="planneddate" -->" size=10 maxlength=15>
         </td>
         <td>
-            <select name="status" size="1" id="status<!-- TMPL_VAR NAME="num" 
-->">
+            <select name="status" size="1" id="status<!-- TMPL_VAR NAME="num" 
-->" OnChange="javascript:if (this.value==2){unHideItems('items'+<!-- TMPL_VAR 
NAME="serialid" -->,'label<!--TMPL_VAR Name="serialid"-->')}">
   <!--TMPL_IF name="status1" -->
                     <option value="1" selected>Waited</option>
   <!-- /TMPL_IF -->
@@ -87,7 +91,6 @@
         </td>
     </tr>
   <!--TMPL_IF Name="serialsadditems"-->
-<!-- Exemple de possibilite -->
           <tr>
           <td colspan="5">
       <a id="label<!--TMPL_VAR Name="serialid"-->" style="color: grey; 
font-size: 80%; cursor: se-resize;"  onclick="unHideItems('items<!--TMPL_VAR 
Name="serialid"-->','label<!--TMPL_VAR Name="serialid"-->')">
@@ -97,123 +100,38 @@
                 Items</a>
         </legend>
           <div id="cataloguing_additem_itemlist">
-        <input type="hidden" name="itemnumber" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
-        Saisir ici les informations de l'exemplaire.
-        Avantage : <br />
-        - Lien avec l'exemplaire assez imm&eacute;diat.<br />
-        -  + visuel.<br />
-        Par javascript, on peut mettre &agrave; jour les champs attaches a 
serialseq et notes.
-        On a un seul formulaire dans la page
-        Inconvenient : Impossible a coder avec notre facon habituelle de 
saisir les exemplaires.
-        Il faudrait avoir une liste de hash directement renvoyee par le 
CGI.<br />
-        Seule possibilite que j'entrevoie :Mettre un attribut a chaque 
sous-champ.<br />
-        Puis reconstruire un HASH des donnees TAG/subfield/value<br />
-        input type="hidden" name="serial" value="<!-- TMPL_VAR NAME="serialid" 
-->" /
-        <table>
-        <tr>
+        <!-- TMPL_LOOP NAME="items" -->
+        <div id="item<!-- TMPL_VAR NAME="serialid" --><!-- TMPL_VAR 
NAME="countitems" -->" class="items">
         <!-- TMPL_LOOP NAME="iteminformation" -->
-            <td>
-                <label><!-- TMPL_VAR NAME="subfield" --> - <!-- TMPL_IF 
name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!-- 
TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label>
+        <div id="subfield<!-- TMPL_VAR NAME="serialid" --><!-- TMPL_VAR 
NAME="countitems" --><!-- TMPL_VAR NAME="countsubfield" -->" class="subfield">  
              <label><!-- TMPL_VAR NAME="subfield" --> - <!-- TMPL_IF 
name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!-- 
TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label>
                 <!-- TMPL_VAR NAME="marc_value" -->
-                <input type="hidden" name="itemnum" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
+                <input type="hidden" name="itemid" value="<!-- TMPL_VAR 
NAME="itemid" -->" />
+                <input type="hidden" name="kohafield" value="<!-- TMPL_VAR 
NAME="kohafield" -->" />
                 <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="tag" -->" />
                 <input type="hidden" name="subfield" value="<!-- TMPL_VAR 
NAME="subfield" -->" />
                 <input type="hidden" name="mandatory" value="<!-- TMPL_VAR 
NAME="mandatory" -->" />
-            </td>
+            </div>
         <!-- /tmpl_loop -->
         
         <input type="hidden" name="moditem" value="" /> 
         <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="itemtagfield" -->" />
         <input type="hidden" name="subfield" value="<!-- TMPL_VAR 
NAME="itemtagsubfield" -->" />
         <input type="hidden" name="serial" value="<!-- TMPL_VAR 
NAME="serialid" -->" />
-        <input type="hidden" name="itemnum" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
+        <input type="hidden" name="bibnum" value="<!-- TMPL_VAR 
NAME="biblionumber" -->" />
+        <input type="hidden" name="itemid" value="<!-- TMPL_VAR NAME="itemid" 
-->" />
         <input type="hidden" name="field_value" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
-        </tr>
-        </table>
-
+        </div>
+        <!--/TMPL_LOOP-->
         </div>
         </fieldset>
     </td>
     </tr>
-<!-- Exemple de possibilite -->
   <!-- /TMPL_IF -->
 <!-- /TMPL_LOOP -->
 </table>
 </div>
-  <!--TMPL_IF Name="serialsadditems"-->
-<!-- Autre solution -->
-<div id="edititems">
-  <a id="label" style="color: grey; font-size: 80%; cursor: se-resize;"  
onclick="unHideItems('items','label')">
-    Items
-  </a>
-  <fieldset style="display:none;" id="items">
-  <legend>  <a style="cursor: se-resize;"  
onclick="HideItems('items','label')">
-Items  </a>
-  </legend>
-    <div id="cataloguing_additem_itemlist">
-      <form method="post" action="additem.pl" name="f">
-      <input type="hidden" name="op" value="<!-- TMPL_VAR NAME="op" -->" />
-      <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR 
NAME="biblionumber" -->" />
-      On affiche d'abord un tableau des exemplaires de la liste des bulletins.
-      Et on a le meme formulaire que pour la page d'ajout des exemplaires.<br 
/>
-      Inconvenient : Le lien entre les informations de l'exemplaire et celle 
de serial risque d'etre beaucoup plus  virtuel qu'autre chose.
-      
-      <!-- TMPL_IF name="item_loop" -->
-          <h2>Existing items</h2>
-          <table>
-              <tr>
-                  <!-- TMPL_LOOP NAME="item_header_loop" -->
-                      <th>
-                          <!-- TMPL_VAR NAME="header_value" -->
-                      </th>
-                  <!-- /TMPL_LOOP -->
-                  <th colspan="2">&nbsp;</th>
-              </tr>
-                  <!-- TMPL_LOOP NAME="item_loop" -->
-                  <tr>
-                      <!-- TMPL_VAR NAME="item_value" -->
-                      <td><a 
href="additem.pl?op=edititem&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" 
-->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">Edit</a></td>
-                      <td><a href="javascript:confirm_deletion(<!-- TMPL_VAR 
NAME="biblionumber" -->,<!-- TMPL_VAR NAME="itemnumber" -->)">Delete</a></td>
-                  </tr>
-                  <!-- /TMPL_LOOP -->
-          </table>
-          </form>
-          </div>
-      <!-- /TMPL_IF -->
-  </div>
+</form>
   
-    <div id="cataloguing_additem_newitem">
-        <!-- TMPL_IF name="opisadd" -->
-            <h2>Add Item</h2>
-        <!-- TMPL_ELSE -->
-            <h2>Edit Item</h2>
-        <!-- /TMPL_IF -->      
-            <!-- TMPL_LOOP NAME="item" -->
-                <p>
-                    <label><!-- TMPL_VAR NAME="subfield" --> - <!-- TMPL_IF 
name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!-- 
TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label>
-                    <!-- TMPL_VAR NAME="marc_value" -->
-                    <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="tag" -->" />
-                    <input type="hidden" name="subfield" value="<!-- TMPL_VAR 
NAME="subfield" -->" />
-                    <input type="hidden" name="mandatory" value="<!-- TMPL_VAR 
NAME="mandatory" -->" />
-                </p>
-            <!-- /tmpl_loop -->
-        <input type="hidden" name="itemnumber" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
-        <!-- TMPL_IF name="barcode_not_unique" -->
-            ERROR : Barcode already exists !
-        <!-- /TMPL_IF -->
-        <!-- TMPL_IF name="opisadd" -->
-        <input type="button" value="Add item"  onClick="Check(this.form)" 
accesskey="w" />
-        <!-- TMPL_ELSE -->
-        <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="itemtagfield" -->" />
-        <input type="hidden" name="subfield" value="<!-- TMPL_VAR 
NAME="itemtagsubfield" -->" />
-        <input type="hidden" name="field_value" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
-        <input type="button" value="Save Changes" onClick="Check(this.form)" 
accesskey="w" />
-        <!-- /TMPL_IF -->
-        </form>
-    </div>
-  </fieldset>
-</div>
-  <!--/TMPL_IF-->
 <script language="JavaScript" type="text/javascript">
 
 function popup() {

Index: koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -u -b -r1.3.2.4 -r1.3.2.5
--- koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl       30 Oct 
2006 15:12:34 -0000      1.3.2.4
+++ koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl       15 Nov 
2006 15:15:50 -0000      1.3.2.5
@@ -671,6 +671,17 @@
             <td><input type="text" name="callnumber" value="<!-- TMPL_VAR 
name="callnumber" -->" size="20"></td>
         </tr>
         <tr>
+            <td>Branch</td>
+            <td>
+                <select name="branchcode">
+                    <option value="">Any branch</option>
+                    <!-- TMPL_LOOP name="branchloop" -->
+                        <option value="<!-- TMPL_VAR name="value" -->" <!-- 
TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR 
name="branchname" --></option>
+                    <!-- /TMPL_LOOP -->
+                </select> (select a branch)
+            </td>
+        </tr>
+        <tr>
             <td><label>Notes</label></td>
             <td><textarea name="notes" cols="30" rows="2"><!-- TMPL_VAR 
name="notes" --></textarea></td>
         </tr>

Index: koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -u -b -r1.3.2.4 -r1.3.2.5
--- koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl    2 Nov 
2006 17:32:55 -0000       1.3.2.4
+++ koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl    15 Nov 
2006 15:15:50 -0000      1.3.2.5
@@ -139,7 +139,7 @@
         <a href="subscription-add.pl?op=mod&amp;subscriptionid=<!-- TMPL_VAR 
name="subscriptionid" -->">Edit</a>
         <a href="serials-recieve.pl?subscriptionid=<!-- TMPL_VAR 
name="subscriptionid" -->">Receive</a>
         <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?bib=<!-- TMPL_VAR 
name="biblionumber" -->">Biblio</a>
-        <a href="/cgi-bin/koha/serials/serial-issues.pl?biblionumber=<!-- 
TMPL_VAR name="biblionumber" -->">Serial issues</a>
+        <a href="/cgi-bin/koha/serials/serials-collection.pl?biblionumber=<!-- 
TMPL_VAR name="biblionumber" -->">Serial issues</a>
         <!-- TMPL_IF NAME="routing" -->
         <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=<!-- TMPL_VAR 
NAME="subscriptionid" -->">Edit Routing List</a>
         <!-- TMPL_ELSE -->
@@ -157,6 +157,7 @@
         <p><label>Librarian identity:</label> <!-- TMPL_VAR name="librarian" 
--></p>
         <p><label>Supplier:</label> <a 
href="/cgi-bin/koha/acqui/supplier.pl?id=<!-- TMPL_VAR 
name="aqbooksellerid"-->"><!-- TMPL_VAR name="aqbooksellername" 
-->&nbsp;</a></p>
         <p><label>Biblio:</label> <i>(<!-- TMPL_VAR name="biblionumber" 
-->)</i> <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?bib=<!-- TMPL_VAR 
name="biblionumber" -->"><!-- TMPL_VAR name="bibliotitle" --></a></p><br />
+        <p><label>Branch :</label> <!-- TMPL_VAR name="branchcode" 
-->&nbsp;</p>
         <p><label>Call Number:</label> <!-- TMPL_VAR name="callnumber" 
-->&nbsp;</p>
         <p><label>Patron alert with:</label> <!-- TMPL_VAR name="letter" 
-->&nbsp;</p>
         <p><label>Notes:</label> <!-- TMPL_VAR name="notes" --></p>

Index: serials/serials-edit.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/Attic/serials-edit.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- serials/serials-edit.pl     13 Nov 2006 09:33:20 -0000      1.1.2.1
+++ serials/serials-edit.pl     15 Nov 2006 15:15:50 -0000      1.1.2.2
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: serials-edit.pl,v 1.1.2.1 2006/11/13 09:33:20 hdl Exp $
+# $Id: serials-edit.pl,v 1.1.2.2 2006/11/15 15:15:50 hdl Exp $
 
 =head1 NAME
 
@@ -75,30 +75,37 @@
 use C4::Serials;
 
 my $query = new CGI;
-my $op = $query->param('op');
 my $dbh = C4::Context->dbh;
 my @serialids = $query->param('serialid');
-# my $auser = $query->param('user');
 my @serialseqs = $query->param('serialseq');
 my @planneddates = $query->param('planneddate');
 my @publisheddates = $query->param('publisheddate');
 my @status = $query->param('status');
 my @notes = $query->param('notes');
 my @subscriptionids = $query->param('subscriptionid');
-my @moditems = $query->param('moditem');
+my $op = $query->param('op');
+warn "op : $op";
+
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "serials/serials-edit.tmpl",
+                query => $query,
+                type => "intranet",
+                authnotrequired => 0,
+                flagsrequired => {catalogue => 1},
+                debug => 1,
+                });
 
 my @serialdatalist;
 foreach my $tmpserialid (@serialids){
   my $data=GetSerialInformation($tmpserialid);
   push @serialdatalist,$data;
 }
-# change status except, if subscription has expired, for the "waited" issue.
+
 if ($op eq 'serialchangestatus') {
-    my $sth = $dbh->prepare("select status from serial where serialid=?");
+#     my $sth = $dbh->prepare("select status from serial where serialid=?");
     for (my $i=0;$i<=$#serialids;$i++) {
-        $sth->execute($serialids[$i]);
-        
-        my ($oldstatus) = $sth->fetchrow;
+#         $sth->execute($serialids[$i]);
+#         my ($oldstatus) = $sth->fetchrow;
         if ($serialids[$i]) {
             ModSerialStatus($serialids[$i],
                             $serialseqs[$i],
@@ -108,95 +115,95 @@
                             $notes[$i]);
         }
     }
-    print 
$query->redirect("serials-collection.pl?biblionumber=".$serialdatalist[0]->{biblionumber});
-}
-my ($template, $loggedinuser, $cookie)
-= get_template_and_user({template_name => "serials/serials-edit.tmpl",
-                query => $query,
-                type => "intranet",
-                authnotrequired => 0,
-                flagsrequired => {catalogue => 1},
-                debug => 1,
-                });
-
-foreach my $tmpserialid (@serialids){
-#   my $data=GetSerialInformation($tmpserialid);
-#   push @serialdatalist,$data;
+    use Data::Dumper;
   if (C4::Context->preference("serialsadditems")){
-      my 
$fwk=MARCfind_frameworkcode($dbh,$serialdatalist[0]->{'biblionumber'});
-      my $branches = GetBranches;
-      my @branchloop;
-      foreach my $thisbranch (keys %$branches) {
-          my $selected = 0;
-  #         if($thisbranch eq $solhistory->{'lastbranch'}){
-#           $selected = 1;
-#           }
-          my %row =(value => $thisbranch,
-                  branchname => $branches->{$thisbranch}->{'branchname'},
-                  selected => $selected,
-                  );
-          push @branchloop, \%row;
+      my @moditems = $query->param('moditem');
+      my @tags = $query->param('tag');
+      my @subfields = $query->param('subfield');
+      my @field_values = $query->param('field_value');
+      my @serials = $query->param('serial');
+      my @bibnums = $query->param('bibnum');
+      my @itemid = $query->param('itemid');
+      my @ind_tag = $query->param('ind_tag');
+      my @indicator = $query->param('indicator');
+      #Rebuilding ALL the data for items into a hash
+      # parting them on $itemid.
+      my %itemhash;
+      my $countdistinct;
+      my $range=scalar(@itemid);
+      for (my $i=0; $i<$range; $i++){
+        unless ($itemhash{$itemid[$i]}){
+          $itemhash{$itemid[$i]}->{'bibnum'}=$bibnums[$countdistinct];
+          $itemhash{$itemid[$i]}->{'serial'}=$serials[$countdistinct];
+          $countdistinct++;
+        }
+        push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i];
+        push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i];
+        push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i];
+        push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i];
+        push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i];
+      }
+      foreach my $item (keys %itemhash){
+        # Verify Itemization is "Valid", i.e. serial status is Arrived or 
Missing
+        my $index;
+        for (my $i=0; $i<scalar(@serialids);$i++){
+          $index = $i if ($itemhash{$item}->{'serial'} eq $serialids[$i]);
+        }
+        if ($status[$index]==2){
+          my $xml = MARChtml2xml( $itemhash{$item}->{'tags'},
+                                  $itemhash{$item}->{'subfields'},
+                                  $itemhash{$item}->{'field_values'},
+                                  $itemhash{$item}->{'ind_tag'},
+                                  $itemhash{$item}->{'indicator'});
+          warn $xml;
+          my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
+          if ($item=~/^N/){
+            #New Item
+            # if autoBarcode is ON, calculate barcode...
+            my ($tagfield,$tagsubfield) = 
&MARCfind_marc_from_kohafield($dbh,"items.barcode");
+            if (C4::Context->preference('autoBarcode')) {
+              unless ($record->field($tagfield)->subfield($tagsubfield)) {
+                my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from 
items");
+                $sth_barcode->execute;
+                my ($newbarcode) = $sth_barcode->fetchrow;
+                $newbarcode++;
+                # OK, we have the new barcode, now create the entry in MARC 
record
+                my $fieldItem = $record->field($tagfield);
+                $record->delete_field($fieldItem);
+                $fieldItem->add_subfields($tagsubfield => $newbarcode);
+                $record->insert_fields_ordered($fieldItem);
+              }
+            }
+            # check for item barcode # being unique
+            my $exists = 
GetItemFromBarcode($record->subfield($tagfield,$tagsubfield)) if 
($record->subfield($tagfield,$tagsubfield));
+  #           push @errors,"barcode_not_unique" if($exists);
+            $template->param("barcode_not_unique" => 
1,'errserialseq'=>$serialseqs[$index]);
+            # if barcode exists, don't create, but report The problem.
+            unless ($exists){
+              my ($biblionumber,$bibitemnum,$itemnumber) = 
AddItem($dbh,$record,$itemhash{$item}->{'bibnum'});
+              AddItem2Serial($itemhash{$item}->{'serial'},$itemnumber);
+              print 
$query->redirect("serials-collection.pl?biblionumber=".$serialdatalist[0]->{biblionumber});
+            }
+          } else {
+            #modify item
+            my ($oldbiblionumber,$oldbibnum,$itemnumber) = 
ModItem($dbh,$record,$itemhash{$item}->{'bibnum'},$item,0);
+            print 
$query->redirect("serials-collection.pl?biblionumber=".$serialdatalist[0]->{biblionumber});
+        }
       }
-      my $itemstatushash = GetItemStatus($fwk);
-      my @itemstatusloop;
-          my $itemstatusloopcount=0;    
-      foreach my $thisitemstatus (keys %$itemstatushash) {
-          my %row =(itemval => $thisitemstatus,
-                      itemlib => $itemstatushash->{$thisitemstatus},
-                  );
-  #            warn "".$row{'itemval'}.", ". $row{"itemlib"};
-                  $itemstatusloopcount++;
-          push @itemstatusloop, \%row;
-      }
-      my $itemlocationhash = GetItemLocation($fwk);
-      my @itemlocationloop;
-      foreach my $thisitemlocation (keys %$itemlocationhash) {
-          my %row =(value => $thisitemlocation,
-                      itemlocationname => 
$itemlocationhash->{$thisitemlocation},
-                  );
-          push @itemlocationloop, \%row;
       }
-  
-          my $choice = 0;
-          if($itemstatusloopcount == 1){ $choice = 1;}   
-          foreach my $data (@serialdatalist){
-              if 
(scalar(@itemstatusloop)){$data->{"itemstatusloop"address@hidden;}
-              else { $data->{"itemstatusloop"}=[];}
-              if 
(scalar(@itemlocationloop)){$data->{"itemlocationloop"address@hidden;}
-              else {$data->{"itemlocationloop"}=[];}
-              $data->{"branchloop"address@hidden ;
-      }
-  # warn "Choice: $choice";
-      $template->param(choice => $choice);    
-      $template->param(serialsadditems 
=>C4::Context->preference("serialsadditems"),
-                      branchloop => address@hidden,
-                      ) ;
-      $template->param(itemstatus=>1,itemstatusloop=>address@hidden) if 
(scalar(@itemstatusloop));
-      $template->param(itemlocation=>1,itemlocationloop=>address@hidden) if 
(scalar(@itemlocationloop));
-  }else{
-      $template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) 
;
   }
 }
 
+$template->param(serialsadditems =>C4::Context->preference("serialsadditems"));
+
 
 
 $template->param(
-#             user => $auser,
+            biblionumber =>$serialdatalist[0]->{'biblionumber'},
+            subscriptionid =>$serialdatalist[0]->{'subsid'},
             serialslist => address@hidden,
-#             count => $count,
-#             biblionumber => $subscription->{biblionumber},
-#             histstartdate => format_date($solhistory->{'histstartdate'}),
-#             enddate => format_date($solhistory->{'enddate'}),
-#             subscriptionid => $subscriptionid,
-#             hassubscriptionexpired =>$hassubscriptionexpired,
-#             abouttoexpire =>$abouttoexpire,    
             intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
             intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
             IntranetNav => C4::Context->preference("IntranetNav"),
-#             routing => $routing,
-#             missingseq => $manualissue,
-#             frommissing => $manualstatus,
-#             missingdate => $manualdate,
-#             missingid => $manualid,
         );
 output_html_with_http_headers $query, $cookie, $template->output;

Index: serials/subscription-add.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/subscription-add.pl,v
retrieving revision 1.6.2.4
retrieving revision 1.6.2.5
diff -u -b -r1.6.2.4 -r1.6.2.5
--- serials/subscription-add.pl 30 Oct 2006 15:16:43 -0000      1.6.2.4
+++ serials/subscription-add.pl 15 Nov 2006 15:15:50 -0000      1.6.2.5
@@ -32,7 +32,7 @@
 my $query = new CGI;
 my $op = $query->param('op');
 my $dbh = C4::Context->dbh;
-my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, 
$aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
+my ($subscriptionid,$auser,$branchcode,$librarian,$cost,$aqbooksellerid, 
$aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
        $firstacquidate, $dow, $irregularity, $numberpattern, $numberlength, 
$weeklength, $monthlength, $sublength,
        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
@@ -76,7 +76,7 @@
 my @sub_type_data;
 if ($op eq 'mod') {
     my $subscriptionid = $query->param('subscriptionid');
-    warn "irregularity :$irregularity numberpattern : $numberpattern, 
callnumber :$callnumber, firstacquidate :$firstacquidate";
+#     warn "irregularity :$irregularity numberpattern : $numberpattern, 
callnumber :$callnumber, firstacquidate :$firstacquidate";
     my $subs = &GetSubscription($subscriptionid);
     $auser = $subs->{'user'};
     $librarian => $subs->{'librarian'},
@@ -206,6 +206,18 @@
 }
 $template->param(letterloop => address@hidden);
 
+my $branches = GetBranches();
+my @branchloop;
+foreach my $thisbranch (keys %$branches) {
+    my $selected = 1 if $thisbranch eq C4::Context->userenv->{'branch'};
+    my %row =(value => $thisbranch,
+                selected => $selected,
+                branchname => $branches->{$thisbranch}->{'branchname'},
+            );
+    push @branchloop, \%row;
+}
+$template->param(branchloop => address@hidden);
+
 if ($op eq 'addsubscription') {
     my @irregular = $query->param('irregular');
     my $irregular_count = @irregular;
@@ -215,6 +227,7 @@
     $irregularity =~ s/\|$//;
 
     my $auser = $query->param('user');
+    my $branchcode = $query->param('branchcode');
     my $aqbooksellerid = $query->param('aqbooksellerid');
     my $cost = $query->param('cost');
     my $aqbudgetid = $query->param('aqbudgetid'); 
@@ -261,7 +274,7 @@
        my $letter = $query->param('letter');
     ### BugFIX : hdl doesnot know what innerloops or letter stand for but it 
seems necessary. So he adds them.
     my ($innerloop1,$innerloop2,$innerloop3);
-       my $subscriptionid = 
NewSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
+       my $subscriptionid = 
NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
                                        
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
                                        
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
                                        
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,

Index: serials/subscription-detail.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/subscription-detail.pl,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -b -r1.3.2.3 -r1.3.2.4
--- serials/subscription-detail.pl      30 Oct 2006 10:22:46 -0000      1.3.2.3
+++ serials/subscription-detail.pl      15 Nov 2006 15:15:50 -0000      1.3.2.4
@@ -132,6 +132,7 @@
 $template->param(
     routing => $routing,
     user => $subs->{auser},
+    branchcode => $subs->{branchcode},
     librarian => $subs->{librarian},
     aqbooksellerid => $subs->{aqbooksellerid},
     aqbooksellername => $subs->{aqbooksellername},

Index: updater/updatedatabase
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase,v
retrieving revision 1.157.2.19
retrieving revision 1.157.2.20
diff -u -b -r1.157.2.19 -r1.157.2.20
--- updater/updatedatabase      14 Nov 2006 16:28:01 -0000      1.157.2.19
+++ updater/updatedatabase      15 Nov 2006 15:15:50 -0000      1.157.2.20
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.157.2.19 2006/11/14 16:28:01 rych Exp $
+# $Id: updatedatabase,v 1.157.2.20 2006/11/15 15:15:50 hdl Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -210,7 +210,7 @@
 );
 
 my %requirefields = (
-       subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text 
NULL', 'firstacquidate'=>'date NOT NULL','irregularity'=>'TINYINT(3) NULL 
default 0','numberpattern'=>'TINYINT(3) NULL default 0', 'callnumber'=>'text 
NULL', 'hemisphere' =>'TINYINT(3) NULL default 0', 'issuesatonce'=>'TINYINT(3) 
NOT NULL default 1'},
+       subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text 
NULL', 'firstacquidate'=>'date NOT NULL','irregularity'=>'TINYINT(3) NULL 
default 0','numberpattern'=>'TINYINT(3) NULL default 0', 'callnumber'=>'text 
NULL', 'hemisphere' =>'TINYINT(3) NULL default 0', 'issuesatonce'=>'TINYINT(3) 
NOT NULL default 1',  'branchcode' =>'varchar(12) NOT NULL default \'\''},
        itemtypes => { 'imageurl' => 'char(200) NULL'},
        aqbookfund => { 'branchcode' => 'varchar(4) NULL'},
        aqbudget => { 'branchcode' => 'varchar(4) NULL'},
@@ -218,6 +218,10 @@
        auth_subfield_structure =>{ 'hidden' => 'TINYINT(3) NOT NULL default 
0', 'kohafield' => 'VARCHAR(45) NOT NULL', 'linkid' =>  'TINYINT(1) NOT NULL 
default 0', 'isurl' => 'TINYINT(1)', 'frameworkcode'=>'VARCHAR(8) NOT  NULL'},
        serial =>{ 'publisheddate' => 'date', 'itemnumber'=>'text 
NULL','routingnotes'=>'text NULL',},
     statistics => { 'associatedborrower' => 'integer'},
+    z3950servers =>{  `name` =>`text`,  `description` => `text NOT NULL`,
+    `position` =>`enum('primary','secondary','') NOT NULL default 'primary'`,  
`icon` =>`text`,
+    `type` =>`enum('zed','opensearch') NOT NULL default 'zed'`,
+  },
                
 #    tablename        => { 'field' => 'fieldtype' },
 );
@@ -1932,6 +1936,16 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.157.2.20  2006/11/15 15:15:50  hdl
+# Final First Version for New Facility for subscription management.
+#
+# Now
+# use serials-collection.pl for history display
+# and serials-edit.pl for serial edition
+# subscription add and detail adds a new branch information to help 
IndependantBranches Library to manage different subscriptions for a serial
+#
+# This is aimed at replacing serials-receive and statecollection.
+#
 # Revision 1.157.2.19  2006/11/14 16:28:01  rych
 # Adding itemtype field to items
 #




reply via email to

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