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

(-)a/installer/data/mysql/atomicupdate/borrowers_primary_contact_method.sql (+3 lines)
Line 0 Link Here
1
ALTER TABLE `borrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `lastseen`;
2
ALTER TABLE `deletedborrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `overdrive_auth_token`;
3
ALTER TABLE `borrower_modifications` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `extended_attributes`;
(-)a/installer/data/mysql/kohastructure.sql (+4 lines)
Lines 641-646 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
641
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
641
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
642
  `login_attempts` int(4) default 0, -- number of failed login attemps
642
  `login_attempts` int(4) default 0, -- number of failed login attemps
643
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
643
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
644
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
644
  KEY borrowernumber (borrowernumber),
645
  KEY borrowernumber (borrowernumber),
645
  KEY `cardnumber` (`cardnumber`),
646
  KEY `cardnumber` (`cardnumber`),
646
  KEY `sms_provider_id` (`sms_provider_id`)
647
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1681-1686 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1681
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1682
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1682
  `login_attempts` int(4) default 0, -- number of failed login attemps
1683
  `login_attempts` int(4) default 0, -- number of failed login attemps
1683
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
1684
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
1685
  `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface)
1686
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
1684
  UNIQUE KEY `cardnumber` (`cardnumber`),
1687
  UNIQUE KEY `cardnumber` (`cardnumber`),
1685
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1688
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1686
  KEY `categorycode` (`categorycode`),
1689
  KEY `categorycode` (`categorycode`),
Lines 3471-3476 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3471
  `smsalertnumber` varchar(50) DEFAULT NULL,
3474
  `smsalertnumber` varchar(50) DEFAULT NULL,
3472
  `privacy` int(11) DEFAULT NULL,
3475
  `privacy` int(11) DEFAULT NULL,
3473
  `extended_attributes` text DEFAULT NULL,
3476
  `extended_attributes` text DEFAULT NULL,
3477
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
3474
  PRIMARY KEY (`verification_token`,`borrowernumber`),
3478
  PRIMARY KEY (`verification_token`,`borrowernumber`),
3475
  KEY `verification_token` (`verification_token`),
3479
  KEY `verification_token` (`verification_token`),
3476
  KEY `borrowernumber` (`borrowernumber`)
3480
  KEY `borrowernumber` (`borrowernumber`)
(-)a/installer/data/mysql/updatedatabase.pl (+1 lines)
Lines 14968-14973 foreach my $file ( sort readdir $dirh ) { Link Here
14968
    }
14968
    }
14969
}
14969
}
14970
14970
14971
14971
=head1 FUNCTIONS
14972
=head1 FUNCTIONS
14972
14973
14973
=head2 TableExists($table)
14974
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-4 / +57 lines)
Lines 538-544 $(document).ready(function() { Link Here
538
538
539
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
539
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
540
  <fieldset class="rows" id="memberentry_contact">
540
  <fieldset class="rows" id="memberentry_contact">
541
    <legend id="contact_lgd">Contact</legend><ol>
541
    <legend id="contact_lgd">Contact</legend>
542
<ol>
542
        [% UNLESS nophone %]
543
        [% UNLESS nophone %]
543
      <li>
544
      <li>
544
      [% IF ( mandatoryphone ) %]
545
      [% IF ( mandatoryphone ) %]
Lines 601-607 $(document).ready(function() { Link Here
601
	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
602
	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
602
    </li>
603
    </li>
603
        [% END %]
604
        [% END %]
604
        [% UNLESS nofax %]
605
    [% UNLESS nofax %]
605
    <li>
606
    <li>
606
      [% IF ( mandatoryfax ) %]
607
      [% IF ( mandatoryfax ) %]
607
      <label for="fax" class="required">
608
      <label for="fax" class="required">
Lines 612-619 $(document).ready(function() { Link Here
612
        <input type="text" id="fax" name="fax" value="[% fax | html %]" />
613
        <input type="text" id="fax" name="fax" value="[% fax | html %]" />
613
	  [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
614
	  [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
614
    </li>
615
    </li>
615
        [% END %]
616
616
	</ol>
617
   [% END %]
618
    <li>
619
       <label for="primary_contact_method">Main contact method:</label>
620
       <select id="primary_contact_method" name="primary_contact_method">
621
       <option value=""></option>
622
         [% FOREACH contactprincipalloo IN contactprincipalloop %]
623
            [% IF ( contactprincipalloo.currentis_phone ) %]
624
               [% IF ( primary_contact_method == 'phone' ) %]
625
                 <option value="phone" selected="selected">Primary phone</option>
626
               [% ELSE %]
627
                 <option value="phone">Primary phone</option>
628
               [% END %]
629
            [% END %]
630
            [% IF ( contactprincipalloo.currentis_phonepro ) %]
631
               [% IF ( primary_contact_method == 'phonepro' ) %]
632
                 <option value="phonepro" selected="selected">Secondary phone</option>
633
               [% ELSE %]
634
                 <option value="phonepro">Secondary phone</option>
635
               [% END %]
636
            [% END %]
637
            [% IF ( contactprincipalloo.currentis_mobile ) %]
638
               [% IF ( primary_contact_method == 'mobile' ) %]
639
                 <option value="mobile" selected="selected">Other phone</option>
640
               [% ELSE %]
641
                 <option value="mobile">Other phone</option>
642
               [% END %]
643
            [% END %]
644
            [% IF ( contactprincipalloo.currentis_email ) %]
645
               [% IF ( primary_contact_method == 'email' ) %]
646
                 <option value="email" selected="selected">Primary email</option>
647
               [% ELSE %]
648
                 <option value="email">Primary email</option>
649
               [% END %]
650
            [% END %]
651
            [% IF ( contactprincipalloo.currentis_emailpro ) %]
652
               [% IF ( primary_contact_method == 'emailpro' ) %]
653
                 <option value="emailpro" selected="selected">Secondary email</option>
654
               [% ELSE %]
655
                 <option value="emailpro">Secondary email</option>
656
               [% END %]
657
            [% END %]
658
            [% IF ( contactprincipalloo.currentis_fax ) %]
659
               [% IF ( primary_contact_method == 'fax' ) %]
660
                 <option value="fax" selected="selected">Fax</option>
661
               [% ELSE %]
662
                 <option value="fax">Fax</option>
663
               [% END %]
664
            [% END %]
665
         [% END %]
666
       </select>
667
    </li>
668
    </ol>
669
617
  </fieldset>
670
  </fieldset>
618
[%END # hide fieldset %]
671
[%END # hide fieldset %]
619
672
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-3 / +27 lines)
Lines 265-273 function validate1(date) { Link Here
265
                [% ELSE %]
265
                [% ELSE %]
266
                    [% guarantor.firstname | html %] [% guarantor.surname | html %]
266
                    [% guarantor.firstname | html %] [% guarantor.surname | html %]
267
                [% END %]
267
                [% END %]
268
            </li>
268
            </ul>
269
        [% END %]
269
        </li>
270
    </ol>
270
    [% ELSIF guarantor %]
271
        <li>
272
            <span class="label">Guarantor:</span>
273
            [% IF guarantor.borrowernumber %]
274
                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber %]">[% guarantor.firstname | html %] [% guarantor.surname | html %]</a>
275
            [% ELSE %]
276
                [% guarantor.firstname | html %] [% guarantor.surname | html %]
277
            [% END %]
278
        </li>
279
    [% END %]
280
    [% SWITCH primary_contact_method %]
281
    [% CASE 'phone' %]
282
    <li><span class="label">Main contact method: </span>Phone</li>
283
    [% CASE 'phonepro' %]
284
    <li><span class="label">Main contact method: </span>Secondary phone</li>
285
    [% CASE 'mobile' %]
286
    <li><span class="label">Main contact method: </span>Other Phone</li>
287
    [% CASE 'email' %]
288
    <li><span class="label">Main contact method: </span>Primary email</li>
289
    [% CASE 'emailpro' %]
290
    <li><span class="label">Main contact method: </span>Secondary email</li>
291
    [% CASE 'fax' %]
292
    <li><span class="label">Main contact method: </span>Fax</li>
293
    [% END %]
294
</ol>
271
</div>
295
</div>
272
      <div class="action">
296
      <div class="action">
273
        [% IF ( guarantor.borrowernumber ) %]
297
        [% IF ( guarantor.borrowernumber ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+50 lines)
Lines 546-551 Link Here
546
                                    [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
546
                                    [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
547
                                </li>
547
                                </li>
548
                            [% END %]
548
                            [% END %]
549
                            <li>
550
                               <label for="borrower_primary_contact_method">Main contact method:</label>
551
                               <select id="borrower_primary_contact_method" name="borrower_primary_contact_method">
552
                               <option value=""></option>
553
                                 [% FOREACH contactprincipalloo IN contactprincipalloop %]
554
                                    [% IF ( contactprincipalloo.currentis_phone ) %]
555
                                       [% IF ( borrower.primary_contact_method == 'phone' ) %]
556
                                         <option value="phone" selected="selected">Primary phone</option>
557
                                       [% ELSE %]
558
                                         <option value="phone">Primary phone</option>
559
                                       [% END %]
560
                                    [% END %]
561
                                    [% IF ( contactprincipalloo.currentis_phonepro ) %]
562
                                       [% IF ( borrower.primary_contact_method == 'phonepro' ) %]
563
                                         <option value="phonepro" selected="selected">Secondary phone</option>
564
                                       [% ELSE %]
565
                                         <option value="phonepro">Secondary phone</option>
566
                                       [% END %]
567
                                    [% END %]
568
                                    [% IF ( contactprincipalloo.currentis_mobile ) %]
569
                                       [% IF ( borrower.primary_contact_method == 'mobile' ) %]
570
                                         <option value="mobile" selected="selected">Other phone</option>
571
                                       [% ELSE %]
572
                                         <option value="mobile">Other phone</option>
573
                                       [% END %]
574
                                    [% END %]
575
                                    [% IF ( contactprincipalloo.currentis_email ) %]
576
                                       [% IF ( borrower.primary_contact_method == 'email' ) %]
577
                                         <option value="email" selected="selected">Primary email</option>
578
                                       [% ELSE %]
579
                                         <option value="email">Primary email</option>
580
                                       [% END %]
581
                                    [% END %]
582
                                    [% IF ( contactprincipalloo.currentis_emailpro ) %]
583
                                       [% IF ( borrower.primary_contact_method == 'emailpro' ) %]
584
                                         <option value="emailpro" selected="selected">Secondary email</option>
585
                                       [% ELSE %]
586
                                         <option value="emailpro">Secondary email</option>
587
                                       [% END %]
588
                                    [% END %]
589
                                    [% IF ( contactprincipalloo.currentis_fax ) %]
590
                                       [% IF ( borrower.primary_contact_method == 'fax' ) %]
591
                                         <option value="fax" selected="selected">Fax</option>
592
                                       [% ELSE %]
593
                                         <option value="fax">Fax</option>
594
                                       [% END %]
595
                                    [% END %]
596
                                 [% END %]
597
                               </select>
598
                            </li>
549
                        </ol>
599
                        </ol>
550
                    </fieldset>
600
                    </fieldset>
551
                [% END %]
601
                [% END %]
(-)a/members/memberentry.pl (-1 / +10 lines)
Lines 628-633 $template->param('typeloop' => \@typeloop, Link Here
628
        no_categories => $no_categories);
628
        no_categories => $no_categories);
629
if($no_categories){ $no_add = 1; }
629
if($no_categories){ $no_add = 1; }
630
630
631
my @contactprincipalloop;
632
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
633
foreach my $field (@fieldArray) {
634
   if ( !(grep { $field eq $_ } @field_check)){
635
        push @contactprincipalloop,{
636
            'currentis_' . $field => 1
637
        };
638
    }
639
}
640
$template->param('contactprincipalloop' => \@contactprincipalloop);
631
641
632
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
642
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
633
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
643
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
Lines 635-641 $template->param( Link Here
635
    roadtypes => $roadtypes,
645
    roadtypes => $roadtypes,
636
    cities    => $cities,
646
    cities    => $cities,
637
);
647
);
638
639
my $default_borrowertitle = '';
648
my $default_borrowertitle = '';
640
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
649
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
641
650
(-)a/members/moremember.pl (+1 lines)
Lines 344-349 $template->param( Link Here
344
    borrowernumber  => $borrowernumber,
344
    borrowernumber  => $borrowernumber,
345
    othernames      => $data->{'othernames'},
345
    othernames      => $data->{'othernames'},
346
    categoryname    => $patron->category->description,
346
    categoryname    => $patron->category->description,
347
    primary_contact_method  => $data->{'primary_contact_method'},
347
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
348
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
348
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
349
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
349
    totalprice      => sprintf("%.2f", $totalprice),
350
    totalprice      => sprintf("%.2f", $totalprice),
(-)a/opac/opac-memberentry.pl (-1 / +13 lines)
Lines 93-98 $template->param( Link Here
93
    libraries         => \@libraries,
93
    libraries         => \@libraries,
94
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
94
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
95
);
95
);
96
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
97
        my @field_check=split(/\|/,$check_BorrowerMandatoryField);
98
        my @contactprincipalloop;
99
        my @fieldArray = qw(phone phonepro mobile email emailpro fax);
100
        foreach my $field (@fieldArray) {
101
           if ( !(grep { $field eq $_ } @field_check)){
102
                push @contactprincipalloop,{
103
                    'currentis_' . $field => 1
104
                };
105
            }
106
        }
107
108
        $template->param('contactprincipalloop' => \@contactprincipalloop);
96
109
97
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
110
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
98
my $conflicting_attribute = 0;
111
my $conflicting_attribute = 0;
99
- 

Return to bug 11879