View | Details | Raw Unified | Return to bug 7673
Collapse All | Expand All

(-)a/C4/Items.pm (-1 / +1 lines)
Lines 1589-1595 sub GetItemnumberFromBarcode { Link Here
1589
    my $dbh = C4::Context->dbh;
1589
    my $dbh = C4::Context->dbh;
1590
1590
1591
    my $rq =
1591
    my $rq =
1592
      $dbh->prepare("SELECT itemnumber FROM items WHERE items.barcode=?");
1592
      $dbh->prepare("SELECT itemnumber FROM items WHERE TRIM(items.barcode)=?");
1593
    $rq->execute($barcode);
1593
    $rq->execute($barcode);
1594
    my ($result) = $rq->fetchrow;
1594
    my ($result) = $rq->fetchrow;
1595
    return ($result);
1595
    return ($result);
(-)a/C4/VirtualShelves.pm (-1 / +1 lines)
Lines 458-464 sub ShelfPossibleAction { Link Here
458
458
459
    return 0 unless defined($shelfnumber);
459
    return 0 unless defined($shelfnumber);
460
460
461
    my $query = qq/
461
    my $query = qq /
462
        SELECT IFNULL(owner,0) AS owner, category, allow_add, allow_delete_own, allow_delete_other, IFNULL(sh.borrowernumber,0) AS borrowernumber
462
        SELECT IFNULL(owner,0) AS owner, category, allow_add, allow_delete_own, allow_delete_other, IFNULL(sh.borrowernumber,0) AS borrowernumber
463
        FROM virtualshelves vs
463
        FROM virtualshelves vs
464
        LEFT JOIN virtualshelfshares sh ON sh.shelfnumber=vs.shelfnumber
464
        LEFT JOIN virtualshelfshares sh ON sh.shelfnumber=vs.shelfnumber
(-)a/cataloguing/additem.pl (-4 / +25 lines)
Lines 33-38 use C4::ClassSource; Link Here
33
use C4::Dates;
33
use C4::Dates;
34
use List::MoreUtils qw/any/;
34
use List::MoreUtils qw/any/;
35
use C4::Search;
35
use C4::Search;
36
use C4::Members;
36
37
37
use MARC::File::XML;
38
use MARC::File::XML;
38
use URI::Escape;
39
use URI::Escape;
Lines 100-106 sub _increment_barcode { Link Here
100
101
101
102
102
sub generate_subfield_form {
103
sub generate_subfield_form {
103
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i) = @_;
104
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $limitededition) = @_;
104
  
105
  
105
  my $frameworkcode = &GetFrameworkCode($biblionumber);
106
  my $frameworkcode = &GetFrameworkCode($biblionumber);
106
        my %subfield_data;
107
        my %subfield_data;
Lines 152-157 sub generate_subfield_form { Link Here
152
	    $value = $input->param('barcode');
153
	    $value = $input->param('barcode');
153
	}
154
	}
154
        my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" );
155
        my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" );
156
        $attributes_no_value .= 'readonly="readonly" '
157
            if (
158
                $limitededition
159
                and C4::Context->preference("marcflavour") eq "UNIMARC"
160
                and $subfieldtag ne 'f'
161
                and $subfieldtag ne 'u'
162
            );
163
155
        my $attributes          = qq($attributes_no_value value="$value" );
164
        my $attributes          = qq($attributes_no_value value="$value" );
156
        
165
        
157
        if ( $subfieldlib->{authorised_value} ) {
166
        if ( $subfieldlib->{authorised_value} ) {
Lines 212-218 sub generate_subfield_form { Link Here
212
                $subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value});
221
                $subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value});
213
            }
222
            }
214
            else {
223
            else {
215
                $subfield_data{marc_value} =CGI::scrolling_list(      # FIXME: factor out scrolling_list
224
                my @scrparam = (
216
                    -name     => "field_value",
225
                    -name     => "field_value",
217
                    -values   => \@authorised_values,
226
                    -values   => \@authorised_values,
218
                    -default  => $value,
227
                    -default  => $value,
Lines 224-229 sub generate_subfield_form { Link Here
224
                    -id       => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield,
233
                    -id       => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield,
225
                    -class    => "input_marceditor",
234
                    -class    => "input_marceditor",
226
                );
235
                );
236
                push @scrparam, (-readonly => "readonly")
237
                    if (
238
                        $limitededition
239
                        and C4::Context->preference("marcflavour") eq "UNIMARC"
240
                        and $subfieldtag ne 'o'
241
                    );
242
                $subfield_data{marc_value} =CGI::scrolling_list(@scrparam);
227
            }
243
            }
228
244
229
        }
245
        }
Lines 308-313 my ($template, $loggedinuser, $cookie) Link Here
308
                 });
324
                 });
309
325
310
326
327
# Does the user have a limited item edition permission?
328
my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser) ;
329
my $limitededition = haspermission($uid,  {'editcatalogue' => 'limited_item_edition'}) if ($uid);
330
# In case user is a superlibrarian, edition is not limited
331
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1);
332
311
my $today_iso = C4::Dates->today('iso');
333
my $today_iso = C4::Dates->today('iso');
312
my $tagslib = &GetMarcStructure(1,$frameworkcode);
334
my $tagslib = &GetMarcStructure(1,$frameworkcode);
313
my $record = GetMarcBiblio($biblionumber);
335
my $record = GetMarcBiblio($biblionumber);
Lines 682-689 if($itemrecord){ Link Here
682
            next if subfield_is_koha_internal_p($subfieldtag);
704
            next if subfield_is_koha_internal_p($subfieldtag);
683
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
705
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
684
706
685
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i);        
707
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition);
686
687
            push @fields, "$tag$subfieldtag";
708
            push @fields, "$tag$subfieldtag";
688
            push (@loop_data, $subfield_data);
709
            push (@loop_data, $subfield_data);
689
            $i++;
710
            $i++;
(-)a/installer/data/mysql/en/mandatory/userpermissions.sql (+3 lines)
Lines 6-11 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
6
   ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'),
6
   ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'),
7
   ( 9, 'fast_cataloging', 'Fast cataloging'),
7
   ( 9, 'fast_cataloging', 'Fast cataloging'),
8
   ( 9, 'edit_items', 'Edit Items'),
8
   ( 9, 'edit_items', 'Edit Items'),
9
   ( 9, 'limited_item_edition', 'Limit item modification to barcode, status and note (please note that edit_item is still required)'),
10
   ( 9, 'delete_all_items', 'Delete all items'),
9
   (11, 'vendors_manage', 'Manage vendors'),
11
   (11, 'vendors_manage', 'Manage vendors'),
10
   (11, 'contracts_manage', 'Manage contracts'),
12
   (11, 'contracts_manage', 'Manage contracts'),
11
   (11, 'period_manage', 'Manage periods'),
13
   (11, 'period_manage', 'Manage periods'),
Lines 32-37 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
32
   (13, 'batch_upload_patron_images', 'Upload patron images in batch or one at a time'),
34
   (13, 'batch_upload_patron_images', 'Upload patron images in batch or one at a time'),
33
   (13, 'schedule_tasks', 'Schedule tasks to run'),
35
   (13, 'schedule_tasks', 'Schedule tasks to run'),
34
   (13, 'items_batchmod', 'Perform batch modification of items'),
36
   (13, 'items_batchmod', 'Perform batch modification of items'),
37
   (13, 'items_limited_batchmod', 'Limit batch item modification to item status (please note that items_batchmod is still required)'),
35
   (13, 'items_batchdel', 'Perform batch deletion of items'),
38
   (13, 'items_batchdel', 'Perform batch deletion of items'),
36
   (13, 'manage_csv_profiles', 'Manage CSV export profiles'),
39
   (13, 'manage_csv_profiles', 'Manage CSV export profiles'),
37
   (13, 'moderate_tags', 'Moderate patron tags'),
40
   (13, 'moderate_tags', 'Moderate patron tags'),
(-)a/installer/data/mysql/updatedatabase.pl (+20 lines)
Lines 5109-5114 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5109
    SetVersion ($DBversion);
5109
    SetVersion ($DBversion);
5110
}
5110
}
5111
5111
5112
5113
$DBversion = "3.07.00.XXX";
5114
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5115
    $dbh->do(qq{
5116
       INSERT INTO permissions (module_bit, code, description) VALUES ('9', 'limited_item_edition', 'Limit item modification to barcode, status and note (please note that edit_item is still required)');
5117
   });
5118
5119
   $dbh->do(qq{
5120
       INSERT INTO permissions (module_bit, code, description) VALUES ('9', 'delete_all_items', 'Delete all items');
5121
   });
5122
5123
   $dbh->do(qq{
5124
       INSERT INTO permissions (module_bit, code, description) VALUES ('13', 'items_limited_batchmod', 'Limit batch item modification to item status (please note that items_batchmod is still required)');
5125
   });
5126
5127
    print "Upgrade to $DBversion done (Adds new permissions for cataloguing and batch item modification)\n";
5128
5129
    SetVersion($DBversion);
5130
}
5131
5112
=head1 FUNCTIONS
5132
=head1 FUNCTIONS
5113
5133
5114
=head2 DropAllForeignKeys($table)
5134
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+1 lines)
Lines 117-122 function confirm_items_deletion() { Link Here
117
			[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Replace Record via Z39.50"), onclick: {fn: PopupZ3950 } },[% END %]
117
			[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Replace Record via Z39.50"), onclick: {fn: PopupZ3950 } },[% END %]
118
			[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Delete Record"), onclick: {fn: confirm_deletion }[% IF ( count ) %],id:'disabled'[% END %] },[% END %]
118
			[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Delete Record"), onclick: {fn: confirm_deletion }[% IF ( count ) %],id:'disabled'[% END %] },[% END %]
119
	        [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Delete all Items"), onclick: {fn: confirm_items_deletion }[% UNLESS ( count ) %],id:'disabled'[% END %] }[% END %]
119
	        [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Delete all Items"), onclick: {fn: confirm_items_deletion }[% UNLESS ( count ) %],id:'disabled'[% END %] }[% END %]
120
            [% IF ( CAN_user_editcatalogue_delete_all_items ) %]{ text: _("Delete all Items"), onclick: {fn: confirm_items_deletion } }[% END %]
120
	    ];
121
	    ];
121
		if(editmenu.length){
122
		if(editmenu.length){
122
			new YAHOO.widget.Button({
123
			new YAHOO.widget.Button({
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +8 lines)
Lines 47-52 function Check(f) { Link Here
47
47
48
    var alertString2;
48
    var alertString2;
49
    if (total_errors==0) {
49
    if (total_errors==0) {
50
        // Explanation about this line: 
51
        // In case of limited edition permission, we have to prevent user from modifying some fields.
52
        // But there is no such thing as readonly attribute for select elements.
53
        // So we use disabled instead. But disabled prevent values from being passed through the form at submit.
54
        // So we "un-disable" the elements just before submitting.
55
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
56
        $("select[name=field_value]").removeAttr("disabled");
50
        return true;
57
        return true;
51
    } else {
58
    } else {
52
        alertString2  = _("Form not submitted because of the following problem(s)");
59
        alertString2  = _("Form not submitted because of the following problem(s)");
Lines 217-223 $(document).ready(function() { Link Here
217
</div>
224
</div>
218
<div class="yui-u">
225
<div class="yui-u">
219
<div id="cataloguing_additem_newitem">
226
<div id="cataloguing_additem_newitem">
220
    <form method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
227
    <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
221
    <input type="hidden" name="op" value="[% op %]" />
228
    <input type="hidden" name="op" value="[% op %]" />
222
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
229
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
223
    [% IF ( opisadd ) %]
230
    [% IF ( opisadd ) %]
(-)a/tools/batchMod.pl (-1 / +7 lines)
Lines 33-38 use C4::BackgroundJob; Link Here
33
use C4::ClassSource;
33
use C4::ClassSource;
34
use C4::Dates;
34
use C4::Dates;
35
use C4::Debug;
35
use C4::Debug;
36
use C4::Members;
36
use MARC::File::XML;
37
use MARC::File::XML;
37
38
38
my $input = new CGI;
39
my $input = new CGI;
Lines 65-70 my ($template, $loggedinuser, $cookie) Link Here
65
                 flagsrequired => $template_flag,
66
                 flagsrequired => $template_flag,
66
                 });
67
                 });
67
68
69
# Does the user have a limited item edition permission?
70
my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser) ;
71
my $limitededition = haspermission($uid,  {'tools' => 'items_limited_batchmod'}) if ($uid);
72
# In case user is a superlibrarian, edition is not limited
73
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1);
68
74
69
my $today_iso = C4::Dates->today('iso');
75
my $today_iso = C4::Dates->today('iso');
70
$template->param(today_iso => $today_iso);
76
$template->param(today_iso => $today_iso);
Lines 274-279 foreach my $tag (sort keys %{$tagslib}) { Link Here
274
    # loop through each subfield
280
    # loop through each subfield
275
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
281
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
276
     	next if subfield_is_koha_internal_p($subfield);
282
     	next if subfield_is_koha_internal_p($subfield);
283
        next if ($limitededition && C4::Context->preference("marcflavour") eq "UNIMARC" && $subfield ne 'o');
277
    	next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
284
    	next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
278
        # barcode and stocknumber are not meant to be batch-modified
285
        # barcode and stocknumber are not meant to be batch-modified
279
    	next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode';
286
    	next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode';
280
- 

Return to bug 7673