biblio & item deletion now works fine in MARC editor.
Stores deleted biblio/item in the marc field of the deletedbiblio/deleteditem table.
This commit is contained in:
parent
4a98096d23
commit
6eb2c6141d
40
C4/Biblio.pm
40
C4/Biblio.pm
|
|
@ -54,7 +54,7 @@ $VERSION = 0.01;
|
|||
|
||||
&NEWnewbiblio &NEWnewitem
|
||||
&NEWmodbiblio &NEWmoditem
|
||||
&NEWdelbiblio
|
||||
&NEWdelbiblio &NEWdelitem
|
||||
|
||||
&MARCaddbiblio &MARCadditem
|
||||
&MARCmodsubfield &MARCaddsubfield
|
||||
|
|
@ -538,6 +538,23 @@ sub MARCdelbiblio {
|
|||
$dbh->do("delete from marc_word where bibid=$bibid");
|
||||
}
|
||||
}
|
||||
|
||||
sub MARCdelitem {
|
||||
# delete the item passed in parameter in MARC tables.
|
||||
my ($dbh,$bibid,$itemnumber)=@_;
|
||||
# my $record = MARC::Record->new();
|
||||
# search MARC tagorder
|
||||
my $record = MARCgetitem($dbh,$bibid,$itemnumber);
|
||||
my $copy2deleted=$dbh->prepare("update deleteditems set marc=? where itemnumber=?");
|
||||
$copy2deleted->execute($record->as_usmarc(),$itemnumber);
|
||||
|
||||
my $sth2 = $dbh->prepare("select tagorder from marc_subfield_table,marc_subfield_structure where marc_subfield_table.tag=marc_subfield_structure.tagfield and marc_subfield_table.subfieldcode=marc_subfield_structure.tagsubfield and bibid=? and kohafield='items.itemnumber' and subfieldvalue=?");
|
||||
$sth2->execute($bibid,$itemnumber);
|
||||
my ($tagorder) = $sth2->fetchrow_array();
|
||||
my $sth=$dbh->prepare("delete from marc_subfield_table where bibid=? and tagorder=?");
|
||||
$sth->execute($bibid,$tagorder);
|
||||
}
|
||||
|
||||
sub MARCmoditem {
|
||||
my ($dbh,$record,$bibid,$itemnumber,$delete)=@_;
|
||||
my $oldrecord=&MARCgetitem($dbh,$bibid,$itemnumber);
|
||||
|
|
@ -1090,6 +1107,13 @@ sub NEWmoditem {
|
|||
OLDmoditem($dbh,$olditem);
|
||||
}
|
||||
|
||||
sub NEWdelitem {
|
||||
my ($dbh,$bibid,$itemnumber)=@_;
|
||||
my $biblio = &MARCfind_oldbiblionumber_from_MARCbibid($dbh,$bibid);
|
||||
&OLDdelitem($dbh,$itemnumber);
|
||||
&MARCdelitem($dbh,$bibid,$itemnumber);
|
||||
}
|
||||
|
||||
#
|
||||
#
|
||||
# OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD OLD
|
||||
|
|
@ -1484,13 +1508,13 @@ sub OLDdelitem{
|
|||
my $query="select * from items where itemnumber=$itemnum";
|
||||
my $sth=$dbh->prepare($query);
|
||||
$sth->execute;
|
||||
my @data=$sth->fetchrow_array;
|
||||
my $data=$sth->fetchrow_hashref;
|
||||
$sth->finish;
|
||||
$query="Insert into deleteditems values (";
|
||||
foreach my $temp (@data){
|
||||
$query .= "'$temp',";
|
||||
$query="Insert into deleteditems set ";
|
||||
foreach my $temp (keys %$data){
|
||||
$query .= "$temp = ".$dbh->quote($data->{$temp}).",";
|
||||
}
|
||||
$query=~ s/\,$/\)/;
|
||||
$query=~ s/\,$//;
|
||||
# print $query;
|
||||
$sth=$dbh->prepare($query);
|
||||
$sth->execute;
|
||||
|
|
@ -2185,6 +2209,10 @@ Paul POULAIN paul.poulain@free.fr
|
|||
|
||||
# $Id$
|
||||
# $Log$
|
||||
# Revision 1.71 2003/11/24 16:28:49 tipaul
|
||||
# biblio & item deletion now works fine in MARC editor.
|
||||
# Stores deleted biblio/item in the marc field of the deletedbiblio/deleteditem table.
|
||||
#
|
||||
# Revision 1.70 2003/11/24 13:29:55 tipaul
|
||||
# moving $id from beginning to end of file (70 commits... huge comments...)
|
||||
#
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@
|
|||
<TMPL_LOOP name="item_loop">
|
||||
<tr>
|
||||
<TMPL_VAR name="item_value">
|
||||
<td><a href="additem.pl?op=edititem&bibid=<TMPL_VAR name="bibid">&itemnum=<TMPL_VAR name="itemnum">">Edit</a></td>
|
||||
<td><a href="additem.pl?op=edititem&bibid=<TMPL_VAR name="bibid">&itemnum=<TMPL_VAR name="itemnum">"><img src="<TMPL_VAR name="interface">/<TMPL_VAR name="theme">/images/fileopen.png" border=0></a></td>
|
||||
<td><a href="javascript:confirm_deletion(<TMPL_VAR name="bibid">,<TMPL_VAR name="itemnum">)"><img src="<TMPL_VAR name="interface">/<TMPL_VAR name="theme">/images/edittrash.png" border=0></a></td>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
|
|
@ -121,6 +122,12 @@ function Dopop(link,i) {
|
|||
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) {
|
||||
var is_confirmed = confirm('Do you confirm item deletion ?');
|
||||
if (is_confirmed) {
|
||||
window.location = "additem.pl?op=delitem&bibid="+bibid+"&itemnum="+itemnum;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<td width=10% align="center"><input type="hidden" name="op" value="addbiblio">
|
||||
<input type="hidden" name="addfield_field">
|
||||
<input type="hidden" name="oldbiblionumber" value="<TMPL_VAR name="oldbiblionumber">">
|
||||
<input type="button" value="items" onClick='Check(this.form)' accesskey="w">
|
||||
<input type="button" value="Enreg puis Exemplaires" onClick='Check(this.form)' accesskey="w">
|
||||
<a href="javascript:PopupZ3950()">recherche z3950</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
<tr>
|
||||
<TMPL_VAR name="item_value">
|
||||
<td><a href="additem.pl?op=edititem&bibid=<TMPL_VAR name="bibid">&itemnum=<TMPL_VAR name="itemnum">"><img src="<TMPL_VAR name="interface">/<TMPL_VAR name="theme">/images/fileopen.png" border=0></a></td>
|
||||
<td><a href="javascript:confirm_deletion(<TMPL_VAR name="bibid">,<TMPL_VAR name="itemnum">)"><img src="<TMPL_VAR name="interface">/<TMPL_VAR name="theme">/images/edittrash.png" border=0></a></td>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
|
|
@ -64,7 +65,7 @@
|
|||
</table>
|
||||
<input type="hidden" name="itemnum" value="<TMPL_VAR name="itemnum">">
|
||||
<TMPL_IF name="barcode_not_unique">
|
||||
<div id="problem"><b>ERROR : Barcode already exists !<b></div>
|
||||
<div id="problem"><b>ERREUR : le code barre existe déjà !<b></div>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF name="opisadd">
|
||||
<input type="button" value="Enregistrer" onClick='Check(this.form)' accesskey="w">
|
||||
|
|
@ -119,6 +120,12 @@ function Dopop(link,i) {
|
|||
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) {
|
||||
var is_confirmed = confirm('Confirmez vous la suppression ?');
|
||||
if (is_confirmed) {
|
||||
window.location = "additem.pl?op=delitem&bibid="+bibid+"&itemnum="+itemnum;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue