Bug 7673: Update permission names in script
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 25 Apr 2014 14:51:35 +0000 (16:51 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 11 Nov 2014 15:27:17 +0000 (12:27 -0300)
Two permission names have been changed since the first patch.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
cataloguing/additem.pl
tools/batchMod.pl

index 941cff0..f2df4a0 100755 (executable)
@@ -104,7 +104,7 @@ sub _increment_barcode {
 
 
 sub generate_subfield_form {
-        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $limitededition) = @_;
+        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $restrictededition) = @_;
   
         my $frameworkcode = &GetFrameworkCode($biblionumber);
 
@@ -158,15 +158,15 @@ sub generate_subfield_form {
         my $attributes_no_value = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" );
         my $attributes_no_value_textarea = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" );
 
-        # Getting list of subfields to keep when limited edition is enabled
+        # Getting list of subfields to keep when restricted edition is enabled
         my $subfieldsToAllowForRestrictedEdition = C4::Context->preference('SubfieldsToAllowForRestrictedEdition');
         my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEdition);
 
-        # If we're on limited edition, and our field is not in the list of subfields to allow,
+        # If we're on restricted edition, and our field is not in the list of subfields to allow,
         # then it is read-only
         $attributes_no_value .= 'readonly="readonly" '
             if (
-                $limitededition
+                $restrictededition
                 and !grep { $tag . '$' . $subfieldtag  eq $_ } @subfieldsToAllow
             );
 
@@ -242,11 +242,11 @@ sub generate_subfield_form {
                     -class    => "input_marceditor",
                 );
 
-                # If we're on limited edition, and our field is not in the list of subfields to allow,
+                # If we're on restricted edition, and our field is not in the list of subfields to allow,
                 # then it is read-only
                 push @scrparam, (-readonly => "readonly"), (-disabled => "disabled")
                     if (
-                        $limitededition
+                        $restrictededition
                         and !grep { $tag . '$' . $subfieldtag  eq $_ } @subfieldsToAllow
                     );
                 $subfield_data{marc_value} =CGI::scrolling_list(@scrparam);
@@ -368,13 +368,13 @@ my ($template, $loggedinuser, $cookie)
                  });
 
 
-# Does the user have a limited item edition permission?
+# Does the user have a restricted item edition permission?
 my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef;
-my $limitededition = $uid ? haspermission($uid,  {'editcatalogue' => 'limited_item_edition'}) : undef;
-# In case user is a superlibrarian, edition is not limited
-$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1);
-# In case user has fast cataloging permission (and we're in fast cataloging), edition is not limited
-$limitededition = 0 if ($limitededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'}));
+my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
+# In case user is a superlibrarian, edition is not restricted
+$restrictededition = 0 if ($restrictededition != 0 && $restrictededition->{'superlibrarian'} eq 1);
+# In case user has fast cataloging permission (and we're in fast cataloging), edition is not restricted
+$restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'}));
 
 my $today_iso = C4::Dates->today('iso');
 my $tagslib = &GetMarcStructure(1,$frameworkcode);
@@ -808,7 +808,7 @@ if($itemrecord){
             next if subfield_is_koha_internal_p($subfieldtag);
             next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
 
-            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition);
+            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
             push @fields, "$tag$subfieldtag";
             push (@loop_data, $subfield_data);
             $i++;
@@ -832,7 +832,7 @@ foreach my $tag ( keys %{$tagslib}){
         my @values = (undef);
         @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
         for my $value (@values){
-            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition);
+            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
             push (@loop_data, $subfield_data);
             $i++;
         }
index 4410a20..2fe39e4 100755 (executable)
@@ -70,11 +70,11 @@ my ($template, $loggedinuser, $cookie)
                  flagsrequired => $template_flag,
                  });
 
-# Does the user have a limited item edition permission?
+# Does the user have a restricted item edition permission?
 my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef;
-my $limitededition = $uid ? haspermission($uid,  {'tools' => 'items_limited_batchmod'}) : undef;
-# In case user is a superlibrarian, edition is not limited
-$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1);
+my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
+# In case user is a superlibrarian, edition is not restricted
+$restrictededition = 0 if ($restrictededition != 0 && $restrictededition->{'superlibrarian'} eq 1);
 
 my $today_iso = C4::Dates->today('iso');
 $template->param(today_iso => $today_iso);
@@ -299,7 +299,7 @@ unshift (@$branches, $nochange_branch);
 
 my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
 
-# Getting list of subfields to keep when limited batchmod edit is enabled
+# Getting list of subfields to keep when restricted batchmod edit is enabled
 my $subfieldsToAllowForBatchmod = C4::Context->preference('SubfieldsToAllowForRestrictedBatchmod');
 my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
 
@@ -307,7 +307,7 @@ foreach my $tag (sort keys %{$tagslib}) {
     # loop through each subfield
     foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
        next if subfield_is_koha_internal_p($subfield);
-        next if ($limitededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow );
+        next if ($restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow );
        next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
         # barcode and stocknumber are not meant to be batch-modified
        next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode';