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

(-)a/C4/Bookseller/Contact.pm (-4 / +9 lines)
Lines 63-68 Contact's e-mail address. Link Here
63
63
64
Notes about contact.
64
Notes about contact.
65
65
66
=item orderacquisition
67
68
Whether the contact should receive acquisitions orders.
69
66
=item claimacquisition
70
=item claimacquisition
67
71
68
Whether the contact should receive acquisitions claims.
72
Whether the contact should receive acquisitions claims.
Lines 92-98 use C4::Context; Link Here
92
96
93
use base qw(Class::Accessor);
97
use base qw(Class::Accessor);
94
98
95
__PACKAGE__->mk_accessors(qw(id name position phone altphone fax email notes claimacquisition claimissues acqprimary serialsprimary bookseller));
99
__PACKAGE__->mk_accessors(qw(id name position phone altphone fax email notes orderacquisition claimacquisition claimissues acqprimary serialsprimary bookseller));
96
100
97
=head1 METHODS
101
=head1 METHODS
98
102
Lines 168-181 sub save { Link Here
168
        $self->phone, $self->altphone,
172
        $self->phone, $self->altphone,
169
        $self->fax,   $self->email,
173
        $self->fax,   $self->email,
170
        $self->notes, $self->acqprimary ? 1 : 0,
174
        $self->notes, $self->acqprimary ? 1 : 0,
171
        $self->serialsprimary ? 1 : 0, $self->claimacquisition ? 1 : 0,
175
        $self->serialsprimary ? 1 : 0,
176
        $self->orderacquisition ? 1 : 0, $self->claimacquisition ? 1 : 0,
172
        $self->claimissues ? 1 : 0, $self->bookseller
177
        $self->claimissues ? 1 : 0, $self->bookseller
173
    );
178
    );
174
    if ($self->id) {
179
    if ($self->id) {
175
        $query = 'UPDATE aqcontacts SET name = ?, position = ?, phone = ?, altphone = ?, fax = ?, email = ?, notes = ?, acqprimary = ?, serialsprimary = ?, claimacquisition = ?, claimissues = ?, booksellerid = ? WHERE id = ?;';
180
        $query = 'UPDATE aqcontacts SET name = ?, position = ?, phone = ?, altphone = ?, fax = ?, email = ?, notes = ?, acqprimary = ?, serialsprimary = ?, orderacquisition = ?, claimacquisition = ?, claimissues = ?, booksellerid = ? WHERE id = ?;';
176
        push @params, $self->id;
181
        push @params, $self->id;
177
    } else {
182
    } else {
178
        $query = 'INSERT INTO aqcontacts (name, position, phone, altphone, fax, email, notes, acqprimary, serialsprimary, claimacquisition, claimissues, booksellerid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);';
183
        $query = 'INSERT INTO aqcontacts (name, position, phone, altphone, fax, email, notes, acqprimary, serialsprimary, orderacquisition, claimacquisition, claimissues, booksellerid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);';
179
    }
184
    }
180
    my $dbh = C4::Context->dbh;
185
    my $dbh = C4::Context->dbh;
181
    my $sth = $dbh->prepare($query);
186
    my $sth = $dbh->prepare($query);
(-)a/C4/Letters.pm (-27 / +77 lines)
Lines 17-24 package C4::Letters; Link Here
17
# You should have received a copy of the GNU General Public License
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use strict;
20
use Modern::Perl;
21
use warnings;
22
21
23
use MIME::Lite;
22
use MIME::Lite;
24
use Mail::Sendmail;
23
use Mail::Sendmail;
Lines 364-375 sub findrelatedto { Link Here
364
363
365
=head2 SendAlerts
364
=head2 SendAlerts
366
365
367
    parameters :
366
    my $err = &SendAlerts($type, $externalid, $letter_code);
368
    - $type : the type of alert
369
    - $externalid : the id of the "object" to query
370
    - $letter_code : the letter to send.
371
367
372
    send an alert to all borrowers having put an alert on a given subject.
368
Parameters:
369
 - $type : the type of alert
370
 - $externalid : the id of the "object" to query
371
 - $letter_code : the notice template to use
372
373
C<&SendAlerts> sends an email notice directly to a patron or a vendor.
374
Currently it supports ($type):
375
- claim serial issues (claimissues)
376
- claim acquisition orders (claimacquisition)
377
- send acquisition orders to the vendor (orderacquisition)
378
- notify patrons about newly received serial issues (issue)
379
- notify patrons when their account is created (members)
373
380
374
    Returns undef or { error => 'message } on failure.
381
    Returns undef or { error => 'message } on failure.
375
    Returns true on success.
382
    Returns true on success.
Lines 449-468 sub SendAlerts { Link Here
449
            }
456
            }
450
        }
457
        }
451
    }
458
    }
452
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
459
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' or $type eq 'orderacquisition' ) {
453
460
454
        # prepare the letter...
461
        # prepare the letter...
455
        # search the biblionumber
462
        my $strsth;
456
        my $strsth =  $type eq 'claimacquisition'
463
        my $sthorders;
457
            ? qq{
464
        my $dataorders;
465
        my $action;
466
        if ( $type eq 'claimacquisition') {
467
            $strsth = qq{
458
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
468
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
459
            FROM aqorders
469
            FROM aqorders
460
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
470
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
461
            LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
471
            LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
462
            LEFT JOIN biblioitems ON aqorders.biblionumber=biblioitems.biblionumber
472
            LEFT JOIN biblioitems ON aqorders.biblionumber=biblioitems.biblionumber
463
            WHERE aqorders.ordernumber IN (
473
            WHERE aqorders.ordernumber IN (
474
            };
475
476
            if (!@$externalid){
477
                carp "No order selected";
478
                return { error => "no_order_selected" };
464
            }
479
            }
465
            : qq{
480
            $strsth .= join( ",", @$externalid ) . ")";
481
            $action = "ACQUISITION CLAIM";
482
            $sthorders = $dbh->prepare($strsth);
483
            $sthorders->execute;
484
            $dataorders = $sthorders->fetchall_arrayref( {} );
485
        }
486
487
        if ($type eq 'claimissues') {
488
            $strsth = qq{
466
            SELECT serial.*,subscription.*, biblio.*, aqbooksellers.*,
489
            SELECT serial.*,subscription.*, biblio.*, aqbooksellers.*,
467
            aqbooksellers.id AS booksellerid
490
            aqbooksellers.id AS booksellerid
468
            FROM serial
491
            FROM serial
Lines 472-492 sub SendAlerts { Link Here
472
            WHERE serial.serialid IN (
495
            WHERE serial.serialid IN (
473
            };
496
            };
474
497
475
        if (!@$externalid){
498
            if (!@$externalid){
476
            carp "No Order selected";
499
                carp "No Order selected";
477
            return { error => "no_order_selected" };
500
                return { error => "no_order_selected" };
501
            }
502
503
            $strsth .= join( ",", @$externalid ) . ")";
504
            $action = "CLAIM ISSUE";
505
            $sthorders = $dbh->prepare($strsth);
506
            $sthorders->execute;
507
            $dataorders = $sthorders->fetchall_arrayref( {} );
478
        }
508
        }
479
509
480
        $strsth .= join( ",", @$externalid ) . ")";
510
        if ( $type eq 'orderacquisition') {
481
        my $sthorders = $dbh->prepare($strsth);
511
            $strsth = qq{
482
        $sthorders->execute;
512
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
483
        my $dataorders = $sthorders->fetchall_arrayref( {} );
513
            FROM aqorders
514
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
515
            LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
516
            LEFT JOIN biblioitems ON aqorders.biblionumber=biblioitems.biblionumber
517
            WHERE aqbasket.basketno = ?
518
            AND orderstatus IN ('new','ordered')
519
            };
520
521
            if (!$externalid){
522
                carp "No basketnumber given";
523
                return { error => "no_basketno" };
524
            }
525
            $action = "ACQUISITION ORDER";
526
            $sthorders = $dbh->prepare($strsth);
527
            $sthorders->execute($externalid);
528
            $dataorders = $sthorders->fetchall_arrayref( {} );
529
        }
484
530
485
        my $sthbookseller =
531
        my $sthbookseller =
486
          $dbh->prepare("select * from aqbooksellers where id=?");
532
          $dbh->prepare("select * from aqbooksellers where id=?");
487
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
533
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
488
        my $databookseller = $sthbookseller->fetchrow_hashref;
534
        my $databookseller = $sthbookseller->fetchrow_hashref;
489
        my $addressee =  $type eq 'claimacquisition' ? 'acqprimary' : 'serialsprimary';
535
536
        my $addressee =  $type eq 'claimacquisition' || $type eq 'orderacquisition' ? 'acqprimary' : 'serialsprimary';
537
490
        my $sthcontact =
538
        my $sthcontact =
491
          $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC");
539
          $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC");
492
        $sthcontact->execute( $dataorders->[0]->{booksellerid} );
540
        $sthcontact->execute( $dataorders->[0]->{booksellerid} );
Lines 537-548 sub SendAlerts { Link Here
537
                                : 'text/plain; charset="utf-8"',
585
                                : 'text/plain; charset="utf-8"',
538
        );
586
        );
539
587
540
        $mail{'Reply-to'} = C4::Context->preference('ReplytoDefault')
588
        if ($type eq 'claimacquisition' || $type eq 'claimissues' ) {
541
          if C4::Context->preference('ReplytoDefault');
589
            $mail{'Reply-to'} = C4::Context->preference('ReplytoDefault')
542
        $mail{'Sender'} = C4::Context->preference('ReturnpathDefault')
590
              if C4::Context->preference('ReplytoDefault');
543
          if C4::Context->preference('ReturnpathDefault');
591
            $mail{'Sender'} = C4::Context->preference('ReturnpathDefault')
544
        $mail{'Bcc'} = $userenv->{emailaddress}
592
              if C4::Context->preference('ReturnpathDefault');
545
          if C4::Context->preference("ClaimsBccCopy");
593
            $mail{'Bcc'} = $userenv->{emailaddress}
594
              if C4::Context->preference("ClaimsBccCopy");
595
        }
546
596
547
        unless ( sendmail(%mail) ) {
597
        unless ( sendmail(%mail) ) {
548
            carp $Mail::Sendmail::error;
598
            carp $Mail::Sendmail::error;
Lines 551-557 sub SendAlerts { Link Here
551
601
552
        logaction(
602
        logaction(
553
            "ACQUISITION",
603
            "ACQUISITION",
554
            $type eq 'claimissues' ? "CLAIM ISSUE" : "ACQUISITION CLAIM",
604
            $action,
555
            undef,
605
            undef,
556
            "To="
606
            "To="
557
                . join( ',', @email )
607
                . join( ',', @email )
(-)a/acqui/basket.pl (-2 / +25 lines)
Lines 20-27 Link Here
20
# You should have received a copy of the GNU General Public License
20
# You should have received a copy of the GNU General Public License
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
22
23
use strict;
23
use Modern::Perl;
24
use warnings;
25
use C4::Auth;
24
use C4::Auth;
26
use C4::Koha;
25
use C4::Koha;
27
use C4::Output;
26
use C4::Output;
Lines 35-40 use C4::Members qw/GetMember/; #needed for permissions checking for changing ba Link Here
35
use C4::Items;
34
use C4::Items;
36
use C4::Suggestions;
35
use C4::Suggestions;
37
use Koha::Libraries;
36
use Koha::Libraries;
37
use C4::Letters qw/SendAlerts/;
38
use Date::Calc qw/Add_Delta_Days/;
38
use Date::Calc qw/Add_Delta_Days/;
39
use Koha::Database;
39
use Koha::Database;
40
use Koha::EDI qw( create_edi_order get_edifact_ean );
40
use Koha::EDI qw( create_edi_order get_edifact_ean );
Lines 116-121 if (!defined $op) { Link Here
116
my $confirm_pref= C4::Context->preference("BasketConfirmations") || '1';
116
my $confirm_pref= C4::Context->preference("BasketConfirmations") || '1';
117
$template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2';
117
$template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2';
118
118
119
$template->param( email_ok => 1 ) if defined $query->param('email_ok');
120
$template->param( email_error => $query->param('email_error') ) if defined $query->param('email_error');
121
122
119
if ( $op eq 'delete_confirm' ) {
123
if ( $op eq 'delete_confirm' ) {
120
    my $basketno = $query->param('basketno');
124
    my $basketno = $query->param('basketno');
121
    my $delbiblio = $query->param('delbiblio');
125
    my $delbiblio = $query->param('delbiblio');
Lines 165-170 if ( $op eq 'delete_confirm' ) { Link Here
165
    );
169
    );
166
    print GetBasketAsCSV($query->param('basketno'), $query);
170
    print GetBasketAsCSV($query->param('basketno'), $query);
167
    exit;
171
    exit;
172
} elsif ($op eq 'email') {
173
    my $redirect_url = '/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'};
174
    my $err;
175
176
    eval {
177
        $err = SendAlerts( 'orderacquisition', $query->param('basketno'), 'ACQORDER' );
178
    };
179
    if ( $@ ) {
180
    $redirect_url .= '&email_error='.$@;
181
    } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) {
182
        $redirect_url .= '&email_error=no_email';
183
    } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_basketno" ) {
184
        $redirect_url .= '&email_error=no_basketno';
185
    } else {
186
        $redirect_url .= '&email_ok=1';
187
    }
188
189
    print $query->redirect($redirect_url)
190
168
} elsif ($op eq 'close') {
191
} elsif ($op eq 'close') {
169
    my $confirm = $query->param('confirm') || $confirm_pref eq '2';
192
    my $confirm = $query->param('confirm') || $confirm_pref eq '2';
170
    if ($confirm) {
193
    if ($confirm) {
(-)a/acqui/lateorders.pl (-2 / +2 lines)
Lines 102-111 if ( $delay and not $delay =~ /^\d{1,3}$/ ) { Link Here
102
}
102
}
103
103
104
if ($op and $op eq "send_alert"){
104
if ($op and $op eq "send_alert"){
105
    my @ordernums = $input->multi_param("ordernumber");# FIXME: Fallback values?
105
    my @ordernums = $input->multi_param("ordernumber");
106
    my $err;
106
    my $err;
107
    eval {
107
    eval {
108
        $err = SendAlerts( 'claimacquisition', \@ordernums, $input->param("letter_code") );    # FIXME: Fallback value?
108
        $err = SendAlerts( 'claimacquisition', \@ordernums, $input->param("letter_code") );
109
        if ( not ref $err or not exists $err->{error} ) {
109
        if ( not ref $err or not exists $err->{error} ) {
110
            AddClaim ( $_ ) for @ordernums;
110
            AddClaim ( $_ ) for @ordernums;
111
        }
111
        }
(-)a/acqui/updatesupplier.pl (-2 / +2 lines)
Lines 97-110 $data{'active'}=$input->param('status'); Link Here
97
my @contacts;
97
my @contacts;
98
my %contact_info;
98
my %contact_info;
99
99
100
foreach (qw(id name position phone altphone fax email notes claimacquisition claimissues acqprimary serialsprimary)) {
100
foreach (qw(id name position phone altphone fax email notes orderacquisition claimacquisition claimissues acqprimary serialsprimary)) {
101
    $contact_info{$_} = [ $input->param('contact_' . $_) ];
101
    $contact_info{$_} = [ $input->param('contact_' . $_) ];
102
}
102
}
103
103
104
for my $cnt (0..scalar(@{$contact_info{'id'}})) {
104
for my $cnt (0..scalar(@{$contact_info{'id'}})) {
105
    my %contact;
105
    my %contact;
106
    my $real_contact;
106
    my $real_contact;
107
    foreach (qw(id name position phone altphone fax email notes claimacquisition claimissues acqprimary serialsprimary)) {
107
    foreach (qw(id name position phone altphone fax email notes orderacquisition claimacquisition claimissues acqprimary serialsprimary)) {
108
        $contact{$_} = $contact_info{$_}->[$cnt];
108
        $contact{$_} = $contact_info{$_}->[$cnt];
109
        $real_contact = 1 if $contact{$_};
109
        $real_contact = 1 if $contact{$_};
110
    }
110
    }
(-)a/installer/data/mysql/atomicupdate/bug_5260_acq_email_orders.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE `aqcontacts` ADD `orderacquisition` BOOLEAN NOT NULL DEFAULT 0 AFTER `notes`;
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2913-2918 CREATE TABLE aqcontacts ( Link Here
2913
  fax varchar(100) default NULL,  -- contact's fax number
2913
  fax varchar(100) default NULL,  -- contact's fax number
2914
  email varchar(100) default NULL, -- contact's email address
2914
  email varchar(100) default NULL, -- contact's email address
2915
  notes mediumtext, -- notes related to the contact
2915
  notes mediumtext, -- notes related to the contact
2916
  orderacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisition orders
2916
  claimacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims
2917
  claimacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims
2917
  claimissues BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive serial claims
2918
  claimissues BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive serial claims
2918
  acqprimary BOOLEAN NOT NULL DEFAULT 0, -- is this the primary contact for acquisitions messages
2919
  acqprimary BOOLEAN NOT NULL DEFAULT 0, -- is this the primary contact for acquisitions messages
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +19 lines)
Lines 201-206 Link Here
201
                        [% IF ediaccount %]
201
                        [% IF ediaccount %]
202
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/edi_ean.pl?op=ediorder&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="ediorderbutton"><i class="fa fa-download"></i> Create EDIFACT order</a></div>
202
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/edi_ean.pl?op=ediorder&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="ediorderbutton"><i class="fa fa-download"></i> Create EDIFACT order</a></div>
203
                        [% END %]
203
                        [% END %]
204
                        [% IF ( active && books_loop ) %]
205
                        <div class="btn-group"><a href="[% script_name %]?op=email&amp;basketno=[% basketno %]" class="btn btn-small" id="emailvendorbutton"><i class="fa fa-envelope"></i> E-mail order</a></div>
206
                        [% END %]
204
                </div>
207
                </div>
205
<!-- Modal for confirm deletion box-->
208
<!-- Modal for confirm deletion box-->
206
                <div class="modal hide" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
209
                <div class="modal hide" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
Lines 291-296 Link Here
291
            <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
294
            <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
292
            [% END %]
295
            [% END %]
293
        [% ELSE %]
296
        [% ELSE %]
297
298
        [% IF email_error %]
299
            <div class="dialog alert">
300
            [% IF ( email_error == "no_email" ) %]
301
                This vendor has no contact selected for sending orders to or is missing an e-mail address.
302
            [% ELSIF ( email_error == "no_basketno" ) %]
303
                No basket given.
304
            [% ELSE %]
305
                ERROR! - [% email_error %]
306
            [% END %]
307
            </div>
308
        [% END %]
309
        [% IF ( email_ok ) %]
310
            <div class="dialog message">Order e-mail was sent to the vendor.</div>
311
        [% END %]
294
        <h1>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
312
        <h1>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
295
        [% IF ( basketno ) %]
313
        [% IF ( basketno ) %]
296
            <div id="acqui_basket_summary" class="yui-g">
314
            <div id="acqui_basket_summary" class="yui-g">
Lines 433-439 Link Here
433
                        <th>No.</th>
451
                        <th>No.</th>
434
                        <th class="anti-the">Order</th>
452
                        <th class="anti-the">Order</th>
435
                        <th class="gste">RRP tax exc.</th>
453
                        <th class="gste">RRP tax exc.</th>
436
                        <th class="gste">ecost tax exc.</th>
454
                        <th class="gste">Ecost tax exc.</th>
437
                        <th class="gsti">RRP tax inc.</th>
455
                        <th class="gsti">RRP tax inc.</th>
438
                        <th class="gsti">ecost tax inc.</th>
456
                        <th class="gsti">ecost tax inc.</th>
439
                        <th>Qty.</th>
457
                        <th>Qty.</th>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-1 / +14 lines)
Lines 30-35 Link Here
30
                <input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary"></input>
30
                <input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary"></input>
31
            [% END %]
31
            [% END %]
32
            <input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary %]"></input>
32
            <input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary %]"></input>
33
        <li><label for="contact_orderacquisition[% contact.id %]">Contact when ordering?</label>
34
            [% IF contact.orderacquisition %]
35
                <input type="checkbox" id="contact_orderacquisition[% contact.id %]" class="contact_orderacquisition" checked="checked"></input>
36
            [% ELSE %]
37
                <input type="checkbox" id="contact_orderacquisition[% contact.id %]" class="contact_orderacquisition"></input>
38
            [% END %]
39
            <input type="hidden" class="contact_orderacquisition_hidden" name="contact_orderacquisition" value="[% contact.orderacquisition %]"></input>
33
        <li><label for="contact_claimacquisition[% contact.id %]">Contact about late orders?</label>
40
        <li><label for="contact_claimacquisition[% contact.id %]">Contact about late orders?</label>
34
            [% IF contact.claimacquisition %]
41
            [% IF contact.claimacquisition %]
35
                <input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition" checked="checked"></input>
42
                <input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition" checked="checked"></input>
Lines 67-72 Link Here
67
    [% IF ( contact.serialsprimary ) %]
74
    [% IF ( contact.serialsprimary ) %]
68
        <p><span class="label">Primary serials contact</span></p>
75
        <p><span class="label">Primary serials contact</span></p>
69
    [% END %]
76
    [% END %]
77
    [% IF ( contact.orderacquisition ) %]
78
        <p><span class="label">Receives orders</span></p>
79
    [% END %]
70
    [% IF ( contact.claimacquisition ) %]
80
    [% IF ( contact.claimacquisition ) %]
71
        <p><span class="label">Receives claims for late orders</span></p>
81
        <p><span class="label">Receives claims for late orders</span></p>
72
    [% END %]
82
    [% END %]
Lines 101-107 function add_contact() { Link Here
101
    });
111
    });
102
    $(new_contact).insertBefore(this);
112
    $(new_contact).insertBefore(this);
103
    if ($('.supplier-contact').length === 2) { // First contact
113
    if ($('.supplier-contact').length === 2) { // First contact
104
        $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
114
        $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_orderacquisition', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
105
            $(checkbox, new_contact).click();
115
            $(checkbox, new_contact).click();
106
        });
116
        });
107
    }
117
    }
Lines 142-147 function delete_contact(ev) { Link Here
142
        }
152
        }
143
        $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
153
        $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
144
    });
154
    });
155
    $('body').on('click', '.contact_orderacquisition', null, function () {
156
        $(this).next('.contact_orderacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
157
    });
145
    $('body').on('click', '.contact_claimacquisition', null, function () {
158
    $('body').on('click', '.contact_claimacquisition', null, function () {
146
        $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
159
        $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
147
    });
160
    });
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (+5 lines)
Lines 319-324 $(document).ready(function() { Link Here
319
                                    [% ELSE %]
319
                                    [% ELSE %]
320
                                      <option value="circulation">Circulation</option>
320
                                      <option value="circulation">Circulation</option>
321
                                    [% END %]
321
                                    [% END %]
322
                                    [% IF ( module == "orderacquisition" ) %]
323
                                      <option value="orderacquisition" selected="selected">Order acquisition</option>
324
                                    [% ELSE %]
325
                                      <option value="orderacquisition">Order acquisition</option>
326
                                    [% END %]
322
                                    [% IF ( module == "claimacquisition" ) %]
327
                                    [% IF ( module == "claimacquisition" ) %]
323
                                      <option value="claimacquisition" selected="selected">Claim acquisition</option>
328
                                      <option value="claimacquisition" selected="selected">Claim acquisition</option>
324
                                    [% ELSE %]
329
                                    [% ELSE %]
(-)a/tools/letter.pl (-3 / +2 lines)
Lines 198-205 sub add_form { Link Here
198
    elsif ( $module eq 'acquisition' ) {
198
    elsif ( $module eq 'acquisition' ) {
199
        push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'items');
199
        push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'items');
200
    }
200
    }
201
    elsif ($module eq 'claimacquisition') {
201
    elsif ($module eq 'claimacquisition' || $module eq 'orderacquisition') {
202
        push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'biblioitems');
202
        push @{$field_selection}, add_fields('aqbooksellers', 'aqbasket', 'aqorders', 'biblio', 'biblioitems');
203
    }
203
    }
204
    elsif ($module eq 'claimissues') {
204
    elsif ($module eq 'claimissues') {
205
        push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription');
205
        push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription');
206
- 

Return to bug 5260