vendor/isotope/isotope-core/system/modules/isotope/dca/tl_iso_address.php line 241

Open in your IDE?
  1. <?php
  2. /*
  3.  * Isotope eCommerce for Contao Open Source CMS
  4.  *
  5.  * Copyright (C) 2009 - 2019 terminal42 gmbh & Isotope eCommerce Workgroup
  6.  *
  7.  * @link       https://isotopeecommerce.org
  8.  * @license    https://opensource.org/licenses/lgpl-3.0.html
  9.  */
  10. /**
  11.  * Table tl_iso_address
  12.  */
  13. $GLOBALS['TL_DCA']['tl_iso_address'] = array
  14. (
  15.     // Config
  16.     'config' => array
  17.     (
  18.         'dataContainer'             => 'Table',
  19.         'enableVersioning'          => false,
  20.         'ptable'                    => '',
  21.         'dynamicPtable'             => true,
  22.         'onload_callback'           => array(),
  23.         'sql' => array
  24.         (
  25.             'keys' => array
  26.             (
  27.                 'id' => 'primary',
  28.                 'pid,store_id' => 'index',
  29.             )
  30.         ),
  31.     ),
  32.     // List
  33.     'list' => array
  34.     (
  35.         'sorting' => array
  36.         (
  37.             'mode'                  => 4,
  38.             'headerFields'          => array('firstname','lastname''username'),
  39.             'disableGrouping'       => true,
  40.             'flag'                  => 1,
  41.             'panelLayout'           => 'filter;sort,search,limit',
  42.             'child_record_callback' => array('Isotope\Backend\Address\Callback','renderLabel')
  43.         ),
  44.         'global_operations' => array
  45.         (
  46.             'all' => array
  47.             (
  48.                 'href'              => 'act=select',
  49.                 'class'             => 'header_edit_all',
  50.                 'attributes'        => 'onclick="Backend.getScrollOffset();"'
  51.             )
  52.         ),
  53.         'operations' => array
  54.         (
  55.             'edit' => array
  56.             (
  57.                 'href'              => 'act=edit',
  58.                 'icon'              => 'edit.svg'
  59.             ),
  60.             'copy' => array
  61.             (
  62.                 'href'              => 'act=copy',
  63.                 'icon'              => 'copy.svg'
  64.             ),
  65.             'delete' => array
  66.             (
  67.                 'href'              => 'act=delete',
  68.                 'icon'              => 'delete.svg',
  69.                 'attributes'        => 'onclick="if (!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '') . '\')) return false; Backend.getScrollOffset();"'
  70.             ),
  71.             'show' => array
  72.             (
  73.                 'href'              => 'act=show',
  74.                 'icon'              => 'show.svg'
  75.             )
  76.         )
  77.     ),
  78.     // Palettes
  79.     'palettes' => array
  80.     (
  81.         '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',
  82.     ),
  83.     // Fields
  84.     'fields' => array
  85.     (
  86.         'id' => array
  87.         (
  88.             'sql'                 =>  "int(10) unsigned NOT NULL auto_increment",
  89.         ),
  90.         'pid' => array
  91.         (
  92.             'sql'                 =>  "int(10) unsigned NOT NULL default '0'",
  93.         ),
  94.         'tstamp' => array
  95.         (
  96.             'sql'                 =>  "int(10) unsigned NOT NULL default '0'",
  97.         ),
  98.         'ptable' => array
  99.         (
  100.             'sql'                 =>  "varchar(64) NOT NULL default ''",
  101.         ),
  102.         'label' => array
  103.         (
  104.             'exclude'               => true,
  105.             'search'                => true,
  106.             'inputType'             => 'text',
  107.             'eval'                  => array('maxlength'=>255'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50'),
  108.             'sql'                   => "varchar(255) NOT NULL default ''",
  109.         ),
  110.         'store_id' => array
  111.         (
  112.             'exclude'               => true,
  113.             'filter'                => true,
  114.             'sorting'               => true,
  115.             'inputType'             => 'text',
  116.             'eval'                  => array('mandatory'=>true'maxlength'=>2'rgxp'=>'digit''tl_class'=>'w50'),
  117.             'sql'                   => "int(2) unsigned NOT NULL default '0'",
  118.         ),
  119.         'gender' => array
  120.         (
  121.             'exclude'               => true,
  122.             'inputType'             => 'select',
  123.             'options'               => array('male''female''other'),
  124.             'reference'             => &$GLOBALS['TL_LANG']['MSC'],
  125.             'eval'                  => array('includeBlankOption'=>true'feEditable'=>true'feGroup'=>'personal''tl_class'=>'w50'),
  126.             'sql'                   => "varchar(32) NOT NULL default ''",
  127.         ),
  128.         'salutation' => array
  129.         (
  130.             'exclude'               => true,
  131.             'inputType'             => 'text',
  132.             'eval'                  => array('maxlength'=>255'feEditable'=>true'feGroup'=>'personal''tl_class'=>'w50'),
  133.             'sql'                   => "varchar(255) NOT NULL default ''",
  134.         ),
  135.         'firstname' => array
  136.         (
  137.             'exclude'               => true,
  138.             'search'                => true,
  139.             'inputType'             => 'text',
  140.             'eval'                  => array('mandatory'=>true'maxlength'=>255'feEditable'=>true'feGroup'=>'personal''tl_class'=>'w50'),
  141.             'sql'                   => "varchar(255) NOT NULL default ''",
  142.         ),
  143.         'lastname' => array
  144.         (
  145.             'exclude'               => true,
  146.             'search'                => true,
  147.             'sorting'               => true,
  148.             'flag'                  => 1,
  149.             'inputType'             => 'text',
  150.             'eval'                  => array('mandatory'=>true'maxlength'=>255'feEditable'=>true'feGroup'=>'personal''tl_class'=>'w50'),
  151.             'sql'                   => "varchar(255) NOT NULL default ''",
  152.         ),
  153.         'dateOfBirth' => array
  154.         (
  155.             'exclude'                 => true,
  156.             'inputType'               => 'text',
  157.             'eval'                    => array('rgxp'=>'date''datepicker'=>true'feEditable'=>true'feViewable'=>true'feGroup'=>'personal''tl_class'=>'w50 wizard'),
  158.             'sql'                     => "varchar(11) NOT NULL default ''"
  159.         ),
  160.         'company' => array
  161.         (
  162.             'exclude'               => true,
  163.             'search'                => true,
  164.             'sorting'               => true,
  165.             'flag'                  => 1,
  166.             'inputType'             => 'text',
  167.             'eval'                  => array('mandatory'=>false'maxlength'=>255'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50'),
  168.             'sql'                   => "varchar(255) NOT NULL default ''",
  169.         ),
  170.         'vat_no' => array
  171.         (
  172.             'exclude'               => true,
  173.             'search'                => true,
  174.             'inputType'             => 'text',
  175.             'eval'                  => array('maxlength'=>255'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50'),
  176.             'sql'                   => "varchar(255) NOT NULL default ''",
  177.         ),
  178.         'street_1' => array
  179.         (
  180.             'exclude'               => true,
  181.             'search'                => true,
  182.             'inputType'             => 'text',
  183.             'eval'                  => array('mandatory'=>true'maxlength'=>255'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50'),
  184.             'sql'                   => "varchar(255) NOT NULL default ''",
  185.         ),
  186.         'street_2' => array
  187.         (
  188.             'exclude'               => true,
  189.             'search'                => true,
  190.             'inputType'             => 'text',
  191.             'eval'                  => array('maxlength'=>255'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50'),
  192.             'sql'                   => "varchar(255) NOT NULL default ''",
  193.         ),
  194.         'street_3' => array
  195.         (
  196.             'exclude'               => true,
  197.             'search'                => true,
  198.             'inputType'             => 'text',
  199.             'eval'                  => array('maxlength'=>255'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50'),
  200.             'sql'                   => "varchar(255) NOT NULL default ''",
  201.         ),
  202.         'postal' => array
  203.         (
  204.             'exclude'               => true,
  205.             'search'                => true,
  206.             'inputType'             => 'text',
  207.             'eval'                  => array('mandatory'=>true'maxlength'=>32'feEditable'=>true'feGroup'=>'address''tl_class'=>'clr w50'),
  208.             'sql'                   => "varchar(32) NOT NULL default ''",
  209.         ),
  210.         'city' => array
  211.         (
  212.             'exclude'               => true,
  213.             'filter'                => true,
  214.             'search'                => true,
  215.             'sorting'               => true,
  216.             'inputType'             => 'text',
  217.             'eval'                  => array('mandatory'=>true'maxlength'=>255'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50'),
  218.             'sql'                   => "varchar(255) NOT NULL default ''",
  219.         ),
  220.         'subdivision' => array
  221.         (
  222.             'exclude'               => true,
  223.             'sorting'               => true,
  224.             'inputType'             => 'conditionalselect',
  225.             'options_callback'      => array('Isotope\Backend''getSubdivisions'),
  226.             'eval'                  => array('feEditable'=>true'feGroup'=>'address''conditionField'=>'country''includeBlankOption'=>true'tl_class'=>'w50'),
  227.             'sql'                   => "varchar(10) NOT NULL default ''",
  228.         ),
  229.         'country' => array
  230.         (
  231.             'exclude'               => true,
  232.             'filter'                => true,
  233.             'sorting'               => true,
  234.             'inputType'             => 'select',
  235.             'options'               => \Contao\System::getCountries(),
  236.             // Do not use options_callback, countries are modified by store config in the frontend
  237.             'eval'                  => array('mandatory'=>true'feEditable'=>true'feGroup'=>'address''tl_class'=>'w50''chosen'=>true),
  238.             'sql'                   => "varchar(32) NOT NULL default ''",
  239.         ),
  240.         'phone' => array
  241.         (
  242.             'exclude'               => true,
  243.             'search'                => true,
  244.             'inputType'             => 'text',
  245.             'eval'                  => array('mandatory'=>false'maxlength'=>64'rgxp'=>'phone''feEditable'=>true'feGroup'=>'contact''tl_class'=>'w50'),
  246.             'sql'                   => "varchar(64) NOT NULL default ''",
  247.         ),
  248.         'email' => array
  249.         (
  250.             'exclude'               => true,
  251.             'search'                => true,
  252.             'inputType'             => 'text',
  253.             'eval'                  => array('mandatory'=>true'maxlength'=>64'rgxp'=>'email''feEditable'=>true'feGroup'=>'contact''tl_class'=>'w50'),
  254.             'sql'                   => "varchar(255) NOT NULL default ''",
  255.         ),
  256.         'isDefaultBilling' => array
  257.         (
  258.             'exclude'               => true,
  259.             'filter'                => true,
  260.             'inputType'             => 'checkbox',
  261.             'eval'                  => array('feEditable'=>true'feGroup'=>'login''membersOnly'=>true'tl_class'=>'w50'),
  262.             'sql'                   => "char(1) NOT NULL default ''",
  263.             'save_callback' => array
  264.             (
  265.                 array('Isotope\Backend\Address\Callback''updateDefault'),
  266.             ),
  267.         ),
  268.         'isDefaultShipping' => array
  269.         (
  270.             'exclude'               => true,
  271.             'filter'                => true,
  272.             'inputType'             => 'checkbox',
  273.             'eval'                  => array('feEditable'=>true'feGroup'=>'login''membersOnly'=>true'tl_class'=>'w50'),
  274.             'sql'                   => "char(1) NOT NULL default ''",
  275.             'save_callback' => array
  276.             (
  277.                 array('Isotope\Backend\Address\Callback''updateDefault'),
  278.             ),
  279.         ),
  280.     )
  281. );
  282. /**
  283.  * Dynamically add parent table
  284.  */
  285. if ('member' === \Contao\Input::get('do')) {
  286.     $GLOBALS['TL_DCA']['tl_iso_address']['config']['ptable'] = 'tl_member';
  287. } elseif ('iso_orders' === \Contao\Input::get('do')) {
  288.     $GLOBALS['TL_DCA']['tl_iso_address']['config']['ptable'] = 'tl_iso_product_collection';
  289. }