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 611-616 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
611
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
611
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
612
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
612
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
613
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
613
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
614
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
614
  KEY borrowernumber (borrowernumber),
615
  KEY borrowernumber (borrowernumber),
615
  KEY `cardnumber` (`cardnumber`),
616
  KEY `cardnumber` (`cardnumber`),
616
  KEY `sms_provider_id` (`sms_provider_id`)
617
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1537-1542 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1537
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1538
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1538
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1539
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1539
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1540
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1541
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
1540
  UNIQUE KEY `cardnumber` (`cardnumber`),
1542
  UNIQUE KEY `cardnumber` (`cardnumber`),
1541
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1543
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1542
  KEY `categorycode` (`categorycode`),
1544
  KEY `categorycode` (`categorycode`),
Lines 3541-3546 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3541
  `privacy` int(11) DEFAULT NULL,
3543
  `privacy` int(11) DEFAULT NULL,
3542
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3544
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3543
  `gdpr_proc_consent` datetime, -- data processing consent
3545
  `gdpr_proc_consent` datetime, -- data processing consent
3546
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
3544
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3547
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3545
  KEY `verification_token` (`verification_token` (191)),
3548
  KEY `verification_token` (`verification_token` (191)),
3546
  KEY `borrowernumber` (`borrowernumber`)
3549
  KEY `borrowernumber` (`borrowernumber`)
(-)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 310-315 Link Here
310
                                                    </ul>
310
                                                    </ul>
311
                                                </li>
311
                                                </li>
312
                                        [% END %]
312
                                        [% END %]
313
314
                                        [% IF ( primary_contact_method ) %]
315
                                            <li>
316
                                                <span class="label">Main contact method: </span>
317
                                                [% SWITCH primary_contact_method %]
318
                                                    [% CASE 'phone' %]
319
                                                        Primary phone
320
                                                    [% CASE 'phonepro' %]
321
                                                        Secondary phone
322
                                                    [% CASE 'mobile' %]
323
                                                        Other phone
324
                                                    [% CASE 'email' %]
325
                                                        Primary email
326
                                                    [% CASE 'emailpro' %]
327
                                                        Secondary email
328
                                                    [% CASE 'fax' %]
329
                                                        Fax
330
                                                [% END %]
331
                                            </li>
332
                                        [% END %]
313
                                    </ol>
333
                                    </ol>
314
                                </div> [% # /div.rows %]
334
                                </div> [% # /div.rows %]
315
                            </div> [% # /div#patron-information %]
335
                            </div> [% # /div#patron-information %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+59 lines)
Lines 623-628 Link Here
623
                                                [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
623
                                                [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
624
                                            </li>
624
                                            </li>
625
                                        [% END %]
625
                                        [% END %]
626
627
                                        [% UNLESS hidden.defined('primary_contact_method') %]
628
                                            <li>
629
                                                [% IF ( mandatory.defined('primary_contact_method') ) %]
630
                                                    <label for="borrower_primary_contact_method" class="required">Main contact method:</label>
631
                                                [% ELSE %]
632
                                                    <label for="borrower_primary_contact_method">Main contact method:</label>
633
                                                [% END %]
634
635
                                                <select id="borrower_primary_contact_method" name="borrower_primary_contact_method">
636
                                                    <option value=""></option>
637
                                                    [% FOREACH contactprincipalloo IN contactprincipalloop %]
638
                                                        [% IF ( contactprincipalloo.currentis_phone ) %]
639
                                                            [% IF ( borrower.primary_contact_method == 'phone' ) %]
640
                                                                <option value="phone" selected="selected">Primary phone</option>
641
                                                            [% ELSE %]
642
                                                                <option value="phone">Primary phone</option>
643
                                                            [% END %]
644
                                                        [% END %]
645
                                                        [% IF ( contactprincipalloo.currentis_phonepro ) %]
646
                                                            [% IF ( borrower.primary_contact_method == 'phonepro' ) %]
647
                                                                <option value="phonepro" selected="selected">Secondary phone</option>
648
                                                            [% ELSE %]
649
                                                                <option value="phonepro">Secondary phone</option>
650
                                                            [% END %]
651
                                                        [% END %]
652
                                                        [% IF ( contactprincipalloo.currentis_mobile ) %]
653
                                                            [% IF ( borrower.primary_contact_method == 'mobile' ) %]
654
                                                                <option value="mobile" selected="selected">Other phone</option>
655
                                                            [% ELSE %]
656
                                                                <option value="mobile">Other phone</option>
657
                                                            [% END %]
658
                                                        [% END %]
659
                                                        [% IF ( contactprincipalloo.currentis_email ) %]
660
                                                            [% IF ( borrower.primary_contact_method == 'email' ) %]
661
                                                                <option value="email" selected="selected">Primary email</option>
662
                                                            [% ELSE %]
663
                                                                <option value="email">Primary email</option>
664
                                                            [% END %]
665
                                                        [% END %]
666
                                                        [% IF ( contactprincipalloo.currentis_emailpro ) %]
667
                                                            [% IF ( borrower.primary_contact_method == 'emailpro' ) %]
668
                                                                <option value="emailpro" selected="selected">Secondary email</option>
669
                                                            [% ELSE %]
670
                                                                <option value="emailpro">Secondary email</option>
671
                                                            [% END %]
672
                                                        [% END %]
673
                                                        [% IF ( contactprincipalloo.currentis_fax ) %]
674
                                                            [% IF ( borrower.primary_contact_method == 'fax' ) %]
675
                                                                <option value="fax" selected="selected">Fax</option>
676
                                                            [% ELSE %]
677
                                                                <option value="fax">Fax</option>
678
                                                            [% END %]
679
                                                        [% END %]
680
                                                    [% END %]
681
                                                </select>
682
                                                [% IF ( mandatory.defined('primary_contact_method') ) %]<span class="required">Required</span>[% END %]
683
                                            </li>
684
                                        [% END %]
626
                                    </ol>
685
                                    </ol>
627
                                </fieldset>
686
                                </fieldset>
628
                            </div> <!-- /.col -->
687
                            </div> <!-- /.col -->
(-)a/opac/opac-memberentry.pl (-1 / +14 lines)
Lines 101-106 $template->param( Link Here
101
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
101
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
102
);
102
);
103
103
104
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
105
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
106
my @contactprincipalloop;
107
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
108
foreach my $field (@fieldArray) {
109
   if ( !(grep { $field eq $_ } @field_check)){
110
        push @contactprincipalloop,{
111
            'currentis_' . $field => 1
112
        };
113
    }
114
}
115
116
$template->param('contactprincipalloop' => \@contactprincipalloop);
117
104
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
118
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
105
my $conflicting_attribute = 0;
119
my $conflicting_attribute = 0;
106
120
107
- 

Return to bug 11879