Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
jfefe committed May 10, 2014
1 parent 7fbcb4f commit 6a9bf00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 56 deletions.
52 changes: 1 addition & 51 deletions htdocs/core/modules/modResource.class.php
Expand Up @@ -121,16 +121,7 @@ public function __construct($db)
// List of particular constants to add when module is enabled
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example:
$this->const = array(
0=>array(
'PLACE_DEFAULT_ZOOM_FOR_MAP',
'chaine',
'1',
'This is a constant to defined default zoom into link to OSM map',
1
)

);
$this->const = array();

// Array to add new pages in new tabs
// Example:
Expand Down Expand Up @@ -165,47 +156,6 @@ public function __construct($db)
'thirdparty:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=societe&element_id=__ID__'
);

/* Example:
// This is to avoid warnings
if (! isset($conf->resource->enabled)) $conf->resource->enabled=0;
$this->dictionnaries=array(
'langs'=>'resource@resource',
// List of tables we want to see into dictonnary editor
'tabname'=>array(
MAIN_DB_PREFIX."table1",
MAIN_DB_PREFIX."table2",
MAIN_DB_PREFIX."table3"
),
// Label of tables
'tablib'=>array("Table1","Table2","Table3"),
// Request to select fields
'tabsql'=>array(
'SELECT f.rowid as rowid, f.code, f.label, f.active'
. ' FROM ' . MAIN_DB_PREFIX . 'table1 as f',
'SELECT f.rowid as rowid, f.code, f.label, f.active'
. ' FROM ' . MAIN_DB_PREFIX . 'table2 as f',
'SELECT f.rowid as rowid, f.code, f.label, f.active'
. ' FROM ' . MAIN_DB_PREFIX . 'table3 as f'
),
// Sort order
'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
// List of fields (result of select to show dictionnary)
'tabfield'=>array("code,label","code,label","code,label"),
// List of fields (list of fields to edit a record)
'tabfieldvalue'=>array("code,label","code,label","code,label"),
// List of fields (list of fields for insert)
'tabfieldinsert'=>array("code,label","code,label","code,label"),
// Name of columns with primary key (try to always name it 'rowid')
'tabrowid'=>array("rowid","rowid","rowid"),
// Condition to show each dictionnary
'tabcond'=>array(
$conf->resource->enabled,
$conf->resource->enabled,
$conf->resource->enabled
)
);
*/

// Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
$this->boxes = array(); // Boxes list
Expand Down
3 changes: 1 addition & 2 deletions htdocs/resource/class/html.formresource.class.php
Expand Up @@ -161,8 +161,7 @@ function select_types_resource($selected='',$htmlname='type_resource',$filtertyp
if ($filtertype != '' && $filtertype != '-1') $filterarray=explode(',',$filtertype);

$resourcestat->load_cache_code_type_resource();

print '<select id="select'.$htmlname.'" class="flat select_tickettype" name="'.$htmlname.'">';
print '<select id="select'.$htmlname.'" class="flat select_'.$htmlname.'" name="'.$htmlname.'">';
if ($empty) print '<option value="">&nbsp;</option>';
if (is_array($resourcestat->cache_code_type_resource) && count($resourcestat->cache_code_type_resource))
{
Expand Down
6 changes: 3 additions & 3 deletions htdocs/resource/class/resource.class.php
Expand Up @@ -692,9 +692,9 @@ function load_cache_code_type_resource()
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label=($langs->trans("ResourceTypeShort".$obj->code)!=("ResourceTypeShort".$obj->code)?$langs->trans("ResourceTypeShort".$obj->code):($obj->label!='-'?$obj->label:''));
$this->cache_code_type_resource[$obj->rowid]['code'] =$obj->code;
$this->cache_code_type_resource[$obj->rowid]['label']=$label;
$this->cache_code_type_resource[$obj->rowid]['active'] =$obj->active;
$this->cache_code_type_resource[$obj->rowid]['code'] = $obj->code;
$this->cache_code_type_resource[$obj->rowid]['label'] = $label;
$this->cache_code_type_resource[$obj->rowid]['active'] = $obj->active;
$i++;
}
return $num;
Expand Down

0 comments on commit 6a9bf00

Please sign in to comment.