Making WordPress.org


Ignore:
Timestamp:
06/15/2017 02:17:54 PM (9 years ago)
Author:
coreymckrill
Message:

WordCamp Post Types: Make sponsor invoice province field optional

Some regions don't have a state or province as part of their official
address format. However, some banks always require that field on
invoices, regardless of the country. The solution in this patch is to
make the state/province field optional, but add the string
"Not applicable" if the field is left blank when the form data is
saved.

Props davidmosterd
Fixes #2711

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-info.php

    r5509 r5575  
    142142
    143143<ul class="wcpt-form">
    144         <li class="wcpt-form-header">
    145                 <?php _e( 'Address', 'wordcamporg' ); ?>
    146         </li>
    147 
    148         <li>
    149                 <label for="_wcpt_sponsor_street_address1">
    150                         <?php _e( 'Street Address 1:', 'wordcamporg' ); ?>
    151                 </label>
    152 
    153                 <input
    154                         type="text"
    155                         class="regular-text"
    156                         id="_wcpt_sponsor_street_address1"
    157                         name="_wcpt_sponsor_street_address1"
    158                         value="<?php echo esc_attr( $street_address1 ); ?>"
    159                     required
    160                 />
    161 
    162                 <?php $this->render_form_field_required_indicator(); ?>
    163         </li>
    164 
    165         <li>
    166                 <label for="_wcpt_sponsor_street_address2">
    167                         <?php _e( 'Street Address 2:', 'wordcamporg' ); ?>
    168                 </label>
    169 
    170                 <input
    171                         type="text"
    172                         class="regular-text"
    173                         id="_wcpt_sponsor_street_address2"
    174                         name="_wcpt_sponsor_street_address2"
    175                         value="<?php echo esc_attr( $street_address2 ); ?>"
    176                 />
    177         </li>
    178 
    179         <li>
    180                 <label for="_wcpt_sponsor_city">
    181                         <?php _e( 'City:', 'wordcamporg' ); ?>
    182                 </label>
    183 
    184                 <input
    185                         type="text"
    186                         class="regular-text"
    187                         id="_wcpt_sponsor_city"
    188                         name="_wcpt_sponsor_city"
    189                         value="<?php echo esc_attr( $city ); ?>"
    190                     required
    191                 />
    192 
    193                 <?php $this->render_form_field_required_indicator(); ?>
    194         </li>
    195 
    196         <li>
    197                 <label for="_wcpt_sponsor_state">
    198                         <?php _e( 'State / Province:', 'wordcamporg' ); ?>
    199                 </label>
    200 
    201                 <input
    202                         type="text"
    203                         class="regular-text"
    204                         id="_wcpt_sponsor_state"
    205                         name="_wcpt_sponsor_state"
    206                         value="<?php echo esc_attr( $state ); ?>"
    207                     required
    208                 />
    209 
    210                 <?php $this->render_form_field_required_indicator(); ?>
    211         </li>
    212 
    213         <li>
    214                 <label for="_wcpt_sponsor_zip_code">
    215                         <?php _e( 'ZIP / Postal Code:', 'wordcamporg' ); ?>
    216                 </label>
    217 
    218                 <input
    219                         type="text"
    220                         class="regular-text"
    221                         id="_wcpt_sponsor_zip_code"
    222                         name="_wcpt_sponsor_zip_code"
    223                         value="<?php echo esc_attr( $zip_code ); ?>"
    224                         maxlength="30"
    225                     required
    226                 />
    227 
    228                 <?php $this->render_form_field_required_indicator(); ?>
    229         </li>
    230 
    231144        <li>
    232145                <label for="_wcpt_sponsor_country">
     
    249162                <?php $this->render_form_field_required_indicator(); ?>
    250163        </li>
     164
     165        <li class="wcpt-form-header">
     166                <?php _e( 'Address', 'wordcamporg' ); ?>
     167        </li>
     168
     169        <li>
     170                <label for="_wcpt_sponsor_street_address1">
     171                        <?php _e( 'Street Address 1:', 'wordcamporg' ); ?>
     172                </label>
     173
     174                <input
     175                        type="text"
     176                        class="regular-text"
     177                        id="_wcpt_sponsor_street_address1"
     178                        name="_wcpt_sponsor_street_address1"
     179                        value="<?php echo esc_attr( $street_address1 ); ?>"
     180                    required
     181                />
     182
     183                <?php $this->render_form_field_required_indicator(); ?>
     184        </li>
     185
     186        <li>
     187                <label for="_wcpt_sponsor_street_address2">
     188                        <?php _e( 'Street Address 2:', 'wordcamporg' ); ?>
     189                </label>
     190
     191                <input
     192                        type="text"
     193                        class="regular-text"
     194                        id="_wcpt_sponsor_street_address2"
     195                        name="_wcpt_sponsor_street_address2"
     196                        value="<?php echo esc_attr( $street_address2 ); ?>"
     197                />
     198        </li>
     199
     200        <li>
     201                <label for="_wcpt_sponsor_city">
     202                        <?php _e( 'City:', 'wordcamporg' ); ?>
     203                </label>
     204
     205                <input
     206                        type="text"
     207                        class="regular-text"
     208                        id="_wcpt_sponsor_city"
     209                        name="_wcpt_sponsor_city"
     210                        value="<?php echo esc_attr( $city ); ?>"
     211                    required
     212                />
     213
     214                <?php $this->render_form_field_required_indicator(); ?>
     215        </li>
     216
     217        <li>
     218                <label for="_wcpt_sponsor_state">
     219                        <?php _e( 'State / Province:', 'wordcamporg' ); ?>
     220                </label>
     221
     222                <input
     223                        type="text"
     224                        class="regular-text"
     225                        id="_wcpt_sponsor_state"
     226                        name="_wcpt_sponsor_state"
     227                        value="<?php echo esc_attr( $state ); ?>"
     228                />
     229
     230                <span class="description">
     231                        <?php esc_html_e( 'Only necessary if you want this to be shown on your invoice', 'wordcamporg' ); ?>
     232                </span>
     233        </li>
     234
     235        <li>
     236                <label for="_wcpt_sponsor_zip_code">
     237                        <?php _e( 'ZIP / Postal Code:', 'wordcamporg' ); ?>
     238                </label>
     239
     240                <input
     241                        type="text"
     242                        class="regular-text"
     243                        id="_wcpt_sponsor_zip_code"
     244                        name="_wcpt_sponsor_zip_code"
     245                        value="<?php echo esc_attr( $zip_code ); ?>"
     246                        maxlength="30"
     247                    required
     248                />
     249
     250                <?php $this->render_form_field_required_indicator(); ?>
     251        </li>
    251252</ul>
    252253
Note: See TracChangeset for help on using the changeset viewer.