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

(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl (+48 lines)
Lines 722-727 Link Here
722
        </xsl:if>
722
        </xsl:if>
723
    </xsl:template>
723
    </xsl:template>
724
724
725
    <xsl:template name="GetCnumSearchURL">
726
        <xsl:param name="title_subfield" select="'t'"/>
727
        <xsl:param name="cnum_subfield" select="'w'"/>
728
        <xsl:param name="opac_url" select="1"/>
729
        <xsl:param name="UseControlNumber"/>
730
731
        <xsl:variable name="orgcode">
732
            <xsl:choose>
733
                <xsl:when test="$UseControlNumber!='1'"/>
734
                <xsl:when test="substring-before(marc:subfield[@code=$cnum_subfield],')')">
735
                    <!-- substring before closing parenthesis, remove parentheses and spaces -->
736
                    <xsl:value-of select="normalize-space(translate(substring-before(marc:subfield[@code=$cnum_subfield],')'),'()',''))"/>
737
                </xsl:when>
738
            </xsl:choose>
739
        </xsl:variable>
740
        <xsl:variable name="controlnumber">
741
            <xsl:choose>
742
                <xsl:when test="$UseControlNumber!='1'"/>
743
                <xsl:when test="substring-after(marc:subfield[@code=$cnum_subfield],')')">
744
                    <!-- substring after closing parenthesis, remove spaces -->
745
                    <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code=$cnum_subfield],')'))"/>
746
                </xsl:when>
747
                <xsl:otherwise>
748
                    <!-- consider whole subfield now as controlnumber -->
749
                    <xsl:value-of select="normalize-space(marc:subfield[@code=$cnum_subfield])"/>
750
                </xsl:otherwise>
751
            </xsl:choose>
752
        </xsl:variable>
753
        <xsl:variable name="scriptname">
754
            <xsl:choose>
755
                <xsl:when test="$opac_url=1"><xsl:text>/cgi-bin/koha/opac-search.pl</xsl:text></xsl:when>
756
                <xsl:otherwise><xsl:text>/cgi-bin/koha/catalogue/search.pl</xsl:text></xsl:otherwise>
757
            </xsl:choose>
758
        </xsl:variable>
759
        <xsl:choose>
760
            <!-- search for (1) controlnumber AND orgcode, or (2) only controlnumber, or (3) title -->
761
            <xsl:when test="$controlnumber!='' and $orgcode!=''">
762
                <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber,' and Control-number-identifier:',$orgcode),false())"/>
763
            </xsl:when>
764
            <xsl:when test="$controlnumber!=''">
765
                <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber),false())"/>
766
            </xsl:when>
767
            <xsl:otherwise>
768
                <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=ti,phr:',translate(marc:subfield[@code=$title_subfield], '()', '')),false())"/>
769
            </xsl:otherwise>
770
        </xsl:choose>
771
    </xsl:template>
772
725
</xsl:stylesheet>
773
</xsl:stylesheet>
726
774
727
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
775
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl (-1 / +48 lines)
Lines 685-690 Link Here
685
        </xsl:if>
685
        </xsl:if>
686
    </xsl:template>
686
    </xsl:template>
687
687
688
    <xsl:template name="GetCnumSearchURL">
689
        <xsl:param name="title_subfield" select="'t'"/>
690
        <xsl:param name="cnum_subfield" select="'w'"/>
691
        <xsl:param name="opac_url" select="1"/>
692
        <xsl:param name="UseControlNumber"/>
693
694
        <xsl:variable name="orgcode">
695
            <xsl:choose>
696
                <xsl:when test="$UseControlNumber!='1'"/>
697
                <xsl:when test="substring-before(marc:subfield[@code=$cnum_subfield],')')">
698
                    <!-- substring before closing parenthesis, remove parentheses and spaces -->
699
                    <xsl:value-of select="normalize-space(translate(substring-before(marc:subfield[@code=$cnum_subfield],')'),'()',''))"/>
700
                </xsl:when>
701
            </xsl:choose>
702
        </xsl:variable>
703
        <xsl:variable name="controlnumber">
704
            <xsl:choose>
705
                <xsl:when test="$UseControlNumber!='1'"/>
706
                <xsl:when test="substring-after(marc:subfield[@code=$cnum_subfield],')')">
707
                    <!-- substring after closing parenthesis, remove spaces -->
708
                    <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code=$cnum_subfield],')'))"/>
709
                </xsl:when>
710
                <xsl:otherwise>
711
                    <!-- consider whole subfield now as controlnumber -->
712
                    <xsl:value-of select="normalize-space(marc:subfield[@code=$cnum_subfield])"/>
713
                </xsl:otherwise>
714
            </xsl:choose>
715
        </xsl:variable>
716
        <xsl:variable name="scriptname">
717
            <xsl:choose>
718
                <xsl:when test="$opac_url=1"><xsl:text>/cgi-bin/koha/opac-search.pl</xsl:text></xsl:when>
719
                <xsl:otherwise><xsl:text>/cgi-bin/koha/catalogue/search.pl</xsl:text></xsl:otherwise>
720
            </xsl:choose>
721
        </xsl:variable>
722
        <xsl:choose>
723
            <!-- search for (1) controlnumber AND orgcode, or (2) only controlnumber, or (3) title -->
724
            <xsl:when test="$controlnumber!='' and $orgcode!=''">
725
                <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber,' and Control-number-identifier:',$orgcode),false())"/>
726
            </xsl:when>
727
            <xsl:when test="$controlnumber!=''">
728
                <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber),false())"/>
729
            </xsl:when>
730
            <xsl:otherwise>
731
                <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=ti,phr:',translate(marc:subfield[@code=$title_subfield], '()', '')),false())"/>
732
            </xsl:otherwise>
733
        </xsl:choose>
734
    </xsl:template>
735
688
</xsl:stylesheet>
736
</xsl:stylesheet>
689
737
690
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
738
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
691
- 

Return to bug 29185