README 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. README (english)
  2. ------------------------------------
  3. Adding your own email selector module
  4. ------------------------------------
  5. If you want to add your own emails selector/import module. This is steps to follow
  6. to add you own email predefined selector:
  7. ***** STEP 1 *****
  8. Copy file
  9. htdocs/core/modules/mailings/example.modules.php
  10. into
  11. htdocs/core/modules/mailings/myselector.modules.php
  12. You can choose value of your choice instead of "myselector" in name
  13. of new file.
  14. ***** STEP 2 *****
  15. Edit this file myselector.modules.php and change following text:
  16. "class mailing_example" into "class mailing_myselector"
  17. "var $name='example';" into var $name='myselector';
  18. "var $desc='...';" into var $desc='A text to describe selector';
  19. "function mailing_example" into "function mailing_myselector"
  20. Then add code inside the "add_to_target" function. What you must do is simply
  21. fill the $target PHP array with one record for each email your selector must return.
  22. You can choose the way you get data: From a file, a database. You are free,
  23. the only requirement is that the $target array is filled by records that are
  24. themselves array of: ('email', 'name', 'firstname', 'other').
  25. This is for example how you can fill the $target array:
  26. // ----- Your code start here -----
  27. $target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0', 'other'=>'other_0');
  28. ...
  29. $target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n', 'other'=>'other_n');
  30. // ----- Your code end here -----
  31. and call the method
  32. parent::addTargetsToDatabase($mailing_id, $target);
  33. ***** STEP 3 *****
  34. Once this file has been edited, you can go to the Dolibarr emailing feature,
  35. you will see a new line selector in the "targets" editor of emailing tool.