preventing librarian other than superlibrarian from deleting itemized biblios.

count_items added in ISBDdetail and MARCdetail relies on information contained in marcrecord.
This commit is contained in:
hdl 2006-10-31 14:33:31 +00:00
parent e9c8e967ec
commit 8ceffe1908
6 changed files with 29 additions and 5 deletions

View File

@ -70,6 +70,8 @@ my ($template, $loggedinuser, $cookie)
debug => 1,
});
my $val=count_items($record);
$template->param("candelete"=>1) if ($val==0||C4::Context->userenv->{flags} eq "1");
my $ISBD = C4::Context->preference('ISBD');
# my @blocs = split /\@/,$ISBD;
# my @fields = $record->fields();
@ -160,3 +162,10 @@ sub get_authorised_value_desc ($$$$$) {
return $value; # if nothing is found return the original value
}
}
sub count_items ($$$$$) {
my ($record) = @_;
my ($tag,$subfield)=MARCfind_marc_from_kohafield(C4::Context->dbh, "items.itemnumber");
my @list_item_fields=$record->field($tag);
my $value=scalar(@list_item_fields);
return $value; # if nothing is found return the original value
}

View File

@ -86,6 +86,9 @@ my ($template, $loggedinuser, $cookie)
debug => 1,
});
my $val=count_items($record);
$template->param("candelete"=>1) if ($val==0||C4::Context->userenv->{flags} eq "1");
#Getting the list of all frameworks
my $queryfwk =$dbh->prepare("select frameworktext, frameworkcode from biblio_framework");
$queryfwk->execute;
@ -277,7 +280,8 @@ sub get_authorised_value_desc ($$$$$) {
#---- branch
if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
return getbranchname($value);
# return getbranchname($value);
return $value;
}
#---- itemtypes
@ -297,3 +301,10 @@ sub get_authorised_value_desc ($$$$$) {
return $value; # if nothing is found return the original value
}
}
sub count_items ($$$$$) {
my ($record) = @_;
my ($tag,$subfield)=MARCfind_marc_from_kohafield(C4::Context->dbh, "items.itemnumber");
my @list_item_fields=$record->field($tag);
my $value=scalar(@list_item_fields);
return $value; # if nothing is found return the original value
}

View File

@ -36,6 +36,7 @@ my ($websitecount, @websites) = &getwebsites($biblionumber);
my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber);
$dat->{'count'}=@items;
$template->param("candelete"=>1) if ($dat->{'count'}==0||C4::Context->userenv->{flags} eq "1");
$dat->{'additional'}=$addauthor->[0]->{'author'};
for (my $i = 1; $i < $authorcount; $i++) {

View File

@ -13,9 +13,10 @@
Edit item
</a>
<a href="javascript:confirm_deletion()" class="button catalogue">
<!--TMPL_IF Name="candelete" --><a href="javascript:confirm_deletion()" class="button catalogue">
delete
</a>
<!--/TMPL_IF -->
<a href="MARCdetail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->" class="button catalogue">
Complete
</a>

View File

@ -17,10 +17,11 @@
Edit item
</a>
<a href="javascript:confirm_deletion()" class="button catalogue">
<!--TMPL_IF Name="candelete" --><a href="javascript:confirm_deletion()" class="button catalogue">
delete
</a>
<a href="detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->" class="button catalogue">
<!--/TMPL_IF -->
<a href="detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->" class="button catalogue">
Complete
</a>
<a href="detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->" class="button catalogue">

View File

@ -14,9 +14,10 @@
Edit item
</a>
<a href="javascript:confirm_deletion()" class="button catalogue">
<!--TMPL_IF Name="candelete" --><a href="javascript:confirm_deletion()" class="button catalogue">
delete
</a>
<!--/TMPL_IF -->
<a href="MARCdetail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->" class="button catalogue">
Complete
</a>