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 365-376 sub findrelatedto { Link Here
365
364
366
=head2 SendAlerts
365
=head2 SendAlerts
367
366
368
    parameters :
367
    my $err = &SendAlerts($type, $externalid, $letter_code);
369
    - $type : the type of alert
370
    - $externalid : the id of the "object" to query
371
    - $letter_code : the letter to send.
372
368
373
    send an alert to all borrowers having put an alert on a given subject.
369
Parameters:
370
 - $type : the type of alert
371
 - $externalid : the id of the "object" to query
372
 - $letter_code : the notice template to use
373
374
C<&SendAlerts> sends an email notice directly to a patron or a vendor.
375
Currently it supports ($type):
376
- claim serial issues (claimissues)
377
- claim acquisition orders (claimacquisition)
378
- send acquisition orders to the vendor (orderacquisition)
379
- notify patrons about newly received serial issues (issue)
380
- notify patrons when their account is created (members)
374
381
375
    Returns undef or { error => 'message } on failure.
382
    Returns undef or { error => 'message } on failure.
376
    Returns true on success.
383
    Returns true on success.
Lines 450-469 sub SendAlerts { Link Here
450
            }
457
            }
451
        }
458
        }
452
    }
459
    }
453
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
460
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' or $type eq 'orderacquisition' ) {
454
461
455
        # prepare the letter...
462
        # prepare the letter...
456
        # search the biblionumber
463
        my $strsth;
457
        my $strsth =  $type eq 'claimacquisition'
464
        my $sthorders;
458
            ? qq{
465
        my $dataorders;
466
        my $action;
467
        if ( $type eq 'claimacquisition') {
468
            $strsth = qq{
459
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
469
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
460
            FROM aqorders
470
            FROM aqorders
461
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
471
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
462
            LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
472
            LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
463
            LEFT JOIN biblioitems ON aqorders.biblionumber=biblioitems.biblionumber
473
            LEFT JOIN biblioitems ON aqorders.biblionumber=biblioitems.biblionumber
464
            WHERE aqorders.ordernumber IN (
474
            WHERE aqorders.ordernumber IN (
475
            };
476
477
            if (!@$externalid){
478
                carp "No order selected";
479
                return { error => "no_order_selected" };
465
            }
480
            }
466
            : qq{
481
            $strsth .= join( ",", @$externalid ) . ")";
482
            $action = "ACQUISITION CLAIM";
483
            $sthorders = $dbh->prepare($strsth);
484
            $sthorders->execute;
485
            $dataorders = $sthorders->fetchall_arrayref( {} );
486
        }
487
488
        if ($type eq 'claimissues') {
489
            $strsth = qq{
467
            SELECT serial.*,subscription.*, biblio.*, aqbooksellers.*,
490
            SELECT serial.*,subscription.*, biblio.*, aqbooksellers.*,
468
            aqbooksellers.id AS booksellerid
491
            aqbooksellers.id AS booksellerid
469
            FROM serial
492
            FROM serial
Lines 473-493 sub SendAlerts { Link Here
473
            WHERE serial.serialid IN (
496
            WHERE serial.serialid IN (
474
            };
497
            };
475
498
476
        if (!@$externalid){
499
            if (!@$externalid){
477
            carp "No Order selected";
500
                carp "No Order selected";
478
            return { error => "no_order_selected" };
501
                return { error => "no_order_selected" };
502
            }
503
504
            $strsth .= join( ",", @$externalid ) . ")";
505
            $action = "CLAIM ISSUE";
506
            $sthorders = $dbh->prepare($strsth);
507
            $sthorders->execute;
508
            $dataorders = $sthorders->fetchall_arrayref( {} );
479
        }
509
        }
480
510
481
        $strsth .= join( ",", @$externalid ) . ")";
511
        if ( $type eq 'orderacquisition') {
482
        my $sthorders = $dbh->prepare($strsth);
512
            $strsth = qq{
483
        $sthorders->execute;
513
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
484
        my $dataorders = $sthorders->fetchall_arrayref( {} );
514
            FROM aqorders
515
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
516
            LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
517
            LEFT JOIN biblioitems ON aqorders.biblionumber=biblioitems.biblionumber
518
            WHERE aqbasket.basketno = ?
519
            AND orderstatus IN ('new','ordered')
520
            };
521
522
            if (!$externalid){
523
                carp "No basketnumber given";
524
                return { error => "no_basketno" };
525
            }
526
            $action = "ACQUISITION ORDER";
527
            $sthorders = $dbh->prepare($strsth);
528
            $sthorders->execute($externalid);
529
            $dataorders = $sthorders->fetchall_arrayref( {} );
530
        }
485
531
486
        my $sthbookseller =
532
        my $sthbookseller =
487
          $dbh->prepare("select * from aqbooksellers where id=?");
533
          $dbh->prepare("select * from aqbooksellers where id=?");
488
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
534
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
489
        my $databookseller = $sthbookseller->fetchrow_hashref;
535
        my $databookseller = $sthbookseller->fetchrow_hashref;
490
        my $addressee =  $type eq 'claimacquisition' ? 'acqprimary' : 'serialsprimary';
536
537
        my $addressee =  $type eq 'claimacquisition' || $type eq 'orderacquisition' ? 'acqprimary' : 'serialsprimary';
538
491
        my $sthcontact =
539
        my $sthcontact =
492
          $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC");
540
          $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC");
493
        $sthcontact->execute( $dataorders->[0]->{booksellerid} );
541
        $sthcontact->execute( $dataorders->[0]->{booksellerid} );
Lines 538-549 sub SendAlerts { Link Here
538
                                : 'text/plain; charset="utf-8"',
586
                                : 'text/plain; charset="utf-8"',
539
        );
587
        );
540
588
541
        $mail{'Reply-to'} = C4::Context->preference('ReplytoDefault')
589
        if ($type eq 'claimacquisition' || $type eq 'claimissues' ) {
542
          if C4::Context->preference('ReplytoDefault');
590
            $mail{'Reply-to'} = C4::Context->preference('ReplytoDefault')
543
        $mail{'Sender'} = C4::Context->preference('ReturnpathDefault')
591
              if C4::Context->preference('ReplytoDefault');
544
          if C4::Context->preference('ReturnpathDefault');
592
            $mail{'Sender'} = C4::Context->preference('ReturnpathDefault')
545
        $mail{'Bcc'} = $userenv->{emailaddress}
593
              if C4::Context->preference('ReturnpathDefault');
546
          if C4::Context->preference("ClaimsBccCopy");
594
            $mail{'Bcc'} = $userenv->{emailaddress}
595
              if C4::Context->preference("ClaimsBccCopy");
596
        }
547
597
548
        unless ( sendmail(%mail) ) {
598
        unless ( sendmail(%mail) ) {
549
            carp $Mail::Sendmail::error;
599
            carp $Mail::Sendmail::error;
Lines 552-558 sub SendAlerts { Link Here
552
602
553
        logaction(
603
        logaction(
554
            "ACQUISITION",
604
            "ACQUISITION",
555
            $type eq 'claimissues' ? "CLAIM ISSUE" : "ACQUISITION CLAIM",
605
            $action,
556
            undef,
606
            undef,
557
            "To="
607
            "To="
558
                . join( ',', @email )
608
                . 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 2915-2920 CREATE TABLE aqcontacts ( Link Here
2915
  fax varchar(100) default NULL,  -- contact's fax number
2915
  fax varchar(100) default NULL,  -- contact's fax number
2916
  email varchar(100) default NULL, -- contact's email address
2916
  email varchar(100) default NULL, -- contact's email address
2917
  notes mediumtext, -- notes related to the contact
2917
  notes mediumtext, -- notes related to the contact
2918
  orderacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisition orders
2918
  claimacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims
2919
  claimacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims
2919
  claimissues BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive serial claims
2920
  claimissues BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive serial claims
2920
  acqprimary BOOLEAN NOT NULL DEFAULT 0, -- is this the primary contact for acquisitions messages
2921
  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