28 include_once DOL_DOCUMENT_ROOT.
"/core/modules/DolibarrModules.class.php";
50 $this->numero = 63000;
53 $this->rights_class =
'resource';
57 $this->family =
"projects";
58 $this->module_position =
'16';
62 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
66 $this->
description =
"Manage resources (printers, cars, room, ...) you can then share into events";
68 $this->version =
'dolibarr';
71 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
77 $this->picto =
'resource';
82 $this->module_parts = array();
90 $this->config_page_url = array(
"resource.php");
94 $this->depends = array();
96 $this->requiredby = array(
'modPlace');
98 $this->phpmin = array(5, 4);
100 $this->langfiles = array(
"resource");
105 $this->
const = array();
137 $this->boxes = array();
149 $this->rights = array();
152 $this->rights[$r][0] = 63001;
153 $this->rights[$r][1] =
'Read resources';
154 $this->rights[$r][3] = 0;
155 $this->rights[$r][4] =
'read';
158 $this->rights[$r][0] = 63002;
159 $this->rights[$r][1] =
'Create/Modify resources';
160 $this->rights[$r][3] = 0;
161 $this->rights[$r][4] =
'write';
164 $this->rights[$r][0] = 63003;
165 $this->rights[$r][1] =
'Delete resources';
166 $this->rights[$r][3] = 0;
167 $this->rights[$r][4] =
'delete';
170 $this->rights[$r][0] = 63004;
171 $this->rights[$r][1] =
'Link resources to agenda events';
172 $this->rights[$r][3] = 0;
173 $this->rights[$r][4] =
'link';
183 $this->menu = array();
187 $this->menu[$r] = array(
188 'fk_menu'=>
'fk_mainmenu=tools',
190 'titre'=>
'MenuResourceIndex',
192 'leftmenu'=>
'resource',
193 'url'=>
'/resource/list.php',
194 'langs'=>
'resource',
197 'perms'=>
'$user->rights->resource->read',
202 $this->menu[$r++] = array(
203 'fk_menu'=>
'fk_mainmenu=tools,fk_leftmenu=resource',
205 'titre'=>
'MenuResourceAdd',
206 'mainmenu'=>
'tools',
207 'leftmenu'=>
'resource_add',
208 'url'=>
'/resource/card.php?action=create',
209 'langs'=>
'resource',
212 'perms'=>
'$user->rights->resource->write',
217 $this->menu[$r++] = array(
218 'fk_menu'=>
'fk_mainmenu=tools,fk_leftmenu=resource',
221 'mainmenu'=>
'tools',
222 'leftmenu'=>
'resource_list',
223 'url'=>
'/resource/list.php',
224 'langs'=>
'resource',
227 'perms'=>
'$user->rights->resource->read',
238 $this->export_code[$r] = $this->rights_class.
'_'.$r;
239 $this->export_label[$r] =
"ResourceSingular";
240 $this->export_permission[$r] = array(array(
"resource",
"read"));
241 $this->export_fields_array[$r] = array(
'r.rowid'=>
'IdResource',
'r.ref'=>
'ResourceFormLabel_ref',
'c.code'=>
'ResourceTypeCode',
'c.label'=>
'ResourceType',
'r.description'=>
'ResourceFormLabel_description',
'r.note_private'=>
"NotePrivate",
'r.note_public'=>
"NotePublic",
'r.asset_number'=>
'AssetNumber',
'r.datec'=>
"DateCreation",
'r.tms'=>
"DateLastModification");
242 $this->export_TypeFields_array[$r] = array(
'r.rowid'=>
'List:resource:ref',
'r.ref'=>
'Text',
'r.asset_number'=>
'Text',
'r.description'=>
'Text',
'c.code'=>
'Text',
'c.label'=>
'List:c_type_resource:label',
'r.datec'=>
'Date',
'r.tms'=>
'Date',
'r.note_private'=>
'Text',
'r.note_public'=>
'Text');
243 $this->export_entities_array[$r] = array(
'r.rowid'=>
'resource',
'r.ref'=>
'resource',
'c.code'=>
'resource',
'c.label'=>
'resource',
'r.description'=>
'resource',
'r.note_private'=>
"resource",
'r.resource'=>
"resource",
'r.asset_number'=>
'resource',
'r.datec'=>
"resource",
'r.tms'=>
"resource");
244 $keyforselect =
'resource'; $keyforelement =
'resource'; $keyforaliasextra =
'extra';
245 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
247 $this->export_dependencies_array[$r] = array(
'resource'=>array(
'r.rowid'));
248 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
249 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'resource as r';
250 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
251 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'resource_extrafields as extra ON extra.fk_object = r.rowid';
252 $this->export_sql_end[$r] .=
' AND r.entity IN ('.getEntity(
'resource').
')';
261 $this->import_code[$r] = $this->rights_class.
'_'.$r;
262 $this->import_label[$r] =
'ImportDataset_resource_1';
263 $this->import_icon[$r] =
'resource';
264 $this->import_entities_array[$r] = array();
265 $this->import_tables_array[$r] = array(
'r'=>MAIN_DB_PREFIX.
'resource',
'extra'=>MAIN_DB_PREFIX.
'resource_extrafields');
266 $this->import_fields_array[$r] = array(
'r.ref'=>
"ResourceFormLabel_ref*",
'r.fk_code_type_resource'=>
'ResourceTypeCode',
'r.description'=>
'ResourceFormLabel_description',
'r.note_private'=>
"NotePrivate",
'r.note_public'=>
"NotePublic",
'r.asset_number'=>
'AssetNumber',
'r.datec'=>
'DateCreation');
268 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.
")";
272 while ($obj = $this->
db->fetch_object(
$resql))
274 $fieldname =
'extra.'.$obj->name;
275 $fieldlabel = ucfirst($obj->label);
276 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
280 $this->import_fieldshidden_array[$r] = array(
'r.fk_user_author'=>
'user->id',
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'resource');
281 $this->import_convertvalue_array[$r] = array(
282 'r.fk_code_type_resource'=>array(
'rule'=>
'fetchidfromcodeorlabel',
'classfile'=>
'/core/class/ctyperesource.class.php',
'class'=>
'Ctyperesource',
'method'=>
'fetch',
'dict'=>
'DictionaryResourceType'),
285 $this->import_regex_array[$r] = array(
's.datec'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
286 $this->import_examplevalues_array[$r] = array(
'r.ref'=>
"REF1",
'r.fk_code_type_resource'=>
"Code from dictionary resource type",
'r.datec'=>
"2017-01-01 or 2017-01-01 12:30:00");
287 $this->import_updatekeys_array[$r] = array(
'r.rf'=>
'ResourceFormLabel_ref');
299 public function init($options =
'')
305 return $this->
_init($sql, $options);
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
loadTables()
Create tables, keys and data required by module Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys and create data commands must be stored in directory /resource/sql/ This function is called by this->init.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
Description and activation class for module Resource.
init($options= '')
Function called when module is enabled.
__construct($db)
Constructor.
_init($array_sql, $options= '')
Enables a module.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
_load_tables($reldir)
Create tables and keys required by module.