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

(-)a/Koha/Schema/Result/Borrower.pm (+8 lines)
Lines 414-419 __PACKAGE__->table("borrowers"); Link Here
414
  default_value: 0
414
  default_value: 0
415
  is_nullable: 0
415
  is_nullable: 0
416
416
417
=head2 primary_contact_method
418
419
  data_type: 'varchar'
420
  is_nullable: 1
421
  size: 45
422
417
=head2 checkprevcheckout
423
=head2 checkprevcheckout
418
424
419
  data_type: 'varchar'
425
  data_type: 'varchar'
Lines 629-634 __PACKAGE__->add_columns( Link Here
629
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
635
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
630
  "privacy_guarantor_checkouts",
636
  "privacy_guarantor_checkouts",
631
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
637
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
638
  "primary_contact_method",
639
  { data_type => "varchar", is_nullable => 1, size => 45 },
632
  "checkprevcheckout",
640
  "checkprevcheckout",
633
  {
641
  {
634
    data_type => "varchar",
642
    data_type => "varchar",
(-)a/Koha/Schema/Result/BorrowerModification.pm (+8 lines)
Lines 410-415 __PACKAGE__->table("borrower_modifications"); Link Here
410
  data_type: 'integer'
410
  data_type: 'integer'
411
  is_nullable: 1
411
  is_nullable: 1
412
412
413
=head2 primary_contact_method
414
415
  data_type: 'varchar'
416
  is_nullable: 1
417
  size: 45
418
413
=head2 extended_attributes
419
=head2 extended_attributes
414
420
415
  data_type: 'mediumtext'
421
  data_type: 'mediumtext'
Lines 585-590 __PACKAGE__->add_columns( Link Here
585
  { data_type => "varchar", is_nullable => 1, size => 50 },
591
  { data_type => "varchar", is_nullable => 1, size => 50 },
586
  "privacy",
592
  "privacy",
587
  { data_type => "integer", is_nullable => 1 },
593
  { data_type => "integer", is_nullable => 1 },
594
  "primary_contact_method",
595
  { data_type => "varchar", is_nullable => 1, size => 45 },
588
  "extended_attributes",
596
  "extended_attributes",
589
  { data_type => "mediumtext", is_nullable => 1 },
597
  { data_type => "mediumtext", is_nullable => 1 },
590
  "gdpr_proc_consent",
598
  "gdpr_proc_consent",
(-)a/Koha/Schema/Result/Deletedborrower.pm (+8 lines)
Lines 411-416 __PACKAGE__->table("deletedborrowers"); Link Here
411
  default_value: 0
411
  default_value: 0
412
  is_nullable: 0
412
  is_nullable: 0
413
413
414
=head2 primary_contact_method
415
416
  data_type: 'varchar'
417
  is_nullable: 1
418
  size: 45
419
414
=head2 checkprevcheckout
420
=head2 checkprevcheckout
415
421
416
  data_type: 'varchar'
422
  data_type: 'varchar'
Lines 614-619 __PACKAGE__->add_columns( Link Here
614
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
620
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
615
  "privacy_guarantor_checkouts",
621
  "privacy_guarantor_checkouts",
616
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
622
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
623
  "primary_contact_method",
624
  { data_type => "varchar", is_nullable => 1, size => 45 },
617
  "checkprevcheckout",
625
  "checkprevcheckout",
618
  {
626
  {
619
    data_type => "varchar",
627
    data_type => "varchar",
(-)a/installer/data/mysql/atomicupdate/borrowers_primary_contact_method.perl (+17 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    if( !column_exists( 'borrowers', 'primary_contact_method' ) ) {
4
        $dbh->do( "ALTER TABLE `borrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `anonymized`" );
5
    }
6
7
    if( !column_exists( 'deletedborrowers', 'primary_contact_method' ) ) {
8
        $dbh->do( "ALTER TABLE `deletedborrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `anonymized`" );
9
    }
10
11
    if( !column_exists( 'borrower_modifications', 'primary_contact_method' ) ) {
12
        $dbh->do( "ALTER TABLE `borrower_modifications` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `gdpr_proc_consent`" );
13
    }
14
15
    SetVersion( $DBversion );
16
    print "Upgrade to $DBversion done (Bug 11879 - Add a new field to patron record: main contact method)\n";
17
}
(-)a/installer/data/mysql/kohastructure.sql (+3 lines)
Lines 589-594 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
589
  `login_attempts` int(4) default 0, -- number of failed login attemps
589
  `login_attempts` int(4) default 0, -- number of failed login attemps
590
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
590
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
591
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
591
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
592
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
592
  KEY borrowernumber (borrowernumber),
593
  KEY borrowernumber (borrowernumber),
593
  KEY `cardnumber` (`cardnumber`),
594
  KEY `cardnumber` (`cardnumber`),
594
  KEY `sms_provider_id` (`sms_provider_id`)
595
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1530-1535 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1530
  `login_attempts` int(4) default 0, -- number of failed login attemps
1531
  `login_attempts` int(4) default 0, -- number of failed login attemps
1531
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1532
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1532
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1533
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1534
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
1533
  UNIQUE KEY `cardnumber` (`cardnumber`),
1535
  UNIQUE KEY `cardnumber` (`cardnumber`),
1534
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1536
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1535
  KEY `categorycode` (`categorycode`),
1537
  KEY `categorycode` (`categorycode`),
Lines 3435-3440 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3435
  `privacy` int(11) DEFAULT NULL,
3437
  `privacy` int(11) DEFAULT NULL,
3436
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3438
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3437
  `gdpr_proc_consent` datetime, -- data processing consent
3439
  `gdpr_proc_consent` datetime, -- data processing consent
3440
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
3438
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3441
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3439
  KEY `verification_token` (`verification_token` (191)),
3442
  KEY `verification_token` (`verification_token` (191)),
3440
  KEY `borrowernumber` (`borrowernumber`)
3443
  KEY `borrowernumber` (`borrowernumber`)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+58 lines)
Lines 657-662 Link Here
657
                                                    [% END %]
657
                                                    [% END %]
658
                                                </li>
658
                                                </li>
659
                                            [% END #/UNLESS nofax %]
659
                                            [% END #/UNLESS nofax %]
660
661
                                            <li>
662
                                            [% IF mandatoryprimary_contact_method %]
663
                                                <label for="primary_contact_method" class="required">
664
                                            [% ELSE %]
665
                                                <label for="primary_contact_method">
666
                                            [% END %]
667
                                            Main contact method: </label>
668
 
669
                                            <select id="primary_contact_method" name="primary_contact_method">
670
                                            <option value=""></option>
671
                                            [% UNLESS nophone %]
672
                                                [% IF ( primary_contact_method == 'phone' ) %]
673
                                                    <option value="phone" selected="selected">Primary phone</option>
674
                                                [% ELSE %]
675
                                                    <option value="phone">Primary phone</option>
676
                                                [% END %]
677
                                            [% END %]
678
                                            [% UNLESS nophonepro %]
679
                                                [% IF ( primary_contact_method == 'phonepro' ) %]
680
                                                    <option value="phonepro" selected="selected">Secondary phone</option>
681
                                                [% ELSE %]
682
                                                    <option value="phonepro">Secondary phone</option>
683
                                                [% END %]
684
                                            [% END %]
685
                                            [% UNLESS nomobile %]
686
                                                [% IF ( primary_contact_method == 'mobile' ) %]
687
                                                    <option value="mobile" selected="selected">Other phone</option>
688
                                                [% ELSE %]
689
                                                    <option value="mobile">Other phone</option>
690
                                                [% END %]
691
                                            [% END %]
692
                                            [% UNLESS noemail %]
693
                                                [% IF ( primary_contact_method == 'email' ) %]
694
                                                    <option value="email" selected="selected">Primary email</option>
695
                                                [% ELSE %]
696
                                                    <option value="email">Primary email</option>
697
                                                [% END %]
698
                                            [% END %]
699
                                            [% UNLESS noemailpro %]
700
                                                [% IF ( primary_contact_method == 'emailpro' ) %]
701
                                                    <option value="emailpro" selected="selected">Secondary email</option>
702
                                                [% ELSE %]
703
                                                    <option value="emailpro">Secondary email</option>
704
                                                [% END %]
705
                                            [% END %]
706
                                            [% UNLESS nofax %]
707
                                                [% IF ( primary_contact_method == 'fax' ) %]
708
                                                    <option value="fax" selected="selected">Fax</option>
709
                                                [% ELSE %]
710
                                                    <option value="fax">Fax</option>
711
                                                [% END %]
712
                                            [% END %]
713
                                            </select>
714
                                            [% IF mandatoryprimary_contact_method %]
715
                                                <span class="required">Required</span>
716
                                            [% END %]
717
                                            </li>
660
                                        </ol>
718
                                        </ol>
661
                                    </fieldset> <!-- /#memberentry_contact -->
719
                                    </fieldset> <!-- /#memberentry_contact -->
662
                                [% END # hide fieldset %]
720
                                [% END # hide fieldset %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+20 lines)
Lines 283-288 Link Here
283
                                                    </ul>
283
                                                    </ul>
284
                                                </li>
284
                                                </li>
285
                                        [% END %]
285
                                        [% END %]
286
287
                                        [% IF ( primary_contact_method ) %]
288
                                             <li>
289
                                                 <span class="label">Main contact method: </span>
290
                                                 [% SWITCH primary_contact_method %]
291
                                                     [% CASE 'phone' %]
292
                                                         Primary phone
293
                                                     [% CASE 'phonepro' %]
294
                                                         Secondary phone
295
                                                     [% CASE 'mobile' %]
296
                                                         Other phone
297
                                                     [% CASE 'email' %]
298
                                                         Primary email
299
                                                     [% CASE 'emailpro' %]
300
                                                         Secondary email
301
                                                     [% CASE 'fax' %]
302
                                                         Fax
303
                                                 [% END %]
304
                                             </li>
305
                                        [% END %]
286
                                    </ol>
306
                                    </ol>
287
                                </div> [% # /div.rows %]
307
                                </div> [% # /div.rows %]
288
                            </div> [% # /div#patron-information %]
308
                            </div> [% # /div#patron-information %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+59 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
585
                            [% UNLESS hidden.defined('primary_contact_method') %]
586
                            <li>
587
                                [% IF ( mandatory.defined('primary_contact_method') ) %]
588
                                    <label for="borrower_primary_contact_method" class="required">Main contact method:</label>
589
                                [% ELSE %]
590
                                    <label for="borrower_primary_contact_method">Main contact method:</label>
591
                                [% END %]
592
593
                                <select id="borrower_primary_contact_method" name="borrower_primary_contact_method">
594
                                <option value=""></option>
595
                                [% FOREACH contactprincipalloo IN contactprincipalloop %]
596
                                    [% IF ( contactprincipalloo.currentis_phone ) %]
597
                                       [% IF ( borrower.primary_contact_method == 'phone' ) %]
598
                                         <option value="phone" selected="selected">Primary phone</option>
599
                                       [% ELSE %]
600
                                         <option value="phone">Primary phone</option>
601
                                       [% END %]
602
                                    [% END %]
603
                                    [% IF ( contactprincipalloo.currentis_phonepro ) %]
604
                                       [% IF ( borrower.primary_contact_method == 'phonepro' ) %]
605
                                         <option value="phonepro" selected="selected">Secondary phone</option>
606
                                       [% ELSE %]
607
                                         <option value="phonepro">Secondary phone</option>
608
                                       [% END %]
609
                                    [% END %]
610
                                    [% IF ( contactprincipalloo.currentis_mobile ) %]
611
                                       [% IF ( borrower.primary_contact_method == 'mobile' ) %]
612
                                         <option value="mobile" selected="selected">Other phone</option>
613
                                       [% ELSE %]
614
                                         <option value="mobile">Other phone</option>
615
                                       [% END %]
616
                                    [% END %]
617
                                    [% IF ( contactprincipalloo.currentis_email ) %]
618
                                       [% IF ( borrower.primary_contact_method == 'email' ) %]
619
                                         <option value="email" selected="selected">Primary email</option>
620
                                       [% ELSE %]
621
                                         <option value="email">Primary email</option>
622
                                       [% END %]
623
                                    [% END %]
624
                                    [% IF ( contactprincipalloo.currentis_emailpro ) %]
625
                                       [% IF ( borrower.primary_contact_method == 'emailpro' ) %]
626
                                         <option value="emailpro" selected="selected">Secondary email</option>
627
                                       [% ELSE %]
628
                                         <option value="emailpro">Secondary email</option>
629
                                       [% END %]
630
                                    [% END %]
631
                                    [% IF ( contactprincipalloo.currentis_fax ) %]
632
                                       [% IF ( borrower.primary_contact_method == 'fax' ) %]
633
                                         <option value="fax" selected="selected">Fax</option>
634
                                       [% ELSE %]
635
                                         <option value="fax">Fax</option>
636
                                       [% END %]
637
                                    [% END %]
638
                                 [% END %]
639
                                </select>
640
                                [% IF ( mandatory.defined('primary_contact_method') ) %]<span class="required">Required</span>[% END %]
641
                             </li>
642
                             [% END %]
584
                        </ol>
643
                        </ol>
585
                    </fieldset>
644
                    </fieldset>
586
                [% END %]
645
                [% END %]
(-)a/opac/opac-memberentry.pl (-1 / +14 lines)
Lines 95-100 $template->param( Link Here
95
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
95
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
96
);
96
);
97
97
98
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
99
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
100
my @contactprincipalloop;
101
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
102
foreach my $field (@fieldArray) {
103
   if ( !(grep { $field eq $_ } @field_check)){
104
        push @contactprincipalloop,{
105
            'currentis_' . $field => 1
106
        };
107
    }
108
}
109
110
$template->param('contactprincipalloop' => \@contactprincipalloop);
111
98
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
112
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
99
my $conflicting_attribute = 0;
113
my $conflicting_attribute = 0;
100
114
101
- 

Return to bug 11879