{extends file="admin-layout.tpl"} {block name="no-return-functions"} {$admin_current_location = 'configuration'} {/block} {block name="page-title"}{intl l='Country migration'}{/block} {block name="check-resource"}admin.configuration.country{/block} {block name="check-access"}update{/block} {block name="main-content"}
{intl l='Migrate countries'}
{intl l='In version 2.3 of Thelia, the system of country has changed.'} {intl l='Now, countries has been split in countries and states.'}
{intl l="The migration process is tricky and couldn't be automated."}

{intl l="The update process has created new countries (even if it exists) and associated states."}
{intl l="The migration will change the address, tax rules and shipping zones to match with the new system."}
{intl l="After the migration the old country will be hide and the new one shown"}

{intl l="For USA and Canada the states already exists as countries, so you have to select the right state."}
{intl l="For other countries, you should decide to use state or not. "} {intl l="If you want to use the new country with its states, you have to check the migrate checkbox and select a state."} {intl l="We added a 'default' state with a blank name as a fallback. Customer will have the possibility to change it later."}
{if $showForm}
{form name="thelia.admin.country.state.migration"}
{include file = "includes/inner-form-toolbar.html" hide_submit_buttons = false page_url = {url path="/admin/configuration/countries/migrate"} close_url = {url path="/admin/configuration/countries"} } {form_hidden_fields exclude="locale"} {render_form_field field='success_url' value={url path="/admin/configuration/countries/migrate"}} {if $form_error}
{$form_error_message}
{/if} {if {hasflash type="migrate"}}
{flash type="migrate"}
{$MESSAGE}
{/flash}
{/if}
{form_collection form=$form collection="migrations"} {$newCountryId=0} {$countryId=0} {/form_collection}
{intl l='Countries to migrate'}
{intl l="Migrate ?"} {intl l="Old country"} {intl l="New country"} {intl l="State"}
{form_collection_field form=$form row=$row field="migrate"} {/form_collection_field} {form_collection_field form=$form row=$row field="country"} {$countryId={$value}} {/form_collection_field} {form_collection_field form=$form row=$row field="new_country"} {$newCountryId={$value}} {/form_collection_field} {form_collection_field form=$form row=$row field="new_state"} {$ref[]={$label_attr.for}} {/form_collection_field}
{/form}
{else}
{intl l="All countries have been migrated"}
{/if}
{if count($countriesMigrated) > 0 }
{intl l='Countries migrated'}
{foreach $countriesMigrated as $country => $new}
{intl l='Country '} {intl l=' migrated to '} {intl l=' country '} {intl l=' state '}
{/foreach}
{/if}
{/block} {block name="javascript-initialization"} {javascripts file='assets/js/bootstrap-select/bootstrap-select.js'} {/javascripts} {javascripts file='assets/js/libs/underscore-min.js'} {/javascripts} {/block} {block name="javascript-last-call"} {hook name="wysiwyg.js" location="wysiwyg-country-edit-js" } {/block}