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 590-595 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
590
  `login_attempts` int(4) default 0, -- number of failed login attemps
590
  `login_attempts` int(4) default 0, -- number of failed login attemps
591
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
591
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
592
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
592
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
593
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
593
  KEY borrowernumber (borrowernumber),
594
  KEY borrowernumber (borrowernumber),
594
  KEY `cardnumber` (`cardnumber`),
595
  KEY `cardnumber` (`cardnumber`),
595
  KEY `sms_provider_id` (`sms_provider_id`)
596
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1582-1587 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1582
  `login_attempts` int(4) default 0, -- number of failed login attemps
1583
  `login_attempts` int(4) default 0, -- number of failed login attemps
1583
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1584
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1584
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1585
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1586
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
1585
  UNIQUE KEY `cardnumber` (`cardnumber`),
1587
  UNIQUE KEY `cardnumber` (`cardnumber`),
1586
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1588
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1587
  KEY `categorycode` (`categorycode`),
1589
  KEY `categorycode` (`categorycode`),
Lines 3409-3414 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3409
  `privacy` int(11) DEFAULT NULL,
3411
  `privacy` int(11) DEFAULT NULL,
3410
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3412
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3411
  `gdpr_proc_consent` datetime, -- data processing consent
3413
  `gdpr_proc_consent` datetime, -- data processing consent
3414
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
3412
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3415
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3413
  KEY `verification_token` (`verification_token` (191)),
3416
  KEY `verification_token` (`verification_token` (191)),
3414
  KEY `borrowernumber` (`borrowernumber`)
3417
  KEY `borrowernumber` (`borrowernumber`)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +62 lines)
Lines 458-463 Link Here
458
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
458
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
459
    <fieldset class="rows" id="memberentry_contact">
459
    <fieldset class="rows" id="memberentry_contact">
460
        <legend id="contact_lgd">Contact</legend><ol>
460
        <legend id="contact_lgd">Contact</legend><ol>
461
        [% UNLESS nophone %]
462
      <li>
463
      [% IF ( mandatoryphone ) %]
464
      <label for="phone" class="required">
465
      [% ELSE %]
466
      <label for="phone">
467
      [% END %]
468
      Primary phone: </label>
469
        <input type="text" id="phone" name="phone" value="[% phone | html %]" />
470
	  [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
461
471
462
        [% UNLESS nocontactname %]
472
        [% UNLESS nocontactname %]
463
            <li>
473
            <li>
Lines 580-587 Link Here
580
                [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
590
                [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
581
            </li>
591
            </li>
582
        [% END %]
592
        [% END %]
593
    <li>
594
       <label for="primary_contact_method">Main contact method:</label>
595
       <select id="primary_contact_method" name="primary_contact_method">
596
       <option value=""></option>
597
         [% FOREACH contactprincipalloo IN contactprincipalloop %]
598
            [% IF ( contactprincipalloo.currentis_phone ) %]
599
               [% IF ( primary_contact_method == 'phone' ) %]
600
                 <option value="phone" selected="selected">Primary phone</option>
601
               [% ELSE %]
602
                 <option value="phone">Primary phone</option>
603
               [% END %]
604
            [% END %]
605
            [% IF ( contactprincipalloo.currentis_phonepro ) %]
606
               [% IF ( primary_contact_method == 'phonepro' ) %]
607
                 <option value="phonepro" selected="selected">Secondary phone</option>
608
               [% ELSE %]
609
                 <option value="phonepro">Secondary phone</option>
610
               [% END %]
611
            [% END %]
612
            [% IF ( contactprincipalloo.currentis_mobile ) %]
613
               [% IF ( primary_contact_method == 'mobile' ) %]
614
                 <option value="mobile" selected="selected">Other phone</option>
615
               [% ELSE %]
616
                 <option value="mobile">Other phone</option>
617
               [% END %]
618
            [% END %]
619
            [% IF ( contactprincipalloo.currentis_email ) %]
620
               [% IF ( primary_contact_method == 'email' ) %]
621
                 <option value="email" selected="selected">Primary email</option>
622
               [% ELSE %]
623
                 <option value="email">Primary email</option>
624
               [% END %]
625
            [% END %]
626
            [% IF ( contactprincipalloo.currentis_emailpro ) %]
627
               [% IF ( primary_contact_method == 'emailpro' ) %]
628
                 <option value="emailpro" selected="selected">Secondary email</option>
629
               [% ELSE %]
630
                 <option value="emailpro">Secondary email</option>
631
               [% END %]
632
            [% END %]
633
            [% IF ( contactprincipalloo.currentis_fax ) %]
634
               [% IF ( primary_contact_method == 'fax' ) %]
635
                 <option value="fax" selected="selected">Fax</option>
636
               [% ELSE %]
637
                 <option value="fax">Fax</option>
638
               [% END %]
639
            [% END %]
640
         [% END %]
641
       </select>
642
    </li>
583
    </ol>
643
    </ol>
584
</fieldset>
644
645
  </fieldset>
585
[%END # hide fieldset %]
646
[%END # hide fieldset %]
586
647
587
<!-- ************************ STEP_1 *********************** -->
648
<!-- ************************ STEP_1 *********************** -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+15 lines)
Lines 287-292 Link Here
287
                                                    </ul>
287
                                                    </ul>
288
                                                </li>
288
                                                </li>
289
                                        [% END %]
289
                                        [% END %]
290
291
                                        [% SWITCH primary_contact_method %]
292
                                        [% CASE 'phone' %]
293
                                        <li><span class="label">Main contact method: </span>Phone</li>
294
                                        [% CASE 'phonepro' %]
295
                                        <li><span class="label">Main contact method: </span>Secondary phone</li>
296
                                        [% CASE 'mobile' %]
297
                                        <li><span class="label">Main contact method: </span>Other Phone</li>
298
                                        [% CASE 'email' %]
299
                                        <li><span class="label">Main contact method: </span>Primary email</li>
300
                                        [% CASE 'emailpro' %]
301
                                        <li><span class="label">Main contact method: </span>Secondary email</li>
302
                                        [% CASE 'fax' %]
303
                                        <li><span class="label">Main contact method: </span>Fax</li>
304
                                        [% END %]
290
                                    </ol>
305
                                    </ol>
291
                                </div> [% # /div.rows %]
306
                                </div> [% # /div.rows %]
292
                            </div> [% # /div#patron-information %]
307
                            </div> [% # /div#patron-information %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+50 lines)
Lines 581-586 Link Here
581
                                    [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
581
                                    [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
582
                                </li>
582
                                </li>
583
                            [% END %]
583
                            [% END %]
584
                            <li>
585
                               <label for="borrower_primary_contact_method">Main contact method:</label>
586
                               <select id="borrower_primary_contact_method" name="borrower_primary_contact_method">
587
                               <option value=""></option>
588
                                 [% FOREACH contactprincipalloo IN contactprincipalloop %]
589
                                    [% IF ( contactprincipalloo.currentis_phone ) %]
590
                                       [% IF ( borrower.primary_contact_method == 'phone' ) %]
591
                                         <option value="phone" selected="selected">Primary phone</option>
592
                                       [% ELSE %]
593
                                         <option value="phone">Primary phone</option>
594
                                       [% END %]
595
                                    [% END %]
596
                                    [% IF ( contactprincipalloo.currentis_phonepro ) %]
597
                                       [% IF ( borrower.primary_contact_method == 'phonepro' ) %]
598
                                         <option value="phonepro" selected="selected">Secondary phone</option>
599
                                       [% ELSE %]
600
                                         <option value="phonepro">Secondary phone</option>
601
                                       [% END %]
602
                                    [% END %]
603
                                    [% IF ( contactprincipalloo.currentis_mobile ) %]
604
                                       [% IF ( borrower.primary_contact_method == 'mobile' ) %]
605
                                         <option value="mobile" selected="selected">Other phone</option>
606
                                       [% ELSE %]
607
                                         <option value="mobile">Other phone</option>
608
                                       [% END %]
609
                                    [% END %]
610
                                    [% IF ( contactprincipalloo.currentis_email ) %]
611
                                       [% IF ( borrower.primary_contact_method == 'email' ) %]
612
                                         <option value="email" selected="selected">Primary email</option>
613
                                       [% ELSE %]
614
                                         <option value="email">Primary email</option>
615
                                       [% END %]
616
                                    [% END %]
617
                                    [% IF ( contactprincipalloo.currentis_emailpro ) %]
618
                                       [% IF ( borrower.primary_contact_method == 'emailpro' ) %]
619
                                         <option value="emailpro" selected="selected">Secondary email</option>
620
                                       [% ELSE %]
621
                                         <option value="emailpro">Secondary email</option>
622
                                       [% END %]
623
                                    [% END %]
624
                                    [% IF ( contactprincipalloo.currentis_fax ) %]
625
                                       [% IF ( borrower.primary_contact_method == 'fax' ) %]
626
                                         <option value="fax" selected="selected">Fax</option>
627
                                       [% ELSE %]
628
                                         <option value="fax">Fax</option>
629
                                       [% END %]
630
                                    [% END %]
631
                                 [% END %]
632
                               </select>
633
                            </li>
584
                        </ol>
634
                        </ol>
585
                    </fieldset>
635
                    </fieldset>
586
                [% END %]
636
                [% END %]
(-)a/members/memberentry.pl (-1 / +12 lines)
Lines 638-643 $template->param( Link Here
638
    typeloop      => \@typeloop,
638
    typeloop      => \@typeloop,
639
    no_categories => $no_categories,
639
    no_categories => $no_categories,
640
);
640
);
641
if($no_categories){ $no_add = 1; }
642
643
my @contactprincipalloop;
644
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
645
foreach my $field (@fieldArray) {
646
   if ( !(grep { $field eq $_ } @field_check)){
647
        push @contactprincipalloop,{
648
            'currentis_' . $field => 1
649
        };
650
    }
651
}
652
$template->param('contactprincipalloop' => \@contactprincipalloop);
641
653
642
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
654
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
643
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
655
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
Lines 645-651 $template->param( Link Here
645
    roadtypes => $roadtypes,
657
    roadtypes => $roadtypes,
646
    cities    => $cities,
658
    cities    => $cities,
647
);
659
);
648
649
my $default_borrowertitle = '';
660
my $default_borrowertitle = '';
650
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
661
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
651
662
(-)a/members/moremember.pl (+4 lines)
Lines 204-209 $template->param( Link Here
204
    fines           => $patron->account->balance,
204
    fines           => $patron->account->balance,
205
    translated_language => $translated_language,
205
    translated_language => $translated_language,
206
    detailview      => 1,
206
    detailview      => 1,
207
    borrowernumber  => $borrowernumber,
208
    othernames      => $data->{'othernames'},
209
    categoryname    => $patron->category->description,
210
    primary_contact_method  => $data->{'primary_contact_method'},
207
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
211
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
208
    $category_type  => 1, # [% IF ( I ) %] = institutional/organisation
212
    $category_type  => 1, # [% IF ( I ) %] = institutional/organisation
209
    housebound_role => scalar $patron->housebound_role,
213
    housebound_role => scalar $patron->housebound_role,
(-)a/opac/opac-memberentry.pl (-1 / +13 lines)
Lines 94-99 $template->param( Link Here
94
    libraries         => \@libraries,
94
    libraries         => \@libraries,
95
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
95
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
96
);
96
);
97
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
98
        my @field_check=split(/\|/,$check_BorrowerMandatoryField);
99
        my @contactprincipalloop;
100
        my @fieldArray = qw(phone phonepro mobile email emailpro fax);
101
        foreach my $field (@fieldArray) {
102
           if ( !(grep { $field eq $_ } @field_check)){
103
                push @contactprincipalloop,{
104
                    'currentis_' . $field => 1
105
                };
106
            }
107
        }
108
109
        $template->param('contactprincipalloop' => \@contactprincipalloop);
97
110
98
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
111
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
99
my $conflicting_attribute = 0;
112
my $conflicting_attribute = 0;
100
- 

Return to bug 11879