Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autocomplete in the Calendar UI
#3
In general it looks good Smile

(11-16-2015, 03:49 PM)Guido1982 Wrote:
  • I have to place the JSON_Accounts.php file in the root, because I can't include the 'Module.php' file otherwise. Joe suggested that other module files could use this becuase they use the 'set_include_path()' function, but I don't see that function being used in the standard module files. My guess is that the other files can use includes as if they were files in the root because they get passed through the index.php root file. My file is not registered by the system and so does not pass through the index.php file. Sadly, I don't know how to change this so any help would be appreciated.

Calendar4You uses set_include_path, but I wouldn't recommend that. You really don't need it at all if you pass your code through index.php which is what you should do because that guarantees you are protected by the system's validations and makes it harder for your code to get hacked.
You can put your script wherever you want, in any module and then call it like this if you don't want the menus and rest of the layout:

Code:
http://your_server/your_corebos/index.php?module={module_where_you_put_your_script}&action={module_where_you_put_your_script}Ajax&file={your_script_with_no_php_extension}

or like this if you want it be executed after loading the menu and toolbar:

Code:
http://your_server/your_corebos/index.php?module={module_where_you_put_your_script}&action={your_script_with_no_php_extension}

with that your code is always executed from the root of the install so your includes are relative to that.


(11-16-2015, 03:49 PM)Guido1982 Wrote:
  • I'm thinking the Calendar module already uses a 'jQuery UI' include (haven't done the full research on this), so maybe the double include could be deleted?

Yes, you are correct, it loads jquery-ui-1.10.2.custom.min.js

(11-16-2015, 03:49 PM)Guido1982 Wrote:
  • Probably the javascript could be moved to a separate file and included in the 'AddEventUI.php' file to make the code less messy.

Maybe you can get rid of the whole thing, but if you need to load a script you should be able to register a HEADERSCRIPT link

(11-16-2015, 03:49 PM)Guido1982 Wrote:
  • In the future, I'd like to offer the possibility to connect an event to both an Account as well as a Sales Order. I think this will require a new column in the database and some code that saves this when the event is saved. If anyone has some pointers on this, help is appreciated.

You may be interested in the getFieldAutocomplete() and/or getReferenceAutocomplete() webservice functions. We use these for our satellite apps and also to do exactly what you are trying to do from inside the application.
These are already prepared to be executed via the ExecuteFunctions.php script in modules/Vtiger

For example, try typing this into your browser:

Code:
http://your_server/your_corebos/index.php?module=Utilities&action=UtilitiesAjax&file=ExecuteFunctions&functiontocall=getReferenceAutocomplete&searchinmodule=Accounts&limit=5&term=vt

which will return the first 5 accounts whose name start with the term "vt"
Joe
TSolucio
Reply


Messages In This Thread
RE: Autocomplete in the Calendar UI - joebordes - 11-16-2015, 09:25 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)