Dear admin,
is it possible to create a page about the module builder on the wiki ?
I’d like to see how to refer to all standard dolibarr objects (fk_ … ) or at least update the wiki with the one I used so I won’t have to search next time.
br
Dear admin,
is it possible to create a page about the module builder on the wiki ?
I’d like to see how to refer to all standard dolibarr objects (fk_ … ) or at least update the wiki with the one I used so I won’t have to search next time.
br
And also how to use the sellist ( also used in addextrafields)
about the objects, here the format I deducted for the type:
integer:ClassName:tongue:athToClassFromHtdocs.class.php
- Should work with ‘link’ instead of ‘integer’
sellist:tableName:ListFieldsToShow:IDcolum(rowid)arentName|ParentColumnName:WhereClause
- ListFieldsToShow : each fields need to be separated with “|”
- REPLACE ‘SELECT’ by ‘’$SEL$’ and the current object id per '$ID$ ‘in WhereClause,
- use extra.’ to refer to the extraf fields of your tableName
- Join and Joinclause might be added in the tableName but I am unsure of the result,
Hello Guys,
I don’t understand how to use the “sellist” type in the extrafield, and cannot find information.
Maybe we need an example to understand better this type, I will do an example and please help me.
I have a dolibarr table called : billing_locations where I have the following fields :
basically is a simple table, and I want to add an extra field in the “thirdparty” view displaying the data from my table.
So : my code is here :
"billing_locations:name:rowid"
here my complete code :
$result4=$extrafields->addExtraField('locations', "Locations list", 'sellist', 102, 20, 'thirdparty', 0, 1, '', "billing_locations:name:rowid", 1, '', 1, 0, '', '', 'billingplus@billingplus', '$conf->billingplus->enabled');
The extra field name is shown in the thirdparty view, but the data is not shown.
Can you explain, please how work : sellist and chkbxlst ?
Best regards,
Isaac Flores
Hello. Could you find the right way to use extrafields in sellist?
Hi @jmaxb1
Hello. Thanks for your reply. I think I wasn’t clear. What I’m looking for to add a sellist in myobject.class.php file. like this:
‘fournfacture_fuel’ => array(‘type’=>‘sellist:facture_fourn:ref_supplier:rowid::entity=1’, ‘label’=>‘FactureFuel’, ‘enabled’=>‘1’, ‘position’=>24, ‘notnull’=>1, ‘visible’=>1,),
I added an extrafield to the suppliers facture to check if facture of supplier is a fuel expense or not.
So I want to add that a s a filter. Like if the query could be like this:
SELECT f.rowid, f.ref_supplier FROM facture_fourn as f JOIN facture_fourn_extrafields as fe WHERE fe.fuel_expense = 1 AND entity = 1
try sth like this
/**
* Class MyobjectForm.
*/
class MyobjectForm extends Form
{
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return combo list with...sth
*
* @param string $selected sth preselected
* @param string $htmlname Name of HTML select combo field
* @param string $morecss Add more css on SELECT element
* @param int $addjscombo Add js combo
* @return string String with HTML select
*/
public function select_sth($selected = '', $htmlname = 'sth', $morecss = 'maxwidth150', $addjscombo = 1)
{
// phpcs:enable
global $conf, $langs, $user;
$out = '';
$sql = "SELECT rowid......
..............................
return $out;
}
then use it
$MyobjectForm = new MyobjectForm($object->db);
............
print $MyobjectForm->select_sth((GETPOSTISSET("sth") ?GETPOST("sth", 'alpha', 2) : ''), "sth", '', 1);
Thanks for your help. I did’t it in a different way at the end. But what I wanted to know if there was a way to make it using sellist properties.
Greets.