Is there any way where we can know all the mandatory fields within a transaction say MK01 for SHDB Recording for BDC Prog ?
No, because fields can be switched to mandatory/optional or even invisible at runtime depending on arbitrary parameters. You will be able to identify certain fields that are mandatory unconditionally, but it is not generally possible to identify all mandatory fields beforehand.
Related
Before calling TYPO3\CMS\Core\Mail\MailMessage::send on a MailMessage, the record gets persisted in one of the two Email record storage pages that I have.
Then the Email gets sent by calling that method. For this, the global configuration values described in Mail API are used.
The thing is that I want some of these values to be different depending on the Pid of the email record being sent. What would be the most sensible way to achieve that? The only way I can think of doing this right now would be to extend and override the aforementioned class and method, and changing the desired $GLOBALS['TYPO3_CONF_VARS']['MAIL'][...] values before the parent::send call. But I'm not sure if this would be the most sensible and optimal way of achieving this. Should I try something else?
Thanks a lot in advance!
Your question still leaves a lot of additional questions:
what version of TYPO3 are you using?
what plugin do you use to transform information (User input?) into a mail?
depending on the software you have options to configure the mails additional to the basic configuration from $GLOBALS['TYPO3_CONF_VARS']['MAIL'].
This configuration is stored in /typo3conf/LocalConfiguration.php, which just stores constant data. But you also have typo3conf/AdditionalConfiguration.php where you can use functions to set values dynamically.
Probably the best way would be to configure your plugin with typoscript or fields in the CE to behave different depending on the page you work.
e.g.: if you use ext:form you have finisher you can configure to set parameters for mails, depending on any available information.
I'm working in a project that uses Catalyst and DBIx::Class.
I have a requirement where, under a certain condition, users should not be able to read or set a specific field in a table (e.g. the last_name field in a list of users that will be presented and may be edited by the user).
Instead of applying the conditional logic to each part of the project where that table field is read or set, risking old or new cases where the logic is missed, is it possible to implement the logic directly in the DBIx::Class based module, to never return or change the value of that field when the condition is met?
I've been trying to find the answer, and I'm still reading, but I'm somewhat new to DBIx::Class and its documentation. Any help would be highly appreciated. Thank you!
I‘d use an around Moose method modifier on the column accessor generated by DBIC.
This won‘t be a real security solution as you can still access data without the Result class, for example when using HashRefInflator.
Same for calling get_column.
Real security would be at the database level with column level security and not allowing the database user used by the application to fetch that field.
Another solution I can think of is an additional Result class for that table that doesn‘t include the column, maybe even defaulting to it and only use the one including the column when the user has a special role.
I need to build a custom id validator that will apply to a single collection, whose id will always be pre-defined (won't need a generator).
In the docs about id generators, it's written:
Currently the configuration of the custom generator applies to every resources (buckets, groups, collections, records). This tiny limitation can easily be fixed, don’t hesitate to get in touch with us!
But there is nothing documented about id validation.
So, how do I:
Implement an id validator, that
Will apply to one collection only?
By default cliquet uses a generator which accepts the following regular expression r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$' (All letters and numbers + underscore and "-").
Before you chose to have a different ID validation mechanism, ensure you really need to.
Now, if that's not enough, you would need to select the proper validator depending on some configuration or already existing values, but this is not implemented in cliquet / kinto.
https://github.com/mozilla-services/cliquet/blob/master/cliquet/resource/init.py#L147 is probably a good place to look at / start with.
I've read many online resources about this issue, but I think this situation is a little different. I'm working on a large app with lots of different forms. I've read in most places that using the (optional) tag is the best way to indicate that a field is optional. However, in this app, there are several forms, each of which vary drastically in the number of required vs. optional fields.
One form may have up to 20 optional fields, another may have 90% required fields. Some are split ~50/50. I still like using (optional), but do you guys have any suggestions? I'm a little split just because some forms have no optional labels while some other forms have the optional tag on every single form label. Thanks
You could use "optional" placeholders while keeping the required fields open:
There can be many variations of this, but it's one way to do it.
I need to capture user input using a form. Each field within the form will undergo validation. The field will be either valid or invalid. Depending on the user input, certain parts of the form may be enabled, disabled, filtered or otherwise modified.
I am considering the state pattern to model the state transitions through the form. Each state will affect how the form is displayed, filtered etc. However, my understanding of the state pattern is that it would require a very large number of states to represent my form.
For example; if I have 10 fields that can be valid or invalid that is:
10P2 = 90 permutations.
That is an enormous number of states to represent in code, and I have grossly simplified the problem.
Questions:
Am I misunderstanding how to implement the state pattern for my problem?
If not, is the state pattern the wrong solution to my problem?
If yes to the last question, what is a good general solution?
Am I misunderstanding how to implement the state pattern for my
problem?
I think you've understood it correctly.
If not, is the state pattern the wrong solution to my problem?
Yes. The State pattern is a good solution when there are a limited number of states (conditions). This is not true in your case.
If yes to the last question, what is a good general solution?
I would recommend using the Specification pattern. You can have any number of rules attached to your input fields. The rules can determine if the field should be enabled or disabled, visible or hidden. Also worth noting is that the rules can be easily unit tested separately.