Clone Tool - Option type Q

How to Clone a row on Table Views

When adding the option type Q to a table view, each row will have a clone option in the tool bars of the far right.

To add the clone tool, from the init Sections module add the option type Q.

$PAGES_CONTENT->setOption("PAGES,VER PAGINAS,VOIR PAGES","aside","5","VEDQ", true);

Or use the manual value directly in the page

$options['clone']  = true / false;

Once the option type is setup then we need we have several options to control what things to clone or not, if this variable is left empty then everything will be cloned except files, all foreign keys will be respected.

$cloneOption = [
   'exclude' => 'file_url,REF_NO,CHECK_NO', // CSV of columns to exclude when cloning
   'relData' => [
       'FKTable' => 'INVOICE_ITEMS', // name of the table containing foreign key values to clone, example invoice items
       'FKPrimaryKey' => 'IIID', // Primary KEY ID of the foreign key table, (won't be cloned because new IDs need to be inserted with auto_increment (auto_increment required)
       'ID' => 'INID' // Primary key of the row being cloned that will be cloned into the new values of the foreign key table
    ], // 
   'files' => 'file_url,img_url,thumb_url'// CSV of column names with paths to files to clone
];