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

(-)a/cataloguing/addbiblio.pl (-3 / +23 lines)
Lines 22-29 Link Here
22
use strict;
22
use strict;
23
#use warnings; FIXME - Bug 2505
23
#use warnings; FIXME - Bug 2505
24
use CGI;
24
use CGI;
25
use CGI::Session;
25
use C4::Output;
26
use C4::Output;
26
use C4::Auth;
27
use C4::Auth qw/:DEFAULT get_session/;
27
use C4::Biblio;
28
use C4::Biblio;
28
use C4::Search;
29
use C4::Search;
29
use C4::AuthoritiesMarc;
30
use C4::AuthoritiesMarc;
Lines 718-724 my $dbh = C4::Context->dbh; Link Here
718
my $hostbiblionumber = $input->param('hostbiblionumber');
719
my $hostbiblionumber = $input->param('hostbiblionumber');
719
my $hostitemnumber = $input->param('hostitemnumber');
720
my $hostitemnumber = $input->param('hostitemnumber');
720
721
721
    
722
# getting userID
723
my $sessionID = $input->cookie("CGISESSID") ;
724
my $session = get_session($sessionID);
725
my $userid = $session->param('id');
726
727
# getting validation variables
728
my $validation = C4::Context->preference('CatalogingValidation');
729
my $validationframework = C4::Context->preference('CatalogingValidationFramework');
730
my %validationusers = map { $_ => 1 } split(/,/,C4::Context->preference('CatalogingValidationUsers'));
731
 
722
my $userflags = 'edit_catalogue';
732
my $userflags = 'edit_catalogue';
723
if ($frameworkcode eq 'FA'){
733
if ($frameworkcode eq 'FA'){
724
    $userflags = 'fast_cataloging';
734
    $userflags = 'fast_cataloging';
Lines 738-743 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
738
    }
748
    }
739
);
749
);
740
750
751
# Clear the framework code if validation is on and the framework code is equal to validation framework but the user is not authorized to use it
752
# Avoid users to user validation framework adding the code to the URL
753
$frameworkcode = '' if ($validation && ($frameworkcode eq $validationframework && !$validationusers{$userid}));
754
741
if ($frameworkcode eq 'FA'){
755
if ($frameworkcode eq 'FA'){
742
    # We need to grab and set some variables in the template for use on the additems screen
756
    # We need to grab and set some variables in the template for use on the additems screen
743
    $template->{VARS}->{'circborrowernumber'} = $input->param('borrowernumber');
757
    $template->{VARS}->{'circborrowernumber'} = $input->param('borrowernumber');
Lines 759-765 foreach my $thisframeworkcode ( keys %$frameworks ) { Link Here
759
	if ($frameworkcode eq $thisframeworkcode){
773
	if ($frameworkcode eq $thisframeworkcode){
760
		$row{'selected'} = 1;
774
		$row{'selected'} = 1;
761
		}
775
		}
762
	push @frameworkcodeloop, \%row;
776
	# Add the framework code if validation is off.
777
	# Add the framework code if validation is on, the framework code is equal to validation framework and the user is not authorized to use it
778
	if (!$validation || ($validation && ($thisframeworkcode ne $validationframework || ($thisframeworkcode eq $validationframework && $validationusers{$userid})))) {
779
		push @frameworkcodeloop, \%row;
780
	}
763
} 
781
} 
764
$template->param( frameworkcodeloop => \@frameworkcodeloop,
782
$template->param( frameworkcodeloop => \@frameworkcodeloop,
765
	breedingid => $breedingid );
783
	breedingid => $breedingid );
Lines 853-858 if ( $op eq "addbiblio" ) { Link Here
853
            ModBiblio( $record, $biblionumber, $frameworkcode );
871
            ModBiblio( $record, $biblionumber, $frameworkcode );
854
        }
872
        }
855
        else {
873
        else {
874
	    # force 942$n = 1 when validation is on and isn't validation framework
875
	    $record->field('942')->update('n' => '1') if ($validation && ($frameworkcode ne $validationframework));
856
            ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode );
876
            ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode );
857
        }
877
        }
858
        if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view")){
878
        if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view")){
(-)a/cataloguing/addbooks.pl (-5 / +20 lines)
Lines 27-33 Link Here
27
use strict;
27
use strict;
28
use warnings;
28
use warnings;
29
use CGI;
29
use CGI;
30
use C4::Auth;
30
use CGI::Session;
31
use C4::Auth qw/:DEFAULT get_session/;
31
use C4::Biblio;
32
use C4::Biblio;
32
use C4::Breeding;
33
use C4::Breeding;
33
use C4::Output;
34
use C4::Output;
Lines 36-41 use C4::Search; Link Here
36
37
37
my $input = new CGI;
38
my $input = new CGI;
38
39
40
# getting userID
41
my $sessionID = $input->cookie("CGISESSID");
42
my $session = get_session($sessionID);
43
my $userid = $session->param('id');
44
45
# getting validation variables
46
my $validation = C4::Context->preference('CatalogingValidation');
47
my $validationframework = C4::Context->preference('CatalogingValidationFramework');
48
my %validationusers = map { $_ => 1 } split(/,/,C4::Context->preference('CatalogingValidationUsers'));
49
39
my $success = $input->param('biblioitem');
50
my $success = $input->param('biblioitem');
40
my $query   = $input->param('q');
51
my $query   = $input->param('q');
41
my @value   = $input->param('value');
52
my @value   = $input->param('value');
Lines 58-67 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
58
my $frameworks = getframeworks;
69
my $frameworks = getframeworks;
59
my @frameworkcodeloop;
70
my @frameworkcodeloop;
60
foreach my $thisframeworkcode ( sort {$frameworks->{$a} cmp $frameworks->{$b}}keys %{$frameworks} ) {
71
foreach my $thisframeworkcode ( sort {$frameworks->{$a} cmp $frameworks->{$b}}keys %{$frameworks} ) {
61
    push @frameworkcodeloop, {
72
	# Add the framework code if validation is off.
62
        value         => $thisframeworkcode,
73
	# Add the framework code if validation is on, the framework code is equal to validation framework and the user is not authorized to use it
63
        frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
74
	if (!$validation || ($validation && ($thisframeworkcode ne $validationframework || ($thisframeworkcode eq $validationframework && $validationusers{$userid})))) {
64
    };
75
		push @frameworkcodeloop, {
76
	        	value         => $thisframeworkcode,
77
			frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
78
	    	};
79
	}
65
}
80
}
66
81
67
82
(-)a/installer/data/mysql/sysprefs.sql (+3 lines)
Lines 387-389 INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdid Link Here
387
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');
387
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');
388
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer');
388
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer');
389
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free');
389
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free');
390
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidation', '0','Active cataloging validation',NULL,'YesNo');
391
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationFramework','','Cataloging validation framework',NULL,'long');
392
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationUsers', '','Cataloging validation users',NULL,'long');
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 6083-6088 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
6083
    SetVersion($DBversion);
6083
    SetVersion($DBversion);
6084
}
6084
}
6085
6085
6086
$DBversion = "XXX";
6087
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6088
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidation', '0','Active cataloging validation',NULL,'YesNo');");
6089
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationFramework','','Cataloging validation framework',NULL,'long');");
6090
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationUsers', '','Cataloging validation users',NULL,'long');");
6091
    print "Upgrade to $DBversion done (Bug 9163 - Cataloguing validation workflow)\n";
6092
    SetVersion($DBversion);
6093
}
6094
6086
=head1 FUNCTIONS
6095
=head1 FUNCTIONS
6087
6096
6088
=head2 TableExists($table)
6097
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-2 / +18 lines)
Lines 156-159 Cataloging: Link Here
156
            - pref: OpacSuppressionByIPRange
156
            - pref: OpacSuppressionByIPRange
157
              class: short
157
              class: short
158
            - (Leave blank if not used. Define a range like <code>192.168.</code>.)
158
            - (Leave blank if not used. Define a range like <code>192.168.</code>.)
159
159
    Validation:
160
        -
161
            - pref: CatalogingValidation
162
              choices:
163
                  yes: Use
164
                  no: "Don't use"
165
            - "cataloging validation. This allows some users to use a special MARC framework (only visible to them) to validate and put the record online in OPAC.<br />"
166
            - "NOTE:<br /> - All MARC frameworks except the validation framework (set in CatalogingValidationFramework) needs to have the suppress subfield hidden.<br /> - The validation framework needs to have suppress subfield visible.<br />- The system preference OPACSuppresion needs to be on.<br /> - The users with access to the validation framework are set in CatalogingValidationUsers."
167
        -
168
            - "Code of the validation framework:"
169
            - pref: CatalogingValidationFramework
170
              class: long
171
            - "<br />NOTE:<br /> - CatalogingValidation needs to be on.<br /> - The framework needs to be created in the MARC frameworks administration panel.<br /> - The framework needs to have suppress subfield visible."
172
        -
173
            - "The following users (list comma separated) will have access to validation framework:"
174
            - pref: CatalogingValidationUsers
175
              class: long
176
            - "<br />NOTE:<br /> - CatalogingValidation needs to be on."
160
- 

Return to bug 9163