From: Jesse P. <je...@st...> - 2004-09-12 19:39:24
|
This is gonna be a fun one. I did the translation fixes on ConfirmDispatch_Invoice yesterday and tried to start ConfirmDispatchControlled_Invoice. I quickly ran into a problem that I have finally tracked down today courtesy of var_dump. Turns out something I knew, but neglected to think about... and web-erp is, probably intentionally, written correctly. The problem is that when you use class based objects, such as cart in DefineCartClass.php, the class needs to exist *before* the session is started if you are going to use that object as a session variable. Since the repercussions of it can be strange (things won't just break), it would be a really good idea to pull all the files the order has been changed in and fix them soon. That essentially puts us at needing to do something like this on every page this happens... just in general would probably be good. ------------------------------------------------------------------------------------------------------------------------ include('includes/DefinePOClass.php'); include('includes/DefineSerialItems.php'); $PageSecurity = 11; /* Session started in header.inc for password checking and authorisation level check */ include('includes/session.inc'); $title = 'Receive Controlled Items'; include('includes/header.inc'); ------------------------------------------------------------------------------------------------------------------------ That, however creates a smaller problem in that the strings in the DefineXXX files can not be translated if the _() function does not exist. I can see a few solutions: * require_once() for the language file include, and putting that line in session and all the files that may be included before it. (easiest) * including all files that may be necessary in session.inc (bad idea) * changing classes to remove strings so translation is moot (probably more correct) thoughts? jesse skaill wrote: > I've noticed this type of thing in some scripts... > > $title = 'Receive Controlled Items'; > $PageSecurity = 11; > > /* Session started in header.inc for password checking and > authorisation level check */ > include('includes/DefinePOClass.php'); > include('includes/DefineSerialItems.php'); > include('includes/session.inc'); > include('includes/header.inc'); > If $title was moved below session.inc and above header.inc that would > be good for $title. However, DefineSerialItems.php has a string in it > which means it also needs to be after session.inc. > > session.inc never uses any includes before it and verifies access so > I'm thinking session.inc should always be the first include anyway. > Can you confirm this Phil? > > Steve |