Hi,
Iām trying to create a new option to the Administration Module, I do a Quick Repair and Rebuild but when I click on the new option that I created appear me an error telling me
āThere is no action by that name: winmax4authenticationā
Does you file also include all the other methods of the stock Administration controller? I suppose not. You probably want to extend the other class, something like:
class CustomAdministrationController extends AdministrationController
Hi, @Fairydx
I see your screenshot of code and the link (http://SuiteCRM_URL/index.php?module=Administration&action=winmax4authentication). I think that you miss: ā&process=trueā in the link and some else.
You should be using XDEBUG and a debugger to check what is happening.
Maybe no view is showing because youāre not returning one? Is your action intended to draw a screen, or just to run some back-end action? You might be better off doing an Ajax call in that case.
That action is to draw a screen with options to save configurations for me to use in the integration that I will create, and I think that Iām returning one view
With the XDEBUG I found out that I cant reach the view, but why?
controller.php:
public function action_winmax4authentication() {
$this->view = 'winmax4authentication';
///////////////////////////////////////////////////////////////////////////////
//// HANDLE CHANGES AFTER SUBMIT
if(isset($_REQUEST['process']) && $_REQUEST['process'] == 'true') {
$admin = new Administration();
$admin->retrieveSettings();
if (!empty($_REQUEST["url"])) {
$admin->saveSetting("winmax4authentication", "url", html_entity_decode($_REQUEST["url"]));
}
if (!empty($_REQUEST["company_code"])) {
$admin->saveSetting("winmax4authentication", "company_code", $_REQUEST["company_code"]);
}
if (!empty($_REQUEST["user"])) {
$admin->saveSetting("winmax4authentication", "user", $_REQUEST["user"]);
}
if (!empty($_REQUEST["password"])) {
$admin->saveSetting("winmax4authentication", "password", $_REQUEST["password"]);
}
header('Location: index.php?module=Administration&action=index');
}
view.winmax4authentication.php:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $current_user, $sugar_config;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
require_once('include/MVC/View/SugarView.php');
class Viewauthentication extends SugarView {
public function __construct() {
parent::SugarView();
}
public function preDisplay() {
$this->dv->tpl = 'custom/modules/Administration/tpl/winmax4authentication.tpl';
}
public function display() {
global $sugar_config, $mod_strings, $app_strings;
$smarty = new Sugar_Smarty();
$smarty->assign('MOD', $mod_strings);
$smarty->assign('APP', $app_strings);
$smarty->assign('config', $sugar_config['winmax4authentication']);
$admin = new Administration();
$admin->retrieveSettings();
if (array_key_exists('winmax4authentication_url', $admin->settings))
$smarty->assign('URL', $admin->settings['winmax4authentication_url']);
if (array_key_exists('winmax4authentication_company_code', $admin->settings))
$smarty->assign('COMPANY_CODE', $admin->settings['winmax4authentication_company_code']);
if (array_key_exists('winmax4authentication_user', $admin->settings))
$smarty->assign('USER', $admin->settings['winmax4authentication_user']);
if (array_key_exists('winmax4authentication_password', $admin->settings))
$smarty->assign('PASSWORD', $admin->settings['winmax4authentication_password']);
$smarty->display($this->dv->tpl);
}
}
?>
First, if this is a new XDEBUG configuration, check that your breakpoints are hitting by setting one at the beginning of index.php. Just to check itās breaking when the request starts.
Then try setting a breakpoint in the GetController code that I mentioned in my post above, and see what is happening there.
That depends on which IDE youāre using (PHP Storm, Eclipse, VS Code, etc)
To get a debugger up and running, you can check documentation on the internet, itās nothing specific to SuiteCRM. I highly recommend that you do it, it changes your productivity dramatically.
@Fairydx
If you want to use:
custom/modules/Administration/views/view.winmax4authentication.php
you should active it in file:
custom/modules/Administration/action_view_map.php
You can look at as an example:
modules/Administration/action_view_map.php