Pārlūkot izejas kodu

combine country code and country name because we need both. will be split in promotion.php

tags/contribute2018
Max Mehl 5 mēnešus atpakaļ
vecāks
revīzija
07dfe2a83d
Parakstījis: max.mehl <max.mehl@fsfe.org> GPG atslēgas ID: 2704E4AB371E2E92
3 mainītis faili ar 9 papildinājumiem un 6 dzēšanām
  1. 7
    3
      cgi-bin/promotion.php
  2. 1
    2
      contribute/spreadtheword.xsl
  3. 1
    1
      tools/xsltsl/countries.xsl

+ 7
- 3
cgi-bin/promotion.php Parādīt failu

@@ -72,7 +72,7 @@ function send_mail ( $to, $from, $subject, $msg, $bcc = NULL, $att = NULL, $att_
72 72
   }
73 73
   $headers .= "X-OTRS-DynamicField-OrderLanguage: " . $_POST["language"] . "\n";
74 74
   $headers .= "X-OTRS-DynamicField-OrderState: order\n";
75
-  $headers .= "X-OTRS-DynamicField-PromoMaterialCountry: " . $_POST["country"] . "\n";
75
+  $headers .= "X-OTRS-DynamicField-PromoMaterialCountry: " . $countrycode . "\n";
76 76
   $headers .= "X-OTRS-DynamicField-PromoMaterialLanguages: " . implode(',', $_POST['languages']) . "\n";
77 77
 
78 78
   if ( $att ) {
@@ -129,6 +129,10 @@ if (empty($_POST['lastname'])  ||
129 129
 # Without this, escapeshellarg() will eat non-ASCII characters.
130 130
 setlocale(LC_CTYPE, "en_US.UTF-8");
131 131
 
132
+# $_POST["country"] has values like "DE|Germany", so split this string
133
+$countrycode = explode('|', $_POST["country"])[0];
134
+$countryname = explode('|', $_POST["country"])[1];
135
+
132 136
 if ($_POST['packagetype'] == 'default') {
133 137
   $subject = "Standard promotion material order";
134 138
 } else {
@@ -147,7 +151,7 @@ if (!empty($_POST['org'])) {
147 151
 }
148 152
 $msg .= "{$_POST['street']}\n".
149 153
        "{$_POST['zip']} "."{$_POST['city']}\n".
150
-       "{$_POST['country']}\n".
154
+       "{$countryname}\n".
151 155
        "\n".
152 156
        "Specifics of the Order:\n";
153 157
 # Default or custom package?
@@ -186,7 +190,7 @@ if (!empty($_POST['org'])) {
186 190
 }
187 191
 $address .= $_POST['street'] . "\\n" .
188 192
             $_POST['zip'] . " " . $_POST['city'] . "\\n" .
189
-            $_POST['country'];
193
+            $countryname;
190 194
 $name = escapeshellarg($name);
191 195
 $address = escapeshellarg($address);
192 196
 shell_exec("$odtfill $template $outfile Name=$name Address=$address Name=$name");

+ 1
- 2
contribute/spreadtheword.xsl Parādīt failu

@@ -239,8 +239,7 @@
239 239
   <xsl:template match="add-language">
240 240
     <xsl:element name="input">
241 241
       <xsl:attribute name="type">hidden</xsl:attribute>
242
-      <xsl:attribute name="id">lang</xsl:attribute>
243
-      <xsl:attribute name="name">lang</xsl:attribute>
242
+      <xsl:attribute name="name">language</xsl:attribute>
244 243
       <xsl:attribute name="value">
245 244
         <xsl:value-of select="/buildinfo/document/@language" />
246 245
       </xsl:attribute>

+ 1
- 1
tools/xsltsl/countries.xsl Parādīt failu

@@ -218,7 +218,7 @@
218 218
         <!-- will output: <option value="ZZ">Fooland</option> -->
219 219
         <xsl:element name="option">
220 220
           <xsl:attribute name="value">
221
-            <xsl:value-of select="@id" />
221
+            <xsl:value-of select="@id" />|<xsl:value-of select="." />
222 222
           </xsl:attribute>
223 223
           <xsl:value-of select="." />
224 224
         </xsl:element>  <!-- /option -->

Notiek ielāde…
Atcelt
Saglabāt