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

(-)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 1304-1309 CREATE TABLE `borrower_modifications` ( Link Here
1304
  `privacy` int(11) DEFAULT NULL,
1304
  `privacy` int(11) DEFAULT NULL,
1305
  `extended_attributes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1305
  `extended_attributes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1306
  `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1306
  `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1307
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1307
  PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1308
  PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1308
  KEY `verification_token` (`verification_token`(191)),
1309
  KEY `verification_token` (`verification_token`(191)),
1309
  KEY `borrowernumber` (`borrowernumber`)
1310
  KEY `borrowernumber` (`borrowernumber`)
Lines 1429-1434 CREATE TABLE `borrowers` ( Link Here
1429
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
1430
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
1430
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1431
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1431
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1432
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1433
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1432
  PRIMARY KEY (`borrowernumber`),
1434
  PRIMARY KEY (`borrowernumber`),
1433
  UNIQUE KEY `cardnumber` (`cardnumber`),
1435
  UNIQUE KEY `cardnumber` (`cardnumber`),
1434
  UNIQUE KEY `userid` (`userid`),
1436
  UNIQUE KEY `userid` (`userid`),
Lines 2430-2435 CREATE TABLE `deletedborrowers` ( Link Here
2430
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
2432
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
2431
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2433
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2432
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2434
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2435
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2433
  KEY `borrowernumber` (`borrowernumber`),
2436
  KEY `borrowernumber` (`borrowernumber`),
2434
  KEY `cardnumber` (`cardnumber`),
2437
  KEY `cardnumber` (`cardnumber`),
2435
  KEY `sms_provider_id` (`sms_provider_id`)
2438
  KEY `sms_provider_id` (`sms_provider_id`)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+58 lines)
Lines 764-769 legend:hover { Link Here
764
                                                    [% END %]
764
                                                    [% END %]
765
                                                </li>
765
                                                </li>
766
                                            [% END #/UNLESS nofax %]
766
                                            [% END #/UNLESS nofax %]
767
768
                                            <li>
769
                                                [% IF mandatoryprimary_contact_method %]
770
                                                    <label for="primary_contact_method" class="required">
771
                                                [% ELSE %]
772
                                                    <label for="primary_contact_method">
773
                                                [% END %]
774
                                                Main contact method: </label>
775
776
                                                <select id="primary_contact_method" name="primary_contact_method">
777
                                                    <option value=""></option>
778
                                                    [% UNLESS nophone %]
779
                                                        [% IF ( primary_contact_method == 'phone' ) %]
780
                                                            <option value="phone" selected="selected">Primary phone</option>
781
                                                        [% ELSE %]
782
                                                            <option value="phone">Primary phone</option>
783
                                                        [% END %]
784
                                                    [% END %]
785
                                                    [% UNLESS nophonepro %]
786
                                                        [% IF ( primary_contact_method == 'phonepro' ) %]
787
                                                            <option value="phonepro" selected="selected">Secondary phone</option>
788
                                                        [% ELSE %]
789
                                                            <option value="phonepro">Secondary phone</option>
790
                                                        [% END %]
791
                                                    [% END %]
792
                                                    [% UNLESS nomobile %]
793
                                                        [% IF ( primary_contact_method == 'mobile' ) %]
794
                                                            <option value="mobile" selected="selected">Other phone</option>
795
                                                        [% ELSE %]
796
                                                            <option value="mobile">Other phone</option>
797
                                                        [% END %]
798
                                                    [% END %]
799
                                                    [% UNLESS noemail %]
800
                                                        [% IF ( primary_contact_method == 'email' ) %]
801
                                                            <option value="email" selected="selected">Primary email</option>
802
                                                        [% ELSE %]
803
                                                            <option value="email">Primary email</option>
804
                                                        [% END %]
805
                                                    [% END %]
806
                                                    [% UNLESS noemailpro %]
807
                                                        [% IF ( primary_contact_method == 'emailpro' ) %]
808
                                                            <option value="emailpro" selected="selected">Secondary email</option>
809
                                                        [% ELSE %]
810
                                                            <option value="emailpro">Secondary email</option>
811
                                                        [% END %]
812
                                                    [% END %]
813
                                                    [% UNLESS nofax %]
814
                                                        [% IF ( primary_contact_method == 'fax' ) %]
815
                                                            <option value="fax" selected="selected">Fax</option>
816
                                                        [% ELSE %]
817
                                                            <option value="fax">Fax</option>
818
                                                        [% END %]
819
                                                    [% END %]
820
                                                </select>
821
                                                [% IF mandatoryprimary_contact_method %]
822
                                                    <span class="required">Required</span>
823
                                                [% END %]
824
                                            </li>
767
                                        </ol>
825
                                        </ol>
768
                                    </fieldset> <!-- /#memberentry_contact -->
826
                                    </fieldset> <!-- /#memberentry_contact -->
769
                                [% END # hide fieldset %]
827
                                [% END # hide fieldset %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+20 lines)
Lines 326-331 Link Here
326
                                                    </ul>
326
                                                    </ul>
327
                                                </li>
327
                                                </li>
328
                                        [% END %]
328
                                        [% END %]
329
330
                                        [% IF ( primary_contact_method ) %]
331
                                            <li>
332
                                                <span class="label">Main contact method: </span>
333
                                                [% SWITCH primary_contact_method %]
334
                                                    [% CASE 'phone' %]
335
                                                        Primary phone
336
                                                    [% CASE 'phonepro' %]
337
                                                        Secondary phone
338
                                                    [% CASE 'mobile' %]
339
                                                        Other phone
340
                                                    [% CASE 'email' %]
341
                                                        Primary email
342
                                                    [% CASE 'emailpro' %]
343
                                                        Secondary email
344
                                                    [% CASE 'fax' %]
345
                                                        Fax
346
                                                [% END %]
347
                                            </li>
348
                                        [% END %]
329
                                    </ol>
349
                                    </ol>
330
                                </div> [% # /div.rows %]
350
                                </div> [% # /div.rows %]
331
                            </div> [% # /div#patron-information %]
351
                            </div> [% # /div#patron-information %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+59 lines)
Lines 578-583 Link Here
578
                                                <div class="required_label [% required.fax | html %]">Required</div>
578
                                                <div class="required_label [% required.fax | html %]">Required</div>
579
                                            </li>
579
                                            </li>
580
                                        [% END %]
580
                                        [% END %]
581
582
                                        [% UNLESS hidden.defined('primary_contact_method') %]
583
                                            <li>
584
                                                [% IF ( mandatory.defined('primary_contact_method') ) %]
585
                                                    <label for="borrower_primary_contact_method" class="required">Main contact method:</label>
586
                                                [% ELSE %]
587
                                                    <label for="borrower_primary_contact_method">Main contact method:</label>
588
                                                [% END %]
589
590
                                                <select id="borrower_primary_contact_method" name="borrower_primary_contact_method">
591
                                                    <option value=""></option>
592
                                                    [% FOREACH contactprincipalloo IN contactprincipalloop %]
593
                                                        [% IF ( contactprincipalloo.currentis_phone ) %]
594
                                                            [% IF ( borrower.primary_contact_method == 'phone' ) %]
595
                                                                <option value="phone" selected="selected">Primary phone</option>
596
                                                            [% ELSE %]
597
                                                                <option value="phone">Primary phone</option>
598
                                                            [% END %]
599
                                                        [% END %]
600
                                                        [% IF ( contactprincipalloo.currentis_phonepro ) %]
601
                                                            [% IF ( borrower.primary_contact_method == 'phonepro' ) %]
602
                                                                <option value="phonepro" selected="selected">Secondary phone</option>
603
                                                            [% ELSE %]
604
                                                                <option value="phonepro">Secondary phone</option>
605
                                                            [% END %]
606
                                                        [% END %]
607
                                                        [% IF ( contactprincipalloo.currentis_mobile ) %]
608
                                                            [% IF ( borrower.primary_contact_method == 'mobile' ) %]
609
                                                                <option value="mobile" selected="selected">Other phone</option>
610
                                                            [% ELSE %]
611
                                                                <option value="mobile">Other phone</option>
612
                                                            [% END %]
613
                                                        [% END %]
614
                                                        [% IF ( contactprincipalloo.currentis_email ) %]
615
                                                            [% IF ( borrower.primary_contact_method == 'email' ) %]
616
                                                                <option value="email" selected="selected">Primary email</option>
617
                                                            [% ELSE %]
618
                                                                <option value="email">Primary email</option>
619
                                                            [% END %]
620
                                                        [% END %]
621
                                                        [% IF ( contactprincipalloo.currentis_emailpro ) %]
622
                                                            [% IF ( borrower.primary_contact_method == 'emailpro' ) %]
623
                                                                <option value="emailpro" selected="selected">Secondary email</option>
624
                                                            [% ELSE %]
625
                                                                <option value="emailpro">Secondary email</option>
626
                                                            [% END %]
627
                                                        [% END %]
628
                                                        [% IF ( contactprincipalloo.currentis_fax ) %]
629
                                                            [% IF ( borrower.primary_contact_method == 'fax' ) %]
630
                                                                <option value="fax" selected="selected">Fax</option>
631
                                                            [% ELSE %]
632
                                                                <option value="fax">Fax</option>
633
                                                            [% END %]
634
                                                        [% END %]
635
                                                    [% END %]
636
                                                </select>
637
                                                [% IF ( mandatory.defined('primary_contact_method') ) %]<span class="required">Required</span>[% END %]
638
                                            </li>
639
                                        [% END %]
581
                                    </ol>
640
                                    </ol>
582
                                </fieldset>
641
                                </fieldset>
583
                            </div> <!-- /.col -->
642
                            </div> <!-- /.col -->
(-)a/opac/opac-memberentry.pl (-1 / +14 lines)
Lines 102-107 $template->param( Link Here
102
    defaultCategory  => $defaultCategory,
102
    defaultCategory  => $defaultCategory,
103
);
103
);
104
104
105
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
106
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
107
my @contactprincipalloop;
108
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
109
foreach my $field (@fieldArray) {
110
   if ( !(grep { $field eq $_ } @field_check)){
111
        push @contactprincipalloop,{
112
            'currentis_' . $field => 1
113
        };
114
    }
115
}
116
117
$template->param('contactprincipalloop' => \@contactprincipalloop);
118
105
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
119
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
106
my $conflicting_attribute = 0;
120
my $conflicting_attribute = 0;
107
121
108
- 

Return to bug 11879