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

(-)a/C4/Members.pm (-34 / +17 lines)
Lines 1541-1588 sub add_member_orgs { Link Here
1541
1541
1542
}    # sub add_member_orgs
1542
}    # sub add_member_orgs
1543
1543
1544
=head2 GetCities (OUEST-PROVENCE)
1544
=head2 GetCities
1545
1545
1546
  ($id_cityarrayref, $city_hashref) = &GetCities();
1546
  $cityarrayref = GetCities();
1547
1547
1548
Looks up the different city and zip in the database. Returns two
1548
  Returns an array_ref of the entries in the cities table
1549
elements: a reference-to-array, which lists the zip city
1549
  If there are entries in the table an empty row is returned
1550
codes, and a reference-to-hash, which maps the name of the city.
1550
  This is currently only used to populate a popup in memberentry
1551
WHERE =>OUEST PROVENCE OR EXTERIEUR
1552
1551
1553
=cut
1552
=cut
1554
1553
1555
sub GetCities {
1554
sub GetCities {
1556
1555
1557
    #my ($type_city) = @_;
1558
    my $dbh   = C4::Context->dbh;
1556
    my $dbh   = C4::Context->dbh;
1559
    my $query = qq|SELECT cityid,city_zipcode,city_name 
1557
    my $city_arr = $dbh->selectall_arrayref(
1560
        FROM cities 
1558
        q|SELECT cityid,city_zipcode,city_name FROM cities ORDER BY city_name|,
1561
        ORDER BY city_name|;
1559
        { Slice => {} });
1562
    my $sth = $dbh->prepare($query);
1560
    if ( @{$city_arr} ) {
1563
1561
        unshift @{$city_arr}, {
1564
    #$sth->execute($type_city);
1562
            city_zipcode => q{},
1565
    $sth->execute();
1563
            city_name    => q{},
1566
    my %city;
1564
            cityid       => q{},
1567
    my @id;
1565
        };
1568
    #    insert empty value to create a empty choice in cgi popup
1566
    }
1569
    push @id, " ";
1567
1570
    $city{""} = "";
1568
    return  $city_arr;
1571
    while ( my $data = $sth->fetchrow_hashref ) {
1572
        push @id, $data->{'city_zipcode'}."|".$data->{'city_name'};
1573
        $city{ $data->{'city_zipcode'}."|".$data->{'city_name'} } = $data->{'city_name'};
1574
    }
1575
1576
#test to know if the table contain some records if no the function return nothing
1577
    my $id = @id;
1578
    if ( $id == 1 ) {
1579
        # all we have is the one blank row
1580
        return ();
1581
    }
1582
    else {
1583
        unshift( @id, "" );
1584
        return ( \@id, \%city );
1585
    }
1586
}
1569
}
1587
1570
1588
=head2 GetSortDetails (OUEST-PROVENCE)
1571
=head2 GetSortDetails (OUEST-PROVENCE)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl (-1 / +10 lines)
Lines 403-409 Link Here
403
      City, State: </label>
403
      City, State: </label>
404
        
404
        
405
        <input type="text" id="city" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->" />
405
        <input type="text" id="city" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->" />
406
        <!-- TMPL_IF NAME="city_cgipopup" -->or <strong>choose</strong> <!-- TMPL_VAR NAME="citypopup" --><!-- /TMPL_IF -->
406
        <!-- TMPL_IF NAME="city_cgipopup" -->or <strong>choose</strong>
407
        <select id="select_city" name "select_city">
408
        <!-- TMPL_LOOP NAME="city_loop" -->
409
            <option value="<!-- TMPL_VAR NAME='city_zipcode'-->|<!-- TMPL_VAR NAME='city_name' -->"
410
                <!-- TMPL_IF NAME="selected" --> selected="1" <!-- /TMPL_IF --> >
411
                <!-- TMPL_VAR NAME="city_name" --> <!-- TMPL_VAR NAME="city_zipcode" -->
412
            </option>
413
        <!-- /TMPL_LOOP -->
414
        </select>
415
        <!-- /TMPL_IF -->
407
	  <!-- TMPL_IF NAME="mandatorycity" --><span class="required">Required</span><!-- /TMPL_IF -->
416
	  <!-- TMPL_IF NAME="mandatorycity" --><span class="required">Required</span><!-- /TMPL_IF -->
408
    </li>
417
    </li>
409
    <li> 
418
    <li> 
(-)a/members/memberentry.pl (-12 / +15 lines)
Lines 69-75 my $op = $input->param('op'); Link Here
69
my $destination    = $input->param('destination');
69
my $destination    = $input->param('destination');
70
my $cardnumber     = $input->param('cardnumber');
70
my $cardnumber     = $input->param('cardnumber');
71
my $check_member   = $input->param('check_member');
71
my $check_member   = $input->param('check_member');
72
my $name_city      = $input->param('name_city');
73
my $nodouble       = $input->param('nodouble');
72
my $nodouble       = $input->param('nodouble');
74
$nodouble = 1 if $op eq 'modify'; # FIXME hack to represent fact that if we're
73
$nodouble = 1 if $op eq 'modify'; # FIXME hack to represent fact that if we're
75
                                  # modifying an existing patron, it ipso facto
74
                                  # modifying an existing patron, it ipso facto
Lines 435-449 $select_city=getidcity($data{'city'}) if defined $guarantorid and ($guarantorid Link Here
435
if (!defined($select_city) or $select_city eq '' ){
434
if (!defined($select_city) or $select_city eq '' ){
436
	$default_city = &getidcity($data{'city'});
435
	$default_city = &getidcity($data{'city'});
437
}
436
}
438
my($cityid);
437
439
($cityid,$name_city)=GetCities();
438
my $city_arrayref = GetCities();
440
$template->param( city_cgipopup => 1) if ($cityid );
439
if (@{$city_arrayref} ) {
441
my $citypopup = CGI::popup_menu(-name=>'select_city',
440
    $template->param( city_cgipopup => 1);
442
        -id => 'select_city',
441
443
        '-values' =>$cityid,
442
    if ($default_city) { # flag the current or default val
444
        -labels=>$name_city,
443
        for my $city ( @{$city_arrayref} ) {
445
        -default=>$default_city,
444
            if ($default_city == $city->{cityid}) {
446
        );  
445
                $city->{selected} = 1;
446
                last;
447
            }
448
        }
449
    }
450
}
447
  
451
  
448
my $default_roadtype;
452
my $default_roadtype;
449
$default_roadtype=$data{'streettype'} ;
453
$default_roadtype=$data{'streettype'} ;
Lines 629-635 $template->param( Link Here
629
  guarantorid => (defined($borrower_data->{'guarantorid'})) ? $borrower_data->{'guarantorid'} : $guarantorid,
633
  guarantorid => (defined($borrower_data->{'guarantorid'})) ? $borrower_data->{'guarantorid'} : $guarantorid,
630
  ethcatpopup => $ethcatpopup,
634
  ethcatpopup => $ethcatpopup,
631
  relshiploop => \@relshipdata,
635
  relshiploop => \@relshipdata,
632
  citypopup => $citypopup,
636
  city_loop => $city_arrayref,
633
  roadpopup => $roadpopup,  
637
  roadpopup => $roadpopup,  
634
  borrotitlepopup => $borrotitlepopup,
638
  borrotitlepopup => $borrotitlepopup,
635
  guarantorinfo   => $guarantorinfo,
639
  guarantorinfo   => $guarantorinfo,
636
- 

Return to bug 4248