Add Local-use statistical patron category_type
authorRyan Higgins <rch@liblime.com>
Mon, 10 Mar 2008 01:48:26 +0000 (20:48 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 10 Mar 2008 10:27:37 +0000 (05:27 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Circulation.pm
C4/Items.pm
koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/categorie.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
members/memberentry.pl

index 0ed7b58..82e868c 100644 (file)
@@ -659,7 +659,7 @@ sub CanBookBeIssued {
     my $item = GetItem(GetItemnumberFromBarcode( $barcode ));
     my $issue = GetItemIssue($item->{itemnumber});
        my $biblioitem = GetBiblioItemData($item->{biblioitemnumber});
-       $item->{'itemtype'}=$biblioitem->{'itemtype'};
+       $item->{'itemtype'}=$item->{'itype'}; 
     my $dbh             = C4::Context->dbh;
 
     #
@@ -670,6 +670,11 @@ sub CanBookBeIssued {
     #
     # BORROWER STATUS
     #
+    if ( $borrower->{'category_type'} eq 'X' && (  $item->{barcode}  )) { 
+       # stats only borrower -- add entry to statistics table, and return issuingimpossible{STATS} = 1  .
+        &UpdateStats(C4::Context->userenv->{'branch'},'localuse','','',$item->{'itemnumber'},$item->{'itemtype'},$borrower->{'borrowernumber'});
+        return( { STATS => 1 }, {});
+    }
     if ( $borrower->{flags}->{GNA} ) {
         $issuingimpossible{GNA} = 1;
     }
index 049be3f..2b89270 100644 (file)
@@ -143,7 +143,13 @@ sub GetItem {
         $ssth->execute($data->{'itemnumber'}) ;
         ($data->{'serialseq'} , $data->{'publisheddate'}) = $ssth->fetchrow_array();
                warn $data->{'serialseq'} , $data->{'publisheddate'};
-    }          
+    }
+       #if we don't have an items.itype, use biblioitems.itemtype.
+       if( ! $data->{'itype'} ) {
+               my $sth = $dbh->prepare("SELECT itemtype FROM biblioitems  WHERE biblionumber = ?");
+               $sth->execute($data->{'biblionumber'});
+               ($data->{'itype'}) = $sth->fetchrow_array;
+       }
     return $data;
 }    # sub GetItem
 
index 76aea2f..ad572f9 100644 (file)
@@ -9,6 +9,7 @@
                $("#addprofessional").parent().remove();
                $("#addorganisation").parent().remove();
                $("#addstaff").parent().remove();
+               $("#addstatistical").parent().remove();
            $("#newmenuc").empty();
            yuiToolbar();
         });
@@ -23,6 +24,7 @@
                        { text: _("Professional Patron"),  url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=P" },
                        { text: _("Organisation"),  url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=I" },
                        { text: _("Staff"),  url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=S" },
+                       { text: _("Statistical"),  url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=X" },
                ] 
        
            new YAHOO.widget.Button({
@@ -43,4 +45,5 @@
 <li><a id="addprofessional" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=P">Professional</a></li>
 <li><a id="addorganisation" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=I">Organisation</a></li>
 <li><a id="addstaff" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=S">Staff</a></li>
+<li><a id="addstatistical" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=X">Statistical</a></li>
 </ul></div>
index 3bad64f..868fdb3 100644 (file)
                                        <!-- TMPL_IF NAME="type_S" --><option value="S" selected="selected">Staff</option><!-- TMPL_ELSE --><option value="S">Staff</option><!-- /TMPL_IF -->
                                        <!-- TMPL_IF NAME="type_I" --><option value="I" selected="selected">Organisation</option><!-- TMPL_ELSE --><option value="I">Organisation</option><!-- /TMPL_IF -->
                                        <!-- TMPL_IF NAME="type_P" --><option value="P" selected="selected">Professional</option><!-- TMPL_ELSE --><option value="P">Professional</option><!-- /TMPL_IF -->
+                                       <!-- TMPL_IF NXME="type_X" --><option value="X" selected="selected">Statistical</option><!-- TMPL_ELSE --><option value="X">Statistical</option><!-- /TMPL_IF -->
                                        </select>
        </li></ol>
 </fieldset>
@@ -234,6 +235,7 @@ Confirm Deletion of Category <!-- TMPL_VAR NAME="categorycode" --><!-- /TMPL_IF
                             <!-- TMPL_IF NAME="type_P" -->Prof.<!-- /TMPL_IF -->
                             <!-- TMPL_IF NAME="type_I" -->Org.<!-- /TMPL_IF -->
                             <!-- TMPL_IF NAME="type_S" -->Staff<!-- /TMPL_IF -->
+                            <!-- TMPL_IF NAME="type_X" -->Statistical<!-- /TMPL_IF -->
                         </td>
                         <td><!-- TMPL_VAR NAME="enrolmentperiod" --> months</td>
                         <td><!-- TMPL_VAR NAME="dateofbirthrequired" --> years</td>
index d0b54df..8b562bf 100755 (executable)
@@ -158,6 +158,10 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <!-- RESULT OF ISSUING REQUEST -->
         <!-- TMPL_IF NAME="IMPOSSIBLE" -->
         <ul>
+        <!-- TMPL_IF NAME="STATS" -->
+            <li><span class="problem">Local Use Recorded</span></li>
+        <!-- /TMPL_IF -->
+
         <!-- TMPL_IF NAME="INVALID_DATE" -->
             <li><span class="problem">The due date is invalid</span></li>
         <!-- /TMPL_IF -->  
index 66e1dba..1ab892e 100644 (file)
@@ -7,24 +7,25 @@
 <h2>Categories, Descriptions and Types</h2>
 <p>Start by assigning a Category Code and a Description to each patron category. Each Category can be one of five types:</p>
 <ul>
-       <li>Adult Patrons: can be linked as "guarantors" to other patrons who are their dependents.</li>
-       <li>Child Patrons: a patron category that has a "guarantor"</li>
-       <li>Organizational Patrons: can be used for institutional members, e.g. other libraries that borrow from you, in which case Koha expects slightly different information about the institution;</li>
-       <li>Professional Patrons  </li>
+       <li>Adult Patrons: can be linked as "guarantors" to other patrons who are their dependents.  This is the default patron type.</li>
+       <li>Child Patrons: a patron category that has a "guarantor".</li>
+       <li>Organizational Patrons: can be used for institutional members, e.g. other libraries that borrow from you, in which case Koha expects slightly different information about the institution.</li>
+       <li>Professional Patrons: can also be associated with a guarantor (usually an organisation). </li>
        <li>Staff Members: A member of the library staff. </li>
+       <li>Statistical Patrons: checking out to this patron type creates a statistical (local use) record but does not actually circulate materials.</li>
 </ul>
 <h3>Note on Permissions</h3>
-<p>Patrons in any category type may be assigned permissions in the staff interface.</p>
-<h2>Enrollment Period</h2>
-<p>Enrollment period is a number indicating how many years a user's enrollment is valid. If you consider enrollments to expire after four years for example (as in a school, perhaps), then set this number to 4. If enrollments never expire, set this to an impossibly high number (99).</p>
+<p>Patrons in any category type may be assigned permissions in the staff interface.  The Staff patron type has additional security features over the other types.</p>
+<h2>Enrollment Period (months)</h2>
+<p>Enrollment period is a number indicating the length in months of a patron enrollment. If enrollments never expire, set this to an impossibly high number ( >= 99).</p>
 
 <h2>Upper Age Limit and Age Required</h2>
 <p>Upper Age Limit and Age Required set the age parameters for this type of user. If you issue children's cards to users between the ages of 2 and 18, for example, then Age Required would be "2" and Upper Age Limit would be "18." If there is no upper age limit, set this value to 99 (the highest allowed).</p>
 
 <h2>Enrollment Fee and Reserve Fee</h2>
-<p>Enrollment Fee and Reserve Fee (if any) should be entered either as whole numbers or with six decimal places, with no currency notation (e.g. "1.250000" instead of "$1.25").</p>
+<p>Enrollment Fee and Reserve Fee (if any) should be entered either as whole numbers or with (up to) six decimal places, with no currency notation (e.g. "1.250000" instead of "$1.25").</p>
 
 <h2>Overdue Notice Required</h2>
 <p>Overdue Notice Required lets you bypass generating overdue notices for this user type.</p>
 
-<!-- TMPL_INCLUDE name="help-bottom.inc" -->
\ No newline at end of file
+<!-- TMPL_INCLUDE name="help-bottom.inc" -->
index 816c8bc..9b9c315 100644 (file)
@@ -231,9 +231,9 @@ patron <!-- TMPL_VAR NAME="surname" --> <!-- TMPL_VAR name="firstname" --></stro
                                <label for="sex-male">Male </label><input type="radio" name="sex" id="sex-male" value="M" />
 <!-- /TMPL_IF -->
 <!-- TMPL_IF NAME="none" -->
-                               <label for="sex-none">? </label><input type="radio" name="sex" id="sex-none" value=""  checked="checked"  />
+                               <label for="sex-none">N/A </label><input type="radio" name="sex" id="sex-none" value=""  checked="checked"  />
 <!-- TMPL_ELSE -->
-                               <label for="sex-none">? </label><input type="radio" name="sex" id="sex-none" value="" />
+                               <label for="sex-none">N/A </label><input type="radio" name="sex" id="sex-none" value="" />
 <!-- /TMPL_IF -->
                </li>
     <!--/TMPL_UNLESS-->
@@ -600,6 +600,7 @@ patron <!-- TMPL_VAR NAME="surname" --> <!-- TMPL_VAR name="firstname" --></stro
                <!-- TMPL_IF EXPR="typename eq 'S'" --><optgroup label="Staff"><!-- /TMPL_IF -->
                <!-- TMPL_IF EXPR="typename eq 'I'" --><optgroup label="Organisation"><!-- /TMPL_IF -->
                <!-- TMPL_IF EXPR="typename eq 'P'" --><optgroup label="Professional"><!-- /TMPL_IF -->
+               <!-- TMPL_IF EXPR="typename eq 'X'" --><optgroup label="Statistical"><!-- /TMPL_IF -->
                 <!-- TMPL_LOOP NAME="categoryloop" -->
                                <!-- TMPL_IF NAME="categorycodeselected" -->
                <option value="<!-- TMPL_VAR NAME="categorycode" -->" selected="selected"><!-- TMPL_VAR NAME="categoryname" --></option>
index 6020184..70ff86c 100755 (executable)
@@ -97,6 +97,7 @@ $template->param("checked" => 1) if ($nodouble eq 1);
 ($borrower_data = GetMember($borrowernumber,'borrowernumber')) if ($op eq 'modify' or $op eq 'save');
 my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'};
 my $category_type = $input->param('category_type');
+my $new_c_type = $category_type; #if we have input param, then we've already chosen the cat_type.
 unless ($category_type or !($categorycode)){
   my $borrowercategory= GetBorrowercategory($categorycode);
   $category_type = $borrowercategory->{'category_type'};
@@ -301,7 +302,7 @@ if ($ethnicitycategoriescount>=0) {
 }
 
 my @typeloop;
-foreach (qw(C A S P I)){
+foreach ( ($new_c_type) ? ($new_c_type) : qw(C A S P I X)){
        my $action="WHERE category_type=?";
        ($categories,$labels)=GetborCatFromCatType($_,$action);
        my @categoryloop;
@@ -483,7 +484,7 @@ foreach (qw(dateenrolled dateexpiry dateofbirth)) {
        $template->param( $_ => $data{$_});
 }
 
-$template->param( "showguarantor"  => ($category_type=~/A|I|S/) ? 0 : 1); # associate with step to know where you are
+$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
 $debug and warn "memberentry step: $step";
 $template->param(%data);
 $template->param( "step_$step"  => 1) if $step;        # associate with step to know where u are