<?php
namespace {
/*
* Isotope eCommerce for Contao Open Source CMS
*
* Copyright (C) 2009 - 2019 terminal42 gmbh & Isotope eCommerce Workgroup
*
* @link https://isotopeecommerce.org
* @license https://opensource.org/licenses/lgpl-3.0.html
*/
/**
* Table tl_iso_address
*/
$GLOBALS['TL_DCA']['tl_iso_address'] = array(
// Config
'config' => array('dataContainer' => 'Table', 'enableVersioning' => \false, 'ptable' => '', 'dynamicPtable' => \true, 'onload_callback' => array(), 'sql' => array('keys' => array('id' => 'primary', 'pid,store_id' => 'index'))),
// List
'list' => array('sorting' => array('mode' => 4, 'headerFields' => array('firstname', 'lastname', 'username'), 'disableGrouping' => \true, 'flag' => 1, 'panelLayout' => 'filter;sort,search,limit', 'child_record_callback' => array('Isotope\\Backend\\Address\\Callback', 'renderLabel')), 'global_operations' => array('all' => array('href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('href' => 'act=edit', 'icon' => 'edit.svg'), 'copy' => array('href' => 'act=copy', 'icon' => 'copy.svg'), 'delete' => array('href' => 'act=delete', 'icon' => 'delete.svg', 'attributes' => 'onclick="if (!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '') . '\')) return false; Backend.getScrollOffset();"'), 'show' => array('href' => 'act=show', 'icon' => 'show.svg'))),
// Palettes
'palettes' => array('default' => '{store_legend},label,store_id;{personal_legend},gender,salutation,firstname,lastname,dateOfBirth,company,vat_no;{address_legend},street_1,street_2,street_3,street_number_1,street_number_2,street_number_3,postal,city,subdivision,country;{contact_legend},email,phone;{default_legend:hide},isDefaultBilling,isDefaultShipping'),
// Fields
'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'ptable' => array('sql' => "varchar(64) NOT NULL default ''"), 'label' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'store_id' => array('exclude' => \true, 'filter' => \true, 'sorting' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 2, 'rgxp' => 'digit', 'tl_class' => 'w50'), 'sql' => "int(2) unsigned NOT NULL default '0'"), 'gender' => array('exclude' => \true, 'inputType' => 'select', 'options' => array('male', 'female'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('includeBlankOption' => \true, 'feEditable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'salutation' => array('exclude' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'firstname' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'lastname' => array('exclude' => \true, 'search' => \true, 'sorting' => \true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'dateOfBirth' => array('exclude' => \true, 'inputType' => 'text', 'eval' => array('rgxp' => 'date', 'datepicker' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50 wizard'), 'sql' => "varchar(11) NOT NULL default ''"), 'company' => array('exclude' => \true, 'search' => \true, 'sorting' => \true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => \false, 'maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'vat_no' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'street_1' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'street_2' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'street_3' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'postal' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 32, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'clr w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'city' => array('exclude' => \true, 'filter' => \true, 'search' => \true, 'sorting' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'subdivision' => array('exclude' => \true, 'sorting' => \true, 'inputType' => 'conditionalselect', 'options_callback' => array('Isotope\\Backend', 'getSubdivisions'), 'eval' => array('feEditable' => \true, 'feGroup' => 'address', 'conditionField' => 'country', 'includeBlankOption' => \true, 'tl_class' => 'w50'), 'sql' => "varchar(10) NOT NULL default ''"), 'country' => array(
'exclude' => \true,
'filter' => \true,
'sorting' => \true,
'inputType' => 'select',
'options' => \Contao\System::getCountries(),
// Do not use options_callback, countries are modified by store config in the frontend
'eval' => array('mandatory' => \true, 'feEditable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50', 'chosen' => \true),
'sql' => "varchar(32) NOT NULL default ''",
), 'phone' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \false, 'maxlength' => 64, 'rgxp' => 'phone', 'feEditable' => \true, 'feGroup' => 'contact', 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'email' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 64, 'rgxp' => 'email', 'feEditable' => \true, 'feGroup' => 'contact', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'isDefaultBilling' => array('exclude' => \true, 'filter' => \true, 'inputType' => 'checkbox', 'eval' => array('feEditable' => \true, 'feGroup' => 'login', 'membersOnly' => \true, 'tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''", 'save_callback' => array(array('Isotope\\Backend\\Address\\Callback', 'updateDefault'))), 'isDefaultShipping' => array('exclude' => \true, 'filter' => \true, 'inputType' => 'checkbox', 'eval' => array('feEditable' => \true, 'feGroup' => 'login', 'membersOnly' => \true, 'tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''", 'save_callback' => array(array('Isotope\\Backend\\Address\\Callback', 'updateDefault')))),
);
/**
* Dynamically add parent table
*/
if ('member' === \Contao\Input::get('do')) {
$GLOBALS['TL_DCA']['tl_iso_address']['config']['ptable'] = 'tl_member';
} elseif ('iso_orders' === \Contao\Input::get('do')) {
$GLOBALS['TL_DCA']['tl_iso_address']['config']['ptable'] = 'tl_iso_product_collection';
}
}
namespace {
$GLOBALS['TL_DCA']['tl_iso_address']['fields']['salutation'] = array('exclude' => \true, 'inputType' => 'radio', 'options' => array('Mrs.', 'Mr.'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''");
$positionOptions = array();
\asort($positionOptions);
$positionOptions = \range(1, 1000);
$GLOBALS['TL_DCA']['tl_iso_address']['fields']['position'] = ['label' => &$GLOBALS['TL_LANG']['tl_iso_address']['position'], 'inputType' => 'select', 'options' => $positionOptions, 'reference' => &$GLOBALS['TL_LANG']['tl_iso_address']['position_option'], 'eval' => array('includeBlankOption' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w100'), 'sql' => "varchar(255) NOT NULL default ''"];
$industryOptions = array();
\asort($industryOptions);
$industryOptions = \range(1, 1000);
$GLOBALS['TL_DCA']['tl_iso_address']['fields']['industry'] = ['label' => &$GLOBALS['TL_LANG']['tl_iso_address']['industry'], 'inputType' => 'select', 'options' => $industryOptions, 'reference' => &$GLOBALS['TL_LANG']['tl_iso_address']['industry_option'], 'eval' => array('includeBlankOption' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w100'), 'sql' => "varchar(255) NOT NULL default ''"];
\Contao\CoreBundle\DataContainer\PaletteManipulator::create()->addField('position', 'country', \Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)->applyToPalette('default', 'tl_iso_address');
}