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 (+3 lines)
Lines 611-616 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
611
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
611
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
612
  `login_attempts` int(4) default 0, -- number of failed login attemps
612
  `login_attempts` int(4) default 0, -- number of failed login attemps
613
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
613
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
614
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
614
  KEY borrowernumber (borrowernumber),
615
  KEY borrowernumber (borrowernumber),
615
  KEY `cardnumber` (`cardnumber`),
616
  KEY `cardnumber` (`cardnumber`),
616
  KEY `sms_provider_id` (`sms_provider_id`)
617
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1638-1643 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1638
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1639
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1639
  `login_attempts` int(4) default 0, -- number of failed login attemps
1640
  `login_attempts` int(4) default 0, -- number of failed login attemps
1640
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1641
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1642
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
1641
  UNIQUE KEY `cardnumber` (`cardnumber`),
1643
  UNIQUE KEY `cardnumber` (`cardnumber`),
1642
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1644
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1643
  KEY `categorycode` (`categorycode`),
1645
  KEY `categorycode` (`categorycode`),
Lines 3427-3432 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3427
  `smsalertnumber` varchar(50) DEFAULT NULL,
3429
  `smsalertnumber` varchar(50) DEFAULT NULL,
3428
  `privacy` int(11) DEFAULT NULL,
3430
  `privacy` int(11) DEFAULT NULL,
3429
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3431
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3432
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
3430
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3433
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3431
  KEY `verification_token` (`verification_token` (191)),
3434
  KEY `verification_token` (`verification_token` (191)),
3432
  KEY `borrowernumber` (`borrowernumber`)
3435
  KEY `borrowernumber` (`borrowernumber`)
(-)a/installer/data/mysql/updatedatabase.pl (+1 lines)
Lines 15632-15637 foreach my $file ( sort readdir $dirh ) { Link Here
15632
    }
15632
    }
15633
}
15633
}
15634
15634
15635
15635
=head1 FUNCTIONS
15636
=head1 FUNCTIONS
15636
15637
15637
=head2 TableExists($table)
15638
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-4 / +57 lines)
Lines 405-411 Link Here
405
405
406
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
406
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
407
  <fieldset class="rows" id="memberentry_contact">
407
  <fieldset class="rows" id="memberentry_contact">
408
    <legend id="contact_lgd">Contact</legend><ol>
408
    <legend id="contact_lgd">Contact</legend>
409
<ol>
409
        [% UNLESS nophone %]
410
        [% UNLESS nophone %]
410
      <li>
411
      <li>
411
      [% IF ( mandatoryphone ) %]
412
      [% IF ( mandatoryphone ) %]
Lines 468-474 Link Here
468
	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
469
	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
469
    </li>
470
    </li>
470
        [% END %]
471
        [% END %]
471
        [% UNLESS nofax %]
472
    [% UNLESS nofax %]
472
    <li>
473
    <li>
473
      [% IF ( mandatoryfax ) %]
474
      [% IF ( mandatoryfax ) %]
474
      <label for="fax" class="required">
475
      <label for="fax" class="required">
Lines 479-486 Link Here
479
        <input type="text" id="fax" name="fax" value="[% fax | html %]" />
480
        <input type="text" id="fax" name="fax" value="[% fax | html %]" />
480
	  [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
481
	  [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
481
    </li>
482
    </li>
482
        [% END %]
483
483
	</ol>
484
   [% END %]
485
    <li>
486
       <label for="primary_contact_method">Main contact method:</label>
487
       <select id="primary_contact_method" name="primary_contact_method">
488
       <option value=""></option>
489
         [% FOREACH contactprincipalloo IN contactprincipalloop %]
490
            [% IF ( contactprincipalloo.currentis_phone ) %]
491
               [% IF ( primary_contact_method == 'phone' ) %]
492
                 <option value="phone" selected="selected">Primary phone</option>
493
               [% ELSE %]
494
                 <option value="phone">Primary phone</option>
495
               [% END %]
496
            [% END %]
497
            [% IF ( contactprincipalloo.currentis_phonepro ) %]
498
               [% IF ( primary_contact_method == 'phonepro' ) %]
499
                 <option value="phonepro" selected="selected">Secondary phone</option>
500
               [% ELSE %]
501
                 <option value="phonepro">Secondary phone</option>
502
               [% END %]
503
            [% END %]
504
            [% IF ( contactprincipalloo.currentis_mobile ) %]
505
               [% IF ( primary_contact_method == 'mobile' ) %]
506
                 <option value="mobile" selected="selected">Other phone</option>
507
               [% ELSE %]
508
                 <option value="mobile">Other phone</option>
509
               [% END %]
510
            [% END %]
511
            [% IF ( contactprincipalloo.currentis_email ) %]
512
               [% IF ( primary_contact_method == 'email' ) %]
513
                 <option value="email" selected="selected">Primary email</option>
514
               [% ELSE %]
515
                 <option value="email">Primary email</option>
516
               [% END %]
517
            [% END %]
518
            [% IF ( contactprincipalloo.currentis_emailpro ) %]
519
               [% IF ( primary_contact_method == 'emailpro' ) %]
520
                 <option value="emailpro" selected="selected">Secondary email</option>
521
               [% ELSE %]
522
                 <option value="emailpro">Secondary email</option>
523
               [% END %]
524
            [% END %]
525
            [% IF ( contactprincipalloo.currentis_fax ) %]
526
               [% IF ( primary_contact_method == 'fax' ) %]
527
                 <option value="fax" selected="selected">Fax</option>
528
               [% ELSE %]
529
                 <option value="fax">Fax</option>
530
               [% END %]
531
            [% END %]
532
         [% END %]
533
       </select>
534
    </li>
535
    </ol>
536
484
  </fieldset>
537
  </fieldset>
485
[%END # hide fieldset %]
538
[%END # hide fieldset %]
486
539
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-3 / +27 lines)
Lines 166-174 Link Here
166
                [% ELSE %]
166
                [% ELSE %]
167
                    [% guarantor.firstname | html %] [% guarantor.surname | html %]
167
                    [% guarantor.firstname | html %] [% guarantor.surname | html %]
168
                [% END %]
168
                [% END %]
169
            </li>
169
            </ul>
170
        [% END %]
170
        </li>
171
    </ol>
171
    [% ELSIF guarantor %]
172
        <li>
173
            <span class="label">Guarantor:</span>
174
            [% IF guarantor.borrowernumber %]
175
                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber %]">[% guarantor.firstname | html %] [% guarantor.surname | html %]</a>
176
            [% ELSE %]
177
                [% guarantor.firstname | html %] [% guarantor.surname | html %]
178
            [% END %]
179
        </li>
180
    [% END %]
181
    [% SWITCH primary_contact_method %]
182
    [% CASE 'phone' %]
183
    <li><span class="label">Main contact method: </span>Phone</li>
184
    [% CASE 'phonepro' %]
185
    <li><span class="label">Main contact method: </span>Secondary phone</li>
186
    [% CASE 'mobile' %]
187
    <li><span class="label">Main contact method: </span>Other Phone</li>
188
    [% CASE 'email' %]
189
    <li><span class="label">Main contact method: </span>Primary email</li>
190
    [% CASE 'emailpro' %]
191
    <li><span class="label">Main contact method: </span>Secondary email</li>
192
    [% CASE 'fax' %]
193
    <li><span class="label">Main contact method: </span>Fax</li>
194
    [% END %]
195
</ol>
172
</div>
196
</div>
173
      <div class="action">
197
      <div class="action">
174
        [% IF ( guarantor.borrowernumber ) %]
198
        [% 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 626-631 $template->param('typeloop' => \@typeloop, Link Here
626
        no_categories => $no_categories);
626
        no_categories => $no_categories);
627
if($no_categories){ $no_add = 1; }
627
if($no_categories){ $no_add = 1; }
628
628
629
my @contactprincipalloop;
630
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
631
foreach my $field (@fieldArray) {
632
   if ( !(grep { $field eq $_ } @field_check)){
633
        push @contactprincipalloop,{
634
            'currentis_' . $field => 1
635
        };
636
    }
637
}
638
$template->param('contactprincipalloop' => \@contactprincipalloop);
629
639
630
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
640
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
631
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
641
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
Lines 633-639 $template->param( Link Here
633
    roadtypes => $roadtypes,
643
    roadtypes => $roadtypes,
634
    cities    => $cities,
644
    cities    => $cities,
635
);
645
);
636
637
my $default_borrowertitle = '';
646
my $default_borrowertitle = '';
638
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
647
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
639
648
(-)a/members/moremember.pl (+4 lines)
Lines 339-344 $template->param( Link Here
339
    patron          => $patron,
339
    patron          => $patron,
340
    translated_language => $translated_language,
340
    translated_language => $translated_language,
341
    detailview      => 1,
341
    detailview      => 1,
342
    borrowernumber  => $borrowernumber,
343
    othernames      => $data->{'othernames'},
344
    categoryname    => $patron->category->description,
345
    primary_contact_method  => $data->{'primary_contact_method'},
342
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
346
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
343
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
347
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
344
    totalprice      => sprintf("%.2f", $totalprice),
348
    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