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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt (-1 / +12 lines)
Lines 111-119 Link Here
111
                                    [% END %]
111
                                    [% END %]
112
                                [% END %]
112
                                [% END %]
113
                            </h1>
113
                            </h1>
114
                            [% FOR m IN messages %]
115
                                <div class="alert alert-[% m.type %]">
116
                                    [% SWITCH m.code %]
117
                                    [% CASE 'already_exists' %]
118
                                        The suggestion has not been inserted. The same suggestion already exists.
119
                                    [% CASE 'success_on_inserted' %]
120
                                        Your suggestion has been submitted.
121
                                    [% CASE %]
122
                                        [% m.code %]
123
                                    [% END %]
124
                                </div>
125
                            [% END %]
114
126
115
                            [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
127
                            [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
116
                            [% IF ( submitted ) %]<div class="alert alert-info">Your suggestion has been submitted.</div>[% END %]
117
128
118
                            [% IF ( suggestions_loop ) %]
129
                            [% IF ( suggestions_loop ) %]
119
                                [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
130
                                [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
(-)a/opac/opac-suggestions.pl (-6 / +10 lines)
Lines 54-60 if ( ! C4::Context->preference('suggestion') ) { Link Here
54
delete $$suggestion{$_} foreach qw<op suggestedbyme>;
54
delete $$suggestion{$_} foreach qw<op suggestedbyme>;
55
$op = 'else' unless $op;
55
$op = 'else' unless $op;
56
56
57
my ( $template, $borrowernumber, $cookie );
57
my ( $template, $borrowernumber, $cookie, @messages );
58
my $deleted = $input->param('deleted');
58
my $deleted = $input->param('deleted');
59
my $submitted = $input->param('submitted');
59
my $submitted = $input->param('submitted');
60
60
Lines 94-99 my $suggestions_loop = Link Here
94
if ( $op eq "add_confirm" ) {
94
if ( $op eq "add_confirm" ) {
95
	if (@$suggestions_loop>=1){
95
	if (@$suggestions_loop>=1){
96
		#some suggestion are answering the request Donot Add
96
		#some suggestion are answering the request Donot Add
97
        for my $suggestion ( @$suggestions_loop ) {
98
            push @messages, { type => 'error', code => 'already_exists', id => $suggestion->{suggestionid} };
99
            last;
100
        }
97
	}
101
	}
98
	else {
102
	else {
99
		my $scrubber = C4::Scrubber->new();
103
		my $scrubber = C4::Scrubber->new();
Lines 109-118 if ( $op eq "add_confirm" ) { Link Here
109
		$$suggestion{$_}='' foreach qw<title author publishercode copyrightdate place collectiontitle isbn STATUS>;
113
		$$suggestion{$_}='' foreach qw<title author publishercode copyrightdate place collectiontitle isbn STATUS>;
110
		$suggestions_loop =
114
		$suggestions_loop =
111
		   &SearchSuggestion( $suggestion );
115
		   &SearchSuggestion( $suggestion );
116
        push @messages, { type => 'info', code => 'success_on_inserted' };
112
	}
117
	}
113
	$op              = 'else';
118
    $op = 'else';
114
    print $input->redirect("/cgi-bin/koha/opac-suggestions.pl?op=else&submitted=1");
115
    exit;
116
}
119
}
117
120
118
if ( $op eq "delete_confirm" ) {
121
if ( $op eq "delete_confirm" ) {
Lines 121-127 if ( $op eq "delete_confirm" ) { Link Here
121
        &DelSuggestion( $borrowernumber, $delete_field );
124
        &DelSuggestion( $borrowernumber, $delete_field );
122
    }
125
    }
123
    $op = 'else';
126
    $op = 'else';
124
    print $input->redirect("/cgi-bin/koha/opac-suggestions.pl?op=else&deleted=1");
127
    print $input->redirect("/cgi-bin/koha/opac-suggestions.pl?op=else");
125
    exit;
128
    exit;
126
}
129
}
127
map{ $_->{'branchcodesuggestedby'}=GetBranchInfo($_->{'branchcodesuggestedby'})->[0]->{'branchname'}} @$suggestions_loop;
130
map{ $_->{'branchcodesuggestedby'}=GetBranchInfo($_->{'branchcodesuggestedby'})->[0]->{'branchname'}} @$suggestions_loop;
Lines 171-176 $template->param( Link Here
171
    patron_reason_loop => $patron_reason_loop,
174
    patron_reason_loop => $patron_reason_loop,
172
    showall    => $allsuggestions,
175
    showall    => $allsuggestions,
173
    "op_$op"         => 1,
176
    "op_$op"         => 1,
177
    $op => 1,
178
    messages => \@messages,
174
    suggestionsview => 1,
179
    suggestionsview => 1,
175
);
180
);
176
181
177
- 

Return to bug 10752