Hi,
I have made some progress. I agree because it could be useful to others.
popupdefs.php:
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } $popupMeta = array( 'moduleMain' => 'Documents', 'varName' => 'DOCUMENTS', 'orderBy' => 'name', 'whereClauses' => array( ), 'searchInputs' => array( ), // Add create 'create' => array ( 'formBase' => 'DocumentsFormBase.php', 'formBaseClass' => 'DocumentsFormBase', 'getFormBodyParams' => array( 0 => '', 1 => '', 2 => 'DocumentSave', ), 'createButton' => $mod_strings['LBL_NEW_FORM_TITLE'], ), 'searchdefs' => array( ), 'listviewdefs' => array( ), );
DocumentsFormBase.php:
please note that this file works if it is in the module directory, if it is in custom it doesn’t work (even if I put the address custom / modules / Documents / DocumentsFormBase.php in popupdefs.php)
<?php
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}
require_once('include/SugarObjects/forms/FormBase.php');
class DocumentsFormBase extends FormBase {
var $moduleName = 'Documents';
var $objectName = 'Document';
function handleSave($prefix, $redirect=true, $useRequired=false){
require_once('include/formbase.php');
$focus = new Document();
$focus = populateFromPost($prefix, $focus);
$focus->save();
}
}
?>
At this point, the popup is displayed, the creation form is displayed in the popup and, apparently, the saving is closed.
But:
- the relationship with the document is not maintained in my custom module
- if I try to open the document from Documents, I read: “This document is missing a file, most likely due to an error during upload. Please retry uploading the file or contact your administrator.”
In the log file I find the following error:
“SugarBean.load_relationships, failed Loading relationship (related_doc_id)”
And I don’t see files in the Uploads folder
Any suggestions? Thank you very much