Skip to content

Commit

Permalink
Add searchform, language key and correct code
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Oct 10, 2015
1 parent 4008a07 commit 8e37da5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
10 changes: 6 additions & 4 deletions htdocs/admin/ihm.php
Expand Up @@ -37,6 +37,7 @@
$langs->load("products");
$langs->load("members");
$langs->load("projects");
$langs->load("hrm");

if (! $user->admin) accessforbidden();

Expand All @@ -46,10 +47,10 @@
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");

// List of supported permanent search area
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name');
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT", "MAIN_SEARCHFORM_EMPLOYEE");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT,$conf->global->MAIN_SEARCHFORM_EMPLOYEE);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"), $langs->trans("Employees"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module4000Name');


if ($action == 'update')
Expand Down Expand Up @@ -82,6 +83,7 @@
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_EMPLOYEE", $_POST["MAIN_SEARCHFORM_EMPLOYEE"],'chaine',0,'',$conf->entity);

dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
Expand Down
21 changes: 11 additions & 10 deletions htdocs/core/modules/modHRM.class.php
Expand Up @@ -56,29 +56,29 @@ public function __construct($db)
// $this->picto = '';

// define triggers
$this->module_parts = array (
$this->module_parts = array();

// Data directories to create when module is enabled
$this->dirs = array ();
$this->dirs = array();

// Config pages
$this->config_page_url = array('admin_hrm.php@hrm');

// Dependencies
$this->depends = array();
$this->requiredby = array("
$this->requiredby = array(/*"
modSalaries,
modExpenseReport,
modHoliday
");
"*/);
$this->conflictwith = array();
$this->phpmin = array (
5,
3
); // Minimum version of PHP required by module
$this->need_dolibarr_version = array (
3,
8
7
); // Minimum version of Dolibarr required by module
$this->langfiles = array (
"hrm"
Expand Down Expand Up @@ -239,12 +239,13 @@ public function __construct($db)
* @param string $options Enabling module ('', 'noboxes')
* @return int if OK, 0 if KO
*/
public function init($options = '')
function init($options='')
{
// Permissions
$this->remove($options);

$sql = array();

$result = $this->loadTables();

return $this->_init($sql, $options);

return $this->_init($sql,$options);
}
}
2 changes: 2 additions & 0 deletions htdocs/langs/en_US/admin.lang
Expand Up @@ -539,6 +539,8 @@ Module2900Name=GeoIPMaxmind
Module2900Desc=GeoIP Maxmind conversions capabilities
Module3100Name=Skype
Module3100Desc=Add a Skype button into card of adherents / third parties / contacts
Module4000Name=HRM
Module4000Desc=Human resources management
Module5000Name=Multi-company
Module5000Desc=Allows you to manage multiple companies
Module6000Name=Workflow
Expand Down
6 changes: 6 additions & 0 deletions htdocs/main.inc.php
Expand Up @@ -1584,6 +1584,12 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'M', 'searchleftproj', img_object('','projectpub'));
}

if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read)
{
$langs->load("hrm");
$searchform.=printSearchForm(DOL_URL_ROOT.'/hrm/employee/list.php', DOL_URL_ROOT.'/hrm/employee/list.php', $langs->trans("Employees"), 'employee', 'search_all', 'M', 'searchleftemployee', img_object('','user'));
}

// Execute hook printSearchForm
$parameters=array();
$reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks
Expand Down

0 comments on commit 8e37da5

Please sign in to comment.