View | Details | Raw Unified | Return to bug 5079
Collapse All | Expand All

(-)a/C4/XSLT.pm (-5 / +17 lines)
Lines 187-193 sub XSLTParse4Display { Link Here
187
                              OPACBaseURL TraceCompleteSubfields UseICU
187
                              OPACBaseURL TraceCompleteSubfields UseICU
188
                              UseAuthoritiesForTracings TraceSubjectSubdivisions
188
                              UseAuthoritiesForTracings TraceSubjectSubdivisions
189
                              Display856uAsImage OPACDisplay856uAsImage 
189
                              Display856uAsImage OPACDisplay856uAsImage 
190
                              UseControlNumber
190
                              UseControlNumber OPACItemLocation
191
                              AlternateHoldingsField AlternateHoldingsSeparator / )
191
                              AlternateHoldingsField AlternateHoldingsSeparator / )
192
    {
192
    {
193
        my $sp = C4::Context->preference( $syspref );
193
        my $sp = C4::Context->preference( $syspref );
Lines 227-238 sub buildKohaItemsNamespace { Link Here
227
    my ($biblionumber, $hidden_items) = @_;
227
    my ($biblionumber, $hidden_items) = @_;
228
228
229
    my @items = C4::Items::GetItemsInfo($biblionumber);
229
    my @items = C4::Items::GetItemsInfo($biblionumber);
230
230
    if ($hidden_items && @$hidden_items) {
231
    if ($hidden_items && @$hidden_items) {
231
        my %hi = map {$_ => 1} @$hidden_items;
232
        my %hi = map {$_ => 1} @$hidden_items;
232
        @items = grep { !$hi{$_->{itemnumber}} } @items;
233
        @items = grep { !$hi{$_->{itemnumber}} } @items;
233
    }
234
    }
235
236
    my $shelflocations = GetKohaAuthorisedValues('items.location',GetFrameworkCode($biblionumber), 'opac');
237
    my $ccodes         = GetKohaAuthorisedValues('items.ccode',GetFrameworkCode($biblionumber), 'opac');
238
234
    my $branches = GetBranches();
239
    my $branches = GetBranches();
235
    my $itemtypes = GetItemTypes();
240
    my $itemtypes = GetItemTypes();
241
    my $location = "";
242
    my $ccode = "";
236
    my $xml = '';
243
    my $xml = '';
237
    for my $item (@items) {
244
    for my $item (@items) {
238
        my $status;
245
        my $status;
Lines 271-281 sub buildKohaItemsNamespace { Link Here
271
            $status = "available";
278
            $status = "available";
272
        }
279
        }
273
        my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):'';
280
        my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):'';
274
	    my $itemcallnumber = xml_escape($item->{itemcallnumber});
281
        $location = xml_escape($shelflocations->{$item->{location}});
282
        $ccode = xml_escape($ccodes->{$item->{ccode}});
283
284
        my $itemcallnumber = xml_escape($item->{itemcallnumber});
275
        $xml.= "<item><homebranch>$homebranch</homebranch>".
285
        $xml.= "<item><homebranch>$homebranch</homebranch>".
276
		"<status>$status</status>".
286
               "<location>$location</location>".
277
		"<itemcallnumber>".$itemcallnumber."</itemcallnumber>"
287
               "<ccode>$ccode</ccode>".
278
        . "</item>";
288
               "<status>$status</status>".
289
               "<itemcallnumber>".$itemcallnumber."</itemcallnumber>".
290
               "</item>";
279
291
280
    }
292
    }
281
    $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>";
293
    $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>";
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 375-377 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
375
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
375
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
378
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacItemLocation','callnum','Show the shelving location of items in the opac','callnum|ccode|location','Choice');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 5536-5541 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5536
    SetVersion($DBversion);
5536
    SetVersion($DBversion);
5537
}
5537
}
5538
5538
5539
$DBversion = "3.09.00.XXX";
5540
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5541
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacItemLocation','callnum','Show the shelving location of items in the opac','callnum|ccode|location','Choice');");
5542
    print "Upgrade to $DBversion done (Add OpacItemLocation syspref)\n";
5543
    SetVersion ($DBversion);
5544
}
5545
5539
=head1 FUNCTIONS
5546
=head1 FUNCTIONS
5540
5547
5541
=head2 TableExists($table)
5548
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+8 lines)
Lines 249-254 OPAC: Link Here
249
                  no: "Don't allow"
249
                  no: "Don't allow"
250
            - patrons to log in to their accounts on the OPAC.
250
            - patrons to log in to their accounts on the OPAC.
251
        -
251
        -
252
            - Show
253
            - pref: OpacItemLocation
254
              choices:
255
                  location: location
256
                  ccode: "collection code"
257
                  callnum: "call number only"
258
            - for items on the OPAC search results.
259
        -
252
            - pref: OpacPasswordChange
260
            - pref: OpacPasswordChange
253
              choices:
261
              choices:
254
                  yes: Allow
262
                  yes: Allow
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl (-40 / +72 lines)
Lines 27-32 Link Here
27
    <xsl:variable name="AlternateHoldingsField" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 1, 3)"/>
27
    <xsl:variable name="AlternateHoldingsField" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 1, 3)"/>
28
    <xsl:variable name="AlternateHoldingsSubfields" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 4)"/>
28
    <xsl:variable name="AlternateHoldingsSubfields" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 4)"/>
29
    <xsl:variable name="AlternateHoldingsSeparator" select="marc:sysprefs/marc:syspref[@name='AlternateHoldingsSeparator']"/>
29
    <xsl:variable name="AlternateHoldingsSeparator" select="marc:sysprefs/marc:syspref[@name='AlternateHoldingsSeparator']"/>
30
    <xsl:variable name="OPACItemLocation" select="marc:sysprefs/marc:syspref[@name='OPACItemLocation']"/>
30
        <xsl:variable name="leader" select="marc:leader"/>
31
        <xsl:variable name="leader" select="marc:leader"/>
31
        <xsl:variable name="leader6" select="substring($leader,7,1)"/>
32
        <xsl:variable name="leader6" select="substring($leader,7,1)"/>
32
        <xsl:variable name="leader7" select="substring($leader,8,1)"/>
33
        <xsl:variable name="leader7" select="substring($leader,8,1)"/>
Lines 1020-1065 Link Here
1020
                            <xsl:otherwise>No copies available </xsl:otherwise>
1021
                            <xsl:otherwise>No copies available </xsl:otherwise>
1021
                        </xsl:choose>
1022
                        </xsl:choose>
1022
				   </xsl:when>
1023
				   </xsl:when>
1023
                   <xsl:when test="count(key('item-by-status', 'available'))>0">
1024
    <xsl:when test="count(key('item-by-status', 'available'))>0">
1024
                   <span class="available">
1025
    <span class="available">
1025
                       <b><xsl:text>Copies available for loan: </xsl:text></b>
1026
         <b>
1026
                       <xsl:variable name="available_items"
1027
              <xsl:value-of select="count(key('item-by-status', 'available'))"/>
1027
                           select="key('item-by-status', 'available')"/>
1028
             <xsl:choose><xsl:when test="count(key('item-by-status', 'available')) = 1"><xsl:text> copy available for loan at </xsl:text></xsl:when>
1028
                       <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1029
        <xsl:otherwise><xsl:text> copies available for loan at </xsl:text></xsl:otherwise></xsl:choose>
1029
                           <xsl:value-of select="items:homebranch"/>
1030
      </b>
1030
						   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1031
           <xsl:variable name="available_items"
1031
                           <xsl:text> (</xsl:text>
1032
                         select="key('item-by-status', 'available')"/>
1032
                           <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1033
            <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1033
                           <xsl:text>)</xsl:text>
1034
          <xsl:value-of select="items:homebranch"/>
1034
<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1035
          <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1035
                       </xsl:for-each>
1036
              <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1036
                   </span>
1037
         </xsl:for-each>
1037
                   </xsl:when>
1038
      </span>
1038
				   </xsl:choose>
1039
      </xsl:when>
1040
      </xsl:choose>
1039
1041
1040
                   <xsl:choose> <xsl:when test="count(key('item-by-status', 'available'))>0">
1042
      <xsl:choose>
1041
                       <xsl:choose><xsl:when test="count(key('item-by-status', 'reference'))>0">
1043
    <xsl:when test="count(key('item-by-status', 'reference'))>0">
1042
                            <br/>
1044
    <span class="available">
1043
                       </xsl:when></xsl:choose>
1045
         <b>
1044
                   </xsl:when> </xsl:choose>
1046
              <xsl:value-of select="count(key('item-by-status', 'reference'))"/>
1047
             <xsl:choose><xsl:when test="count(key('item-by-status', 'reference')) = 1"><xsl:text> copy available for reference at </xsl:text></xsl:when>
1048
           <xsl:otherwise><xsl:text> copies available for reference at </xsl:text></xsl:otherwise></xsl:choose>
1049
         </b>
1050
           <xsl:variable name="reference_items"
1051
                         select="key('item-by-status', 'reference')"/>
1052
               <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1053
                   <xsl:value-of select="items:homebranch"/>
1054
                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1055
              <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1056
         </xsl:for-each>
1057
      </span>
1058
      </xsl:when>
1059
      </xsl:choose>
1045
1060
1046
                   <xsl:choose>
1047
                   <xsl:when test="count(key('item-by-status', 'reference'))>0">
1048
                   <span class="available">
1049
                       <b><xsl:text>Copies available for reference: </xsl:text></b>
1050
                       <xsl:variable name="reference_items"
1051
                           select="key('item-by-status', 'reference')"/>
1052
                       <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1053
                           <xsl:value-of select="items:homebranch"/>
1054
						   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1055
                           <xsl:text> (</xsl:text>
1056
                           <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1057
                           <xsl:text>)</xsl:text>
1058
                   <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1059
                       </xsl:for-each>
1060
                   </span>
1061
                   </xsl:when>
1062
                   </xsl:choose>
1063
1061
1064
                   <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
1062
                   <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
1065
                   <span class="unavailable">
1063
                   <span class="unavailable">
Lines 1105-1111 Link Here
1105
                       <xsl:text>). </xsl:text>                   </span>
1103
                       <xsl:text>). </xsl:text>                   </span>
1106
                   </xsl:if>
1104
                   </xsl:if>
1107
               </span>
1105
               </span>
1108
    </xsl:template>
1106
    <xsl:choose>
1107
    <xsl:when test="($OPACItemLocation='location' or $OPACItemLocation='ccode') and (count(key('item-by-status', 'available'))!=0 or count(key('item-by-status', 'reference'))!=0)">
1108
        <span class="results_summary" id="location">
1109
            <span class="label">Location(s): </span>
1110
            <xsl:choose>
1111
            <xsl:when test="count(key('item-by-status', 'available'))>0">
1112
                <span class="available">
1113
                    <xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
1114
                    <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1115
                        <xsl:choose>
1116
                            <xsl:when test="$OPACItemLocation='location'"><b><xsl:value-of select="concat(items:location,' ')"/></b></xsl:when>
1117
                            <xsl:when test="$OPACItemLocation='ccode'"><b><xsl:value-of select="concat(items:ccode,' ')"/></b></xsl:when>
1118
                        </xsl:choose>
1119
                        <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> <xsl:value-of select="items:itemcallnumber"/></xsl:if>
1120
                        <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1121
                    </xsl:for-each>
1122
                </span>
1123
            </xsl:when>
1124
            <xsl:when test="count(key('item-by-status', 'reference'))>0">
1125
                <span class="available">
1126
                    <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
1127
                    <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1128
                        <xsl:choose>
1129
                            <xsl:when test="$OPACItemLocation='location'"><b><xsl:value-of select="concat(items:location,' ')"/></b></xsl:when>
1130
                            <xsl:when test="$OPACItemLocation='ccode'"><b><xsl:value-of select="concat(items:ccode,' ')"/></b></xsl:when>
1131
                        </xsl:choose>
1132
                        <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> <xsl:value-of select="items:itemcallnumber"/></xsl:if>
1133
                        <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1134
                    </xsl:for-each>
1135
                </span>
1136
            </xsl:when>
1137
            </xsl:choose>
1138
        </span>
1139
    </xsl:when>
1140
   </xsl:choose>
1141
  </xsl:template>
1109
1142
1110
    <xsl:template name="nameABCDQ">
1143
    <xsl:template name="nameABCDQ">
1111
            <xsl:call-template name="chopPunctuation">
1144
            <xsl:call-template name="chopPunctuation">
1112
- 

Return to bug 5079