Add separate fields for zip and city in order form
continuous-integration/drone/push Build is passing Details

Many people forget to enter zip and city in their merchandise order, so
we add seaprate fields to remind them.
pull/2476/head
Reinhard Müller 11 months ago
parent 1091ba0f9a
commit 7d9ec041c3

@ -2,7 +2,7 @@
# -----------------------------------------------------------------------------
# Process merchandise order
# -----------------------------------------------------------------------------
# Copyright (C) 2008-2019 Free Software Foundation Europe <contact@fsfe.org>
# Copyright (C) 2008-2022 Free Software Foundation Europe <contact@fsfe.org>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
@ -39,6 +39,8 @@ if ($query->param("url")) {
my $name = decode("utf-8", $query->param("name"));
my $address = decode("utf-8", $query->param("address"));
my $zip = decode("utf-8", $query->param("zip"));
my $city = decode("utf-8", $query->param("city"));
my $country = decode("utf-8", $query->param("country"));
my ($country_code, $country_name) = split /\|/, $country;
my $email = decode("utf-8", $query->param("email"));
@ -55,7 +57,7 @@ if ($country_code eq 'DE') {
}
# Remove all parameters except for items and prices.
$query->delete("url", "name", "address", "country", "email", "phone", "language");
$query->delete("url", "name", "address", "zip", "city", "country", "email", "phone", "language");
my $lang = substr $language, 0, 2;
@ -69,6 +71,12 @@ if (!$name) {
exit;
}
if (!$address or !$zip or !$city or !$country) {
print "Content-type: text/html\n\n";
print "<p>Please enter your complete address!</p>\n";
exit;
}
if (!$email) {
print "Content-type: text/html\n\n";
print "<p>Please enter your email address!</p>\n";
@ -119,7 +127,7 @@ my $reference = "MP" . $date . (substr $time, -4) . (sprintf "%03u", $amount);
# Compile email text
# -----------------------------------------------------------------------------
my $body = "$name\n$address\n$country_name\nPhone: $phone\n\n";
my $body = "$name\n$address\n$zip $city\n$country_name\nPhone: $phone\n\n";
foreach $item ($query->param) {
$value = $query->param($item);
@ -153,6 +161,7 @@ push @odtfill, "/tmp/invoice.odt";
push @odtfill, "repeat=" . $count;
push @odtfill, "Name=" . $name;
push @odtfill, "Address=" . $address =~ s/\n/\\n/gr;
push @odtfill, "ZipCity=" . $zip . " " . $city;
push @odtfill, "Country=" . $country_name;
foreach $item ($query->param) {
$value = $query->param($item);

@ -87,7 +87,21 @@
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Adresse:</label>
<div class="col-sm-4">
<textarea class="form-control" rows="5" id="address" name="address" type="text" />
<textarea class="form-control" rows="3" id="address" name="address" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Postleitzahl:</label>
<div class="col-sm-4">
<input class="form-control" id="zip" name="zip" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Ort:</label>
<div class="col-sm-4">
<input class="form-control" id="city" name="city" type="text" />
</div>
</div>

@ -86,7 +86,21 @@
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Address:</label>
<div class="col-sm-4">
<textarea class="form-control" rows="5" id="address" name="address" type="text" />
<textarea class="form-control" rows="3" id="address" name="address" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Zip:</label>
<div class="col-sm-4">
<input class="form-control" id="zip" name="zip" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">City:</label>
<div class="col-sm-4">
<input class="form-control" id="city" name="city" type="text" />
</div>
</div>

@ -86,7 +86,21 @@
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Dirección:</label>
<div class="col-sm-4">
<textarea class="form-control" rows="5" id="address" name="address" type="text" />
<textarea class="form-control" rows="3" id="address" name="address" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Código postal:</label>
<div class="col-sm-4">
<input class="form-control" id="zip" name="zip" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Ciudad:</label>
<div class="col-sm-4">
<input class="form-control" id="city" name="city" type="text" />
</div>
</div>

@ -84,9 +84,23 @@
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Adresse complète:</label>
<label class="col-sm-2 control-label" for="address">Adresse :</label>
<div class="col-sm-4">
<textarea class="form-control" rows="5" id="address" name="address" type="text" />
<textarea class="form-control" rows="3" id="address" name="address" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Code postal :</label>
<div class="col-sm-4">
<input class="form-control" id="zip" name="zip" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Ville :</label>
<div class="col-sm-4">
<input class="form-control" id="city" name="city" type="text" />
</div>
</div>

@ -86,7 +86,21 @@
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Indirizzo:</label>
<div class="col-sm-4">
<textarea class="form-control" rows="5" id="address" name="address" type="text" />
<textarea class="form-control" rows="3" id="address" name="address" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Codice postale:</label>
<div class="col-sm-4">
<input class="form-control" id="zip" name="zip" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Città:</label>
<div class="col-sm-4">
<input class="form-control" id="city" name="city" type="text" />
</div>
</div>

@ -79,7 +79,7 @@
<h2>Je gegevens</h2>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">naam:</label>
<label class="col-sm-2 control-label" for="name">Naam:</label>
<div class="col-sm-4">
<input class="form-control" id="name" name="name" type="text" />
</div>
@ -88,7 +88,21 @@
<div class="row form-group">
<label class="col-sm-2 control-label" for="address">Adres:</label>
<div class="col-sm-4">
<textarea class="form-control" rows="5" id="address" name="address" type="text" />
<textarea class="form-control" rows="3" id="address" name="address" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Postcode:</label>
<div class="col-sm-4">
<input class="form-control" id="zip" name="zip" type="text" />
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label" for="name">Plaats:</label>
<div class="col-sm-4">
<input class="form-control" id="city" name="city" type="text" />
</div>
</div>

Binary file not shown.
Loading…
Cancel
Save