so I have done the following, and it seems to work:
-I dropped all foreign keys constraints of all primary keys which were int(11) auto_increment
-I changed all previous foreign keys to varchar(25) and all primary keys to varchar(25)
-I added again all the foreign keys constraints
Like this, I didn't lose any linked tables. The old values still have the values of auto_increment, and the new ones will have a unique hash id.
Now I can clone simple forms which don't contain any subform. But when cloning a form which contains a subform, it didn't work. I encountered errors because it was trying to insert values of the subform also. I saw here how to set all subform values to null: https://forums.nubuilder.cloud/viewtopic. ... ilit=clone
So I added this code:
Code: Select all
if (nuFormType() == 'edit') {
if (nuIsClone()) {
$("Input[id^='subgridname']").val('').change();
}
}
Before clone:
After clone:
As you can see, it added the old contact of the old company to the new cloned company (it created a new contact with the CONCAT used on the subform for display purpose)
And here are the errors I have in debug:
Code: Select all
[0] :
===USER==========
globeadmin
===PDO MESSAGE===
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'contact_entreprise_id' in 'field list'
===SQL===========
INSERT INTO relance (relance_id, `contact_entreprise_id`, `relance_date`, `relance_type`, `relance_info`, `relance_statut`) VALUES ('5b0fef45b61b749', '5b0fef45b598dc2', '2018-05-31', 'Téléphone', 'TESTRELANCE', 'A faire');
===BACK TRACE====
/var/www/erpversus/nudata.php - line 346 (nuRunQuery)
/var/www/erpversus/nuapi.php - line 50 (nuUpdateDatabase)
Code: Select all
[0] :
===USER==========
globeadmin
===PDO MESSAGE===
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'contact_entreprise_id' in 'field list'
===SQL===========
INSERT INTO relance (relance_id, `contact_entreprise_id`, `relance_date`, `relance_type`, `relance_info`, `relance_statut`) VALUES ('5b0fef45b5e7abb', '5b0fef45b598dc2', '2018-06-01', 'Email', 'TEST', 'A faire');
===BACK TRACE====
/var/www/erpversus/nudata.php - line 346 (nuRunQuery)
/var/www/erpversus/nuapi.php - line 50 (nuUpdateDatabase)