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 612-617 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
612
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
612
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
613
  `login_attempts` int(4) default 0, -- number of failed login attemps
613
  `login_attempts` int(4) default 0, -- number of failed login attemps
614
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
614
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
615
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
615
  KEY borrowernumber (borrowernumber),
616
  KEY borrowernumber (borrowernumber),
616
  KEY `cardnumber` (`cardnumber`),
617
  KEY `cardnumber` (`cardnumber`),
617
  KEY `sms_provider_id` (`sms_provider_id`)
618
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1642-1647 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1642
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1643
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1643
  `login_attempts` int(4) default 0, -- number of failed login attemps
1644
  `login_attempts` int(4) default 0, -- number of failed login attemps
1644
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1645
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1646
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
1645
  UNIQUE KEY `cardnumber` (`cardnumber`),
1647
  UNIQUE KEY `cardnumber` (`cardnumber`),
1646
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1648
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1647
  KEY `categorycode` (`categorycode`),
1649
  KEY `categorycode` (`categorycode`),
Lines 3431-3436 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3431
  `smsalertnumber` varchar(50) DEFAULT NULL,
3433
  `smsalertnumber` varchar(50) DEFAULT NULL,
3432
  `privacy` int(11) DEFAULT NULL,
3434
  `privacy` int(11) DEFAULT NULL,
3433
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3435
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3436
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
3434
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3437
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3435
  KEY `verification_token` (`verification_token` (191)),
3438
  KEY `verification_token` (`verification_token` (191)),
3436
  KEY `borrowernumber` (`borrowernumber`)
3439
  KEY `borrowernumber` (`borrowernumber`)
(-)a/installer/data/mysql/updatedatabase.pl (+1 lines)
Lines 15837-15842 foreach my $file ( sort readdir $dirh ) { Link Here
15837
    }
15837
    }
15838
}
15838
}
15839
15839
15840
15840
=head1 FUNCTIONS
15841
=head1 FUNCTIONS
15841
15842
15842
=head2 TableExists($table)
15843
=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 169-177 Link Here
169
                [% ELSE %]
169
                [% ELSE %]
170
                    [% guarantor.firstname | html %] [% guarantor.surname | html %]
170
                    [% guarantor.firstname | html %] [% guarantor.surname | html %]
171
                [% END %]
171
                [% END %]
172
            </li>
172
            </ul>
173
        [% END %]
173
        </li>
174
    </ol>
174
    [% ELSIF guarantor %]
175
        <li>
176
            <span class="label">Guarantor:</span>
177
            [% IF guarantor.borrowernumber %]
178
                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber %]">[% guarantor.firstname | html %] [% guarantor.surname | html %]</a>
179
            [% ELSE %]
180
                [% guarantor.firstname | html %] [% guarantor.surname | html %]
181
            [% END %]
182
        </li>
183
    [% END %]
184
    [% SWITCH primary_contact_method %]
185
    [% CASE 'phone' %]
186
    <li><span class="label">Main contact method: </span>Phone</li>
187
    [% CASE 'phonepro' %]
188
    <li><span class="label">Main contact method: </span>Secondary phone</li>
189
    [% CASE 'mobile' %]
190
    <li><span class="label">Main contact method: </span>Other Phone</li>
191
    [% CASE 'email' %]
192
    <li><span class="label">Main contact method: </span>Primary email</li>
193
    [% CASE 'emailpro' %]
194
    <li><span class="label">Main contact method: </span>Secondary email</li>
195
    [% CASE 'fax' %]
196
    <li><span class="label">Main contact method: </span>Fax</li>
197
    [% END %]
198
</ol>
175
</div>
199
</div>
176
      <div class="action">
200
      <div class="action">
177
        [% IF ( guarantor.borrowernumber ) %]
201
        [% 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 634-639 $template->param('typeloop' => \@typeloop, Link Here
634
        no_categories => $no_categories);
634
        no_categories => $no_categories);
635
if($no_categories){ $no_add = 1; }
635
if($no_categories){ $no_add = 1; }
636
636
637
my @contactprincipalloop;
638
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
639
foreach my $field (@fieldArray) {
640
   if ( !(grep { $field eq $_ } @field_check)){
641
        push @contactprincipalloop,{
642
            'currentis_' . $field => 1
643
        };
644
    }
645
}
646
$template->param('contactprincipalloop' => \@contactprincipalloop);
637
647
638
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
648
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
639
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
649
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
Lines 641-647 $template->param( Link Here
641
    roadtypes => $roadtypes,
651
    roadtypes => $roadtypes,
642
    cities    => $cities,
652
    cities    => $cities,
643
);
653
);
644
645
my $default_borrowertitle = '';
654
my $default_borrowertitle = '';
646
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
655
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
647
656
(-)a/members/moremember.pl (+4 lines)
Lines 342-347 $template->param( Link Here
342
    patron          => $patron,
342
    patron          => $patron,
343
    translated_language => $translated_language,
343
    translated_language => $translated_language,
344
    detailview      => 1,
344
    detailview      => 1,
345
    borrowernumber  => $borrowernumber,
346
    othernames      => $data->{'othernames'},
347
    categoryname    => $patron->category->description,
348
    primary_contact_method  => $data->{'primary_contact_method'},
345
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
349
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
346
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
350
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
347
    totalprice      => sprintf("%.2f", $totalprice),
351
    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