Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Screen Customizatio...
 
Notifications
Clear all

Screen Customization : eval in default value

6 Posts
2 Users
0 Reactions
1,529 Views
Fanch
(@fsouliers)
Posts: 86
Active Member
Topic starter
 
[#7098]

Hello,

I use Screen Customization plugin, quite often I use the eval trick to set a default value and I now have a problem for which I don't even know how to look for some information :
For the project entity, I would like to set a default value for the description field depending of the type of the project.
Basically I thought something dirty like $this->idProjectType == 173 ? "Specific default val": "really default val" could work ... but no ...

Can anyone give me some help ?


 
Posted : 17 Dec 2020 20H00
(@babynus)
Posts: 14952
Member Admin
 

I think you should use parenthesis for condition

($this->idProjectType == 173) ? "Specific default val": "really default val"

Possibly you can try also to specifically use $value as result

$value=($this->idProjectType == 173) ? "Specific default val": "really default val"

 
Posted : 17 Dec 2020 20H05
Fanch
(@fsouliers)
Posts: 86
Active Member
Topic starter
 

Well, I have the same result in both cases and it does not work 🙁
I imagine this is because my project does not exist yet in the database.

But worse, I tried to look at the code and set the default value to

RequestHandler::getValue('idProjectType');

(why ... because I guess I am tired) ... and now I can't even log anymore to Projeqtor, as I have an error "exception occured at {time of the error}" 🙁 🙁 🙁

... how can I unset this change ?
Looking at the code, I thought there was a verification about the viability of the formula .... but it seems it's not enough .... 🙁

where in the database can I unset this default value ? (I imagine I have to erase a cell in the DB)


 
Posted : 17 Dec 2020 22H31
Fanch
(@fsouliers)
Posts: 86
Active Member
Topic starter
 

So ...
I changed the file model/custom/Project.php to remove this dumb default value (I set it to a single word).

... but I still can’t connect to Projeqtor anymore ... 🙁

what happens ?


 
Posted : 18 Dec 2020 16H34
(@babynus)
Posts: 14952
Member Admin
 

To retreive connection, rename file model/custom/Project.php to model/custom/Project.php.old
Post here this file, we'll have a look


 
Posted : 18 Dec 2020 16H53
Fanch
(@fsouliers)
Posts: 86
Active Member
Topic starter
 

OK, my second problem is solved : my stupid default value added a "); in the Project.php so all the end of the file was erroneous.

So back to my first problem ... if anybody knows how to set a default value according to the project type, it would be welcome 🙂


 
Posted : 18 Dec 2020 17H37
Share:

Scroll to Top