thorntonstuart / simplecloner Goto Github PK
View Code? Open in Web Editor NEWAn entry cloning module compatible with EE3
An entry cloning module compatible with EE3
Any chance of getting Simple Cloner to work with Solspace Calendar entries?
I have one channel that does not clone when requested (or generate an error message for the first attempt). This is the same channel as my previous issue. When I then try a second time to clone the same entry, I get the following error message:
Exception Caught
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '78-17' for key 'PRIMARY':
INSERT INTO `exp_category_posts` (`entry_id`, `cat_id`) VALUES (78, 17)
ee/legacy/database/drivers/mysqli/mysqli_connection.php:122
Entry 78 already exists (in a different channel that doesn't use that category group). When I look at exp_category_posts
, it has created new rows for entry 78. When I remove the new rows for 78 and try to clone the entry again, it adds the rows back into exp_category_posts
. When I try to clone the entry yet another time, I get the Duplicate entry error again.
Entry 78 is the most recent entry created on the site. When I create a new entry in another channel, the Duplicate entry error (and the database) indicates that SimpleCloner is trying to create the categories for the very newest entry.
If it helps, this channel has two category groups and the following field types:
Here is the stack trace for the error message:
#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(137): CI_DB_mysqli_connection->query('INSERT INTO `ex...')
#1 ee/legacy/database/DB_driver.php(297): CI_DB_mysqli_driver->_execute('INSERT INTO `ex...')
#2 ee/legacy/database/DB_driver.php(203): CI_DB_driver->simple_query('INSERT INTO `ex...')
#3 ee/legacy/database/DB_active_rec.php(1462): CI_DB_driver->query('INSERT INTO `ex...')
#4 user/addons/simple_cloner/ext.simple_cloner.php(278): CI_DB_active_record->insert('category_posts', Array)
#5 ee/legacy/libraries/Extensions.php(243): Simple_cloner_ext->simple_cloner_content_save(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#6 ee/legacy/libraries/Extensions.php(138): EE_Extensions->call_class('Simple_cloner_e...', 'after_channel_e...', Array, Array)
#7 [internal function]: EE_Extensions->call('after_channel_e...', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#8 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(642): call_user_func_array(Array, Array)
#9 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}('after_channel_e...', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#10 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(615): call_user_func_array(Object(Closure), Array)
#11 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}()
#12 ee/EllisLab/ExpressionEngine/Service/Event/Emitter.php(153): call_user_func_array(Object(Closure), Array)
#13 [internal function]: EllisLab\ExpressionEngine\Service\Event\Emitter->emit('afterSave')
#14 ee/EllisLab/ExpressionEngine/Library/Data/Entity.php(629): call_user_func_array(Array, Array)
#15 [internal function]: EllisLab\ExpressionEngine\Library\Data\Entity->emit('afterSave')
#16 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(834): call_user_func_array('parent::emit', Array)
#17 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(60): EllisLab\ExpressionEngine\Service\Model\Model->emit('afterSave')
#18 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(294): EllisLab\ExpressionEngine\Service\Model\Query\Update->run()
#19 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(260): EllisLab\ExpressionEngine\Service\Model\DataStore->runQuery('Update', Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#20 ee/EllisLab/ExpressionEngine/Service/Model/Query/Builder.php(83): EllisLab\ExpressionEngine\Service\Model\DataStore->updateQuery(Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#21 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(366): EllisLab\ExpressionEngine\Service\Model\Query\Builder->update()
#22 ee/EllisLab/ExpressionEngine/Model/Content/ContentModel.php(198): EllisLab\ExpressionEngine\Service\Model\Model->save()
#23 ee/EllisLab/ExpressionEngine/Controller/Publish/AbstractPublish.php(295): EllisLab\ExpressionEngine\Model\Content\ContentModel->save()
#24 ee/EllisLab/ExpressionEngine/Controller/Publish/Edit.php(482): EllisLab\ExpressionEngine\Controller\Publish\AbstractPublish->saveEntryAndRedirect(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry))
#25 [internal function]: EllisLab\ExpressionEngine\Controller\Publish\Edit->entry('33')
#26 ee/EllisLab/ExpressionEngine/Core/Core.php(189): call_user_func_array(Array, Array)
#27 ee/EllisLab/ExpressionEngine/Core/Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#28 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#29 html/mmdcms/index.php(143): require_once('...')
#29 html/mmdcms/index.php(143): require_once('...')
I attempted to clone an entry using this add-on. I went to the "Simple Cloner" tab when viewing the entry I wanted to clone, I added a suffix for new entry, turned on the toggle button to "clone entry", and then saved. Doing this logged me out, and when I logged back in to the control panel, not only was there no clone present, but the original entry had been deleted. Major inconvenience.
In PHP 7, I get this warning even after making the suggested change to the Bloqs PublishController.php
Exception Caught
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1543' for key 'PRIMARY':
INSERT INTO exp_assets_selections
(selection_id
, file_id
, entry_id
, field_id
, col_id
, row_id
, var_id
, element_id
, content_type
, sort_order
, is_draft
) VALUES (1543, 46, 340, 4, 1, '144', NULL, NULL, 'grid', 0, 0)
ee/legacy/database/drivers/mysqli/mysqli_connection.php:122
====
Stack Trace is below:
#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(137): CI_DB_mysqli_connection->query('INSERT INTO ex...') #1 ee/legacy/database/DB_driver.php(297): CI_DB_mysqli_driver->_execute('INSERT INTO
ex...')
#2 ee/legacy/database/DB_driver.php(203): CI_DB_driver->simple_query('INSERT INTO ex...') #3 ee/legacy/database/DB_active_rec.php(1449): CI_DB_driver->query('INSERT INTO
ex...')
#4 user/addons/simple_cloner/ext.simple_cloner.php(447): CI_DB_active_record->insert('assets_selectio...', Array)
#5 ee/legacy/libraries/Extensions.php(243): Simple_cloner_ext->simple_cloner_content_save(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#6 ee/legacy/libraries/Extensions.php(138): EE_Extensions->call_class('Simple_cloner_e...', 'after_channel_e...', Array, Array)
#7 [internal function]: EE_Extensions->call('after_channel_e...', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#8 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(642): call_user_func_array(Array, Array)
#9 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model{closure}('after_channel_e...', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#10 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(615): call_user_func_array(Object(Closure), Array)
#11 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model{closure}()
#12 ee/EllisLab/ExpressionEngine/Service/Event/Emitter.php(153): call_user_func_array(Object(Closure), Array)
#13 [internal function]: EllisLab\ExpressionEngine\Service\Event\Emitter->emit('afterSave')
#14 ee/EllisLab/ExpressionEngine/Library/Data/Entity.php(630): call_user_func_array(Array, Array)
#15 [internal function]: EllisLab\ExpressionEngine\Library\Data\Entity->emit('afterSave')
#16 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(834): call_user_func_array('parent::emit', Array)
#17 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(60): EllisLab\ExpressionEngine\Service\Model\Model->emit('afterSave')
#18 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(294): EllisLab\ExpressionEngine\Service\Model\Query\Update->run()
#19 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(260): EllisLab\ExpressionEngine\Service\Model\DataStore->runQuery('Update', Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#20 ee/EllisLab/ExpressionEngine/Service/Model/Query/Builder.php(83): EllisLab\ExpressionEngine\Service\Model\DataStore->updateQuery(Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#21 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(366): EllisLab\ExpressionEngine\Service\Model\Query\Builder->update()
#22 ee/EllisLab/ExpressionEngine/Model/Content/ContentModel.php(198): EllisLab\ExpressionEngine\Service\Model\Model->save()
#23 ee/EllisLab/ExpressionEngine/Controller/Publish/AbstractPublish.php(295): EllisLab\ExpressionEngine\Model\Content\ContentModel->save()
#24 ee/EllisLab/ExpressionEngine/Controller/Publish/Edit.php(482): EllisLab\ExpressionEngine\Controller\Publish\AbstractPublish->saveEntryAndRedirect(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry))
#25 [internal function]: EllisLab\ExpressionEngine\Controller\Publish\Edit->entry('50')
#26 ee/EllisLab/ExpressionEngine/Core/Core.php(189): call_user_func_array(Array, Array)
#27 ee/EllisLab/ExpressionEngine/Core/Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#28 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#29 httpdocs/admin.php(143): require_once('...')
#29 httpdocs/admin.php(143): require_once('...')
CartThrob price modifiers are similar to grid in functionality..allows you to add options to products like Colors or Sizes. This data unfortunately doesn't clone over--but my grid data did! Would be great if this could get baked into the product somehow.
Any chance you're working on an EE4 version?
Hello!
Great extension, but would it be possible to again add channel_images compatibility?
It was working great in older version, but from what i understand, it is no longer supported in 2.0?
Would be great if it could be implemented again, or i must use older version :)
Thanks!
I'm using EE 3.5.5, Ansel 2.0.3, and Simple Cloner 1.2.0. I first experienced this issue on a development site, but I was able to recreate it with a clean install of EE with only Ansel and Simple Cloner installed.
Here's the issue: I have a channel with an Ansel field. I have a simple template that calls the image URL for the Ansel field. When I create an entry (EntryA) and add an image to the Ansel field, the template displays the URL properly. When I clone the entry in Simple Cloner (EntryA-Clone), the template displays the URL properly for both entries. But if I delete EntryA-Clone, the template breaks and generates a Fatal Error. The template remains broken until I open the EntryA, remove the image(s) from the Ansel field, save the entry, and then relink the image(s) within the Ansel field. Once I do that, the template again displays the image URL properly.
Here are the error messages that I get:
Undefined offset: 149
user/addons/ansel/Service/AnselImages/ImagesTag.php, line 306
Severity: E_NOTICE
Notice
Undefined offset: 12
user/addons/ansel/Service/AnselImages/ImagesTag.php, line 308
Severity: E_NOTICE
Notice
Trying to get property of non-object
user/addons/ansel/Service/AnselImages/ImagesTag.php, line 365
Severity: E_NOTICE
Notice
Trying to get property of non-object
user/addons/ansel/Service/AnselImages/ImagesTag.php, line 365
Severity: E_NOTICE
Notice
Trying to get property of non-object
user/addons/ansel/Service/AnselImages/ImagesTag.php, line 367
Severity: E_NOTICE
Fatal error: Uncaught Error: Call to a member function getUrlSafeParam() on null in /path/to/system/user/addons/ansel/Service/AnselImages/ImagesTag.php:367 Stack trace:
#0 /path/to/system/user/addons/ansel/Service/AnselImages/ImagesTag.php(217): BuzzingPixel\Ansel\Service\AnselImages\ImagesTag->setVariablesFromRecord(Object(BuzzingPixel\Ansel\Record\Image))
#1 /path/to/system/user/addons/ansel/Controller/Field/ImagesTag.php(121): BuzzingPixel\Ansel\Service\AnselImages\ImagesTag->getVariables()
#2 /path/to/system/user/addons/ansel/ft.ansel.php(762): BuzzingPixel\Ansel\Controller\Field\ImagesTag->parse(Array, '\n\t Small: {i...')
#3 /path/to/system/ee/legacy/libraries/api/Api_channel_fields.php(409): Ansel_ft->replace_tag('{"placeholder":...', Array, '\n\t Small: {i...')
#4 /path/to/system/ee/legacy/libraries/channel_entries_parser/components/Custom_field_pair.php(203): in /path/to/system/user/addons/ansel/Service/AnselImages/ImagesTag.php on line 367
I opened a support ticket with TJ at BuzzingPixel, and here is his explanation for what he thinks might be happening:
It sounds like Simple Cloner is duplicating the
exp_ansel_images
table rows but not creating the images themselves, but rather pointing back to the images Ansel created for the original field/entry.The way Ansel works is that the original image is uploaded to the specified directory for source images, then that image is manipulated according to the field settings and crop lasso and saved as a new image. That image that Ansel manipulated and created is considered “owned” by the originating field. As such, if the image row is deleted, or the entry or owning element is deleted, the manipulated image is deleted. In the case of Simple Cloner (from what it sounds like it is doing), if it’s just duplicating the table rows in
exp_ansel_images
, then when you delete one of the image rows or entries, Ansel deletes the image because of the assumed ownership of the image. Thus that image goes missing for the other entry.The last time I looked at Simple Cloner, it looked like it was doing a lot of procedural work, direct database calls and so forth. What would be ideal would be for Simple Cloner to prep the data that Ansel expects on entry submission, then run Ansel’s field type methods for the new entry. Failing that, Simple Cloner will need to duplicate the manipulated image for each image row in the containing element (entry), add it to the EE (or Assets or Treasury) file manager in the appropriate way, and then update the IDs in the duplicated
exp_ansel_images
table row to point to the new image.
Please let me know if you have any other questions about my setup. Thanks for your time.
When I clone an entry I receive the below error. I'm on EE 3.5.14. I don't have Ansel installed.
Undefined variable: ansel_fields
user/addons/simple_cloner/ext.simple_cloner.php, line 468 show details
Notice
Undefined variable: ansel_fields
user/addons/simple_cloner/ext.simple_cloner.php, line 601 hide details
Severity: E_NOTICE
I removed the references to Ansel and now I can clone entries without errors.
Hello!
Would it be possible to add a dropdown or something to skip cloning certain field?
For example, i have a field that needs to be unique.
Thanks!
In ext.simple_cloner.php, errors in the entry are being printed to the page:
$errors = ee()->api_channel_entries->get_errors(); print_r($errors);
We're seeing that come up when the editor failed to populate a required field:
Array ( [Field Name] => The following field is required: )
Any help here would be very much appreciated.
Would be awesome if this could be updated to work with the Bloqs add-on! If you need any help testing with this I would be happy to assist.
I'm trying out SimpleCloner for the first time today (EE 3.5.3). It seems to work fine on a few of my simpler channels. Unfortunately, on the one channel I really want to use it, I'm getting an error when I try to clone the entry:
Array ( [Wine] => The following field is required: )
Exception Caught
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_name.exp_assets_folders' doesn't exist:
SELECT * FROM (`exp_assets_folders`) WHERE `folder_name` = 27
ee/legacy/database/drivers/mysqli/mysqli_connection.php:122
For what it's worth, Wine is a relationship field. I do not have Assets installed. I'm using Ansel and the native EE File Manager with my images.
This channel is admittedly a fairly complicated one. It's got about 35 fields, including:
Here is the Stack Trace, if that's of any assistance:
#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(137): CI_DB_mysqli_connection->query('SELECT *\nFROM (...')
#1 ee/legacy/database/DB_driver.php(297): CI_DB_mysqli_driver->_execute('SELECT *\nFROM (...')
#2 ee/legacy/database/DB_driver.php(203): CI_DB_driver->simple_query('SELECT *\nFROM (...')
#3 ee/legacy/database/DB_active_rec.php(1219): CI_DB_driver->query('SELECT *\nFROM (...')
#4 user/addons/simple_cloner/ext.simple_cloner.php(522): CI_DB_active_record->get()
#5 user/addons/simple_cloner/ext.simple_cloner.php(576): Simple_cloner_ext->generate_new_ansel_image(Array, 27, '46')
#6 user/addons/simple_cloner/ext.simple_cloner.php(290): Simple_cloner_ext->duplicate_ansel(Object(CI_DB_mysqli_result), 78)
#7 ee/legacy/libraries/Extensions.php(243): Simple_cloner_ext->simple_cloner_content_save(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#8 ee/legacy/libraries/Extensions.php(138): EE_Extensions->call_class('Simple_cloner_e...', 'after_channel_e...', Array, Array)
#9 [internal function]: EE_Extensions->call('after_channel_e...', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#10 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(642): call_user_func_array(Array, Array)
#11 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}('after_channel_e...', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#12 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(615): call_user_func_array(Object(Closure), Array)
#13 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}()
#14 ee/EllisLab/ExpressionEngine/Service/Event/Emitter.php(153): call_user_func_array(Object(Closure), Array)
#15 [internal function]: EllisLab\ExpressionEngine\Service\Event\Emitter->emit('afterSave')
#16 ee/EllisLab/ExpressionEngine/Library/Data/Entity.php(629): call_user_func_array(Array, Array)
#17 [internal function]: EllisLab\ExpressionEngine\Library\Data\Entity->emit('afterSave')
#18 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(834): call_user_func_array('parent::emit', Array)
#19 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(60): EllisLab\ExpressionEngine\Service\Model\Model->emit('afterSave')
#20 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(294): EllisLab\ExpressionEngine\Service\Model\Query\Update->run()
#21 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(260): EllisLab\ExpressionEngine\Service\Model\DataStore->runQuery('Update', Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#22 ee/EllisLab/ExpressionEngine/Service/Model/Query/Builder.php(83): EllisLab\ExpressionEngine\Service\Model\DataStore->updateQuery(Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#23 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(366): EllisLab\ExpressionEngine\Service\Model\Query\Builder->update()
#24 ee/EllisLab/ExpressionEngine/Model/Content/ContentModel.php(198): EllisLab\ExpressionEngine\Service\Model\Model->save()
#25 ee/EllisLab/ExpressionEngine/Controller/Publish/AbstractPublish.php(295): EllisLab\ExpressionEngine\Model\Content\ContentModel->save()
#26 ee/EllisLab/ExpressionEngine/Controller/Publish/Edit.php(482): EllisLab\ExpressionEngine\Controller\Publish\AbstractPublish->saveEntryAndRedirect(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry))
#27 [internal function]: EllisLab\ExpressionEngine\Controller\Publish\Edit->entry('32')
#28 ee/EllisLab/ExpressionEngine/Core/Core.php(189): call_user_func_array(Array, Array)
#29 ee/EllisLab/ExpressionEngine/Core/Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#30 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#31 html/mmdcms/index.php(143): require_once('...')
#31 html/mmdcms/index.php(143): require_once('...')
Thanks for your time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.