|
Lines 32-41
use C4::Biblio;
Link Here
|
| 32 |
use C4::Items; |
32 |
use C4::Items; |
| 33 |
use C4::Output; |
33 |
use C4::Output; |
| 34 |
use C4::VirtualShelves; |
34 |
use C4::VirtualShelves; |
|
|
35 |
use Koha::Email; |
| 35 |
|
36 |
|
| 36 |
my $query = new CGI; |
37 |
my $query = new CGI; |
| 37 |
|
38 |
|
| 38 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( |
39 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
| 39 |
{ |
40 |
{ |
| 40 |
template_name => "virtualshelves/sendshelfform.tt", |
41 |
template_name => "virtualshelves/sendshelfform.tt", |
| 41 |
query => $query, |
42 |
query => $query, |
|
Lines 48-62
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
Link Here
|
| 48 |
my $shelfid = $query->param('shelfid'); |
49 |
my $shelfid = $query->param('shelfid'); |
| 49 |
my $email = $query->param('email'); |
50 |
my $email = $query->param('email'); |
| 50 |
|
51 |
|
| 51 |
my $dbh = C4::Context->dbh; |
52 |
my $dbh = C4::Context->dbh; |
| 52 |
|
53 |
|
| 53 |
if ( $email ) { |
54 |
if ($email) { |
| 54 |
my $email_from = C4::Context->preference('KohaAdminEmailAddress'); |
55 |
my $comment = $query->param('comment'); |
| 55 |
my $comment = $query->param('comment'); |
56 |
my $message = Koha::Email->new(); |
| 56 |
|
57 |
my %mail = $message->create_message_headers( |
| 57 |
my %mail = ( |
58 |
{ |
| 58 |
To => $email, |
59 |
to => $email |
| 59 |
From => $email_from |
60 |
} |
| 60 |
); |
61 |
); |
| 61 |
|
62 |
|
| 62 |
my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( |
63 |
my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( |
|
Lines 69-77
if ( $email ) {
Link Here
|
| 69 |
} |
70 |
} |
| 70 |
); |
71 |
); |
| 71 |
|
72 |
|
| 72 |
my @shelf = GetShelf($shelfid); |
73 |
my @shelf = GetShelf($shelfid); |
| 73 |
my ($items, $totitems) = GetShelfContents($shelfid); |
74 |
my ( $items, $totitems ) = GetShelfContents($shelfid); |
| 74 |
my $marcflavour = C4::Context->preference('marcflavour'); |
75 |
my $marcflavour = C4::Context->preference('marcflavour'); |
| 75 |
my $iso2709; |
76 |
my $iso2709; |
| 76 |
my @results; |
77 |
my @results; |
| 77 |
|
78 |
|
|
Lines 84-92
if ( $email ) {
Link Here
|
| 84 |
my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
85 |
my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
| 85 |
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); |
86 |
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); |
| 86 |
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); |
87 |
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); |
| 87 |
my $subtitle = GetRecordValue('subtitle', $record, $fw); |
88 |
my $subtitle = GetRecordValue( 'subtitle', $record, $fw ); |
| 88 |
|
89 |
|
| 89 |
my @items = GetItemsInfo( $biblionumber ); |
90 |
my @items = GetItemsInfo($biblionumber); |
| 90 |
|
91 |
|
| 91 |
$dat->{MARCNOTES} = $marcnotesarray; |
92 |
$dat->{MARCNOTES} = $marcnotesarray; |
| 92 |
$dat->{MARCSUBJCTS} = $marcsubjctsarray; |
93 |
$dat->{MARCSUBJCTS} = $marcsubjctsarray; |
|
Lines 100-112
if ( $email ) {
Link Here
|
| 100 |
push( @results, $dat ); |
101 |
push( @results, $dat ); |
| 101 |
} |
102 |
} |
| 102 |
|
103 |
|
| 103 |
if (C4::Context->preference('OPACBaseURL')){ |
104 |
if ( C4::Context->preference('OPACBaseURL') ) { |
| 104 |
$template2->param( OPACBaseURL => C4::Context->preference('OPACBaseURL') ); |
105 |
$template2->param( |
| 105 |
} |
106 |
OPACBaseURL => C4::Context->preference('OPACBaseURL') ); |
|
|
107 |
} |
| 106 |
|
108 |
|
| 107 |
$template2->param( |
109 |
$template2->param( |
| 108 |
BIBLIO_RESULTS => \@results, |
110 |
BIBLIO_RESULTS => \@results, |
| 109 |
email_sender => $email_from, |
111 |
email_sender => $mail{'from'}, |
| 110 |
comment => $comment, |
112 |
comment => $comment, |
| 111 |
shelfname => $shelf[1], |
113 |
shelfname => $shelf[1], |
| 112 |
); |
114 |
); |
|
Lines 146-152
if ( $email ) {
Link Here
|
| 146 |
# We set and put the multipart content |
148 |
# We set and put the multipart content |
| 147 |
$mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; |
149 |
$mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; |
| 148 |
|
150 |
|
| 149 |
my $isofile = encode_base64(encode("UTF-8", $iso2709)); |
151 |
my $isofile = encode_base64( encode( "UTF-8", $iso2709 ) ); |
| 150 |
$boundary = '--' . $boundary; |
152 |
$boundary = '--' . $boundary; |
| 151 |
|
153 |
|
| 152 |
$mail{body} = <<END_OF_BODY; |
154 |
$mail{body} = <<END_OF_BODY; |
|
Lines 167-174
END_OF_BODY
Link Here
|
| 167 |
|
169 |
|
| 168 |
# Sending mail |
170 |
# Sending mail |
| 169 |
if ( sendmail %mail ) { |
171 |
if ( sendmail %mail ) { |
|
|
172 |
|
| 170 |
# do something if it works.... |
173 |
# do something if it works.... |
| 171 |
$template->param( SENT => "1" ); |
174 |
$template->param( SENT => "1" ); |
| 172 |
} |
175 |
} |
| 173 |
else { |
176 |
else { |
| 174 |
# do something if it doesnt work.... |
177 |
# do something if it doesnt work.... |
|
Lines 179-188
END_OF_BODY
Link Here
|
| 179 |
$template->param( email => $email ); |
182 |
$template->param( email => $email ); |
| 180 |
output_html_with_http_headers $query, $cookie, $template->output; |
183 |
output_html_with_http_headers $query, $cookie, $template->output; |
| 181 |
|
184 |
|
| 182 |
|
185 |
} |
| 183 |
}else{ |
186 |
else { |
| 184 |
$template->param( shelfid => $shelfid, |
187 |
$template->param( |
| 185 |
url => "/cgi-bin/koha/virtualshelves/sendshelf.pl", |
188 |
shelfid => $shelfid, |
| 186 |
); |
189 |
url => "/cgi-bin/koha/virtualshelves/sendshelf.pl", |
|
|
190 |
); |
| 187 |
output_html_with_http_headers $query, $cookie, $template->output; |
191 |
output_html_with_http_headers $query, $cookie, $template->output; |
| 188 |
} |
192 |
} |
| 189 |
- |
|
|