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 1305-1310 CREATE TABLE `borrower_modifications` ( Link Here
1305
  `privacy` int(11) DEFAULT NULL,
1305
  `privacy` int(11) DEFAULT NULL,
1306
  `extended_attributes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1306
  `extended_attributes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1307
  `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1307
  `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1308
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1308
  PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1309
  PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1309
  KEY `verification_token` (`verification_token`(191)),
1310
  KEY `verification_token` (`verification_token`(191)),
1310
  KEY `borrowernumber` (`borrowernumber`)
1311
  KEY `borrowernumber` (`borrowernumber`)
Lines 1431-1436 CREATE TABLE `borrowers` ( Link Here
1431
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
1432
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
1432
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1433
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1433
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1434
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1435
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1434
  PRIMARY KEY (`borrowernumber`),
1436
  PRIMARY KEY (`borrowernumber`),
1435
  UNIQUE KEY `cardnumber` (`cardnumber`),
1437
  UNIQUE KEY `cardnumber` (`cardnumber`),
1436
  UNIQUE KEY `userid` (`userid`),
1438
  UNIQUE KEY `userid` (`userid`),
Lines 2432-2437 CREATE TABLE `deletedborrowers` ( Link Here
2432
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
2434
  `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
2433
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2435
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2434
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2436
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2437
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2435
  KEY `borrowernumber` (`borrowernumber`),
2438
  KEY `borrowernumber` (`borrowernumber`),
2436
  KEY `cardnumber` (`cardnumber`),
2439
  KEY `cardnumber` (`cardnumber`),
2437
  KEY `sms_provider_id` (`sms_provider_id`)
2440
  KEY `sms_provider_id` (`sms_provider_id`)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+58 lines)
Lines 740-745 legend:hover { Link Here
740
                                                    [% END %]
740
                                                    [% END %]
741
                                                </li>
741
                                                </li>
742
                                            [% END #/UNLESS nofax %]
742
                                            [% END #/UNLESS nofax %]
743
744
                                            <li>
745
                                                [% IF mandatoryprimary_contact_method %]
746
                                                    <label for="primary_contact_method" class="required">
747
                                                [% ELSE %]
748
                                                    <label for="primary_contact_method">
749
                                                [% END %]
750
                                                Main contact method: </label>
751
752
                                                <select id="primary_contact_method" name="primary_contact_method">
753
                                                    <option value=""></option>
754
                                                    [% UNLESS nophone %]
755
                                                        [% IF ( primary_contact_method == 'phone' ) %]
756
                                                            <option value="phone" selected="selected">Primary phone</option>
757
                                                        [% ELSE %]
758
                                                            <option value="phone">Primary phone</option>
759
                                                        [% END %]
760
                                                    [% END %]
761
                                                    [% UNLESS nophonepro %]
762
                                                        [% IF ( primary_contact_method == 'phonepro' ) %]
763
                                                            <option value="phonepro" selected="selected">Secondary phone</option>
764
                                                        [% ELSE %]
765
                                                            <option value="phonepro">Secondary phone</option>
766
                                                        [% END %]
767
                                                    [% END %]
768
                                                    [% UNLESS nomobile %]
769
                                                        [% IF ( primary_contact_method == 'mobile' ) %]
770
                                                            <option value="mobile" selected="selected">Other phone</option>
771
                                                        [% ELSE %]
772
                                                            <option value="mobile">Other phone</option>
773
                                                        [% END %]
774
                                                    [% END %]
775
                                                    [% UNLESS noemail %]
776
                                                        [% IF ( primary_contact_method == 'email' ) %]
777
                                                            <option value="email" selected="selected">Primary email</option>
778
                                                        [% ELSE %]
779
                                                            <option value="email">Primary email</option>
780
                                                        [% END %]
781
                                                    [% END %]
782
                                                    [% UNLESS noemailpro %]
783
                                                        [% IF ( primary_contact_method == 'emailpro' ) %]
784
                                                            <option value="emailpro" selected="selected">Secondary email</option>
785
                                                        [% ELSE %]
786
                                                            <option value="emailpro">Secondary email</option>
787
                                                        [% END %]
788
                                                    [% END %]
789
                                                    [% UNLESS nofax %]
790
                                                        [% IF ( primary_contact_method == 'fax' ) %]
791
                                                            <option value="fax" selected="selected">Fax</option>
792
                                                        [% ELSE %]
793
                                                            <option value="fax">Fax</option>
794
                                                        [% END %]
795
                                                    [% END %]
796
                                                </select>
797
                                                [% IF mandatoryprimary_contact_method %]
798
                                                    <span class="required">Required</span>
799
                                                [% END %]
800
                                            </li>
743
                                        </ol>
801
                                        </ol>
744
                                    </fieldset> <!-- /#memberentry_contact -->
802
                                    </fieldset> <!-- /#memberentry_contact -->
745
                                [% END # hide fieldset %]
803
                                [% END # hide fieldset %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+20 lines)
Lines 307-312 Link Here
307
                                                    </ul>
307
                                                    </ul>
308
                                                </li>
308
                                                </li>
309
                                        [% END %]
309
                                        [% END %]
310
311
                                        [% IF ( primary_contact_method ) %]
312
                                            <li>
313
                                                <span class="label">Main contact method: </span>
314
                                                [% SWITCH primary_contact_method %]
315
                                                    [% CASE 'phone' %]
316
                                                        Primary phone
317
                                                    [% CASE 'phonepro' %]
318
                                                        Secondary phone
319
                                                    [% CASE 'mobile' %]
320
                                                        Other phone
321
                                                    [% CASE 'email' %]
322
                                                        Primary email
323
                                                    [% CASE 'emailpro' %]
324
                                                        Secondary email
325
                                                    [% CASE 'fax' %]
326
                                                        Fax
327
                                                [% END %]
328
                                            </li>
329
                                        [% END %]
310
                                    </ol>
330
                                    </ol>
311
                                </div> [% # /div.rows %]
331
                                </div> [% # /div.rows %]
312
                            </div> [% # /div#patron-information %]
332
                            </div> [% # /div#patron-information %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+59 lines)
Lines 554-559 Link Here
554
                                                <div class="required_label [% required.fax | html %]">Required</div>
554
                                                <div class="required_label [% required.fax | html %]">Required</div>
555
                                            </li>
555
                                            </li>
556
                                        [% END %]
556
                                        [% END %]
557
558
                                        [% UNLESS hidden.defined('primary_contact_method') %]
559
                                            <li>
560
                                                [% IF ( mandatory.defined('primary_contact_method') ) %]
561
                                                    <label for="borrower_primary_contact_method" class="required">Main contact method:</label>
562
                                                [% ELSE %]
563
                                                    <label for="borrower_primary_contact_method">Main contact method:</label>
564
                                                [% END %]
565
566
                                                <select id="borrower_primary_contact_method" name="borrower_primary_contact_method">
567
                                                    <option value=""></option>
568
                                                    [% FOREACH contactprincipalloo IN contactprincipalloop %]
569
                                                        [% IF ( contactprincipalloo.currentis_phone ) %]
570
                                                            [% IF ( borrower.primary_contact_method == 'phone' ) %]
571
                                                                <option value="phone" selected="selected">Primary phone</option>
572
                                                            [% ELSE %]
573
                                                                <option value="phone">Primary phone</option>
574
                                                            [% END %]
575
                                                        [% END %]
576
                                                        [% IF ( contactprincipalloo.currentis_phonepro ) %]
577
                                                            [% IF ( borrower.primary_contact_method == 'phonepro' ) %]
578
                                                                <option value="phonepro" selected="selected">Secondary phone</option>
579
                                                            [% ELSE %]
580
                                                                <option value="phonepro">Secondary phone</option>
581
                                                            [% END %]
582
                                                        [% END %]
583
                                                        [% IF ( contactprincipalloo.currentis_mobile ) %]
584
                                                            [% IF ( borrower.primary_contact_method == 'mobile' ) %]
585
                                                                <option value="mobile" selected="selected">Other phone</option>
586
                                                            [% ELSE %]
587
                                                                <option value="mobile">Other phone</option>
588
                                                            [% END %]
589
                                                        [% END %]
590
                                                        [% IF ( contactprincipalloo.currentis_email ) %]
591
                                                            [% IF ( borrower.primary_contact_method == 'email' ) %]
592
                                                                <option value="email" selected="selected">Primary email</option>
593
                                                            [% ELSE %]
594
                                                                <option value="email">Primary email</option>
595
                                                            [% END %]
596
                                                        [% END %]
597
                                                        [% IF ( contactprincipalloo.currentis_emailpro ) %]
598
                                                            [% IF ( borrower.primary_contact_method == 'emailpro' ) %]
599
                                                                <option value="emailpro" selected="selected">Secondary email</option>
600
                                                            [% ELSE %]
601
                                                                <option value="emailpro">Secondary email</option>
602
                                                            [% END %]
603
                                                        [% END %]
604
                                                        [% IF ( contactprincipalloo.currentis_fax ) %]
605
                                                            [% IF ( borrower.primary_contact_method == 'fax' ) %]
606
                                                                <option value="fax" selected="selected">Fax</option>
607
                                                            [% ELSE %]
608
                                                                <option value="fax">Fax</option>
609
                                                            [% END %]
610
                                                        [% END %]
611
                                                    [% END %]
612
                                                </select>
613
                                                [% IF ( mandatory.defined('primary_contact_method') ) %]<span class="required">Required</span>[% END %]
614
                                            </li>
615
                                        [% END %]
557
                                    </ol>
616
                                    </ol>
558
                                </fieldset>
617
                                </fieldset>
559
                            </div> <!-- /.col -->
618
                            </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