View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Supportez nous sur Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - [SOLVED] Best way to set default values - ProjeQtOr

Prochaines sessions de formation

Les prochaines formations et démonstrations sont ouvertes, inscrivez-vous rapidement !

 

Démonstration de ProjeQtOr

(gratuit, sur inscription)

Mardi 23 avril (10h30-12h)

Jeudi 16 mai (16h-17h30)

Jeudi 13 juin (10h30-12h)

 
 

Planifiez avec ProjeQtOr

3 et 4 avril (9h - 12h30)

 
 

Administrez avec ProjeQtOr

10 et 11 avril (9h - 12h30)

 

 

 
 

[SOLVED] Best way to set default values

More
21 Oct 2016 14:32 - 03 Nov 2016 17:21 #1 by huets15
Hello,

I begin in ProjeQtOr's plugin developpment.
I want to know what is the best way to make a plugin to set default value for (any) fields ? My question is about assign value to a field (with JS ? with HTML default value for <input> ? Is there something in ObjectDetail.php ?)

Thanks in advance
Last edit: 03 Nov 2016 17:21 by huets15.
The topic has been locked.
More
26 Oct 2016 10:44 #2 by link
Replied by link on topic Best way to set default values
Hi,
I don't know if this will help
If you want default values to be set in fields while creating new object
go to model and find the class and affect default values to properties
Ex :
public $_sec_description;
public $id; // redefine $id to specify its visible place
public $reference;
public $name='name'; // default value while creating new object is 'name'
The topic has been locked.
More
03 Nov 2016 17:15 - 03 Nov 2016 17:17 #3 by huets15
Hi,

My plugin is made.

I developped a Trait that read a xml parameter of default values (define object, field and values) and set the default value directly on objet's property (only if it's empty)
I have a php file launched during plugin installation (thanks to "postInstall" property of the plugin description)
This php file copy all customisable classes (which extend a ***Main classes) in the custom folder (only classes which not already exist in the custom folder)
Then, it includes the Trait (include_once('...'); ) (stored in plugin folder) and use it (use MyTrait;) in all classes of custom folder (which extend a ***Main classes).
The installation php file also makes the call of a method of the Trait at the last line of the constructor of all classes of custom folder (which extend a ***Main classes).
I also set Triggers in plugin description file to launch the method of the Trait on the beforeSave event.

Hope it could help someone
Last edit: 03 Nov 2016 17:17 by huets15.
The topic has been locked.
Moderators: babynusprotion
Time to create page: 0.032 seconds

Paramétrages de cookies

×

Cookies fonctionnels

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Veuillez vous connecter pour voir vos activités!

Autres cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.