CoreBOSBB

Full Version: Work on Schedular has begun
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I've begun working on the Schedular module. Currently I'm in the planning phase. So basically I'm setting up the file structure and most importantly the manifest file. The repo can ben found here. The manifest file is my main concern at this moment.

As you can see I'm creating three tables at the moment. One to keep track of resource groups that a user can create. Upon installation I will create one resource group by default ('users'). When this resource group is selected as the one to show, a settings-allowed user can select the system users that will be used as resources. As you can see there is no way of keeping track of the currently selected resource group right now. I think I will keep track of this in a new 'general settings' table.

Every resource group gets an ID that will be used in the second table. This second table keeps track of the individual resources and the group it belongs to.

The third table is used to keep track of which resource is assigned to which internal coreBOS activity. This is where it gets a little tricky. When an activity is saved in the Schedular, my plan is to create an event through the normal internal system. I am not familiar with this system (apart from just writing SQL directly), but I need some kind of feedback. Meaning: after the system is done creating the normal activity, I need to know the crmid of that newly created activity so I can save this. This way I can load activities from the vtiger_activity table and get the correct resource for each activity (if any). So I need a little help on this. Is there a 'vtlib' way to do this? And does it provide a callback after creating an activity?
The easiest way to create a record from within the application (and from outside) is to use the webservice interface.
Look at how we do it in the calendar import script:

https://github.com/tsolucio/corebos/blob/master/build/HelperScripts/importcalendarcsv.php#L153

the result of that call contains the ID you are looking for.
(07-12-2016, 08:37 PM)joebordes Wrote: [ -> ]The easiest way to create a record from within the application (and from outside) is to use the webservice interface.
Look at how we do it in the calendar import script:

https://github.com/tsolucio/corebos/blob/master/build/HelperScripts/importcalendarcsv.php#L153

the result of that call contains the ID you are looking for.

I suspected that would be the best way. So in this case the result is returned to '$row', and the ID can be retrieved from '$row["id"]'?
Correct!
As I'm currently in the process of writing the 'save' code, I'd like to know two things:
  • How do I assign an event to a user other than the user currently using the Schedular module? I see I need to pass in $current_user, but my guess is this is mainly for checking if the current user has rights to save. How do we assign the user the event is designated to?
  • I'm getting errors on missing fields like 'parent_id'. How do I find out which fields are required and what they are? For instance, I can't find the parent_id column in the vtiger_activity table.
Use the webservice development tool:

https://github.com/tsolucio/coreBOSwsDevelopment

click on the "List Types" link and go to the calendar module, you will see the list of fields, their names and if they are mandatory or not among other details.

In that list of fields you will see the assigned_user_id field which is common to all modules and is where you will specify the owner of the new calendar record.

BTW, by default parent_id is not mandatory so it is probably set in your install.
Great, nice that we have a tool like that.

What is parent_id anyway? Just for my understanding of the application.

Someting that's not wuite clear to me right now. When I use the webservice creation to create an event that is assigned to a user other than the current one (and not an admin user) the event still gets assigned to the admin user (user ID 1). When I use the webservice tool and select the calendar I get:

Can create: 1
Can update: 1
Can delete: 1
Can retrieve: 1

Is the '1' here user no. 1? Or is the '1' more a boolean here? When I go to the 'sales man' profile (to which my other test users have been assigned) I can't permit them to create entities.

Right now I manually update the 'smownerid' field in the 'vtiger_crmentity' table after I create an event through a second query but there has to be a more 'in-app' way of doing this. Being so that the purpose of this module is that a 'planning user' can assign events to other users this is kind of a critical thing. I can still manage to do it, but it feels kind of hacky.

About the parent_id, nevermind. I see that it is the 'related module'....
If I remember correctly this works correctly. Before I try and verify two things come to mind:

1.- you are assigning the user with its' webservice id, right? Something like 19x22

2.- show me the piece of code where you fill in the array of values
Crap, should have thought of it but yes, I forgot to add the webservice ID.. That's the tab ID for the webservice module right?
It happens a lot in the beginning. :-)

No, it is not the tabid, for some strange reason that I haver never known the answer to (because I asked various times but was ignored by vtiger), webservice API generates it's own module ID for each module. You can see this number in the vtiger_ws_entity table and also using the Webserice development tool, on the List Types page you get the module's webservice ID.

BTW, I forgot to answer the "Can Create: 1" question above, that is a boolean true saying that the user currently connected has permission to create.
Pages: 1 2