Merge remote-tracking branch 'origin/new/bug_6488'
authorPaul Poulain <paul.poulain@biblibre.com>
Thu, 2 Feb 2012 14:21:45 +0000 (15:21 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 2 Feb 2012 14:21:45 +0000 (15:21 +0100)
43 files changed:
C4/Biblio.pm
C4/Members.pm
C4/Search.pm
acqui/z3950_search.pl
catalogue/detail.pl
cataloguing/merge.pl
circ/circulation.pl
debian/docs/koha-create.xml
debian/docs/koha-remove.xml
debian/scripts/koha-create
debian/scripts/koha-remove
docs/history.txt
installer/data/mysql/atomicupdate/bug_6843_Renew_membership_from_expiry_or_current_date.pl [new file with mode: 0755]
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt
kohaversion.pl
members/boraccount.pl
members/deletemem.pl
members/mancredit.pl
members/maninvoice.pl
members/member-flags.pl
members/member-password.pl
members/moremember.pl
members/notices.pl
members/pay.pl
members/paycollect.pl
members/readingrec.pl
opac/opac-addbybiblionumber.pl
t/Csv.t [deleted file]
t/Reports.t [deleted file]
t/db_dependent/Csv.t [new file with mode: 0755]
t/db_dependent/Reports.t [new file with mode: 0755]
tags/list.pl [new file with mode: 0755]

index ad559fa..631e891 100644 (file)
@@ -320,7 +320,7 @@ sub ModBiblio {
     SetUTF8Flag($record);
     my $dbh = C4::Context->dbh;
 
-    $frameworkcode = "" unless $frameworkcode;
+    $frameworkcode = "" if !$frameworkcode || $frameworkcode eq "Default"; # XXX
 
     _strip_item_fields($record, $frameworkcode);
 
@@ -1043,9 +1043,13 @@ for the given frameworkcode
 
 sub GetMarcFromKohaField {
     my ( $kohafield, $frameworkcode ) = @_;
-    return 0, 0 unless $kohafield and defined $frameworkcode;
+    return (0, undef) unless $kohafield and defined $frameworkcode;
     my $relations = C4::Context->marcfromkohafield;
-    return ( $relations->{$frameworkcode}->{$kohafield}->[0], $relations->{$frameworkcode}->{$kohafield}->[1] );
+    if ( my $mf = $relations->{$frameworkcode}->{$kohafield} ) {
+        return @$mf;
+    }
+    warn qq{No marc tags for framework "$frameworkcode" field $kohafield};
+    return (0, undef);
 }
 
 =head2 GetMarcBiblio
@@ -3157,9 +3161,24 @@ sub _koha_marc_update_bib_ids {
     # we drop the original field
     # we add the new builded field.
     my ( $biblio_tag,     $biblio_subfield )     = GetMarcFromKohaField( "biblio.biblionumber",          $frameworkcode );
+    die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag;
     my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode );
+    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblio_tag;
 
-    if ( $biblio_tag != $biblioitem_tag ) {
+    if ( $biblio_tag == $biblioitem_tag ) {
+
+        # biblionumber & biblioitemnumber are in the same field (can't be <10 as fields <10 have only 1 value)
+        my $new_field = MARC::Field->new(
+            $biblio_tag, '', '',
+            "$biblio_subfield"     => $biblionumber,
+            "$biblioitem_subfield" => $biblioitemnumber
+        );
+
+        # drop old field and create new one...
+        my $old_field = $record->field($biblio_tag);
+        $record->delete_field($old_field) if $old_field;
+        $record->insert_fields_ordered($new_field);
+    } else {
 
         # biblionumber & biblioitemnumber are in different fields
 
@@ -3187,20 +3206,6 @@ sub _koha_marc_update_bib_ids {
         $old_field = $record->field($biblioitem_tag);
         $record->delete_field($old_field) if $old_field;
         $record->insert_fields_ordered($new_field);
-
-    } else {
-
-        # biblionumber & biblioitemnumber are in the same field (can't be <10 as fields <10 have only 1 value)
-        my $new_field = MARC::Field->new(
-            $biblio_tag, '', '',
-            "$biblio_subfield"     => $biblionumber,
-            "$biblioitem_subfield" => $biblioitemnumber
-        );
-
-        # drop old field and create new one...
-        my $old_field = $record->field($biblio_tag);
-        $record->delete_field($old_field) if $old_field;
-        $record->insert_fields_ordered($new_field);
     }
 }
 
index 1d7bc42..b81872c 100644 (file)
@@ -1687,7 +1687,9 @@ sub ExtendMemberSubscriptionTo {
     my $dbh = C4::Context->dbh;
     my $borrower = GetMember('borrowernumber'=>$borrowerid);
     unless ($date){
-      $date=POSIX::strftime("%Y-%m-%d",localtime());
+      $date = (C4::Context->preference('BorrowerRenewalPeriodBase') eq 'dateexpiry') ?
+                                        C4::Dates->new($borrower->{'dateexpiry'}, 'iso')->output("iso") :
+                                        C4::Dates->new()->output("iso");
       $date = GetExpiryDate( $borrower->{'categorycode'}, $date );
     }
     my $sth = $dbh->do(<<EOF);
index f090fd8..e86bb26 100644 (file)
@@ -34,6 +34,7 @@ use C4::Items;
 use C4::Charset;
 use YAML;
 use URI::Escape;
+use Business::ISBN;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
 
@@ -1721,7 +1722,7 @@ sub searchResults {
                     $item_in_transit_count++ if $transfertwhen ne '';
                    $item_onhold_count++     if $reservestatus eq 'Waiting';
                     $item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan};
-                    
+
                     # can place hold on item ?
                     if ((!$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems'))
                       && !$item->{itemlost}
@@ -2637,7 +2638,15 @@ $template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) )
 
 sub z3950_search_args {
     my $bibrec = shift;
-    $bibrec = { title => $bibrec } if !ref $bibrec;
+    my $isbn = Business::ISBN->new($bibrec);
+
+    if (defined $isbn && $isbn->is_valid)
+    {
+        $bibrec = { isbn => $bibrec } if !ref $bibrec;
+    }
+    else {
+        $bibrec = { title => $bibrec } if !ref $bibrec;
+    }
     my $array = [];
     for my $field (qw/ lccn isbn issn title author dewey subject /)
     {
index 47dbe52..80503e0 100755 (executable)
@@ -134,8 +134,17 @@ if ( $op ne "do_search" ) {
 }
 else {
     my @id = $input->param('id');
+
+    if ( not defined @id ) {
+        # empty server list -> report and exit
+        $template->param( emptyserverlist => 1 );
+        output_html_with_http_headers $input, $cookie, $template->output;
+        exit;
+    }
+
     my @oConnection;
     my @oResult;
+    my @errconn;
     my $s = 0;
     my $query;
     my $nterms;
@@ -164,7 +173,7 @@ else {
         $query .= " \@attr 1=21 \"$subject\" ";
         $nterms++;
     }
-       if ($lccn) {    
+    if ($lccn) {
         $query .= " \@attr 1=9 $lccn ";
         $nterms++;
     }
@@ -186,7 +195,6 @@ warn "query ".$query  if $DEBUG;
         $sth->execute($servid);
         while ( $server = $sth->fetchrow_hashref ) {
             warn "serverinfo ".join(':',%$server) if $DEBUG;
-            my $noconnection = 0;
             my $option1      = new ZOOM::Options();
             $option1->option( 'async' => 1 );
             $option1->option( 'elementSetName', 'F' );
@@ -237,9 +245,10 @@ sub displayresults {
         my ( $error, $errmsg, $addinfo, $diagset ) =
           $oConnection[$k]->error_x();
         if ($error) {
-            warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n"
-              if $DEBUG;
-
+            if ($error =~ m/^(10000|10007)$/ ) {
+                push(@errconn, {'server' => $serverhost[$k]});
+            }
+            $DEBUG and warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n";
         }
         else {
             my $numresults = $oResult[$k]->size();
@@ -280,13 +289,6 @@ sub displayresults {
                           )
                           = ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' );
                         my %row_data;
-                        if ( $i % 2 ) {
-                            $toggle = 1;
-                        }
-                        else {
-                            $toggle = 0;
-                        }
-                        $row_data{toggle}       = $toggle;
                         $row_data{server}       = $servername[$k];
                         $row_data{isbn}         = $oldbiblio->{isbn};
                         $row_data{lccn}         = $oldbiblio->{lccn};
@@ -295,9 +297,9 @@ sub displayresults {
                         $row_data{breedingid}   = $breedingid;
                         $row_data{biblionumber} = $biblionumber;
                         push( @breeding_loop, \%row_data );
-                           
+
                     } else {
-                        push(@breeding_loop,{'toggle'=>($i % 2)?1:0,'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1});
+                        push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1});
                     } # $rec
                 }    # upto 5 results
             }    #$numresults
@@ -308,10 +310,11 @@ sub displayresults {
         breeding_loop => \@breeding_loop,
         server        => $servername[$k],
         numberpending => $numberpending,
+        errconn       => \@errconn
     );
     output_html_with_http_headers $input, $cookie, $template->output if $numberpending == 0;
 
-    #          print  $template->output  if $firstresult !=1;
+    #   print  $template->output  if $firstresult !=1;
     $firstresult++;
 }
 displayresults();
index fcf1f2b..db38551 100755 (executable)
@@ -35,6 +35,7 @@ use C4::Serials;
 use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn);
 use C4::External::Amazon;
 use C4::Search;                # enabled_staff_search_views
+use C4::Tags qw(get_tags);
 use C4::VirtualShelves;
 use C4::XSLT;
 use C4::Images;
@@ -395,4 +396,16 @@ if (C4::Context->preference('OPACBaseURL')){
      $template->param( OpacUrl => C4::Context->preference('OPACBaseURL') );
 }
 
+# Displaying tags
+
+my $tag_quantity;
+if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) {
+    $template->param(
+        TagsEnabled => 1,
+        TagsShowOnDetail => $tag_quantity
+    );
+    $template->param(TagLoop => get_tags({biblionumber=>$biblionumber, approved=>1,
+                                'sort'=>'-weight', limit=>$tag_quantity}));
+}
+
 output_html_with_http_headers $query, $cookie, $template->output;
index 0b881f1..020001d 100755 (executable)
@@ -27,6 +27,7 @@ use C4::Auth;
 use C4::Items;
 use C4::Biblio;
 use C4::Serials;
+use C4::Koha;
 use C4::Reserves qw/MergeHolds/;
 
 my $input = new CGI;
@@ -61,7 +62,7 @@ if ($merge) {
     # Rewriting the leader
     $record->leader(GetMarcBiblio($tobiblio)->leader());
 
-    my $frameworkcode = &GetFrameworkCode($tobiblio);
+    my $frameworkcode = $input->param('frameworkcode');
     my @notmoveditems;
 
     # Modifying the reference record
@@ -108,77 +109,107 @@ if ($merge) {
        push @errors, $error if ($error); 
     }
 
-    # Errors
-    my @errors_loop  = map{{error => $_}}@errors;
-
     # Parameters
     $template->param(
-       errors  => \@errors_loop,
        result => 1,
        biblio1 => $input->param('biblio1')
     );
 
-
 #-------------------------
 # Show records to merge
 #-------------------------
 } else {
-
     my $mergereference = $input->param('mergereference');
     my $biblionumber = $input->param('biblionumber');
 
-    my $data1 = GetBiblioData($biblionumber[0]);
-    my $data2 = GetBiblioData($biblionumber[1]);
-
-    # Ask the user to choose which record will be the kept
-    if (not $mergereference) {
-       $template->param(
-           choosereference => 1,       
-           biblio1 => $biblionumber[0],
-           biblio2 => $biblionumber[1],
-           title1 => $data1->{'title'},
-           title2 => $data2->{'title'}
-           );
-    } else {
-
-       if (scalar(@biblionumber) != 2) {
-           push @errors, "An unexpected number of records was provided for merging. Currently only two records at a time can be merged.";
-       }
-
-       # Checks if both records use the same framework
-       my $frameworkcode1 = &GetFrameworkCode($biblionumber[0]);
-       my $frameworkcode2 = &GetFrameworkCode($biblionumber[1]);
-       my $framework;
-       if ($frameworkcode1 ne $frameworkcode2) {
-           push @errors, "The records selected for merging are using different frameworks. Currently merging is only available for records using the same framework.";
-       } else {
-           $framework = $frameworkcode1;       
-       }
-
-       # Getting MARC Structure
-       my $tagslib = GetMarcStructure(1, $framework);
-
-       my $notreference = ($biblionumber[0] == $mergereference) ? $biblionumber[1] : $biblionumber[0];
-
-       # Creating a loop for display
-       my @record1 = _createMarcHash(GetMarcBiblio($mergereference), $tagslib);
-       my @record2 = _createMarcHash(GetMarcBiblio($notreference), $tagslib);
-
-       # Errors
-       my @errors_loop  = map{{error => $_}}@errors;
-
-       # Parameters
-       $template->param(
-           errors  => \@errors_loop,
-           biblio1 => $mergereference,
-           biblio2 => $notreference,
-           mergereference => $mergereference,
-           record1 => @record1,
-           record2 => @record2,
-           framework => $framework
-           );
+    if (scalar(@biblionumber) != 2) {
+        push @errors, "An unexpected number of records was provided for merging. Currently only two records at a time can be merged.";
+    }
+    else {
+        my $data1 = GetBiblioData($biblionumber[0]);
+        my $record1 = GetMarcBiblio($biblionumber[0]);
+
+        my $data2 = GetBiblioData($biblionumber[1]);
+        my $record2 = GetMarcBiblio($biblionumber[1]);
+
+        # Checks if both records use the same framework
+        my $frameworkcode1 = &GetFrameworkCode($biblionumber[0]);
+        my $frameworkcode2 = &GetFrameworkCode($biblionumber[1]);
+
+
+        my $subtitle1 = GetRecordValue('subtitle', $record1, $frameworkcode1);
+        my $subtitle2 = GetRecordValue('subtitle', $record2, $frameworkcode1);
+
+        if ($mergereference) {
+
+            my $framework;
+            if ($frameworkcode1 ne $frameworkcode2) {
+                $framework = $input->param('frameworkcode')
+                  or push @errors, "Famework not selected.";
+            } else {
+                $framework = $frameworkcode1;
+            }
+
+            # Getting MARC Structure
+            my $tagslib = GetMarcStructure(1, $framework);
+
+            my $notreference = ($biblionumber[0] == $mergereference) ? $biblionumber[1] : $biblionumber[0];
+
+            # Creating a loop for display
+            my @record1 = _createMarcHash(GetMarcBiblio($mergereference), $tagslib);
+            my @record2 = _createMarcHash(GetMarcBiblio($notreference), $tagslib);
+
+            # Parameters
+            $template->param(
+                biblio1 => $mergereference,
+                biblio2 => $notreference,
+                mergereference => $mergereference,
+                record1 => @record1,
+                record2 => @record2,
+                framework => $framework,
+            );
+        }
+        else {
+
+        # Ask the user to choose which record will be the kept
+            $template->param(
+                choosereference => 1,
+                biblio1 => $biblionumber[0],
+                biblio2 => $biblionumber[1],
+                title1 => $data1->{'title'},
+                subtitle1 => $subtitle1,
+                title2 => $data2->{'title'},
+                subtitle2 => $subtitle2
+            );
+            if ($frameworkcode1 ne $frameworkcode2) {
+                my $frameworks = getframeworks;
+                my @frameworkselect;
+                foreach my $thisframeworkcode ( keys %$frameworks ) {
+                    my %row = (
+                        value         => $thisframeworkcode,
+                        frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
+                    );
+                    if ($frameworkcode1 eq $thisframeworkcode){
+                        $row{'selected'} = 1;
+                        }
+                    push @frameworkselect, \%row;
+                }
+                $template->param(
+                    frameworkselect => \@frameworkselect,
+                    frameworkcode1 => $frameworkcode1,
+                    frameworkcode2 => $frameworkcode2,
+                );
+            }
+        }
     }
 }
+
+if (@errors) {
+    # Errors
+    my @errors_loop  = map{{error => $_}}@errors;
+    $template->param( errors  => \@errors_loop );
+}
+
 output_html_with_http_headers $input, $cookie, $template->output;
 exit;
 
index 1b6c619..e8d22cb 100755 (executable)
@@ -705,6 +705,7 @@ $template->param(
     soundon           => C4::Context->preference("SoundOn"),
     fast_cataloging   => $fast_cataloging,
     CircAutoPrintQuickSlip   => C4::Context->preference("CircAutoPrintQuickSlip"),
+       activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
 );
 
 # save stickyduedate to session
index a3e1520..ec1e426 100644 (file)
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>koha-create</command>
-      <arg choice="req"><option>--create-db</option>|<option>--request-db</option>|<option>--populate-db</option></arg>
+      <arg choice="req"><option>--create-db</option>|<option>--request-db</option>|<option>--populate-db</option>|<option>--use-db</option></arg>
       <arg><option>--marcflavor</option> marc21|normarc|unimarc</arg>
       <arg><option>--zebralang</option> en|nb|fr</arg>
       <arg><option>--defaultsql</option> /path/to/some.sql</arg>
       <arg><option>--configfile</option> /path/to/config</arg>
+      <arg><option>--passwdfile</option> /path/to/passwd</arg>
+      <arg><option>--database</option> database</arg>
       <arg><option>--adminuser</option> n</arg>
       <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
     </cmdsynopsis>
@@ -40,7 +42,7 @@
     <varlistentry>
       <term><option>--create-db</option></term>
       <listitem>
-        <para>Create a new datbase on localhost. If the database you want to use does not reside on localhost, you  can  use <option>--request-db</option> and <option>--populate-db</option>, see below.</para>
+        <para>Create a new database on localhost. If the database you want to use does not reside on localhost, you can use <option>--request-db</option> and <option>--populate-db</option>, see below. If the database already exists, you can use <option>--use-db</option>, see below.</para>
       </listitem>
     </varlistentry>
     
     <varlistentry>
       <term><option>--populate-db</option></term>
       <listitem>
-        <para>When you have run koha-create with the <option>--request-db</option> option, and a database has been set up, you can finnish your installation by running <command>koha-create</command> with this option.</para>
+        <para>When you have run koha-create with the <option>--request-db</option> option, and a database has been set up, you can finish your installation by running <command>koha-create</command> with this option.</para>
+      </listitem>
+    </varlistentry>
+
+    <varlistentry>
+      <term><option>--use-db</option></term>
+      <listitem>
+        <para>When the database you want to use has already been populated, you can run <command>koha-create</command> with this option to take care of all the other set-up configuration.</para>
       </listitem>
     </varlistentry>
 
     </varlistentry>
 
     <varlistentry>
+      <term><option>--database</option></term>
+      <listitem>
+        <para>MySQL database to use.</para>
+      </listitem>
+    </varlistentry>
+
+    <varlistentry>
       <term><option>--defaultsql</option></term>
       <listitem>
         <para>Path to an SQL-file other than the one pointed to in the default or alternative config file. Corresponds to the DEFAULTSQL config file variable.</para>
     </varlistentry>
 
     <varlistentry>
+      <term><option>--passwdfile</option></term>
+      <listitem>
+        <para>Path to an alternative passwd file. This file is in the same format as the default (Koha) passwd file, see below for details.</para>
+      </listitem>
+    </varlistentry>
+
+    <varlistentry>
       <term><option>--zebralang</option></term>
       <listitem>
         <para>Primary language for Zebra indexing. Corresponds to the ZEBRA_LANGUAGE config file variable.</para>
       </varlistentry>
     
       <varlistentry>
+        <term><option>OPACPORT</option></term>
+        <listitem>
+          <para>The port for the OPAC.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>OPACPREFIX</option></term>
+        <listitem>
+          <para>This is inserted before the instance name  when  forming  Apache ServerName.  For subdomains, make sure it ends with a period.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>OPACSUFFIX</option></term>
+        <listitem>
+          <para>This  is inserted after the instance name, but before the domain name, when forming Apache ServerName.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
         <term><option>INTRAPORT</option></term>
         <listitem>
           <para>The port for the intranet.  If you set this to empty or 80, then you must also define INTRAPREFIX or INTRASUFFIX.</para>
         <para>Configuration variables are read from this file, if it exists.</para>
       </listitem>
     </varlistentry>
+
+    <varlistentry>
+      <term><option><filename>/etc/koha/passwd</filename></option></term>
+      <listitem>
+        <para>Pre-selected database credentials are read from this file, if it exists. The format for this file is instancename:username:passwd:database. Database is optional, but the other three are required if you want to use pre-determined database user credentials.</para>
+      </listitem>
+    </varlistentry>
   </variablelist>
   </refsect1>
 
index ee2b266..4e272f8 100644 (file)
 
   <refsynopsisdiv>
     <cmdsynopsis>
-      <command>koha-remove</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
+      <command>koha-remove</command>
+      <arg><option>--keep-mysql</option></arg>
+      <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
 
+  <refsect1><title>Options</title>
+  <variablelist>
+    <varlistentry>
+      <term><option>--keep-mysql</option></term>
+      <listitem>
+        <para>Leave the MySQL database and user when removing the Koha instance.</para>
+      </listitem>
+    </varlistentry>
+  </variablelist>
+  </refsect1>
+
   <refsect1><title>Description</title>
   <para>Remove a Koha instance.</para>
   </refsect1>
-  
+
   <refsect1><title>See also</title>
   <simplelist type="inline">
     <member><command>koha-disable(8)</command></member>
@@ -39,7 +52,7 @@
     <member><command>koha-restore(8)</command></member>
   </simplelist>
   </refsect1>
-  
+
 </refentry>
 
 </article>
index ddfa0b0..bb2b642 100755 (executable)
 
 set -e
 
-usage="Usage: $0 [--create-db|--request-db|--populate-db] \
+usage="Usage: $0 [--create-db|--request-db|--populate-db|--use-db] \
     [--marcflavor marc21|normarc|unimarc] \
     [--zebralang en|nb|fr] \
     [--defaultsql /path/to/some.sql] \
-    [--configfile /path/to/config] [--adminuser n] instancename"
+    [--configfile /path/to/config] [--passwdfile /path/to/passwd] \
+    [--database database] [--adminuser n] instancename"
 
 die() {
     echo "$@" 1>&2
     exit 1
 }
 
+# UPPER CASE VARIABLES - from configfile or default value
+# lower case variables - generated within this script
 generate_config_file() {
     touch "$2"
     chown "root:$username" "$2"
     chmod 0640 "$2"
     sed -e "s/__KOHASITE__/$name/g" \
-        -e "s/__OPACPORT__/80/g" \
+        -e "s/__OPACPORT__/$OPACPORT/g" \
         -e "s/__INTRAPORT__/$INTRAPORT/g" \
-        -e "s/__OPACSERVER__/$domain/g" \
+        -e "s/__OPACSERVER__/$opacdomain/g" \
         -e "s/__INTRASERVER__/$intradomain/g" \
         -e "s/__ZEBRA_PASS__/$zebrapwd/g" \
         -e "s/__ZEBRA_MARC_FORMAT__/$ZEBRA_MARC_FORMAT/g" \
@@ -73,6 +76,9 @@ getinstancemysqldatabase() {
 
 # Set defaults and read config file, if it exists.
 DOMAIN=""
+OPACPORT="80"
+OPACPREFIX=""
+OPACSUFFIX=""
 INTRAPORT="8080"
 INTRAPREFIX=""
 INTRASUFFIX=""
@@ -80,14 +86,15 @@ DEFAULTSQL=""
 ZEBRA_MARC_FORMAT="marc21"
 ZEBRA_LANGUAGE="en"
 ADMINUSER="1"
+PASSWDFILE="/etc/koha/passwd"
 if [ -e /etc/koha/koha-sites.conf ]
 then
     . /etc/koha/koha-sites.conf
 fi
 
-[ $# -ge 2 ] && [ $# -le 12 ] || die $usage
+[ $# -ge 2 ] && [ $# -le 16 ] || die $usage
 
-TEMP=`getopt -o crpm:l:d:f:a: -l create-db,request-db,populate-db,marcflavor:,zebralang:,defaultsql:,configfile:,adminuser: \
+TEMP=`getopt -o crpm:l:d:f:a: -l create-db,request-db,populate-db,use-db,marcflavor:,zebralang:,defaultsql:,configfile:,passwdfile:,adminuser: \
      -n "$0" -- "$@"`
 
 # Note the quotes around `$TEMP': they are essential!
@@ -104,10 +111,13 @@ while true ; do
                -c|--create-db) op=create ; shift ;;
                -r|--request-db) op=request ; shift ;;
                -p|--populate-db) op=populate ; shift ;;
+        -u|--use-db) op=use ; shift ;;
                -m|--marcflavor) CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;;
                -l|--zebralang) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;;
                -d|--defaultsql) CLO_DEFAULTSQL="$2" ; shift 2 ;;
                -f|--configfile) configfile="$2" ; shift 2 ;;
+        -s|--passwdfile) CLO_PASSWDFILE="$2" ; shift 2 ;;
+        -b|--database) CLO_DATABASE="$2" ; shift 2 ;;
                -a|--adminuser) CLO_ADMINUSER="$2" ; shift 2 ;;
                --) shift ; break ;;
                *) die "Internal error processing command line arguments" ;;
@@ -142,31 +152,54 @@ if [ "$CLO_ADMINUSER" != "" ]
 then
     ADMINUSER="$CLO_ADMINUSER"
 fi
+if [ "$CLO_PASSWDFILE" != "" ]
+then
+    PASSWDFILE="$CLO_PASSWDFILE"
+fi
 
 name="$1"
 
-domain="$name$DOMAIN"
-if [ "$INTRAPORT" = 80 ] || [ "$INTRAPORT" = "" ]
+opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN"
+intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN"
+
+
+if [ `cat $PASSWDFILE | grep "^$name:"` ]
 then
-    intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN"
-else
-    intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN:$INTRAPORT"
+    passwdline=`cat $PASSWDFILE | grep "^$name:"`
+    mysqluser=`echo $passwdline | cut -d ":" -f 2`
+    mysqlpwd=`echo $passwdline | cut -d ":" -f 3`
+    mysqldb=`echo $passwdline | cut -d ":" -f 4`
 fi
 
+# The order of precedence for MySQL database name is:
+# default < passwd file < command line
+if [ "$mysqldb" = "" ]
+then
+    mysqldb="koha_$name"
+fi
+if [ "$CLO_DATABASE" != "" ]
+then
+    mysqldb="$CLO_DATABASE"
+fi
 
-mysqldb="koha_$name"
+if [ "$mysqluser" = "" ]
+then
+    mysqluser="koha_$name"
+fi
 mysqlhost="$(getmysqlhost)"
-mysqluser="koha_$name"
 
-if [ "$op" = create ] || [ "$op" = request ]
+if [ "$op" = create ] || [ "$op" = request ] || [ "$op" = use ]
 then
-    mysqlpwd="$(pwgen -1)"
+    if [ "$mysqlpwd" = "" ]
+    then
+        mysqlpwd="$(pwgen -1)"
+    fi
 else
     mysqlpwd="$(getinstancemysqlpassword $name)"
 fi
 
 
-if [ "$op" = create ] || [ "$op" = request ]
+if [ "$op" = create ] || [ "$op" = request ] || [ "$op" = use ]
 then
     # Create new user and group.
     username="$name-koha"
@@ -199,6 +232,15 @@ FLUSH PRIVILEGES;
 eof
     fi #`
 
+    if [ "$op" = use ]
+    then
+        mysql --defaults-extra-file=/etc/mysql/koha-common.cnf --force <<eof
+CREATE USER \`$mysqluser\`@'%' IDENTIFIED BY '$mysqlpwd';
+GRANT ALL PRIVILEGES ON \`$mysqldb\`.* TO \`$mysqluser\`;
+FLUSH PRIVILEGES;
+eof
+    fi #`
+
     # Generate and install Apache site-available file and log dir.
     generate_config_file apache-site.conf.in \
         "/etc/apache2/sites-available/$name"
@@ -285,7 +327,7 @@ eof
 fi
 
 
-if [ "$op" = create ] || [ "$op" = populate ]
+if [ "$op" = create ] || [ "$op" = populate ] || [ "$op" = use ]
 then
     # Reconfigure Apache.
     a2ensite "$name"
index b9e5c2a..09720ea 100755 (executable)
 
 set -e
 
+args=$(getopt -l keep-mysql -o k -n $0 -- "$@")
+set -- $args
+while [ ! -z "$1" ]
+do
+    case "$1" in
+         -k|--keep-mysql) keepmysql=1; exit;;
+          *) break;;
+    esac
+    shift
+done
+
 
 for name in "$@"
 do
     echo "Removing Koha instance $name"
 
-    mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
+    if [ "$keepmysql" != "1" ]
+    then
+        mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
 DROP USER \`koha_$name\`;
 DROP DATABASE \`koha_$name\`;
 FLUSH PRIVILEGES;
 eof
+    fi #`
     
     koha-stop-zebra $name
     [ -f "/etc/apache2/sites-available/$name" ]  && \
index 2473e1a..3da3df7 100644 (file)
@@ -596,4 +596,11 @@ January 16 2012    Jesse Maseto becomes the 168th developer to have a patch pushed
 January 17 2012        Connor Dewar becomes the 169th developer to have a patch pushed (as part of the Catalyst Open Source Academy)
 January 17 2012        Sam Sanders becomes the 170th developer to have a patch pushed (as part of the Catalyst Open Source Academy)
 January 18 2012        Olivier Crouzet becomes the 171st developer to have a patch pushed
+January 31 2012        Bart Jorgensen becomes the 172st developer to have a patch pushed
+January 31 2012        Kate Henderson becomes the 173st developer to have a patch pushed
+January 31 2012        Jono Mingard becomes the 174st developer to have a patch pushed
+January 31 2012        Jorgia Kelsey becomes the 175st developer to have a patch pushed
+February 1 2012        Aleksa Vujicic becomes the 176th developer to have a patch pushed
+February 1 2012        Peter Lorimer becomes the 177th developer to have a patch pushed
+
 
diff --git a/installer/data/mysql/atomicupdate/bug_6843_Renew_membership_from_expiry_or_current_date.pl b/installer/data/mysql/atomicupdate/bug_6843_Renew_membership_from_expiry_or_current_date.pl
new file mode 100755 (executable)
index 0000000..bffd857
--- /dev/null
@@ -0,0 +1,9 @@
+#! /usr/bin/perl
+use strict;
+use warnings;
+use C4::Context;
+my $dbh=C4::Context->dbh;
+$dbh->do(<<ENDOFRENEWAL);
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice');
+ENDOFRENEWAL
+print "Upgrade done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
index 2a59b47..5e3d79d 100755 (executable)
@@ -333,3 +333,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice');
index 0982282..099dfb9 100755 (executable)
@@ -4651,7 +4651,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     $dbh->do(
         q|INSERT INTO permissions (module_bit, code, description) VALUES (13, 'upload_local_cover_images', 'Upload local cover images')|
     );
-    print "Upgrade done (Added support for local cover images)\n";
+    print "Upgrade to $DBversion done (Added support for local cover images)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.07.00.011";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do(<<ENDOFRENEWAL);
+    INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice');
+ENDOFRENEWAL
+    print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
     SetVersion($DBversion);
 }
 =head1 FUNCTIONS
index 913076f..a4acfdf 100644 (file)
@@ -118,7 +118,7 @@ function update_child() {
         [% END %]
        [% END %]
        [% IF ( CAN_user_borrowers ) %]
-        [% IF ( adultborrower ) %]<li><a id="addchild" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C">Add child</a></li>[% END %]
+        [% IF ( adultborrower AND activeBorrowerRelationship ) %]<li><a id="addchild" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C">Add child</a></li>[% END %]
         [% IF ( CAN_user_staffaccess ) %] <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]">Change Password</a></li>[% END %]
     [% END %]
     <li><a id="duplicate" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;category_type=[% category_type %]">Duplicate</a></li>
index bc3e920..bad8502 100644 (file)
@@ -114,7 +114,7 @@ function update_child() {
                 <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=[% borrowernumber %]&amp;category_type=A">Edit</a></li>
             [% END %]
         [% END %]
-       [% IF ( adultborrower ) %]<li><a id="addchild" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C">Add child</a></li>[% END %]
+       [% IF ( adultborrower AND activeBorrowerRelationship ) %]<li><a id="addchild" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C">Add child</a></li>[% END %]
        [% IF CAN_user_staffaccess %]<li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]">Change Password</a></li> [% END %]
        <li><a id="duplicate" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;category_type=[% category_type %]">Duplicate</a></li>
     <li id="printmenuc"><a id="printpage" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]&amp;print=page">Print Page</a></li>
index 46f0724..40e0ff3 100644 (file)
                 <li>Andrei V. Toutoukine</li>
                 <li>Darrell Ulm</li>
                 <li>Universidad ORT Uruguay (Ernesto Silva, Andres Tarallo)</li>
+                <li>Aleksa Vujicic</li>
                <li>Reed Wade</li>
                <li>Ian Walls</li>
                 <li><a href="http://www.ohloh.net/accounts/janewagner">Jane Wagner</a></li>
index 66dbc6e..1f2ad60 100644 (file)
@@ -120,7 +120,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
 
         </p>
     [% END %]
-    <fieldset class="action"><input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/> <a class="cancel close" href="#">Cancel</a></fieldset>
+    <fieldset class="action"><input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/> <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a></fieldset>
     </div>
     </form>
 
@@ -155,6 +155,13 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
     [% END %]</tbody>
 </table>
     [% ELSE %]
+        [% IF ( emptyserverlist ) %]
+            You didn't select any Z39.50 target.
+        [% ELSE %]
+            [% FOREACH errcon IN errconn %]
+                Connection failed to [% errcon.server %]
+            [% END %]
+        [% END %]
         <p>Nothing found. <a href="javascript: history.back()">Try another search</a>.</p>
     [% END %]
 
index 0e2f73b..3d88883 100644 (file)
@@ -42,7 +42,7 @@ Patrons:
          - "Guarantors can be the following of those they guarantee:"
          - pref: borrowerRelationship
            class: multi
-         - (input multiple choices separated by |)
+         - (input multiple choices separated by |). Leave empty to deactivate
      -
          - "Borrowers can have the following titles:"
          - pref: BorrowersTitles
@@ -114,3 +114,9 @@ Patrons:
                yes: Do
                no: "Don't"
          - store and display surnames in upper case.
+     -
+         - When renewing borrowers, base the new expiry date on
+         - pref: BorrowerRenewalPeriodBase
+           choices:
+               now: current date.
+               dateexpiry: current membership expiry date.
index 38a26c9..80e04a9 100644 (file)
@@ -102,6 +102,18 @@ function verify_images() {
             [% END %]
             </span>
         [% END %]
+        [% IF ( TagsEnabled &&  TagsShowOnDetail &&  TagLoop ) %]
+                <span class="results_summary"><span class="label">Tags:</span>
+                    [% FOREACH TagLoo IN TagLoop %]
+                        [% IF ( CAN_user_tools_moderate_tags ) %]
+                        <a href="/cgi-bin/koha/tags/list.pl?tag=[% TagLoo.term |url %]">[% TagLoo.term |html %]</a>
+                        [% ELSE %]
+                        [% TagLoo.term |html %]
+                        [% END %]
+                        <span class="weight">([% TagLoo.weight_total %])</span>[% IF ( loop.last ) %][% ELSE %], [% END %]
+                    [% END %]
+                    </span>
+        [% END %]
         [% IF ( holdcount ) %]<span class="results_summary"><span class="label">Holds:</span> <span class="holdcount"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber %]">[% holdcount %]</a></span></span>[% ELSE %][% END %]
 
         [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]</div><div class="yui-u" id="bookcoverimg">
@@ -220,9 +232,24 @@ function verify_images() {
                </ul>
                </li>
         [% END %]
+        [% IF ( TagsEnabled &&  TagsShowOnDetail &&  TagLoop ) %]
+                <li><strong>Tags:</strong>
+                    <ul id="tagslist">
+                    [% FOREACH TagLoo IN TagLoop %]
+                        <li>
+                        [% IF ( CAN_user_tools_moderate_tags ) %]
+                        <a href="/cgi-bin/koha/tags/list.pl?tag=[% TagLoo.term |url %]">[% TagLoo.term |html %]</a>
+                        [% ELSE %]
+                        [% TagLoo.term |html %]
+                        [% END %]
+                        <span class="weight">([% TagLoo.weight_total %])</span>[% IF ( loop.last ) %][% ELSE %], [% END %]</li>
+                    [% END %]
+                    </ul></li>
+        [% END %]
             [% IF ( holdcount ) %]<li><strong>Holds:</strong> <span class="holdcount"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber %]">[% holdcount %]</a></span></li>[% ELSE %][% END %]
         </ul>
                [% END %]
+
 </div>
 </div>
 <div id="bibliodetails" class="toptabs">
index 0d8a84c..9235fdd 100644 (file)
@@ -1,5 +1,6 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Cataloging &rsaquo; Merging records</title>
+[% INCLUDE 'greybox.inc' %]
 [% INCLUDE 'doc-head-close.inc' %]
 <style type="text/css">
 div.record ul, div.record li { float:none; display:block; }
@@ -161,13 +162,17 @@ $(document).ready(function(){
 
 });
 
+function changeFramework(fw) {
+    $("#Frameworks").val(fw);
+}
+
 //]]>
 </script>
 </head>
 <body>
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cataloging-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>  &rsaquo; [% IF ( biblionumber ) %]Editing <em>[% title |html %]</em> (Record Number [% biblionumber %])[% ELSE %]Add MARC Record[% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>  &rsaquo; Merging records</div>
 
 <div id="doc" class="yui-t7">
 
@@ -195,9 +200,26 @@ $(document).ready(function(){
     <fieldset class="rows">
        <legend>Merge reference</legend>
        <ol>
-       <li class="radio"><input type="radio" value="[% biblio1 %]" checked="checked" id="mergereference1" name="mergereference" /><label style="float:none" for="mergereference1">[% title1 %] ([% biblio1 %])</label></li>
-       <li class="radio"><input type="radio" value="[% biblio2 %]" id="mergereference2" name="mergereference" /><label style="float:none" for="mergereference2">[% title2 %] ([% biblio2 %])</label></li>
+       <li class="radio"><input type="radio" value="[% biblio1 %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 %]')" /><label for="mergereference1">[% title1 %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1.subfield %][% END %] (<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblio1 %]" title="MARC" rel="gb_page_center[600,500]">[% biblio1 %]</a>)</label></li>
+       <li class="radio"><input type="radio" value="[% biblio2 %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 %]')" /><label for="mergereference2">[% title2 %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2.subfield %][% END %] (<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblio2 %]" title="MARC" rel="gb_page_center[600,500]">[% biblio2 %]</a>)</label></li>
+
+    [% IF frameworkselect %]
+          <li><label for="frameworkcode">Using framework:</label>
+                      <select name="frameworkcode" id="frameworkcode">
+                                      <option value="Default">Default</option>
+                                      [% FOREACH frameworkcodeloo IN frameworkselect %]
+                                          [% IF ( frameworkcodeloo.selected ) %]
+                                              <option value="[% frameworkcodeloo.value %]" selected="selected">
+                                          [% ELSE %]
+                                              <option value="[% frameworkcodeloo.value %]">
+                                          [% END %]
+                                           [% frameworkcodeloo.frameworktext %]
+                                           </option>
+                                      [% END %]
+                      </select></li>
+    [% END %]
 </ol>
+
        <input type="hidden" name="biblionumber" value="[% biblio1 %]" />
        <input type="hidden" name="biblionumber" value="[% biblio2 %]" />
        <fieldset class="action"><input type="submit" value="Next" /></fieldset>
@@ -332,14 +354,15 @@ $(document).ready(function(){
                [% END %]
 
            </ul>
+</div>
+</div> <!-- // #result -->
+</div> <!-- .yui-u -->
 
 <input type="hidden" name="biblio1" value="[% biblio1 %]" />
 <input type="hidden" name="biblio2" value="[% biblio2 %]" />
 <input type="hidden" name="mergereference" value="[% mergereference %]" />
+<input type="hidden" name="frameworkcode" value="[% framework %]" />
 
-</div>
-</div> <!-- // #result -->
-</div> <!-- .yui-u -->
 <fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
 </div>
 </form>
index 6dfd8f9..cf40c77 100644 (file)
@@ -6,6 +6,14 @@
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
+<script type=text/javascript>
+
+function confirmWriteoffAll() {
+    return confirm(_("Are you sure you want to writeoff all fines?"));
+}
+
+</script>
+
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay Fines for [% borrower.firstname %] [% borrower.surname %]</div>
 
 <div id="doc3" class="yui-t2">
@@ -88,8 +96,8 @@
 </table>
 <fieldset class="action">
 <input type="submit" name="paycollect"  value="Pay Amount" class="submit" />
-<input type="submit" name="woall"  value="Writeoff All" class="submit" />
-<input type="submit" name="payselected"  value="Pay Selected" class="submit" />
+<input type="submit" name="woall"  value="Writeoff All" class="submit" onclick="return confirmWriteoffAll()" />
+<input type="submit" name="payselected"  value="Pay Selected" class="submit"/>
 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
 </fieldset>
 </form>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt
new file mode 100644 (file)
index 0000000..05fd452
--- /dev/null
@@ -0,0 +1,103 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Koha &rsaquo; Tools &rsaquo; Tags &rsaquo; [% IF ( do_it ) %]Review &rsaquo; [% ELSE %]Review Tags[% END %]</title>
+[% INCLUDE 'doc-head-close.inc' %]
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<script type="text/javascript">
+//<![CDATA[
+    $.tablesorter.addParser({
+        id: 'articles',
+        is: function(s) {return false;  },
+        format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
+        type: 'text'
+    });
+    $(document).ready(function() {
+        $(".delete").click(function (event) {
+            $(this).parent().parent().parent().addClass("selected");
+            var answer = confirm(_("Are you sure you want to remove the tag from this title?"));
+                if (!answer){
+                    $("tr").removeClass("selected");
+                    event.preventDefault();
+                }
+        });
+        $("#itemst").tablesorter({
+            sortList: [[0,0]],
+            headers: { 0: { sorter: 'articles' },1: { sorter: false },2:{sorter:false}}
+        });
+    });
+//]]>
+</script>
+<style type="text/css">
+tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : transparent; }</style>
+</head>
+<body>
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'cat-search.inc' %]
+
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/tags/review.pl">Tags</a> &rsaquo; Results for tag <i>[% tag %]</i></div>
+
+<div id="doc3" class="yui-t2">
+ <div id="bd">
+  <div id="yui-main">
+  <div class="yui-b">
+[% IF ( titles ) %]
+<h3>Titles tagged with the term <i>[% tag %]</i></h3>
+<table id="itemst">
+       <thead><tr>
+           <th>Title</th>
+           <th>Location</th>
+           <th>&nbsp;</th>
+        </tr></thead>
+
+        [% FOREACH title IN titles %]
+            [% IF ( title.even ) %]
+                <tr class="highlight">
+            [% ELSE %]
+                <tr>
+            [% END %]
+            <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = title.biblionumber %][% title.title |html %][% FOREACH subtitl IN title.subtitle %] [% subtitl.subfield %][% END %]</a>
+            [% title.author %]
+            <p>[% IF ( title.publishercode ) %]- [% title.publishercode|html %]
+            [% IF ( title.place ) %] [% title.place %][% END %][% END %]
+            [% IF ( title.pages ) %] - [% title.pages %][% IF ( title.size ) %] [% title.size %]
+            [% END %]
+            [% END %]</p>
+            [% IF ( title.notes ) %]
+            <p>[% title.notes |html%]</p>[% END %]
+            [% IF ( title.TagLoop ) %]<p style="font-size:90%"><strong>Tagged with:</strong> [% FOREACH TagLoo IN title.TagLoop %]
+            <a href="/cgi-bin/koha/tags/list.pl?tag=[% TagLoo.term %]">[% TagLoo.term |html %]</a> <span class="weight">([% TagLoo.weight_total %])</span>[% IF ( loop.last ) %][% ELSE %], [% END %]
+            [% END %]</p>
+            [% END %]
+            </td>
+            <td>[% IF ( title.items ) %]<ul style="font-size:80%">[% FOREACH item IN title.items %]
+                <li>
+                    [% item.branchname %] [% item.location_description %]
+                    [% IF ( item.itemcallnumber ) %]
+                        ([% item.itemcallnumber %])
+                    [% END %]
+                </li>
+                [% END %]</ul>[% ELSE %]This record has no items.[% END %]
+             </td>
+             <td><form method="post" action="/cgi-bin/koha/tags/list.pl"><input type="hidden" name="op" value="del" /><input type="hidden" name="tag" value="[% tag %]" /><input type="hidden" name="tag_id" value="[% title.tag_id %]" /><input type="submit" class="delete" value="Remove tag" /></form></td>
+            </tr>
+        [% END %]
+    </table>
+[% ELSE %]
+       <div class="dialog message">There are no titles tagged with the term <i>[% tag %]</i></div>
+[% END %]
+</form>
+ </div>
+ </div>
+ <div class="yui-b">
+  <ul>
+    <li><a href="/cgi-bin/koha/tags/review.pl?approved=1">Approved tags</a>
+    </li>
+    <li><a href="/cgi-bin/koha/tags/review.pl?approved=-1">Rejected tags</a>
+    </li>
+    <li><a href="/cgi-bin/koha/tags/review.pl?approved=0">Pending tags</a>
+    </li>
+    <li><a href="/cgi-bin/koha/tags/review.pl?approved=all">All tags</a>
+    </li>
+  </ul>
+ </div>
+</div>
+[% INCLUDE 'intranet-bottom.inc' %]
\ No newline at end of file
index 5d025af..843f7ca 100644 (file)
@@ -217,7 +217,7 @@ td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
                [% ELSE %]<td class="pending">
                [% END %]
            </td>
-           <td>[% tagloo.term %]
+           <td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term %]">[% tagloo.term %]</a>
            </td>
                <td>[% tagloo.weight_total %]
            </td>
index a73324e..c6379f0 100644 (file)
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.07.00.010';
+    our $VERSION = '3.07.00.011';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
index 2805f27..44db953 100755 (executable)
@@ -128,6 +128,7 @@ $template->param(
     is_child            => ($data->{'category_type'} eq 'C'),
     reverse_col         => $reverse_col,
     accounts            => $accts,
+       activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
index b1ba709..924245a 100755 (executable)
@@ -102,6 +102,7 @@ if ($countissues > 0 or $flags->{'CHARGES'}  or $data->{'borrowernumber'}){
         email => $bor->{'email'},
         branchcode => $bor->{'branchcode'},
         branchname => GetBranchName($bor->{'branchcode'}),
+               activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
     );
     if ($countissues >0) {
         $template->param(ItemsOnIssues => $countissues);
index 3c664c2..88200d0 100755 (executable)
@@ -106,6 +106,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
                    branchcode => $data->{'branchcode'},
                    branchname => GetBranchName($data->{'branchcode'}),
                    is_child        => ($data->{'category_type'} eq 'C'),
+                       activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
         );
     output_html_with_http_headers $input, $cookie, $template->output;
 }
index 1f42093..f1c572c 100755 (executable)
@@ -133,6 +133,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
                branchcode => $data->{'branchcode'},
                branchname => GetBranchName($data->{'branchcode'}),
                is_child        => ($data->{'category_type'} eq 'C'),
+               activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
     );
     output_html_with_http_headers $input, $cookie, $template->output;
 }
index 76f300e..ca8c9d0 100755 (executable)
@@ -191,6 +191,7 @@ $template->param(
                branchname => GetBranchName($bor->{'branchcode'}),
                loop => \@loop,
                is_child        => ($bor->{'category_type'} eq 'C'),
+               activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
                );
 
     output_html_with_http_headers $input, $cookie, $template->output;
index 25e9551..8128a3d 100755 (executable)
@@ -121,6 +121,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
            destination => $destination,
                is_child        => ($bor->{'category_type'} eq 'C'),
            defaultnewpassword => $defaultnewpassword,
+               activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
        );
 
 
index 6e5407c..c477100 100755 (executable)
@@ -481,6 +481,7 @@ $template->param(
     "dateformat_" . (C4::Context->preference("dateformat") || '') => 1,
     samebranch     => $samebranch,
     quickslip            => $quickslip,
+       activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
 );
 
 #Get the slip news items
index 41f2a90..51a843c 100755 (executable)
@@ -68,6 +68,7 @@ $template->param(
                        sentnotices             => 1,
                         branchname              => GetBranchName($borrower->{'branchcode'}),
                         categoryname            => $borrower->{'description'},
+                       activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
 );
 output_html_with_http_headers $input, $cookie, $template->output;
 
index 6bc18fc..72a109f 100755 (executable)
@@ -103,6 +103,8 @@ for (@names) {
     }
 }
 
+$template->param( activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne '') );
+
 add_accounts_to_template();
 
 output_html_with_http_headers $input, $cookie, $template->output;
index cbddc05..e05a5a6 100755 (executable)
@@ -138,6 +138,7 @@ $template->param(
     borrowenumber => $borrowernumber,    # some templates require global
     borrower      => $borrower,
     total         => $total_due
+       activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
index b4fb8a7..c4a8237 100755 (executable)
@@ -133,6 +133,7 @@ $template->param(
                                                branchname => GetBranchName($data->{'branchcode'}),
                                                showfulllink => (scalar @loop_reading > 50),                                    
                                                loop_reading => \@loop_reading,
+                                               activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
 );
 output_html_with_http_headers $input, $cookie, $template->output;
 
index fd3124b..610b22e 100755 (executable)
@@ -59,7 +59,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         template_name   => "opac-addbybiblionumber.tmpl",
         query           => $query,
         type            => "opac",
-        authnotrequired =>( C4::Context->preference("OpacPublic") ? 1 : 0 ),
+        authnotrequired => 0,
     }
 );
 
diff --git a/t/Csv.t b/t/Csv.t
deleted file mode 100755 (executable)
index 17cd8bb..0000000
--- a/t/Csv.t
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/perl
-#
-# This Koha test module is a stub!  
-# Add more tests here!!!
-
-use strict;
-use warnings;
-
-use Test::More tests => 4;
-
-BEGIN {
-        use_ok('C4::Csv');
-}
-
-ok(C4::Csv::GetCsvProfiles(), 'test getting csv profiles');
-is(C4::Csv::GetCsvProfile(),undef, 'test getting csv profiles');
-
-ok(C4::Csv::GetCsvProfilesLoop(), 'test getting profile loop');
diff --git a/t/Reports.t b/t/Reports.t
deleted file mode 100755 (executable)
index e28efd6..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/perl
-#
-# This Koha test module is a stub!  
-# Add more tests here!!!
-
-use strict;
-use warnings;
-
-use Test::More tests => 2;
-
-BEGIN {
-        use_ok('C4::Reports');
-}
-
-
-ok(GetDelimiterChoices(),"Testing getting delimeter choices");  #Not testing the value of the output just that it returns something.
diff --git a/t/db_dependent/Csv.t b/t/db_dependent/Csv.t
new file mode 100755 (executable)
index 0000000..17cd8bb
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+#
+# This Koha test module is a stub!  
+# Add more tests here!!!
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+BEGIN {
+        use_ok('C4::Csv');
+}
+
+ok(C4::Csv::GetCsvProfiles(), 'test getting csv profiles');
+is(C4::Csv::GetCsvProfile(),undef, 'test getting csv profiles');
+
+ok(C4::Csv::GetCsvProfilesLoop(), 'test getting profile loop');
diff --git a/t/db_dependent/Reports.t b/t/db_dependent/Reports.t
new file mode 100755 (executable)
index 0000000..e28efd6
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+#
+# This Koha test module is a stub!  
+# Add more tests here!!!
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+BEGIN {
+        use_ok('C4::Reports');
+}
+
+
+ok(GetDelimiterChoices(),"Testing getting delimeter choices");  #Not testing the value of the output just that it returns something.
diff --git a/tags/list.pl b/tags/list.pl
new file mode 100755 (executable)
index 0000000..6a363ac
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/bin/perl
+
+# Copyright 2011 Athens County Public Libraries
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use warnings;
+use strict;
+use CGI;
+
+use C4::Auth qw(:DEFAULT check_cookie_auth);
+use C4::Biblio;
+use C4::Context;
+use C4::Dates qw(format_date);
+use C4::Items;
+use C4::Koha;
+use C4::Tags 0.03 qw(get_tags remove_tag get_tag_rows);
+use C4::Output;
+
+my $needed_flags = { tools => 'moderate_tags'
+};    # FIXME: replace when more specific permission is created.
+
+my $query        = CGI->new;
+my $op           = $query->param('op') || '';
+my $biblionumber = $query->param('biblionumber');
+my $tag          = $query->param('tag');
+my $tag_id       = $query->param('tag_id');
+
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+    {
+        template_name   => "tags/list.tmpl",
+        query           => $query,
+        type            => "intranet",
+        debug           => 1,
+        authnotrequired => 0,
+        flagsrequired   => $needed_flags,
+    }
+);
+
+if ( $op eq "del" ) {
+    remove_tag($tag_id);
+    print $query->redirect("/cgi-bin/koha/tags/list.pl?tag=$tag");
+}
+else {
+
+    my $marcflavour = C4::Context->preference('marcflavour');
+    my @results;
+
+    if ($tag) {
+        my $taglist = get_tag_rows( { term => $tag } );
+        for ( @{$taglist} ) {
+            my $dat    = &GetBiblioData( $_->{biblionumber} );
+            my $record = &GetMarcBiblio( $_->{biblionumber} );
+            $dat->{'subtitle'} =
+              GetRecordValue( 'subtitle', $record,
+                GetFrameworkCode( $_->{biblionumber} ) );
+            my @items = GetItemsInfo( $_->{biblionumber} );
+            $dat->{biblionumber} = $_->{biblionumber};
+            $dat->{tag_id}       = $_->{tag_id};
+            $dat->{items}        = \@items;
+            $dat->{TagLoop}      = get_tags(
+                {
+                    biblionumber => $_->{biblionumber},
+                    'sort'       => '-weight',
+                    limit        => 10
+                }
+            );
+            push( @results, $dat );
+        }
+
+        my $resultsarray = \@results;
+
+        $template->param(
+            tag    => $tag,
+            titles => $resultsarray,
+        );
+    }
+}
+
+output_html_with_http_headers $query, $cookie, $template->output;