remove constants for size in Schema
authorTim Mallezie <tim.mallezie@chiro.be>
Thu, 7 May 2015 19:10:19 +0000 (21:10 +0200)
committerTim Mallezie <tim.mallezie@chiro.be>
Thu, 7 May 2015 19:10:19 +0000 (21:10 +0200)
CRM/Core/CodeGen/Specification.php
xml/schema/Contact/Contact.xml
xml/schema/Contribute/Contribution.xml
xml/schema/Core/Email.xml
xml/schema/Core/Phone.xml
xml/schema/Core/Website.xml
xml/schema/Financial/FinancialTrxn.xml
xml/schema/Price/PriceFieldValue.xml

index 86c69c0b289e28b9aa73d5de41a764238968b6d1..516a11e326b5e526e1614c04dff6978507ef228a 100644 (file)
@@ -660,35 +660,14 @@ class CRM_Core_CodeGen_Specification {
 
   /**
    * Sets the size property of a textfield.
-   * See constants defined in CRM_Utils_Type for possible values
    */
   protected function getSize($fieldXML) {
     // Extract from <size> tag if supplied
     if (!empty($fieldXML->html) && $this->value('size', $fieldXML->html)) {
-      $const = 'CRM_Utils_Type::' . strtoupper($fieldXML->html->size);
-      if (defined($const)) {
-        return $const;
-      }
+      return $this->value('size', $fieldXML->html);
     }
     // Infer from <length> tag if <size> was not explicitly set or was invalid
-
-    // This map is slightly different from CRM_Core_Form_Renderer::$_sizeMapper
-    // Because we usually want fields to render as smaller than their maxlength
-    $sizes = array(
-      2 => 'TWO',
-      4 => 'FOUR',
-      6 => 'SIX',
-      8 => 'EIGHT',
-      16 => 'TWELVE',
-      32 => 'MEDIUM',
-      64 => 'BIG',
-    );
-    foreach ($sizes as $length => $name) {
-      if ($fieldXML->length <= $length) {
-        return "CRM_Utils_Type::$name";
-      }
-    }
-    return 'CRM_Utils_Type::HUGE';
+    return $fieldXML->length;
   }
 
 }
index d8c78e8d369c1c11bf6563a9b94cb933b2514b80..06f6b50d67a40cbd517fa484b28e988f9a4aef7e 100644 (file)
     <length>64</length>
     <html>
       <type>Text</type>
-      <size>EIGHT</size>
+      <size>8</size>
     </html>
 
     <import>true</import>
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
 
     <export>true</export>
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
 
     <export>true</export>
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
 
     <import>true</import>
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
 
     <import>true</import>
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
 
     <import>true</import>
     <add>1.1</add>
     <html>
       <type>File</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
   </field>
   <field>
     <length>255</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
 
     <import>true</import>
     <length>64</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/^first|(f(irst\s)?name)$/i</headerPattern>
     <length>64</length>
     <html>
       <type>Text</type>
-      <size>MEDIUM</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/^middle|(m(iddle\s)?name)$/i</headerPattern>
     <length>64</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/^last|(l(ast\s)?name)$/i</headerPattern>
     <length>255</length>
     <html>
       <type>Text</type>
-      <size>MEDIUM</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/^job|(j(ob\s)?title)$/i</headerPattern>
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/^household|(h(ousehold\s)?name)$/i</headerPattern>
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/^organization|(o(rganization\s)?name)$/i</headerPattern>
index df7f9c0af1ddc330a990e35563531510267467b9..e7b166204e8cccef54f929170c42dab95d2b99df 100644 (file)
     <length>255</length>
     <html>
       <type>Text</type>
-      <size>SIX</size>
+      <size>6</size>
     </html>
     <import>true</import>
     <add>2.2</add>
index a731fae3cc5ca5ee72a7ae7de52c08492a94dc4f..9e60f7f804dbc20ee99af7c648e679e57a255c3a 100644 (file)
@@ -60,7 +60,7 @@
     <length>254</length>
     <html>
       <type>Text</type>
-      <size>MEDIUM</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/e.?mail/i</headerPattern>
index dd854ec11d5104cb3d2e3788cd7908dd8ce94100..7dee80ee063f5985f3404988543ce771d9040cd0 100644 (file)
     <length>16</length>
     <html>
       <type>Text</type>
-      <size>FOUR</size>
+      <size>4</size>
     </html>
     <import>true</import>
     <export>true</export>
index 32a68a4c76fc04a7abd7112debbdc8359abd3a54..7eda447a1081ef57eb44983ffe2e50d4775de29d 100644 (file)
@@ -39,7 +39,7 @@
     <length>128</length>
     <html>
       <type>Text</type>
-      <size>BIG</size>
+      <size>30</size>
     </html>
     <import>true</import>
     <headerPattern>/Website/i</headerPattern>
index 8aee581831a39e17ec7f214a8fc7ba1de70dcf3b..9ec34cd0186cfc07ced6a493ea8d67e5d3c7fb70 100755 (executable)
     <length>255</length>
     <html>
       <type>Text</type>
-      <size>SIX</size>
+      <size>6</size>
     </html>
     <add>4.3</add>
   </field>
index 060c9e45241b33302ab080eabbb06aab187ab0c6..256a5284d737500a80e44c124f06d06c79086f49 100644 (file)
@@ -74,7 +74,7 @@
     <length>512</length>
     <html>
       <type>Text</type>
-      <size>EIGHT</size>
+      <size>8</size>
     </html>
     <required>true</required>
     <comment>Price field option amount</comment>