Forum

Screen Customizatio...
 
Notifications
Retirer tout

Screen Customization : eval in default value

6 Posts
2 Utilisateurs
0 Reactions
1,528 Vu
Fanch
(@fsouliers)
Posts: 86
Active Member
Début du sujet
 
[#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 ?


 
Posté : 17 Déc PM 20:1212
(@babynus)
Posts: 14952
Membre 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"

 
Posté : 17 Déc PM 20:1212
Fanch
(@fsouliers)
Posts: 86
Active Member
Début du sujet
 

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)


 
Posté : 17 Déc PM 22:1212
Fanch
(@fsouliers)
Posts: 86
Active Member
Début du sujet
 

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 ?


 
Posté : 18 Déc PM 16:1212
(@babynus)
Posts: 14952
Membre 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


 
Posté : 18 Déc PM 16:1212
Fanch
(@fsouliers)
Posts: 86
Active Member
Début du sujet
 

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 🙂


 
Posté : 18 Déc PM 17:1212
Share:
Retour en haut