Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird error when trying to update inventorydetails
For the module I'm developing I'm trying to update inventorydetails through the normal save method (and setting focusmode to edit). Saving new records is fine, but updating existing records causes:

Sorry! Attempt to access restricted file.
We are looking for this file path: modules//.php
We are looking here:
Real file path:

Any idea why this is?
that is an indication that $currentModule or $_REQUEST['module'] are not set. The code leading to that probably does something like

PHP Code:
include "modules/$currentModule/$currentModule.php"

look for that piece of code, probably in include/utils/CommonUtils.php, and add a var_dump($_REQUEST,$currentModule); or debug_print_backtrace to see if you can find what is missing
The line you suggested is indeed there, in "modules/Vtiger/Save.php", which in turn calls "checkFileAccessForInclusion" in CommonUtils.php. That function is the one printing the message.. I've tried setting globals by force, but without luck so far. Will try your method.

I see that the default "createInventoryDetails" function temporarily sets aside the currentmodule and then sets it back..

I now have:

PHP Code:
        global $current_user$currentModule;
$save_currentModule $currentModule;
$currentModule 'InventoryDetails';

$invdet_focus = new InventoryDetails();
$invdet_focus->retrieve_entity_info($record['lineitem_id'], 'InventoryDetails');
$invdet_focus->mode 'edit';

$invdet_focus->column_fields['account_id'] = $_REQUEST['ps_accountid'];
$invdet_focus->column_fields['contact_id'] = $_REQUEST['ps_contactid'];
$invdet_focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];

// Overwrite column fields that have matching keys
foreach ($record as $key => $value) {
            if (
array_key_exists($key$invdet_focus->column_fields)) {
$invdet_focus->column_fields[$key] = $record[$key];

$handler vtws_getModuleHandlerFromName('InventoryDetails'$current_user);
$meta $handler->getMeta();
$invdet_focus->column_fields DataTransform::sanitizeRetrieveEntityInfo($invdet_focus->column_fields$meta);

$currentModule $save_currentModule

Sadly still the same issue.
I think I've narrowed this down to the getInstance mthod in CRMENtity.php

I've identified that somewhere along the line, the fromEntityId method of VTEntityData gets passed '0' as an ID.. Now I need to figure out why.
Commenting this line also helps, so it's narrowing down....

Okay, probably the dumbest mistake I've ever made, and never will repeat. I never set the $invdet_focus->id property....

s**t happens
It has hit the fan, spread all across the room and is just now cleaned...

Forum Jump:

Users browsing this thread: 1 Guest(s)