&NEWnewbiblio &NEWnewitem
&NEWmodbiblio &NEWmoditem
- &NEWdelbiblio
+ &NEWdelbiblio &NEWdelitem
&MARCaddbiblio &MARCadditem
&MARCmodsubfield &MARCaddsubfield
$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);
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
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;
# $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...)
#
<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>
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>
<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>
</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">
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>