koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha C4/Serials.pm koha-tmpl/intranet-tmpl/prog... [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha C4/Serials.pm koha-tmpl/intranet-tmpl/prog... [rel_3_0]
Date: Tue, 16 Jan 2007 16:41:36 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      07/01/16 16:41:36

Modified files:
        C4             : Serials.pm 
        koha-tmpl/intranet-tmpl/prog/en/serials: serials-collection.tmpl 
                                                 serials-edit.tmpl 
        serials        : serials-collection.pl serials-edit.pl 

Log message:
        managing unexpected arrivals for multple subscriptions to One biblio.
        + some Bug Fixing in Serials.pm

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.26&r2=1.5.2.27
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.8&r2=1.1.2.9
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.6&r2=1.1.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/serials/serials-collection.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.5&r2=1.1.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/serials/serials-edit.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.7&r2=1.1.2.8

Patches:
Index: C4/Serials.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Serials.pm,v
retrieving revision 1.5.2.26
retrieving revision 1.5.2.27
diff -u -b -r1.5.2.26 -r1.5.2.27
--- C4/Serials.pm       16 Jan 2007 10:46:09 -0000      1.5.2.26
+++ C4/Serials.pm       16 Jan 2007 16:41:36 -0000      1.5.2.27
@@ -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.pm,v 1.5.2.26 2007/01/16 10:46:09 hdl Exp $
+# $Id: Serials.pm,v 1.5.2.27 2007/01/16 16:41:36 hdl Exp $
 
 use strict;
 use C4::Date;
@@ -35,7 +35,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.26 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.5.2.27 $' =~ /\d+/g;
     shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
 };
 
@@ -408,7 +408,7 @@
     if (C4::Context->preference('IndependantBranches') && 
         C4::Context->userenv && 
         C4::Context->userenv->{'flags'} != 1){
-      $query.=" AND subscription.branchcode IN 
('".C4::Context->userenv->{'branch'}."','')";
+       $query.=" AND subscription.branchcode IN 
('".C4::Context->userenv->{'branch'}."',\"''\")";
     }
     my $sth = $dbh->prepare($query);
     $sth->execute($biblionumber);
@@ -464,7 +464,14 @@
   LEFT JOIN aqbudget ON subscription.aqbudgetid=aqbudget.aqbudgetid 
   LEFT JOIN aqbooksellers on subscription.aqbooksellerid=aqbooksellers.id 
   LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber 
-  WHERE     subscription.biblionumber = ? 
+  WHERE     subscription.biblionumber = ? |;
+    if (C4::Context->preference('IndependantBranches') && 
+        C4::Context->userenv && 
+        C4::Context->userenv->{'flags'} != 1){
+      $query.="
+  AND subscription.branchcode IN 
('".C4::Context->userenv->{'branch'}."',\"''\")";
+    }
+    $query .=qq|
   ORDER BY year DESC,
           
IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate) 
DESC,
           serial.subscriptionid
@@ -1173,7 +1180,7 @@
                         
add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
                         numberingmethod=?, status=?, biblionumber=?, 
callnumber=?, notes=?, letter=?, hemisphere=?,manualhistory=?
                     WHERE subscriptionid = ?";
-    warn "query :".$query;
+#     warn "query :".$query;
     my $sth = $dbh->prepare($query);
     $sth->execute(
         $auser,           $branchcode,   $aqbooksellerid, $cost,
@@ -1676,10 +1683,10 @@
           $weeknb += $subscription->{weeklength};
           my $weeknbcalc= $weeknb % 52;
           $year += int($weeknb/52);
-          warn "year : $year weeknb :$weeknb weeknbcalc $weeknbcalc";
+#           warn "year : $year weeknb :$weeknb weeknbcalc $weeknbcalc";
           @endofsubscriptiondate=Monday_of_Week($weeknbcalc,$year);
         }
-        foreach (@endofsubscriptiondate){warn "endofsubscription :$_"}
+#         foreach (@endofsubscriptiondate){warn "endofsubscription :$_"}
         my $endofsubscriptiondate = 
Date_to_Time($endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2],
         0,0,0) if (@endofsubscriptiondate);
         return 1 if ( (@endofsubscriptiondate && 
Delta_Days($res[0],$res[1],$res[2],
@@ -2587,7 +2594,7 @@
                 $month++;    # to check if following ones are to be skipped too
             }
         }
-        warn "annee mois jour $year $month $day";
+#         warn "annee mois jour $year $month $day";
         @resultdate = Add_Delta_YMD($year,$month, $day ,0,1,0 );
 
         # warn "Planneddate2: $planneddate";
@@ -2630,7 +2637,7 @@
                 $month = $month % 12;$year++;
             }    # need to rollover to check January
         }
-        @resultdate = Add_Delta_YM($year,$month, $day, 0, 3, 0);
+        @resultdate = Add_Delta_YMD($year,$month, $day, 0, 3, 0);
     }
     if ( $subscription->{periodicity} == 9 ) {
         for ( my $i = 0 ; $i < @irreg ; $i++ ) {

Index: koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/Attic/serials-collection.tmpl,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -b -r1.1.2.8 -r1.1.2.9
--- koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl     15 Jan 
2007 14:59:09 -0000      1.1.2.8
+++ koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl     16 Jan 
2007 16:41:36 -0000      1.1.2.9
@@ -20,18 +20,27 @@
        }
 }
 showlayer(<!-- TMPL_VAR NAME="yearmax"-->);
-function show(branchcode)
+function addsubscriptionid()
 {
-  if (branchcode !=""){
-       for (var eltlist in document.getElementsbyName("branch")) {
-      eltslist.style.visibility="hidden" ;
+       var tab=new Array();
+    var serialids = document.edition.serialid;
+    for (i=0; i<serialids.length; i++){
+      if (serialids[i].checked == true){
+        var found=false;
+        for (var val in tab){
+          if (tab[val] == 
document.getElementsByName("subs")[i].getAttribute('val')){found = true;}
     }
-  } else {
-    branchcode="branch";
+        if (found == false){
+          
tab=tab.concat((document.getElementsByName("subs")[i].getAttribute('val')));
   }
-  for (eltslist in document.getElementsbyName(branchcode)) {
-      eltslist.style.visibility="visible";
   }
+    }
+    var string="";
+    for (var val in tab){
+      string = string + tab[val] + ",";
+    }
+    string=string.substring(0,string.length -1);
+    document.edition.subscriptionid.value=string;
 }
 </script>
 
@@ -103,13 +112,15 @@
                     <!-- TMPL_VAR Name="branchcode" -->
                 </td>
                 <td>
-                  <input type="checkbox" name="serialid" value=<!--TMPL_VAR 
Name="serialid"--> />
+                  <div visibility="hidden" name="subs" val="<!--TMPL_VAR 
Name="subscriptionid"-->"></div>
+                  <input type="checkbox" name="serialid" value="<!--TMPL_VAR 
Name="serialid"-->" onclick="javascript:addsubscriptionid();"/>
                 </td>
             </tr>
       <!-- /TMPL_LOOP -->
         </table>
     </div>
     <!--/TMPL_LOOP -->
+  <input type="hidden" name="subscriptionid" value="<!--TMPL_VAR 
Name="subscriptionidlist"-->">
   <input type="submit" value="Edit serials" class="button bull">
   </form>
 

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.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl   15 Jan 2007 
14:59:09 -0000      1.1.2.6
+++ koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl   16 Jan 2007 
16:41:36 -0000      1.1.2.7
@@ -98,10 +98,10 @@
   <!--TMPL_IF Name="serialsadditems"-->
           <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"-->')">
+      <a id="label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR 
Name="serialid"-->" style="color: grey; font-size: 80%; cursor: se-resize;"  
onclick="unHideItems('items<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR 
Name="serialid"-->','label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR 
Name="serialid"-->')">
              Items   </a>
-        <fieldset style="display:none;" id="items<!--TMPL_VAR 
Name="serialid"-->">
-        <legend><a style="cursor: se-resize;"  
onclick="HideItems('items<!--TMPL_VAR Name="serialid"-->','label<!--TMPL_VAR 
Name="serialid"-->')">
+        <fieldset style="display:none;" id="items<!-- TMPL_VAR 
NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->">
+        <legend><a style="cursor: se-resize;"  onclick="HideItems('items<!-- 
TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->','label<!-- 
TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->')">
                 Items</a>
         </legend>
           <div id="cataloguing_additem_itemlist">
@@ -133,6 +133,7 @@
     </tr>
   <!-- /TMPL_IF -->
 <!-- /TMPL_LOOP -->
+<!-- TMPL_LOOP name="newserialloop" -->
     <tr>
         <td>
             <input type="hidden" name="serialid" value="NEW" />
@@ -140,7 +141,7 @@
             <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR 
NAME="biblionumber" -->" />
             <input type="hidden" name="itemcount" value="<!-- TMPL_VAR 
name="issuesatonce" -->" />
             <input type="hidden" name="user" value="<!-- TMPL_VAR 
name="librarian" -->" />
-            New Issue <input type="text" name="serialseq" value="" size="20" 
maxlength="100" />
+            <b>Subs. <!-- TMPL_VAR name="subscriptionid" --></b> New Issue 
<input type="text" name="serialseq" value="" size="20" maxlength="100" />
         </td>
         <td>
             <input type="text" name="publisheddate" value="<!-- TMPL_VAR 
name="publisheddate" -->" size=10 maxlength=15>
@@ -149,7 +150,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" 
-->" OnChange="javascript:if (this.value==2){unHideItems('items'+<!-- TMPL_VAR 
NAME="serialid" -->,'label<!--TMPL_VAR Name="serialid"-->')}">
+            <select name="status" size="1" id="status<!-- TMPL_VAR NAME="num" 
-->" OnChange="javascript:if (this.value==2){unHideItems('items'+<!-- TMPL_VAR 
NAME="subscriptionid" --><!-- TMPL_VAR NAME="serialid" -->,'label<!-- TMPL_VAR 
NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->')}">
   <!--TMPL_IF name="status1" -->
                     <option value="1" selected>Waited</option>
   <!-- /TMPL_IF -->
@@ -187,16 +188,16 @@
 
         </td>
         <td>
-            <input type="text" name="notes" value="<!-- TMPL_VAR name="notes" 
-->" size=20 maxlength=255>
+            <input type="text" name="notes" value="" size=20 maxlength=255>
         </td>
     </tr>
   <!--TMPL_IF Name="serialsadditems"-->
           <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"-->')">
+      <a id="label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR 
Name="serialid"-->" style="color: grey; font-size: 80%; cursor: se-resize;"  
onclick="unHideItems('items<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR 
Name="serialid"-->','label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR 
Name="serialid"-->')">
              Items   </a>
-        <fieldset style="display:none;" id="items<!--TMPL_VAR 
Name="serialid"-->">
-        <legend><a style="cursor: se-resize;"  
onclick="HideItems('items<!--TMPL_VAR Name="serialid"-->','label<!--TMPL_VAR 
Name="serialid"-->')">
+        <fieldset style="display:none;" id="items<!-- TMPL_VAR 
NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->">
+        <legend><a style="cursor: se-resize;"  onclick="HideItems('items<!-- 
TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->','label<!-- 
TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->')">
                 Items</a>
         </legend>
           <div id="cataloguing_additem_itemlist">
@@ -225,6 +226,7 @@
     </td>
     </tr>
   <!-- /TMPL_IF -->
+<!-- /TMPL_LOOP -->
 
 </table>
 </div>

Index: serials/serials-collection.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/Attic/serials-collection.pl,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -b -r1.1.2.5 -r1.1.2.6
--- serials/serials-collection.pl       18 Dec 2006 16:35:19 -0000      1.1.2.5
+++ serials/serials-collection.pl       16 Jan 2007 16:41:36 -0000      1.1.2.6
@@ -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-collection.pl,v 1.1.2.5 2006/12/18 16:35:19 toins Exp $
+# $Id: serials-collection.pl,v 1.1.2.6 2007/01/16 16:41:36 hdl Exp $
 
 use strict;
 use CGI;
@@ -55,8 +55,13 @@
 my $title = $subscriptions->[0]{bibliotitle};
 my $yearmax=($subscriptions->[0]{year} eq "manage" && 
scalar(@$subscriptions)>1)? $subscriptions->[1]{year} 
:$subscriptions->[0]{year};
 my $yearmin=$subscriptions->[scalar(@$subscriptions)-1]{year};
-
+my $subscriptionidlist="";
+foreach my $subscription (@$subscriptiondescs){
+  $subscriptionidlist.=$subscription->{'subscriptionid'}."," ;
+}
+chop $subscriptionidlist;
 $template->param(
+          subscriptionidlist => $subscriptionidlist,
           biblionumber => $query->param('biblionumber'),
           subscriptions => $subscriptiondescs,
           years => $subscriptions,

Index: serials/serials-edit.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/Attic/serials-edit.pl,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -b -r1.1.2.7 -r1.1.2.8
--- serials/serials-edit.pl     15 Jan 2007 14:59:09 -0000      1.1.2.7
+++ serials/serials-edit.pl     16 Jan 2007 16:41:36 -0000      1.1.2.8
@@ -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.7 2007/01/15 14:59:09 hdl Exp $
+# $Id: serials-edit.pl,v 1.1.2.8 2007/01/16 16:41:36 hdl Exp $
 
 =head1 NAME
 
@@ -85,17 +85,21 @@
 my @subscriptionids = $query->param('subscriptionid');
 my $op = $query->param('op');
 # warn "op : $op";
+if (scalar(@subscriptionids)==1 && index($subscriptionids[0],",")>0){
+  @subscriptionids =split /,/,$subscriptionids[0];
+}
 
 # If user comes from subscription details
 unless (@serialids){
-  my $subscriptionid=$query->param('subscriptionid');
+  foreach my $subscriptionid (@subscriptionids){
   my $serstatus=$query->param('serstatus');
+    if ($serstatus){
   my ($count,@tmpser)=GetSerials2($subscriptionid,$serstatus);
-
-  foreach (@tmpser) 
-  {
+      foreach (@tmpser) {
     push @serialids, $_->{'serialid'};
   }
+    }
+  }
 }
 
 my ($template, $loggedinuser, $cookie)
@@ -115,15 +119,21 @@
   push @serialdatalist,$data;
 }
 
-if (C4::Context->preference("serialsadditems")){
-#Create New empty item  
-  my $itemprocessed =
+my @newserialloop;
+foreach my $subscriptionid (@subscriptionids){
+  my $cell;
+  if (C4::Context->preference("serialsadditems")){
+  #Create New empty item  
+    $cell =
     PrepareItemrecordDisplay( $serialdatalist[0]->{'biblionumber'} );
-  $itemprocessed->{'itemid'}       = "NNEW";
-  $itemprocessed->{'serialid'}     = "NEW";
-  $itemprocessed->{'countitems'}   = 1;
-  $template->param($itemprocessed);
+  }
+  $cell->{'subscriptionid'}=$subscriptionid;
+  $cell->{'itemid'}       = "NNEW";
+  $cell->{'serialid'}     = "NEW";
+  $cell->{'issuesatonce'}   = 1;
+  push @newserialloop,$cell;
 }
+$template->param(newserialloop=>address@hidden);
 
 if ($op eq 'serialchangestatus') {
 #     my $sth = $dbh->prepare("select status from serial where serialid=?");
@@ -131,11 +141,8 @@
     for (my $i=0;$i<=$#serialids;$i++) {
 #         $sth->execute($serialids[$i]);
 #         my ($oldstatus) = $sth->fetchrow;
-        warn "serialid : \"$serialids[$i]\"";
         if ($serialids[$i] && $serialids[$i] eq "NEW") {
-          warn "NEW";
           if ($serialseqs[$i]){
-            warn "New issue";
             #IF newserial was provided a name Then we have to create a 
newSerial
             ### FIXME if NewIssue is modified to use subscription 
biblionumber, then biblionumber would not be useful.
             $newserial = NewIssue( 
$serialseqs[$i],$subscriptionids[$i],$serialdatalist[0]->{'biblionumber'},
@@ -240,7 +247,6 @@
 
 $template->param(
             biblionumber =>$serialdatalist[0]->{'biblionumber'},
-            subscriptionid =>$serialdatalist[0]->{'subsid'},
             serialslist => address@hidden,
             intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
             intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),




reply via email to

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