vezunchik
Total posts: 11
18 Dec 2018 09:04

Hi Sergey and others.

Is it possible import records with composite title type? When I trying to import such records as a result I get 0 imported records. In source code of import controller I see next code: components\com_cobalt\controllers\import.php

if(!$row->get($params->get('field.title')))
    {
        continue;
    }

but this field exists in the params form only when title type is simple(properties.item_title == 1): components/com_cobalt/views/import/tmpl/params.php

<?php if($this->type->params->get('properties.item_title') == 1): ?>
            <div class="control-group">
                <label class="control-label" for="name"><?php echo JText::_('CTITLE');?>
                    <span class="pull-right" rel="tooltip" data-original-title="<?php echo JText::_('CREQUIRED') ?>">
                        <?php echo HTMLFormatHelper::icon('asterisk-small.png');  ?></span>
                </label>

                <div class="controls">
                    <div class="row-fluid">
                        <?php echo $this->fieldlist('title', $this->item->params->get('field.title'));?>
                    </div>
                </div>
            </div>
        <?php endif;?>

so all my records are skipped. please advice.

Last Modified: 15 Jan 2019


Sergey
Total posts: 13,748
20 Dec 2018 12:32

Unfortunately composite title does not work on import.


vezunchik
Total posts: 11
06 Jan 2019 23:32

I've made some fixes to import controller and I want to propose to apply it in next Cobalt release. What do you think? See lines 100 and 224-234.

import


vezunchik
Total posts: 11
06 Jan 2019 23:51

Also, I want propose small fix for media/mint/js/uploader/UploadHandler.php, function get_config_bytes().

function get_config_bytes($val)
    {
        $val = trim($val);
        $last = strtolower($val[strlen($val) - 1]);
        $val = substr($val, 0, -1);
        switch($last)
        {
            case 'g':
                $val *= 1024;
            case 'm':
                $val *= 1024;
            case 'k':
                $val *= 1024;
        }
        return $this->fix_integer_overflow($val);
    }

without this fix ($val = substr($val, 0, -1);), import process hasn't gone to the next step and in logs I have next php notice: "PHP Notice: A non well formed numeric value encountered in /www/magitex/media/mint/js/uploader/UploadHandler.php on line 360"

PHP version 7.2.5


Sergey
Total posts: 13,748
15 Jan 2019 13:49

Ok, I see the changes in import. But that is not all for composite title. Then someone ask why other placeholders do not work on composite title duting import. So it either have to be done completely or stay as it is.

vezunchik Notice: A non well formed numeric value encountered in /www/magitex/media/mint/js/uploader/UploadHandler.php on line 360"

Applied settype($val, 'int');

Powered by Cobalt