Project module, how to choose default "relatedto" field value - vtiger

Good morning everyone, I would like a tip on a small detail of the Projects module that makes my work difficult.
When a new project is created there is the possibility to relate it to either an organization or a contact,but in the field where it is chosen the default value is organization, so every time I create a new project I have to click on organization, select contact, and then choose the contact i want.
How can i get the default value on Contacts? Or at least break the relationship between Projects and Organizations (i don't need it)?
I tried to modify the table vtiger_field from the database, the fieldname is linktoaccountscontacts, and to modify the defaultvalue, but it does not work.
Any help would be very much appreciated, thanks!

if you don't need the relationship between Projects and Organizations you can delete it in the vtiger_fieldmodulerel table:
DELETE FROM vtiger_fieldmodulerel WHERE fieldid IN (SELECT fieldid FROM `vtiger_field` WHERE `fieldname`='linktoaccountscontacts') AND relmodule ='Accounts'

Related

Oracle APEX - Reusable Pages?

We have some tables in our database that all have the same attributes but the table is named differently for each. I'm not sure of the Architect's original intent in creating them in this way, but this is what I have to work with.
My question for all the expert Oracle APEX developers: is there away to create a reusable page that I can pass the table name to and that table name would be used in the reporting region and DML processing of that page?
I've read up on templates and plugins and don't see a path forward with those options. Of course, I'm new to webdevelopment, so forgive my ignorance.
We are using version 18.2.
Thanks,
Brian
For reporting purposes, you could use a source which is a function that returns a query (i.e. a SELECT statement). Doing so, you'd dynamically decide which table to select from.
However, DML isn't that simple. Instead of default row processing, you should write your own process(es) so that you'd insert/update/delete rows in the right table. I've never done that, but I'd say that it is possible. Basically, you'd keep all logic in the database (for example, a package) and call those procedures from your Apex application.
You could have multiple regions on one page; one region per table. Then use dynamic actions to show/hide the regions and run the select query based on a table name selected by the user.
Select table name from a dropdown or list
Show the region that matches the table name (dynamic action)
Hide the any other regions that are visible (dynamic action)
Refresh the selected region so the data loads (dynamic action)
If that idea works let me know and I can provide a bit more guidance.
I never tried it with reports, but would it work to put all three reports in a single page, and set them via an Item to have Server-Side Conditions that decide what gets shown in the page? You'd likely need separate items with a determined value for the page to recognize and display.
I know I did that to set buttons such as Delete, Save and Create dynamically, rather than creating two or more separate pages for handling editing of certain information. In this case it regarded which buttons to shown based on a reports' primary key being sent to said "Edit" page. If the value was empty, it meant you wanted to create a new record (also because the create button/link sent no PK). If said PK was sent (via a edit button/link), then you'd have the page recognize it and hide the create button and rather show the edit button.

Django Models: Creating Subtypes

I am new to Django and am working through some models on a project right now.
Is there a decent way to set the following up?
Using a model that ties to the auth_user model (UserAccount), I prompt users to select the type of account they have (Ex: Vendor or Buyer).
This part works fine... but I want to build the site experience based off of their account type. How would I create VendorProfile or BuyerProfile models (with differing data) based upon that option?
I might be over analyzing this, but basically I do not want any profiles to be linked to both types of data. Is that something I should just control with views, or is there a good way to lock my models and prevent duplicate information? Let me know if you think this is too broad, but I'm still on the conceptual level.
So:
auth_user model
UserAccount model:
user: one to one (User)
account_type: 'V' or 'B'
VendorProfile(?)
user: one to one (UserAccount where type='v')?
company name:
vendor code:
BuyerProfile(?)
user: one to one (UserAccount where type='b')?
favorite color:
pet's name:
yes you can do that. for that you need to change a small thing in the auth table of django and that is you need to add a column account_type where the V or B will be stored. Hope you can find it how to do it.
next is create 2 models for vendor and buyer. make a onetoonefield with the user table for storing the id of the user, in this models keep the extra information of the vendor or buyer you want to store.
hope it helps

Multiplechoice widget with really big lsit

In my model Person can have more than one partner, so the ManyToMany Model is the only answer (this has to be ManyToMany for other reasons, so please don't think about changing it).
If I use default widget i got a list of all persons with selected one, two maybe three persons (which are partners of Person).
It would be ok, if the Person list is about 10-100 - and it works on test database. But my prod database has 10.000 persons or more, so the ModelMultipleChoice widget would be filled with 10.000 records, and finding the correct partner will last ages, and memory usage isn't trivial.
I need only to see names of partners with possibility to unset it from person, and some possibility to add new just typing name. The best solution is to show listbox with filtered names after typing three or four first letters, but any solution would be great.
With forms it would be easier, but I need it in admin, so I'd like to use django admin standards.

Adding a custom property dependent on another in Umbraco

The request
I want to add Members to their department in our Company, but our company has more offices and each office its own departments, so we need to organize that first and then try to assign each Member to its department so that they only have permissions to access their own department.
Departments overview as Umbraco Content:
Root Node
-Office 1
-- Department1.1
-- Department1.2
-Office 2
-- Department 2.1
-Office 3
-- Department 3.1
-- Department 3.2
-- Department 3.3
Now, if I add a User, I want one property to select the office and another to select the department.
Possible solutions
Checking here and there, I've seen I can make the Office property using the UltimatePicker type in Umbraco creating a custom data-type linked to a parent node and then a property inside my MemberType. That will display the offices under "Root Node" and link the member to one of them.
Now, to make the department property I've seen there could be some way using a custom manually-coded property, adding a usercontrol and using it to display the office children dynamically (I've not tried it yet, I'm theorizing).
But I am worried that the second property will be dependent on the first one, and when I've tried to create my custom property implementing umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor in my usercontrol it only allows me to save one value, not two of them. Which has sense as this is supposed to be A property, and not a bunch of them.
My question
Now, what's the best way to have those 2 custom properties and also make sure that in case I change the office the department will be also refreshed?
Best crazy idea at the moment
Up to this moment, I can only imagine creating 2 usercontrols, one for each property, and manually clean the department each time the office is updated, though I don't know if this is possible (Can I really get departments dynamically? Can I clean the dep. property FROM office property usercontrol?) and I would prefer to have them together as to simplify the codes.
If the relationship is key and you need to prevent a user from accidentally choosing a department that doesn't belong to an office, then you could create a single usercontrol that contains two drop-down menus. The first menu displays the offices and the second is only populated (preferably by an ajax call) once an office selection has been made.
The code for retrieving the offices and departments would be relatively straightforward using the umbraco api.
The usercontrol could then save the id's of each to xml or a comma delimited list.
Alternatively, you could just allow the user to select a department and the office is implied by the choice of department. You could use the uComponent's multi-nodepicker and filter the node selection to only the Department doc type. The overhead then is in the UI code where you have to work out the Office from the Department.
To get around this, you could have a label property that simply stores the ID of the Department's Office. The Office ID could then be saved using an OnSave event handler.

Can't add two FK-related tables into maintenance view?

I created two database tables: Primary table and Secondary table.
An Employer field of Primary table is a foreign key for an Employer field for Secondary table, at least I see a checked checkbox at Secondary->Entry Help/Check for Employer field. Both tables are activated.
Now I'm trying to create a View and here is the problem. I choose Dictionary Objects->Create->View->choose Maintenance View, then enter a name.
I go on and then at Table/Join Conditions I'm able to add only ONE table. Why not two? Also I see a blue hint "Table selection and join definition only possible with relationships".
What's the reason I can't add two tables to the View? What am I doing wrong?
Thank you.
First, check whether there really is a foreign key relation ship (key/arrow button above the columns of the secondary table).
When creating the view, the system should show you a message (don't know the english text,
should amount to "you can only add secondary views using the key relations"). Enter the primary table you want to maintain. Then place the cursor in that field and press the button below the list of tables. Select the other table from the list. If you don't see it there, chances are that your relationship definitions are wrong.
(This whole setup is to ensure that you only use relationship definitions that can be used by the view maintenance generator later on.)
Please take a look at the documentation as well, this should explain a lot of other questions you might encounter.