improvement of reserves.pl with item - reservation
authoralaurin <alaurin>
Fri, 19 May 2006 17:05:11 +0000 (17:05 +0000)
committeralaurin <alaurin>
Fri, 19 May 2006 17:05:11 +0000 (17:05 +0000)
C4/Koha.pm
koha-tmpl/intranet-tmpl/prog/en/circ/branchtransfers.tmpl
koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl
koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl
koha-tmpl/intranet-tmpl/prog/en/circ/selectbranchprinter.tmpl
koha-tmpl/intranet-tmpl/prog/en/reserve/request.tmpl
reserve/modrequest.pl
reserve/placerequest.pl
reserve/request.pl

index 12d9415..f08794f 100644 (file)
@@ -57,6 +57,7 @@ Koha.pm provides many functions for Koha scripts.
                        &getauthtypes &getauthtype
                        &getallthemes &getalllanguages
                        &getallbranches &getletters
+                       &getbranchname
                         getnbpages
                         getitemtypeimagedir
                         getitemtypeimagesrc
@@ -149,6 +150,18 @@ sub getbranches {
        return (\%branches);
 }
 
+sub getbranchname {
+       my ($branchcode)=@_;
+       my $dbh = C4::Context->dbh;
+       my $sth;
+       $sth = $dbh->prepare("Select branchname from branches where branchcode=?");
+       $sth->execute($branchcode);
+       my $branchname = $sth->fetchrow_array;
+       $sth->finish;
+       
+       return($branchname);
+}
+
 =head2 getallbranches
 
   $branches = &getallbranches();
@@ -180,6 +193,7 @@ foreach my $thisbranch (keys %$branches) {
 
 =cut
 
+
 sub getallbranches {
 # returns a reference to a hash of references to ALL branches...
        my %branches;
index fd14607..28cbad6 100644 (file)
@@ -1,4 +1,6 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Circulation: Transfers<!-- TMPL_INCLUDE NAME="doc-head-circ-close.inc" -->
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
 
 
 <h1>Circulation: Transfers</h1>
index 1572d53..939483d 100644 (file)
@@ -5,6 +5,7 @@
 <!-- /TMPL_IF -->
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
 
 
 <h1>Circulation: Issues</h1>
index a7c7675..e488d6b 100644 (file)
@@ -1,6 +1,7 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Circulation: Returns<!-- TMPL_IF Name="returned" -->: <!-- TMPL_VAR Name="itemtitle" --><!-- /TMPL_IF -->
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
 
 
 <!-- TMPL_IF Name="found" -->
index 3e514e6..3bc8042 100644 (file)
@@ -1,4 +1,6 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Circulation: Select Your Home Branch<!-- TMPL_INCLUDE NAME="doc-head-circ-close.inc" -->
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
 
 
 <h1>Circulation: Select Your Home Branch</h1>
index 14e0c02..b334d7f 100644 (file)
@@ -3,6 +3,55 @@ Koha -- Circulation
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
 
+<script language="JavaScript">
+function check() {
+       var msg = "";
+       var count_reserv = 0;
+       var alreadyreserved = 0;
+
+// check if we have checkitem form
+if (document.form.checkitem){
+       for (i=0;i<document.form.checkitem.length;i++){
+               if (document.form.checkitem[i].checked == true) {
+                               count_reserv++ ;
+                       }
+       }
+       // for only one item, check the checkitem without consider the loop checkitem
+       if (i==0){
+               if (document.form.checkitem.checked == true) {
+                       count_reserv++;
+               }
+       }
+}
+
+if (document.form.request.checked == true){
+               count_reserv++ ;
+}
+
+if (document.form.alreadyreserved.value == "1"){
+                alreadyreserved++ ;
+}
+
+if (count_reserv == "0"){
+               msg += _("- Please select a document to reserve\n");
+}
+if (count_reserv >= "2"){
+               msg += _("- You can select only one type of document\n by item, or by the first item returned\n");
+}
+
+if (alreadyreserved > "0"){
+               msg += _("- This borrower had already reserved this document\n Please cancel the previous reserve first \n");
+}
+
+       if (msg == "") return(true);
+       else    {
+               alert(msg);
+               return(false);
+       }
+}
+</script>
+
+
 <h1>Request for reserve</h1>
 
 <fieldset>
@@ -28,12 +77,14 @@ Koha -- Circulation
     </table>
 
     <div id="action">
+    <input type="hidden" name="bib" value="<!-- TMPL_VAR NAME="bib"-->">
      <input type="submit" value="Search">
     </div>
   <!-- TMPL_ELSE -->
     <!-- TMPL_VAR NAME="CGIselectborrower" -->
 
     <div id="action">
+    <input type="hidden" name="bib" value="<!-- TMPL_VAR NAME="bib"-->">
      <input type="submit" value="Select">
     </div>
   <!-- /TMPL_UNLESS -->
@@ -61,19 +112,19 @@ Koha -- Circulation
     <!-- TMPL_IF NAME="diffbranch" -->                 
     <p class="problem">
       <label class="label100"><u>Localisation</u></label>
-      Le lecteur n'est pas dans sa bibliothèque d'appartenance
+      The borrower isn't in is own library
     </p>
     <!-- /TMPL_IF -->
 
     <!-- TMPL_IF NAME="alreadyreserved" -->                    
     <p class="problem">
-      <label class="label100"><u>Opération impossible</u></label>
-      Ce lecteur a déjà fait une demande de réservation pour ce document
+      <label class="label100"><u>Operation can be make</u></label>
+      This borrower had already make a reserv for this document
     </p>
     <!-- /TMPL_IF -->
 
   <!-- TMPL_IF NAME="messageborrower" -->
-    <div class="problem">attention, il n'y a pas de lecteur à ce nom, veuillez en saisir un autre </div> 
+    <div class="problem">Carrefull,there is no borrower with this name, Please, try an other </div> 
   <!-- /TMPL_IF -->
 <!-- /TMPL_UNLESS -->
 
@@ -125,7 +176,7 @@ Koha -- Circulation
 
       <tr>
         <th>
-          <label>Lieu de retrait</label>
+          <label>Place of retreat</label>
         </th>
         <td>
           <!-- TMPL_VAR NAME="CGIbranch" -->
@@ -180,16 +231,16 @@ Koha -- Circulation
     <!-- /TMPL_IF -->
 
     <!-- TMPL_IF Name="message" -->
-          Ne peut être sélectionné (Document perdu ou en grand retard)
+          Cant' be selected (lost or long overdue)
     <!-- /TMPL_IF -->
 
     <!-- TMPL_IF Name="notforloan" -->
-          Ce document, n'est pas prêtable (<!-- TMPL_VAR NAME="notforloanvalue" -->)
+          This document is not for loan (<!-- TMPL_VAR NAME="notforloanvalue" -->)
     <!-- /TMPL_IF -->
 
     <!-- TMPL_IF Name="transfertwhen" -->
-          Document en tranfert du site : <!-- TMPL_VAR NAME="transfertfrom" -->,
-          vers : <!-- TMPL_VAR NAME="transfertto" -->, le : <!-- TMPL_VAR NAME="transfertwhen" -->
+          Document in transfer from the library : <!-- TMPL_VAR NAME="transfertfrom" -->,
+          to : <!-- TMPL_VAR NAME="transfertto" -->, the : <!-- TMPL_VAR NAME="transfertwhen" -->
     <!-- /TMPL_IF -->
         </td>
       </tr>
@@ -236,10 +287,10 @@ Koha -- Circulation
       <tr>
         <td>
           <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->">
-          <input type="hidden" name="biblio" value="<!-- TMPL_VAR NAME="biblionumber" -->">
+          <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->">
           <select name="rank-request">
     <!-- TMPL_IF Name="wait" -->
-            <option value="W" selected>En attente</option>
+            <option value="W" selected>Waiting</option>
     <!-- /TMPL_IF -->
               
     <!-- TMPL_LOOP Name="optionloop" -->
@@ -247,17 +298,17 @@ Koha -- Circulation
               <!-- TMPL_VAR NAME="num" -->
             </option>
     <!-- /TMPL_LOOP -->
-            <option value="del">Sup</option>
+            <option value="del">del</option>
           </select>
         </td>
         <td>
-          <a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></a>
+          <a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="borrowernumber" --></a>
         </td>
         <td><!-- TMPL_VAR NAME="notes" --></td>
         <td><!-- TMPL_VAR NAME="date" --></td>
         <td>
     <!-- TMPL_IF Name="wait" -->
-          Exemplaire en attente à <b> <!-- TMPL_VAR NAME="wbrname" --></b> <input type="hidden" name="pickup" value=<!-- TMPL_VAR NAME="wbrcd" -->>
+          Document waiting at <b> <!-- TMPL_VAR NAME="wbrname" --></b> <input type="hidden" name="pickup" value=<!-- TMPL_VAR NAME="wbrcd" -->>
     <!-- TMPL_ELSE -->
           <select name="pickup">
       <!-- TMPL_LOOP Name="branchloop" -->
@@ -279,20 +330,20 @@ Koha -- Circulation
           </a>
     <!-- TMPL_ELSE -->
       <!-- TMPL_IF Name="constrainttypea" -->
-          <i>Suivant Disponible</i>
+          <i>Next available</i>
       <!-- TMPL_ELSE -->
         <!-- TMPL_IF Name="constrainttypeo" -->
-          Uniquement ce type :<b><!-- TMPL_VAR NAME="volumeddesc" --> <!-- TMPL_VAR NAME="itemtype" --></b>
+          only this type :<b><!-- TMPL_VAR NAME="volumeddesc" --> <!-- TMPL_VAR NAME="itemtype" --></b>
         <!-- /TMPL_IF -->
       <!-- /TMPL_IF -->
     <!-- /TMPL_IF -->
         </td>
       </tr>
-  <!-- /TMPL_LOOP --> <!-- reserveloop -->
+  <!-- /TMPL_LOOP --> <!-- existing reserveloop -->
       <tr>
         <td colspan="6" align="right">
-          Supprimer une réservation en sélectionnant
-          <input type="image" name="submit" value="Réservation" border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/2rightarrow.png">
+          Cancel a reserve with select
+          <input type="image" name="submit" value="Reserv" border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/2rightarrow.png">
         </td>
       </tr>
     </table>
index 36ef7a6..a319214 100755 (executable)
@@ -50,5 +50,5 @@ my $from=$input->param('from');
 if ($from eq 'borrower'){
   print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$borrower[0]");
  } else {
-   print $input->redirect("/cgi-bin/koha/request.pl?biblionumber=$biblionumber[0]");
+   print $input->redirect("/cgi-bin/koha/reserve/request.pl?bib=$biblionumber[0]");
 }
index c6ea752..00474b9 100755 (executable)
 
 use strict;
 #use DBI;
+use C4::Search;
 use C4::Biblio;
 use CGI;
 use C4::Output;
 use C4::Reserves2;
+use C4::Circulation::Circ2;
 use C4::Members;
 
 my $input = new CGI;
@@ -34,7 +36,7 @@ my $input = new CGI;
 
 my @bibitems=$input->param('biblioitem');
 my @reqbib=$input->param('reqbib');
-my $biblionumber=$input->param('biblionumber');
+my $biblio=$input->param('biblio');
 my $borrower=$input->param('member');
 my $notes=$input->param('notes');
 my $branch=$input->param('pickup');
@@ -42,6 +44,26 @@ my @rank=$input->param('rank-request');
 my $type=$input->param('type');
 my $title=$input->param('title');
 my $bornum=borrdata($borrower,'');
+# Nouveau developpement
+my $checkitem=$input->param('checkitem');
+# my $priority;
+my $found;
+
+#new op : if we have an item selectionned, and the pickup branch is the same as the holdingbranch of the document, we force the value $rank and $found .
+if ($checkitem ne ''){
+               $rank[0] = '0';
+               my %env;
+               my $item = $checkitem;
+               $item = getiteminformation(\%env,$item);
+               if ( $item->{'holdingbranch'} eq $branch ){
+               $found = 'W';   
+               }
+
+
+}
+
+# END of new op .
+
 if ($type eq 'str8' && $bornum ne ''){
        my $count=@bibitems;
        @bibitems=sort @bibitems;
@@ -59,15 +81,15 @@ if ($type eq 'str8' && $bornum ne ''){
        my $const;
        if ($input->param('request') eq 'any'){
        $const='a';
-       CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblionumber,$const,\@realbi,$rank[0],$notes,$title);
+  CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,$const,\@realbi,$rank[0],$notes,$title,$checkitem,$found);
        } elsif ($reqbib[0] ne ''){
        $const='o';
-       CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblionumber,$const,\@reqbib,$rank[0],$notes,$title);
+  CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,$const,\@reqbib,$rank[0],$notes,$title,$checkitem, $found);
        } else {
-       CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$notes,$title);
+  CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,'a',\@realbi,$rank[0],$notes,$title,$checkitem, $found);
        }
        
-       print $input->redirect("request.pl?biblionumber=$biblionumber");
+print $input->redirect("request.pl?bib=$biblio");
 } elsif ($bornum eq ''){
        print $input->header();
        print "Invalid card number please try again";
index 6a7ec0e..19dbda0 100755 (executable)
@@ -56,7 +56,6 @@ my ($template, $borrowernumber, $cookie)
 
 # get biblio information....
 my $bib = $input->param('bib');
-warn '[Debub Pierrick] $bib: ', $bib;
 my $dat = bibdata($bib);
 
 # Select borrowers infos
@@ -263,6 +262,7 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
 
         if (defined $reservedate) {
             $item->{backgroundcolor} = 'reserved';
+            $item->{reservedate} = format_date($reservedate);
         }
 
         # Management of the notforloan document