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

(-)a/C4/Members.pm (-47 lines)
Lines 66-78 BEGIN { Link Here
66
        &GetPendingIssues
66
        &GetPendingIssues
67
        &GetAllIssues
67
        &GetAllIssues
68
68
69
        &getidcity
70
71
        &GetFirstValidEmailAddress
69
        &GetFirstValidEmailAddress
72
        &GetNoticeEmailAddress
70
        &GetNoticeEmailAddress
73
71
74
        &GetAge
72
        &GetAge
75
        &GetCities
76
        &GetSortDetails
73
        &GetSortDetails
77
        &GetTitles
74
        &GetTitles
78
75
Lines 1356-1376 sub get_cardnumber_length { Link Here
1356
    return ( $min, $max );
1353
    return ( $min, $max );
1357
}
1354
}
1358
1355
1359
=head2 getdcity (OUEST-PROVENCE)
1360
1361
recover cityid  with city_name condition
1362
1363
=cut
1364
1365
sub getidcity {
1366
    my ($city_name) = @_;
1367
    my $dbh = C4::Context->dbh;
1368
    my $sth = $dbh->prepare("select cityid from cities where city_name=? ");
1369
    $sth->execute($city_name);
1370
    my $data = $sth->fetchrow;
1371
    return $data;
1372
}
1373
1374
=head2 GetFirstValidEmailAddress
1356
=head2 GetFirstValidEmailAddress
1375
1357
1376
  $email = GetFirstValidEmailAddress($borrowernumber);
1358
  $email = GetFirstValidEmailAddress($borrowernumber);
Lines 1677-1711 sub SetAge{ Link Here
1677
    return $borrower;
1659
    return $borrower;
1678
}    # sub SetAge
1660
}    # sub SetAge
1679
1661
1680
=head2 GetCities
1681
1682
  $cityarrayref = GetCities();
1683
1684
  Returns an array_ref of the entries in the cities table
1685
  If there are entries in the table an empty row is returned
1686
  This is currently only used to populate a popup in memberentry
1687
1688
=cut
1689
1690
sub GetCities {
1691
1692
    my $dbh   = C4::Context->dbh;
1693
    my $city_arr = $dbh->selectall_arrayref(
1694
        q|SELECT cityid,city_zipcode,city_name,city_state,city_country FROM cities ORDER BY city_name|,
1695
        { Slice => {} });
1696
    if ( @{$city_arr} ) {
1697
        unshift @{$city_arr}, {
1698
            city_zipcode => q{},
1699
            city_name    => q{},
1700
            cityid       => q{},
1701
            city_state   => q{},
1702
            city_country => q{},
1703
        };
1704
    }
1705
1706
    return  $city_arr;
1707
}
1708
1709
=head2 GetSortDetails (OUEST-PROVENCE)
1662
=head2 GetSortDetails (OUEST-PROVENCE)
1710
1663
1711
  ($lib) = &GetSortDetails($category,$sortvalue);
1664
  ($lib) = &GetSortDetails($category,$sortvalue);
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc (-9 / +10 lines)
Lines 80-96 Link Here
80
      [% END %]
80
      [% END %]
81
      City: </label>
81
      City: </label>
82
        <input type="text" id="city" name="city" size="20" value="[% city %]" />
82
        <input type="text" id="city" name="city" size="20" value="[% city %]" />
83
        [% IF ( city_cgipopup ) %]or choose
83
        [% IF cities.count %]or choose
84
        <select id="select_city" name="select_city">
84
        <select id="select_city" name="select_city">
85
        [% FOREACH city_loo IN city_loop %]
85
            <option value="|||"></option>
86
            [% IF ( city_loo.selected ) %]
86
            [% FOREACH c IN cities %]
87
            <option value="[% city_loo.city_zipcode %]|[% city_loo.city_name %]|[% city_loo.city_state %]|[% city_loo.city_country %]" selected="selected">
87
                [% IF c.city_name == city %]
88
            [% ELSE %]
88
                <option value="[% c.city_zipcode %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]" selected="selected">
89
            <option value="[% city_loo.city_zipcode %]|[% city_loo.city_name %]|[% city_loo.city_state %]|[% city_loo.city_country %]">
89
                [% ELSE %]
90
                <option value="[% c.city_zipcode %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]">
91
                [% END %]
92
                    [% c.city_name %] [% c.city_state %] [% c.city_zipcode %]
93
                </option>
90
            [% END %]
94
            [% END %]
91
                [% city_loo.city_name %] [% city_loo.city_state %] [% city_loo.city_zipcode %]
92
            </option>
93
        [% END %]
94
        </select>
95
        </select>
95
        [% END %]
96
        [% END %]
96
      [% IF ( mandatorycity ) %]<span class="required">Required</span>[% END %]
97
      [% IF ( mandatorycity ) %]<span class="required">Required</span>[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc (-9 / +10 lines)
Lines 68-84 Link Here
68
      [% END %]
68
      [% END %]
69
      City: </label>
69
      City: </label>
70
        <input type="text" id="city" name="city" size="20" value="[% city %]" />
70
        <input type="text" id="city" name="city" size="20" value="[% city %]" />
71
        [% IF ( city_cgipopup ) %]or choose
71
        [% IF cities.count %]or choose
72
        <select id="select_city" name="select_city">
72
        <select id="select_city" name="select_city">
73
        [% FOREACH city_loo IN city_loop %]
73
            <option value="|||"></option>
74
            [% IF ( city_loo.selected ) %]
74
            [% FOREACH c IN cities %]
75
            <option value="[% city_loo.city_zipcode %]|[% city_loo.city_name %]|[% city_loo.city_state %]|[% city_loo.city_country %]" selected="selected">
75
                [% IF c.city_name == city %]
76
            [% ELSE %]
76
                <option value="[% c.city_zipcode %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]" selected="selected">
77
            <option value="[% city_loo.city_zipcode %]|[% city_loo.city_name %]|[% city_loo.city_state %]|[% city_loo.city_country %]">
77
                [% ELSE %]
78
                <option value="[% c.city_zipcode %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]">
79
                [% END %]
80
                    [% c.city_name %] [% c.city_state %] [% c.city_zipcode %]
81
                </option>
78
            [% END %]
82
            [% END %]
79
                [% city_loo.city_name %] [% city_loo.city_state %] [% city_loo.city_zipcode %]
80
            </option>
81
        [% END %]
82
        </select>
83
        </select>
83
        [% END %]
84
        [% END %]
84
      [% IF ( mandatorycity ) %]<span class="required">Required</span>[% END %]
85
      [% IF ( mandatorycity ) %]<span class="required">Required</span>[% END %]
(-)a/members/memberentry.pl (-27 / +6 lines)
Lines 40-45 use C4::Letters; Link Here
40
use C4::Branch; # GetBranches
40
use C4::Branch; # GetBranches
41
use C4::Form::MessagingPreferences;
41
use C4::Form::MessagingPreferences;
42
use Koha::Borrower::Debarments;
42
use Koha::Borrower::Debarments;
43
use Koha::Cities;
43
use Koha::DateUtils;
44
use Koha::DateUtils;
44
use Email::Valid;
45
use Email::Valid;
45
use Module::Load;
46
use Module::Load;
Lines 83-94 $nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate'); # FIXME hack to rep Link Here
83
                                     # modifying an existing patron, it ipso facto
84
                                     # modifying an existing patron, it ipso facto
84
                                     # isn't a duplicate.  Marking FIXME because this
85
                                     # isn't a duplicate.  Marking FIXME because this
85
                                     # script needs to be refactored.
86
                                     # script needs to be refactored.
86
my $select_city   = $input->param('select_city');
87
my $nok           = $input->param('nok');
87
my $nok           = $input->param('nok');
88
my $guarantorinfo = $input->param('guarantorinfo');
88
my $guarantorinfo = $input->param('guarantorinfo');
89
my $step          = $input->param('step') || 0;
89
my $step          = $input->param('step') || 0;
90
my @errors;
90
my @errors;
91
my $default_city;
92
my $borrower_data;
91
my $borrower_data;
93
my $NoUpdateLogin;
92
my $NoUpdateLogin;
94
my $userenv = C4::Context->userenv;
93
my $userenv = C4::Context->userenv;
Lines 531-561 foreach (qw(C A S P I X)) { Link Here
531
$template->param('typeloop' => \@typeloop,
530
$template->param('typeloop' => \@typeloop,
532
        no_categories => $no_categories);
531
        no_categories => $no_categories);
533
if($no_categories){ $no_add = 1; }
532
if($no_categories){ $no_add = 1; }
534
# test in city
535
if ( $guarantorid ) {
536
    $select_city = getidcity($data{city});
537
}
538
($default_city=$select_city) if ($step eq 0);
539
if (!defined($select_city) or $select_city eq '' ){
540
	$default_city = &getidcity($data{'city'});
541
}
542
533
543
my $city_arrayref = GetCities();
544
if (@{$city_arrayref} ) {
545
    $template->param( city_cgipopup => 1);
546
534
547
    if ($default_city) { # flag the current or default val
535
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
548
        for my $city ( @{$city_arrayref} ) {
549
            if ($default_city == $city->{cityid}) {
550
                $city->{selected} = 1;
551
                last;
552
            }
553
        }
554
    }
555
}
556
  
557
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE', $data{streettype} );
536
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE', $data{streettype} );
558
$template->param( roadtypes => $roadtypes);
537
$template->param(
538
    roadtypes => $roadtypes,
539
    cities    => $cities,
540
);
559
541
560
my $default_borrowertitle = '';
542
my $default_borrowertitle = '';
561
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
543
unless ( $op eq 'duplicate' ) { $default_borrowertitle=$data{'title'} }
Lines 683-689 $template->param( step => $step ) if $step; # associate with step to know wh Link Here
683
$template->param(
665
$template->param(
684
  BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
666
  BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
685
  category_type => $category_type,#to know the category type of the borrower
667
  category_type => $category_type,#to know the category type of the borrower
686
  select_city => $select_city,
687
  "$category_type"  => 1,# associate with step to know where u are
668
  "$category_type"  => 1,# associate with step to know where u are
688
  destination   => $destination,#to know wher u come from and wher u must go in redirect
669
  destination   => $destination,#to know wher u come from and wher u must go in redirect
689
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
670
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
Lines 695-701 $template->param( Link Here
695
  borrowernumber  => $borrowernumber, #register number
676
  borrowernumber  => $borrowernumber, #register number
696
  guarantorid => ($borrower_data->{'guarantorid'} || $guarantorid),
677
  guarantorid => ($borrower_data->{'guarantorid'} || $guarantorid),
697
  relshiploop => \@relshipdata,
678
  relshiploop => \@relshipdata,
698
  city_loop => $city_arrayref,
699
  borrotitlepopup => $borrotitlepopup,
679
  borrotitlepopup => $borrotitlepopup,
700
  guarantorinfo   => $guarantorinfo,
680
  guarantorinfo   => $guarantorinfo,
701
  flagloop  => \@flagdata,
681
  flagloop  => \@flagdata,
702
- 

Return to bug 15631