Weird error when trying to update inventorydetails - Printable Version +- CoreBOSBB (https://discussions.corebos.org) +-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18) +--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4) +--- Thread: Weird error when trying to update inventorydetails (/showthread.php?tid=488) |
Weird error when trying to update inventorydetails - Guido1982 - 11-08-2016 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: Code: Sorry! Attempt to access restricted file. Any idea why this is? RE: Weird error when trying to update inventorydetails - joebordes - 11-08-2016 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 RE: Weird error when trying to update inventorydetails - Guido1982 - 11-08-2016 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; Sadly still the same issue. RE: Weird error when trying to update inventorydetails - Guido1982 - 11-08-2016 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. RE: Weird error when trying to update inventorydetails - Guido1982 - 11-08-2016 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.... RE: Weird error when trying to update inventorydetails - joebordes - 11-08-2016 :-D s**t happens RE: Weird error when trying to update inventorydetails - Guido1982 - 11-08-2016 It has hit the fan, spread all across the room and is just now cleaned... |