koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha cataloguing/addbiblio.pl cataloguing/addit... [rel_3_0]


From: paul poulain
Subject: [Koha-cvs] koha cataloguing/addbiblio.pl cataloguing/addit... [rel_3_0]
Date: Wed, 11 Oct 2006 14:28:33 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     paul poulain <tipaul>   06/10/11 14:28:33

Modified files:
        cataloguing    : addbiblio.pl additem.pl 
        koha-tmpl/intranet-tmpl/prog/en/cataloguing: addbiblio.tmpl 
                                                     additem.tmpl 

Log message:
        - fixing links to have correct API (biblionumber / itemnumber)
        - getting rid of "bibid"
        - fixing some encoding bugs
        
        add & modify works fine for me now (with updated items table. I'll 
commit updatedatabase quickly)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/addbiblio.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.14.2.7&r2=1.14.2.8
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/additem.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.7.2.6&r2=1.7.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=1.1.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/cataloguing/additem.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1&r2=1.1.2.1

Patches:
Index: cataloguing/addbiblio.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/addbiblio.pl,v
retrieving revision 1.14.2.7
retrieving revision 1.14.2.8
diff -u -b -r1.14.2.7 -r1.14.2.8
--- cataloguing/addbiblio.pl    10 Oct 2006 16:09:15 -0000      1.14.2.7
+++ cataloguing/addbiblio.pl    11 Oct 2006 14:28:33 -0000      1.14.2.8
@@ -1,6 +1,6 @@
 #!/usr/bin/perl 
 
-# $Id: addbiblio.pl,v 1.14.2.7 2006/10/10 16:09:15 tipaul Exp $
+# $Id: addbiblio.pl,v 1.14.2.8 2006/10/11 14:28:33 tipaul Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -33,9 +33,6 @@
 use HTML::Template;
 use MARC::File::USMARC;
 use MARC::File::XML;
-# if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
-#      MARC::File::XML->default_record_format( 'UNIMARC' );
-# }
 use vars qw( $tagslib);
 use vars qw( $authorised_values_sth);
 use vars qw( $is_a_modif );
@@ -476,7 +473,7 @@
 $record=MARCgetbiblio($dbh,$biblionumber) if ($biblionumber);
 ($record,$encoding) = MARCfindbreeding($dbh,$breedingid) if ($breedingid);
 
-warn "biblionumber : $biblionumber = ".$record->as_formatted;
+# warn "biblionumber : $biblionumber = ".$record->as_formatted;
 $is_a_modif=0;
 my ($biblionumtagfield,$biblionumtagsubfield);
 my 
($biblioitemnumtagfield,$biblioitemnumtagsubfield,$bibitem,$biblioitemnumber);
@@ -500,9 +497,12 @@
        # build indicator hash.
        my @ind_tag = $input->param('ind_tag');
        my @indicator = $input->param('indicator');
-       my $record = 
MARChtml2marc(C4::Context->dbh,address@hidden,address@hidden,address@hidden,address@hidden,address@hidden);
-    warn "xml : ".$record->as_formatted;
-#     my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
+    if (C4::Context->preference('TemplateEncoding') eq "iso-8859-1") {
+        $record = 
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,address@hidden,address@hidden);
+    } else {
+        my $xml = 
MARChtml2xml(address@hidden,address@hidden,address@hidden,address@hidden,address@hidden);
+        
$record=MARC::Record->new_from_xml($xml,C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
+    }
        # check for a duplicate
        my ($duplicatebiblionumber,$duplicatebibid,$duplicatetitle) = 
FindDuplicate($record) if ($op eq "addbiblio") && (!$is_a_modif);
        my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
@@ -526,7 +526,6 @@
                build_tabs ($template, $record, $dbh,$encoding);
                build_hidden_data;
                $template->param(
-                       oldbiblionumber          => $biblionumber,
                        biblionumber             => $biblionumber,
                        biblionumtagfield        => $biblionumtagfield,
                        biblionumtagsubfield     => $biblionumtagsubfield,
@@ -566,7 +565,6 @@
        build_tabs ($template, $record, $dbh,$encoding);
        build_hidden_data;
        $template->param(
-               oldbiblionumber          => $biblionumber,
                biblionumber             => $biblionumber,
                biblionumtagfield        => $biblionumtagfield,
                biblionumtagsubfield     => $biblionumtagsubfield,
@@ -603,7 +601,6 @@
        build_tabs ($template, $record, $dbh,$encoding);
        build_hidden_data;
        $template->param(
-           oldbiblionumber                      => $biblionumber,
                biblionumber             => $biblionumber,
                biblionumtagfield        => $biblionumtagfield,
                biblionumtagsubfield     => $biblionumtagsubfield,

Index: cataloguing/additem.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/additem.pl,v
retrieving revision 1.7.2.6
retrieving revision 1.7.2.7
diff -u -b -r1.7.2.6 -r1.7.2.7
--- cataloguing/additem.pl      9 Oct 2006 16:44:23 -0000       1.7.2.6
+++ cataloguing/additem.pl      11 Oct 2006 14:28:33 -0000      1.7.2.7
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: additem.pl,v 1.7.2.6 2006/10/09 16:44:23 toins Exp $
+# $Id: additem.pl,v 1.7.2.7 2006/10/11 14:28:33 tipaul Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -61,14 +61,7 @@
 my $dbh = C4::Context->dbh;
 my $error = $input->param('error');
 my $biblionumber = $input->param('biblionumber');
-if (!$biblionumber){
-    $biblionumber=$input->param('bibid');
-}
-my $biblioitemnumber = find_biblioitemnumber($dbh,$biblionumber);
 my $itemnumber = $input->param('itemnumber');
-if (!$itemnumber){
-    $itemnumber=$input->param('itemnum');
-    }
 
 my $op = $input->param('op');
 
@@ -114,7 +107,7 @@
        my $exists = get_item_from_barcode($addedolditem->{'barcode'});
        push @errors,"barcode_not_unique" if($exists);
        # if barcode exists, don't create, but report The problem.
-       my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = 
AddItem($dbh,$record,$biblioitemnumber) unless ($exists);
+       my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = 
AddItem($dbh,$record,$biblionumber) unless ($exists);
        if ($exists) {
        $nextop = "additem";
                $itemrecord = $record;
@@ -126,6 +119,7 @@
 
#------------------------------------------------------------------------------------------------------------------------------
 # retrieve item if exist => then, it's a modif
        $itemrecord = MARCgetitem($dbh,$biblionumber,$itemnumber);
+       warn "ITEM : ".$itemrecord->as_formatted;
        $nextop="saveitem";
 
#------------------------------------------------------------------------------------------------------------------------------
 } elsif ($op eq "delitem") {
@@ -139,7 +133,7 @@
        $nextop="additem";
        }else{
                &DelItem($dbh,$biblionumber,$itemnumber);
-               print 
$input->redirect("additem.pl?bibid=$biblionumber&frameworkcode=$frameworkcode");
+               print 
$input->redirect("additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode");
                #$nextop="additem";
        }
 
#------------------------------------------------------------------------------------------------------------------------------
@@ -203,7 +197,7 @@
                                        $this_row{'nomod'}=1;
                        }
                }
-               $this_row{itemnum} = $subf[$i][1] if ($field->tag() eq 
$itemtagfield && $subf[$i][0] eq $itemtagsubfield);
+               $this_row{itemnumber} = $subf[$i][1] if ($field->tag() eq 
$itemtagfield && $subf[$i][0] eq $itemtagsubfield);
        }
        if (%this_row) {
                push(@big_array, \%this_row);
@@ -229,7 +223,7 @@
        my %row_data;
        $items_data =~ s/"/&quot;/g;
        $row_data{item_value} = $items_data;
-       $row_data{itemnum} = $big_array[$i]->{itemnum};
+       $row_data{itemnumber} = $big_array[$i]->{itemnumber};
        #reporting this_row values
        $row_data{'nomod'} = $big_array[$i]{'nomod'};
        push(@item_value_loop,\%row_data);
@@ -348,12 +342,10 @@
 $template->param(item_loop => address@hidden,
                                                item_header_loop => 
address@hidden,
                                                biblionumber => $biblionumber,
-                                                bibid        => $biblionumber, 
                                                title => $oldrecord->{title},
                                                author => $oldrecord->{author},
                                                item => address@hidden,
                                                itemnumber => $itemnumber,
-                                               itemnum => $itemnumber,
                                                itemtagfield => $itemtagfield,
                                                itemtagsubfield 
=>$itemtagsubfield,
                                                op => $nextop,

Index: koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl  20 Sep 2006 
13:44:14 -0000      1.1.2.2
+++ koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl  11 Oct 2006 
14:28:33 -0000      1.1.2.3
@@ -1,16 +1,16 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Cataloging: <!-- TMPL_IF 
NAME="oldbiblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR 
name="bibid" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Cataloging: <!-- TMPL_IF 
NAME="biblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR name="bibid" 
--><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF -->
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
 <!-- TMPL_INCLUDE NAME="menu-catalogue.inc" -->
 
        <form method="post" name="f" id="f" action="addbiblio.pl">
-<h1><!-- TMPL_IF NAME="oldbiblionumtagfield" -->Edit MARC Record Number <!-- 
TMPL_VAR name="oldbiblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- 
/TMPL_IF --> With Framework : <!--TMPL_VAR Name="framework" --></h1>
+<h1><!-- TMPL_IF NAME="biblionumtagfield" -->Edit MARC Record Number <!-- 
TMPL_VAR name="biblionumber" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF 
--> With Framework : <!--TMPL_VAR Name="framework" --></h1>
 
                <input type="hidden" name="op" value="addbiblio" />
                <input type="hidden" name="addfield_field" />
                <input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR 
NAME="frameworkcode" -->" />
-               <input type="hidden" name="oldbiblionumber" value="<!-- 
TMPL_VAR NAME="oldbiblionumber" -->" />
+               <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR 
NAME="biblionumber" -->" />
                <!-- TMPL_IF name="0XX" -->
                <a href="#0XX">0</a>
                <!-- /TMPL_IF -->
@@ -372,15 +372,15 @@
                                <input type="hidden" name="tag_mandatory" 
value="<!-- TMPL_VAR NAME="tag_mandatory" -->" />
                <!-- /TMPL_LOOP -->     <br clear="both" />
                </div>  <br clear="both" />
-               <!-- TMPL_IF name="oldbiblionumtagfield" -->
-                       <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="oldbiblionumtagfield" -->" />
-                       <input type="hidden" name="subfield" value="<!-- 
TMPL_VAR NAME="oldbiblionumtagsubfield" -->" />
-                       <input type="hidden" name="field_value" value="<!-- 
TMPL_VAR NAME="oldbiblionumber" -->" />
+               <!-- TMPL_IF name="biblionumtagfield" -->
+                       <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="biblionumtagfield" -->" />
+                       <input type="hidden" name="subfield" value="<!-- 
TMPL_VAR NAME="biblionumtagsubfield" -->" />
+                       <input type="hidden" name="field_value" value="<!-- 
TMPL_VAR NAME="biblionumber" -->" />
                        <input type="hidden" name="mandatory" value="0" />
                        <input type="hidden" name="kohafield" value="<!-- 
TMPL_VAR NAME="kohafield" -->" />
-                       <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="oldbiblioitemnumtagfield" -->" />
-                       <input type="hidden" name="subfield" value="<!-- 
TMPL_VAR NAME="oldbiblioitemnumtagsubfield" -->" />
-                       <input type="hidden" name="field_value" value="<!-- 
TMPL_VAR NAME="oldbiblioitemnumber" -->" />
+                       <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="biblioitemnumtagfield" -->" />
+                       <input type="hidden" name="subfield" value="<!-- 
TMPL_VAR NAME="biblioitemnumtagsubfield" -->" />
+                       <input type="hidden" name="field_value" value="<!-- 
TMPL_VAR NAME="biblioitemnumber" -->" />
                        <input type="hidden" name="mandatory" value="0" />
                        <input type="hidden" name="kohafield" value="<!-- 
TMPL_VAR NAME="kohafield" -->" />
                        <input type="hidden" name="tag_mandatory" value="<!-- 
TMPL_VAR NAME="tag_mandatory" -->" />
@@ -486,28 +486,28 @@
                }
                alert(alertString2);
        } else {
-               document.forms[0].submit();
+               document.forms['f'].submit();
        }
 }
 function Dopop(link,i) {
-       defaultvalue=document.forms[0].field_value[i].value;
+       defaultvalue=document.forms['f'].field_value[i].value;
        newin=window.open(link+"&result="+defaultvalue,"value 
builder",'width=550,height=550,toolbar=false,scrollbars=yes');
 }
 
 function PopupZ3950() {
     var strQuery="";
        var error = 0;
-       for (i=0 ; i<document.forms[0].field_value.length ; i++) {
-               if (document.forms[0].kohafield[i].value == "biblioitems.isbn"){
-                       if(document.forms[0].field_value[i].value.length>0) {
-                   strQuery += "&isbn="+document.forms[0].field_value[i].value;
+       for (i=0 ; i<document.forms['f'].field_value.length ; i++) {
+               if (document.forms['f'].kohafield[i].value == 
"biblioitems.isbn"){
+                       if(document.forms['f'].field_value[i].value.length>0) {
+                   strQuery += 
"&isbn="+document.forms['f'].field_value[i].value;
                } else {
                        error++;
                }
                }
-               if (document.forms[0].kohafield[i].value == "biblio.title"){
-                       if(document.forms[0].field_value[i].value.length>0) {
-                   strQuery += 
"&title="+document.forms[0].field_value[i].value;
+               if (document.forms['f'].kohafield[i].value == "biblio.title"){
+                       if(document.forms['f'].field_value[i].value.length>0) {
+                   strQuery += 
"&title="+document.forms['f'].field_value[i].value;
                } else {
                        error++;
                }
@@ -519,9 +519,9 @@
                        error++;
                }
                }
-               if (document.forms[0].kohafield[i].value == "biblioitems.issn"){
-                       if(document.forms[0].field_value[i].value.length>0) {
-                   strQuery += "&issn="+document.forms[0].field_value[i].value;
+               if (document.forms['f'].kohafield[i].value == 
"biblioitems.issn"){
+                       if(document.forms['f'].field_value[i].value.length>0) {
+                   strQuery += 
"&issn="+document.forms['f'].field_value[i].value;
                } else {
                        error++;
                }
@@ -536,13 +536,13 @@
 
 function Changefwk(FwkList) {
   var fwk = FwkList.options[FwkList.selectedIndex].value;
-  window.location = "addbiblio.pl?oldbiblionumber=<!--TMPL_VAR 
Name="oldbiblionumber"-->&frameworkcode="+fwk;
+  window.location = "addbiblio.pl?biblionumber=<!--TMPL_VAR 
Name="biblionumber"-->&frameworkcode="+fwk;
 }
 
 function AddField(field,cntrepeatfield) {
-        document.forms['f'].op.value = "addfield";
-        document.forms['f'].addfield_field.value=field;
-        document.f.submit();
+    document.forms['f'].op.value = "addfield";
+    document.forms['f'].addfield_field.value=field;
+    document.f.submit();
 }
 </script></body>
 </html>

Index: koha-tmpl/intranet-tmpl/prog/en/cataloguing/additem.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/cataloguing/additem.tmpl,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -b -r1.1 -r1.1.2.1
--- koha-tmpl/intranet-tmpl/prog/en/cataloguing/additem.tmpl    19 Jan 2006 
12:48:00 -0000      1.1
+++ koha-tmpl/intranet-tmpl/prog/en/cataloguing/additem.tmpl    11 Oct 2006 
14:28:33 -0000      1.1.2.1
@@ -9,7 +9,7 @@
 <div id="cataloguing_additem_itemlist">
        <form method="post" action="additem.pl" name="f">
        <input type="hidden" name="op" value="<!-- TMPL_VAR NAME="op" -->" />
-       <input type="hidden" name="bibid" value="<!-- TMPL_VAR NAME="bibid" 
-->" />
+       <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR 
NAME="biblionumber" -->" />
        <!-- TMPL_IF name="item_loop" -->
                <h2>Existing items</h2>
                <table>
@@ -24,8 +24,8 @@
                                <!-- TMPL_LOOP NAME="item_loop" -->
                                <tr>
                                        <!-- TMPL_VAR NAME="item_value" -->
-                                       <td><a 
href="additem.pl?op=edititem&amp;bibid=<!-- TMPL_VAR NAME="bibid" 
-->&amp;itemnum=<!-- TMPL_VAR NAME="itemnum" -->">Edit</a></td>
-                                       <td><a 
href="javascript:confirm_deletion(<!-- TMPL_VAR NAME="bibid" -->,<!-- TMPL_VAR 
NAME="itemnum" -->)">Delete</a></td>
+                                       <td><a 
href="additem.pl?op=edititem&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" 
-->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">Edit</a></td>
+                                       <td><a 
href="javascript:confirm_deletion(<!-- TMPL_VAR NAME="biblionumber" -->,<!-- 
TMPL_VAR NAME="itemnumber" -->)">Delete</a></td>
                                </tr>
                                <!-- /TMPL_LOOP -->
                </table>
@@ -47,7 +47,7 @@
                                <input type="hidden" name="mandatory" 
value="<!-- TMPL_VAR NAME="mandatory" -->" />
                        </p>
                <!-- /tmpl_loop -->
-       <input type="hidden" name="itemnum" value="<!-- TMPL_VAR NAME="itemnum" 
-->" />
+       <input type="hidden" name="itemnumber" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
        <!-- TMPL_IF name="barcode_not_unique" -->
                ERROR : Barcode already exists !
        <!-- /TMPL_IF -->
@@ -56,7 +56,7 @@
        <!-- TMPL_ELSE -->
        <input type="hidden" name="tag" value="<!-- TMPL_VAR 
NAME="itemtagfield" -->" />
        <input type="hidden" name="subfield" value="<!-- TMPL_VAR 
NAME="itemtagsubfield" -->" />
-       <input type="hidden" name="field_value" value="<!-- TMPL_VAR 
NAME="itemnum" -->" />
+       <input type="hidden" name="field_value" value="<!-- TMPL_VAR 
NAME="itemnumber" -->" />
        <input type="button" value="Save Changes" onClick="Check(this.form)" 
accesskey="w" />
        <!-- /TMPL_IF -->
        </form>
@@ -124,10 +124,10 @@
        defaultvalue=document.forms[0].field_value[i].value;
        newin=window.open(link+"&result="+defaultvalue,"value 
builder",'width=500,height=400,toolbar=false,scrollbars=yes');
 }
-function confirm_deletion(bibid,itemnum) {
+function confirm_deletion(biblionumber,itemnumber) {
        var is_confirmed = confirm(_('Are you sure you want to delete this 
item?'));
        if (is_confirmed) {
-       window.location = 
"additem.pl?op=delitem&bibid="+bibid+"&itemnum="+itemnum;
+       window.location = 
"additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
        }
 }
 </script>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]