Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ExactOnline for coreBOS
#31
So basically every record in the system has to have an assigned user? That means I have to create this field, always for every custom module?

I see you use REQUEST in your example. Since this is a collection of all the superglobals, I guess this is a post variable? I see you have made a custom Save.php file here (mine, from the Payslip tutorial just contains an inclusion of the stock vTiger Save.php file). If I understand correctly, the 'focus' object is a temporary representation of the entity you are saving right? Will everything in the module's Save.php file be executed before the system actually saves the record?
Reply
#32
(12-21-2015, 10:55 AM)Guido1982 Wrote: So basically every record in the system has to have an assigned user? That means I have to create this field, always for every custom module?

Yes. There are 4 fields that should almost always be created on all modules although they are really in the vtiger_crmentity table. You can see these four in the default manifest.xml file:

https://github.com/tsolucio/corebos/blob/master/vtlib/ModuleDir/manifest.xml#L65

assigned user, created time, modified time and description


(12-21-2015, 10:55 AM)Guido1982 Wrote: I see you use REQUEST in your example. Since this is a collection of all the superglobals, I guess this is a post variable?

It is a POST variable when creating records using the application. If you are creating them by code, you have to "artificially" fill in the variable so the save process thinks it is being called from the web interface.


(12-21-2015, 10:55 AM)Guido1982 Wrote: I see you have made a custom Save.php file here (mine, from the Payslip tutorial just contains an inclusion of the stock vTiger Save.php file). If I understand correctly, the 'focus' object is a temporary representation of the entity you are saving right?

Note that the code I linked is just an example, your code will be different and has nothing to do with the Save.php file. The Save.php file is called ONLY from the application web interface, if you are creating records with your own code it will NOT get called.
$focus is the object you are saving.



(12-21-2015, 10:55 AM)Guido1982 Wrote: Will everything in the module's Save.php file be executed before the system actually saves the record?

Absolutely not. When your code calls the save() method, there will be no reference to the Save.php file.
Joe
TSolucio
Reply
#33
I updated my manifest file, I didn't have the required fields, neither did I have a description block or a description field. I'll remove my module completely and re-install it to see how it goes.

So, the Save.php file in the folder for the current Module is only called when you use the normal 'save' button inside the application? And you could make custom code here, but that won't be called when you for instance save a record from a workflow function? I understand that with timecontrol you needed a different function than the normal save action, for instance keeping in the record after the save is done.
Reply
#34
(12-28-2015, 04:11 PM)Guido1982 Wrote: So, the Save.php file in the folder for the current Module is only called when you use the normal 'save' button inside the application?

Correct

(12-28-2015, 04:11 PM)Guido1982 Wrote: And you could make custom code here, but that won't be called when you for instance save a record from a workflow function?

You should not make any custom code in this file. There are better ways to do that now: aftersave events, save_module, preSaveCheck.

(12-28-2015, 04:11 PM)Guido1982 Wrote: I understand that with timecontrol you needed a different function than the normal save action, for instance keeping in the record after the save is done.

Yes and no, at the time I created that I thought that was the correct way of doing it. I would do it differently now although that still works.
Joe
TSolucio
Reply
#35
Thanks. I'm still working on my manifest file, but now I have created one that saves a record and the filter seems to work as intended. I'm still a bit vague on the exact use of the entity identifier. I've got mine setup, it works, but I'd like to understand it better:

Take a look at my manifest file, here I've got the entity identifier. I've placed it inside the 'record name' field. I assume this means this field (recordname) becomes the entity identifier (this also is what the 'fieldname' in the table vtiger_entityname says). Am I correct to assume you always need to set the 'id' (in my case 'exactonlineid') field as its value, so it will correspond with the crmentity value? So the entity identifier will work as the link between the module ID and the global system ID's?

Furthermore, I set up the default mandatory fields, but is it also mandatory to set up the 'LBL_DESCRIPTION_INFORMATION' block in which the 'description' field lives? Or could that also live in the default block? I create a field called 'exactonlinereturn' in which I want to write the return from exact during saving, but if description is mandatory, I might as well use description for this.

I have setup record name and record no to auto gen on save, but nothing happens on save. I'm not sure but somehow the record numbering is not taking place. And how should I configure the record name to auto populate? Or is it better to do this in the vtws_create funtion?
Reply
#36
(12-29-2015, 11:01 AM)Guido1982 Wrote: .... Am I correct to assume you always need to set the 'id' (in my case 'exactonlineid') field as its value, so it will correspond with the crmentity value? So the entity identifier will work as the link between the module ID and the global system ID's?

Correct

(12-29-2015, 11:01 AM)Guido1982 Wrote: Furthermore, I set up the default mandatory fields, but is it also mandatory to set up the 'LBL_DESCRIPTION_INFORMATION' block in which the 'description' field lives? Or could that also live in the default block? I create a field called 'exactonlinereturn' in which I want to write the return from exact during saving, but if description is mandatory, I might as well use description for this.

Description is the only one that isn't mandatory, you could ignore this one, it is just "in line" with the rest of the application. You can put it in any block you want or leave it out completely.



(12-29-2015, 11:01 AM)Guido1982 Wrote: I have setup record name and record no to auto gen on save, but nothing happens on save. I'm not sure but somehow the record numbering is not taking place. And how should I configure the record name to auto populate? Or is it better to do this in the vtws_create funtion?

There can be only one uitype4=autonumbering field in any module. uitype=3 is a really special field for users (the access key field) and it is filled with some specific code in the users module. That is an internal uitype.
It would be best that you set the value of the field yourself.
Joe
TSolucio
Reply
#37
Well, right now I have an almost functioning module, except it will only save the first record, and not give it a record number. When you try to create the second record, it will not say 'AUTO GEN ON SAVE' in the UI type 4 field and not save the second record. Also, it indicates I have to setup record numbering, but that doesn't work. This may be due to the several times I installed this module, I'll do some exploring.

EDIT
Fixed it, I set my column for numbering to an integer, but I had a couple of leading zeroes. The record no field should therefor be of type varchar...
Reply
#38
Yes. it is a varchar because it saves also the prefix in the same field
Glad you got it working
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 20 Guest(s)