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 (+4 lines)
Lines 637-642 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
637
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
637
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
638
  `login_attempts` int(4) default 0, -- number of failed login attemps
638
  `login_attempts` int(4) default 0, -- number of failed login attemps
639
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
639
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
640
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
640
  KEY borrowernumber (borrowernumber),
641
  KEY borrowernumber (borrowernumber),
641
  KEY `cardnumber` (`cardnumber`),
642
  KEY `cardnumber` (`cardnumber`),
642
  KEY `sms_provider_id` (`sms_provider_id`)
643
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1674-1679 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1674
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1675
  `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
1675
  `login_attempts` int(4) default 0, -- number of failed login attemps
1676
  `login_attempts` int(4) default 0, -- number of failed login attemps
1676
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
1677
  `overdrive_auth_token` text default NULL, -- persist OverDrive auth token
1678
  `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface)
1679
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
1677
  UNIQUE KEY `cardnumber` (`cardnumber`),
1680
  UNIQUE KEY `cardnumber` (`cardnumber`),
1678
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1681
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1679
  KEY `categorycode` (`categorycode`),
1682
  KEY `categorycode` (`categorycode`),
Lines 3448-3453 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3448
  `smsalertnumber` varchar(50) DEFAULT NULL,
3451
  `smsalertnumber` varchar(50) DEFAULT NULL,
3449
  `privacy` int(11) DEFAULT NULL,
3452
  `privacy` int(11) DEFAULT NULL,
3450
  `extended_attributes` text DEFAULT NULL,
3453
  `extended_attributes` text DEFAULT NULL,
3454
  `primary_contact_method` varchar(45) DEFAULT NULL, --  useful for reporting purposes
3451
  PRIMARY KEY (`verification_token`,`borrowernumber`),
3455
  PRIMARY KEY (`verification_token`,`borrowernumber`),
3452
  KEY `verification_token` (`verification_token`),
3456
  KEY `verification_token` (`verification_token`),
3453
  KEY `borrowernumber` (`borrowernumber`)
3457
  KEY `borrowernumber` (`borrowernumber`)
(-)a/installer/data/mysql/updatedatabase.pl (+1 lines)
Lines 14615-14620 foreach my $file ( sort readdir $dirh ) { Link Here
14615
    }
14615
    }
14616
}
14616
}
14617
14617
14618
14618
=head1 FUNCTIONS
14619
=head1 FUNCTIONS
14619
14620
14620
=head2 TableExists($table)
14621
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-4 / +57 lines)
Lines 491-497 $(document).ready(function() { Link Here
491
491
492
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
492
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
493
  <fieldset class="rows" id="memberentry_contact">
493
  <fieldset class="rows" id="memberentry_contact">
494
    <legend id="contact_lgd">Contact</legend><ol>
494
    <legend id="contact_lgd">Contact</legend>
495
<ol>
495
        [% UNLESS nophone %]
496
        [% UNLESS nophone %]
496
      <li>
497
      <li>
497
      [% IF ( mandatoryphone ) %]
498
      [% IF ( mandatoryphone ) %]
Lines 554-560 $(document).ready(function() { Link Here
554
	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
555
	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
555
    </li>
556
    </li>
556
        [% END %]
557
        [% END %]
557
        [% UNLESS nofax %]
558
    [% UNLESS nofax %]
558
    <li>
559
    <li>
559
      [% IF ( mandatoryfax ) %]
560
      [% IF ( mandatoryfax ) %]
560
      <label for="fax" class="required">
561
      <label for="fax" class="required">
Lines 565-572 $(document).ready(function() { Link Here
565
        <input type="text" id="fax" name="fax" value="[% fax | html %]" />
566
        <input type="text" id="fax" name="fax" value="[% fax | html %]" />
566
	  [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
567
	  [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
567
    </li>
568
    </li>
568
        [% END %]
569
569
	</ol>
570
   [% END %]
571
    <li>
572
       <label for="primary_contact_method">Main contact method:</label>
573
       <select id="primary_contact_method" name="primary_contact_method">
574
       <option value=""></option>
575
         [% FOREACH contactprincipalloo IN contactprincipalloop %]
576
            [% IF ( contactprincipalloo.currentis_phone ) %]
577
               [% IF ( primary_contact_method == 'phone' ) %]
578
                 <option value="phone" selected="selected">Primary phone</option>
579
               [% ELSE %]
580
                 <option value="phone">Primary phone</option>
581
               [% END %]
582
            [% END %]
583
            [% IF ( contactprincipalloo.currentis_phonepro ) %]
584
               [% IF ( primary_contact_method == 'phonepro' ) %]
585
                 <option value="phonepro" selected="selected">Secondary phone</option>
586
               [% ELSE %]
587
                 <option value="phonepro">Secondary phone</option>
588
               [% END %]
589
            [% END %]
590
            [% IF ( contactprincipalloo.currentis_mobile ) %]
591
               [% IF ( primary_contact_method == 'mobile' ) %]
592
                 <option value="mobile" selected="selected">Other phone</option>
593
               [% ELSE %]
594
                 <option value="mobile">Other phone</option>
595
               [% END %]
596
            [% END %]
597
            [% IF ( contactprincipalloo.currentis_email ) %]
598
               [% IF ( primary_contact_method == 'email' ) %]
599
                 <option value="email" selected="selected">Primary email</option>
600
               [% ELSE %]
601
                 <option value="email">Primary email</option>
602
               [% END %]
603
            [% END %]
604
            [% IF ( contactprincipalloo.currentis_emailpro ) %]
605
               [% IF ( primary_contact_method == 'emailpro' ) %]
606
                 <option value="emailpro" selected="selected">Secondary email</option>
607
               [% ELSE %]
608
                 <option value="emailpro">Secondary email</option>
609
               [% END %]
610
            [% END %]
611
            [% IF ( contactprincipalloo.currentis_fax ) %]
612
               [% IF ( primary_contact_method == 'fax' ) %]
613
                 <option value="fax" selected="selected">Fax</option>
614
               [% ELSE %]
615
                 <option value="fax">Fax</option>
616
               [% END %]
617
            [% END %]
618
         [% END %]
619
       </select>
620
    </li>
621
    </ol>
622
570
  </fieldset>
623
  </fieldset>
571
[%END # hide fieldset %]
624
[%END # hide fieldset %]
572
625
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+14 lines)
Lines 273-278 function validate1(date) { Link Here
273
            [% END %]
273
            [% END %]
274
        </li>
274
        </li>
275
    [% END %]
275
    [% END %]
276
    [% SWITCH primary_contact_method %]
277
    [% CASE 'phone' %]
278
    <li><span class="label">Main contact method: </span>Phone</li>
279
    [% CASE 'phonepro' %]
280
    <li><span class="label">Main contact method: </span>Secondary phone</li>
281
    [% CASE 'mobile' %]
282
    <li><span class="label">Main contact method: </span>Other Phone</li>
283
    [% CASE 'email' %]
284
    <li><span class="label">Main contact method: </span>Primary email</li>
285
    [% CASE 'emailpro' %]
286
    <li><span class="label">Main contact method: </span>Secondary email</li>
287
    [% CASE 'fax' %]
288
    <li><span class="label">Main contact method: </span>Fax</li>
289
    [% END %]
276
</ol>
290
</ol>
277
</div>
291
</div>
278
      <div class="action">
292
      <div class="action">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+50 lines)
Lines 571-576 Link Here
571
                                    [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
571
                                    [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
572
                                </li>
572
                                </li>
573
                            [% END %]
573
                            [% END %]
574
                            <li>
575
                               <label for="borrower_primary_contact_method">Main contact method:</label>
576
                               <select id="borrower_primary_contact_method" name="borrower_primary_contact_method">
577
                               <option value=""></option>
578
                                 [% FOREACH contactprincipalloo IN contactprincipalloop %]
579
                                    [% IF ( contactprincipalloo.currentis_phone ) %]
580
                                       [% IF ( borrower.primary_contact_method == 'phone' ) %]
581
                                         <option value="phone" selected="selected">Primary phone</option>
582
                                       [% ELSE %]
583
                                         <option value="phone">Primary phone</option>
584
                                       [% END %]
585
                                    [% END %]
586
                                    [% IF ( contactprincipalloo.currentis_phonepro ) %]
587
                                       [% IF ( borrower.primary_contact_method == 'phonepro' ) %]
588
                                         <option value="phonepro" selected="selected">Secondary phone</option>
589
                                       [% ELSE %]
590
                                         <option value="phonepro">Secondary phone</option>
591
                                       [% END %]
592
                                    [% END %]
593
                                    [% IF ( contactprincipalloo.currentis_mobile ) %]
594
                                       [% IF ( borrower.primary_contact_method == 'mobile' ) %]
595
                                         <option value="mobile" selected="selected">Other phone</option>
596
                                       [% ELSE %]
597
                                         <option value="mobile">Other phone</option>
598
                                       [% END %]
599
                                    [% END %]
600
                                    [% IF ( contactprincipalloo.currentis_email ) %]
601
                                       [% IF ( borrower.primary_contact_method == 'email' ) %]
602
                                         <option value="email" selected="selected">Primary email</option>
603
                                       [% ELSE %]
604
                                         <option value="email">Primary email</option>
605
                                       [% END %]
606
                                    [% END %]
607
                                    [% IF ( contactprincipalloo.currentis_emailpro ) %]
608
                                       [% IF ( borrower.primary_contact_method == 'emailpro' ) %]
609
                                         <option value="emailpro" selected="selected">Secondary email</option>
610
                                       [% ELSE %]
611
                                         <option value="emailpro">Secondary email</option>
612
                                       [% END %]
613
                                    [% END %]
614
                                    [% IF ( contactprincipalloo.currentis_fax ) %]
615
                                       [% IF ( borrower.primary_contact_method == 'fax' ) %]
616
                                         <option value="fax" selected="selected">Fax</option>
617
                                       [% ELSE %]
618
                                         <option value="fax">Fax</option>
619
                                       [% END %]
620
                                    [% END %]
621
                                 [% END %]
622
                               </select>
623
                            </li>
574
                        </ol>
624
                        </ol>
575
                    </fieldset>
625
                    </fieldset>
576
                [% END %]
626
                [% END %]
(-)a/members/memberentry.pl (-1 / +10 lines)
Lines 609-614 $template->param('typeloop' => \@typeloop, Link Here
609
        no_categories => $no_categories);
609
        no_categories => $no_categories);
610
if($no_categories){ $no_add = 1; }
610
if($no_categories){ $no_add = 1; }
611
611
612
my @contactprincipalloop;
613
my @fieldArray = qw(phone phonepro mobile email emailpro fax);
614
foreach my $field (@fieldArray) {
615
   if ( !(grep { $field eq $_ } @field_check)){
616
        push @contactprincipalloop,{
617
            'currentis_' . $field => 1
618
        };
619
    }
620
}
621
$template->param('contactprincipalloop' => \@contactprincipalloop);
612
622
613
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
623
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
614
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
624
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
Lines 616-622 $template->param( Link Here
616
    roadtypes => $roadtypes,
626
    roadtypes => $roadtypes,
617
    cities    => $cities,
627
    cities    => $cities,
618
);
628
);
619
620
my $default_borrowertitle = '';
629
my $default_borrowertitle = '';
621
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
630
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
622
631
(-)a/members/moremember.pl (-1 / +2 lines)
Lines 345-351 $template->param( Link Here
345
    borrowernumber  => $borrowernumber,
345
    borrowernumber  => $borrowernumber,
346
    othernames      => $data->{'othernames'},
346
    othernames      => $data->{'othernames'},
347
    categoryname    => $data->{'description'},
347
    categoryname    => $data->{'description'},
348
    was_renewed     => scalar $input->param('was_renewed') ? 1 : 0,
348
    primary_contact_method  => $data->{'primary_contact_method'},
349
    was_renewed     => $input->param('was_renewed') ? 1 : 0,
349
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
350
    todaysdate      => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
350
    totalprice      => sprintf("%.2f", $totalprice),
351
    totalprice      => sprintf("%.2f", $totalprice),
351
    totaldue        => sprintf("%.2f", $total),
352
    totaldue        => sprintf("%.2f", $total),
(-)a/opac/opac-memberentry.pl (-1 / +13 lines)
Lines 89-94 $template->param( Link Here
89
    libraries         => \@libraries,
89
    libraries         => \@libraries,
90
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
90
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
91
);
91
);
92
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
93
        my @field_check=split(/\|/,$check_BorrowerMandatoryField);
94
        my @contactprincipalloop;
95
        my @fieldArray = qw(phone phonepro mobile email emailpro fax);
96
        foreach my $field (@fieldArray) {
97
           if ( !(grep { $field eq $_ } @field_check)){
98
                push @contactprincipalloop,{
99
                    'currentis_' . $field => 1
100
                };
101
            }
102
        }
103
104
        $template->param('contactprincipalloop' => \@contactprincipalloop);
92
105
93
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
106
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
94
my $conflicting_attribute = 0;
107
my $conflicting_attribute = 0;
95
- 

Return to bug 11879