Bugzilla – Attachment 21547 Details for
Bug 10402
Add multiple contacts for vendors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10402 follow-up: choose contacts for serials and acq claims
Bug-10402-follow-up-choose-contacts-for-serials-an.patch (text/plain), 12.80 KB, created by
Jared Camins-Esakov
on 2013-09-28 16:31:42 UTC
(
hide
)
Description:
Bug 10402 follow-up: choose contacts for serials and acq claims
Filename:
MIME Type:
Creator:
Jared Camins-Esakov
Created:
2013-09-28 16:31:42 UTC
Size:
12.80 KB
patch
obsolete
>From 305b80edea0b0df084fc051b5d90209ccf13549a Mon Sep 17 00:00:00 2001 >From: Jared Camins-Esakov <jcamins@cpbibliography.com> >Date: Sat, 28 Sep 2013 12:22:34 -0400 >Subject: [PATCH] Bug 10402 follow-up: choose contacts for serials and acq > claims > >This patch makes it possible to choose a particular contact for >acquisitions and serials claims. To test: > >1) Select a contact to use for claiming late orders and a contact > to use for claiming late issues. >2) Send a claim for a late order and a claim for a late issue. >3) Note that the claims went out to the proper people. >4) Sign off. > >Note: the claim messages are recorded in the logs in the *Acquisitions* >module, not the Letters module as you might expect >--- > C4/Bookseller/Contact.pm | 23 +++++++++---- > C4/Letters.pm | 9 +++-- > acqui/updatesupplier.pl | 14 ++++---- > installer/data/mysql/kohastructure.sql | 3 +- > installer/data/mysql/updatedatabase.pl | 14 ++++++-- > .../prog/en/modules/acqui/supplier.tt | 35 ++++++++++++++++++++ > 6 files changed, 79 insertions(+), 19 deletions(-) > >diff --git a/C4/Bookseller/Contact.pm b/C4/Bookseller/Contact.pm >index 09ec8da..7004cb1 100644 >--- a/C4/Bookseller/Contact.pm >+++ b/C4/Bookseller/Contact.pm >@@ -63,10 +63,13 @@ Contact's e-mail address. > > Notes about contact. > >-=item rank >+=item claimacquistion > >-Ranking of the contact so that the contact can be given the correct >-priority in display. >+Whether the contact should receive acquisitions claims. >+ >+=item claimissues >+ >+Whether the contact should receive serials claims. > > =item bookseller > >@@ -81,7 +84,7 @@ use C4::Context; > > use base qw(Class::Accessor); > >-__PACKAGE__->mk_accessors(qw(id name position phone altphone fax email notes rank bookseller)); >+__PACKAGE__->mk_accessors(qw(id name position phone altphone fax email notes claimacquisition claimissues bookseller)); > > =head1 METHODS > >@@ -152,12 +155,18 @@ sub save { > my ($self) = @_; > > my $query; >- my @params = ($self->name, $self->position, $self->phone, $self->altphone, $self->fax, $self->email, $self->notes, $self->rank, $self->bookseller); >+ my @params = ( >+ $self->name, $self->position, >+ $self->phone, $self->altphone, >+ $self->fax, $self->email, >+ $self->notes, $self->claimacquisition ? 1 : 0, >+ $self->claimissues ? 1 : 0, $self->bookseller >+ ); > if ($self->id) { >- $query = 'UPDATE aqcontacts SET name = ?, position = ?, phone = ?, altphone = ?, fax = ?, email = ?, notes = ?, rank = ?, booksellerid = ? WHERE id = ?;'; >+ $query = 'UPDATE aqcontacts SET name = ?, position = ?, phone = ?, altphone = ?, fax = ?, email = ?, notes = ?, claimacquisition = ?, claimissues = ?, booksellerid = ? WHERE id = ?;'; > push @params, $self->id; > } else { >- $query = 'INSERT INTO aqcontacts (name, position, phone, altphone, fax, email, notes, rank, booksellerid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);'; >+ $query = 'INSERT INTO aqcontacts (name, position, phone, altphone, fax, email, notes, claimacquisition, claimissues, booksellerid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);'; > } > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare($query); >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 93bc34d..c780ba9 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -346,10 +346,14 @@ sub SendAlerts { > $dbh->prepare("select * from aqbooksellers where id=?"); > $sthbookseller->execute( $dataorders->[0]->{booksellerid} ); > my $databookseller = $sthbookseller->fetchrow_hashref; >+ my $sthcontact = >+ $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 LIMIT 1"); >+ $sthcontact->execute( $dataorders->[0]->{booksellerid} ); >+ my $datacontact = $sthcontact->fetchrow_hashref; > > my @email; > push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail}; >- push @email, $databookseller->{contemail} if $databookseller->{contemail}; >+ push @email, $databookseller->{email} if ( $datacontact && $datacontact->{email} ); > unless (@email) { > warn "Bookseller $dataorders->[0]->{booksellerid} without emails"; > return { error => "no_email" }; >@@ -363,6 +367,7 @@ sub SendAlerts { > tables => { > 'branches' => $userenv->{branch}, > 'aqbooksellers' => $databookseller, >+ 'aqcontacts' => $datacontact, > }, > repeat => $dataorders, > want_librarian => 1, >@@ -383,7 +388,7 @@ sub SendAlerts { > $type eq 'claimissues' ? "CLAIM ISSUE" : "ACQUISITION CLAIM", > undef, > "To=" >- . $databookseller->{contemail} >+ . join( ',', @email ) > . " Title=" > . $letter->{title} > . " Content=" >diff --git a/acqui/updatesupplier.pl b/acqui/updatesupplier.pl >index 7ce5633..33a9297 100755 >--- a/acqui/updatesupplier.pl >+++ b/acqui/updatesupplier.pl >@@ -37,10 +37,12 @@ All informations regarding this supplier are listed on input parameter. > Here is the list : > > supplier, id, company, company_postal, physical, company_phone, >-physical, company_phone, company_fax, website, company_contact_name, >-company_contact_position, contact_phone, contact_phone_2, contact_fax, >-company_email, contact_notes, notes, status, publishers_imprints, >-list_currency, gst, list_gst, invoice_gst, discount, gstrate. >+physical, company_phone, company_fax, website, company_email, notes, >+status, publishers_imprints, list_currency, gst, list_gst, invoice_gst, >+discount, gstrate, contact_name, contact_position, contact_phone, >+contact_altphone, contact_fax, contact_email, contact_notes, >+contact_claimacquisition, contact_claimissues. >+ > > =cut > >@@ -102,14 +104,14 @@ $data{'active'}=$input->param('status'); > my @contacts; > my %contact_info; > >-foreach (qw(id name position phone altphone fax email notes)) { >+foreach (qw(id name position phone altphone fax email notes claimacquisition claimissues)) { > $contact_info{$_} = [ $input->param('contact_' . $_) ]; > } > > for my $cnt (0..scalar(@{$contact_info{'id'}})) { > my %contact; > my $real_contact; >- foreach (qw(id name position phone altphone fax email notes)) { >+ foreach (qw(id name position phone altphone fax email notes claimacquisition claimissues)) { > $contact{$_} = $contact_info{$_}->[$cnt]; > $real_contact = 1 if $contact{$_}; > } >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 11ebc41..5cb27aa 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2869,7 +2869,8 @@ CREATE TABLE aqcontacts ( > fax varchar(100) default NULL, -- contact's fax number > email varchar(100) default NULL, -- contact's email address > notes mediumtext, -- notes related to the contact >- rank SMALLINT default 0, -- display rank for the contact >+ claimacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims >+ claimissues BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive serial claims > booksellerid int(11) not NULL, > PRIMARY KEY (id), > CONSTRAINT booksellerid_fk2 FOREIGN KEY (booksellerid) >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 00f92ca..7d1c400 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7166,20 +7166,28 @@ if ( CheckVersion($DBversion) ) { > fax varchar(100) default NULL, > email varchar(100) default NULL, > notes mediumtext, >- rank SMALLINT default 0, >+ claimacquisition BOOLEAN NOT NULL DEFAULT 0, >+ claimissues BOOLEAN NOT NULL DEFAULT 0, > booksellerid int(11) not NULL, > PRIMARY KEY (id), > CONSTRAINT booksellerid_fk2 FOREIGN KEY (booksellerid) > REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;"); > $dbh->do("INSERT INTO aqcontacts (name, position, phone, altphone, fax, >- email, notes, booksellerid) >+ email, notes, booksellerid, acq_claim, serial_claim) > SELECT contact, contpos, contphone, contaltphone, contfax, contemail, >- contnotes, id FROM aqbooksellers;"); >+ contnotes, id, 1, 1 FROM aqbooksellers;"); > $dbh->do("ALTER TABLE aqbooksellers DROP COLUMN contact, > DROP COLUMN contpos, DROP COLUMN contphone, > DROP COLUMN contaltphone, DROP COLUMN contfax, > DROP COLUMN contemail, DROP COLUMN contnotes;"); >+ $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contact>>', '<<aqcontacts.name>>')"); >+ $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contpos>>', '<<aqcontacts.position>>')"); >+ $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contphone>>', '<<aqcontacts.phone>>')"); >+ $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contaltphone>>', '<<aqcontacts.altphone>>')"); >+ $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contfax>>', '<<aqcontacts.contfax>>')"); >+ $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contemail>>', '<<aqcontacts.contemail>>')"); >+ $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contnotes>>', '<<aqcontacts.contnotes>>')"); > print "Upgrade to $DBversion done (Bug 10402: Move bookseller contacts to separate table)\n"; > SetVersion($DBversion); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >index 853ff54..45eb50e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >@@ -16,6 +16,21 @@ > <input type="text" size="40" id="contact_email[% contact.id %]" name="contact_email" value="[% contact.email %]" /></li> > <li><label for="contact_notes[% contact.id %]">Notes: </label> > <textarea id="contact_notes[% contact.id %]" name="contact_notes" cols="40" rows="4">[% contnotes %]</textarea></li> >+ <li><label for="contact_claimacquisition[% contact.id %]">Contact about late orders?</label> >+ [% IF contact.claimacquisition %] >+ <input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition" checked="checked"></input> >+ [% ELSE %] >+ <input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition"></input> >+ [% END %] >+ <input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition %]"></input> >+ <li><label for="contact_claimissues[% contact.id %]">Contact about late issues?</label> >+ [% IF contact.claimissues %] >+ <input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues" checked="checked"></input> >+ [% ELSE %] >+ <input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues"></input> >+ [% END %] >+ <input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues %]"></input> >+ </li> > [% IF contact.id %]<li><button class="btn" class="delete-contact"><i class="icon-remove"></i> Delete contact</li>[% END %] > </ol> > [% END %] >@@ -32,6 +47,12 @@ > [% IF ( contact.notes ) %] > <p><span class="label">Notes: </span>[% contact.notes %]</p> > [% END %] >+ [% IF ( contact.claimacquisition ) %] >+ <p><span class="label">Receives claims for late orders</span></p> >+ [% END %] >+ [% IF ( contact.claimissues ) %] >+ <p><span class="label">Receives claims for late issues</span></p> >+ [% END %] > [% END %] > > [% INCLUDE 'doc-head-open.inc' %] >@@ -93,6 +114,20 @@ function delete_contact() { > } ) ); > $('.delete-contact').click(delete_contact); > $('#add-contact').click(add_contact); >+ $('.contact_claimacquisition').click(function () { >+ $('.contact_claimacquisition').filter(':checked').not(this).removeAttr('checked'); >+ $('.contact_claimacquisition_hidden').each(function () { >+ $(this).val('0'); >+ }); >+ $(this).next('.contact_claimacquisition_hidden').val('1'); >+ }); >+ $('.contact_claimissues').click(function () { >+ $('.contact_claimissues').filter(':checked').not(this).removeAttr('checked'); >+ $('.contact_claimissues_hidden').each(function () { >+ $(this).val('0'); >+ }); >+ $(this).next('.contact_claimissues_hidden').val('1'); >+ }); > }); > //]]> > </script> >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10402
:
18973
|
18974
|
18975
|
19233
|
19234
|
19235
|
19603
|
19604
|
19808
|
19809
|
19810
|
20019
|
20020
|
20021
|
20045
|
20046
|
20047
|
20048
|
20559
|
20560
|
20561
|
20562
|
21019
|
21020
|
21021
|
21022
|
21023
|
21056
|
21547
|
21549
|
21804
|
23370
|
23371
|
23372
|
23373
|
23374
|
23375
|
23376
|
23377
|
24561
|
24562
|
24563
|
24564
|
24565
|
24566
|
24567
|
24568
|
29223
|
29224
|
29225
|
29226
|
29227
|
29511
|
29600
|
29601
|
29602
|
29603
|
29604
|
29761
|
30209
|
30210
|
30211
|
30212
|
30213
|
30460
|
30461
|
30462
|
30463
|
30464
|
31091
|
31092
|
31093
|
31094
|
31095
|
31096