From 8f8de587b8e8c2049ea721d8a6862aeaa1b3c116 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 10 Oct 2015 06:39:59 +0200 Subject: [PATCH] Add admin & first version to manage establishment --- htdocs/core/modules/modHRM.class.php | 2 +- htdocs/hrm/admin/admin_establishment.php | 126 +++++++ htdocs/hrm/admin/admin_hrm.php | 58 +++ htdocs/hrm/admin/index.html | 0 htdocs/hrm/class/establishment.class.php | 324 +++++++++++++++++ htdocs/hrm/class/index.html | 0 htdocs/hrm/establishment/card.php | 415 ++++++++++++++++++++++ htdocs/hrm/establishment/index.html | 0 htdocs/hrm/establishment/info.php | 59 +++ htdocs/hrm/index.html | 0 htdocs/theme/eldy/img/object_building.png | Bin 0 -> 563 bytes htdocs/theme/md/img/object_building.png | Bin 0 -> 563 bytes 12 files changed, 983 insertions(+), 1 deletion(-) create mode 100644 htdocs/hrm/admin/admin_establishment.php create mode 100644 htdocs/hrm/admin/admin_hrm.php create mode 100644 htdocs/hrm/admin/index.html create mode 100644 htdocs/hrm/class/establishment.class.php create mode 100644 htdocs/hrm/class/index.html create mode 100644 htdocs/hrm/establishment/card.php create mode 100644 htdocs/hrm/establishment/index.html create mode 100644 htdocs/hrm/establishment/info.php create mode 100644 htdocs/hrm/index.html create mode 100644 htdocs/theme/eldy/img/object_building.png create mode 100644 htdocs/theme/md/img/object_building.png diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 68549d2cd10..c63fa04f65e 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -62,7 +62,7 @@ class modHRM extends DolibarrModules $this->dirs = array (); // Config pages - $this->config_page_url = array('admin_hrm.php'); + $this->config_page_url = array('admin_hrm.php@hrm'); // Dependencies $this->depends = array(); diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php new file mode 100644 index 00000000000..2fb6507d0ba --- /dev/null +++ b/htdocs/hrm/admin/admin_establishment.php @@ -0,0 +1,126 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/hrm/admin/admin_establishment.php + * \ingroup HRM + * \brief HRM Establishment module setup page + */ +require('../../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php'; + +$langs->load("admin"); +$langs->load('hrm'); + +if (! $user->admin) + accessforbidden(); + +$error=0; + +$action = GETPOST('action', 'alpha'); + +$object = new Establishment($db); + +/* + * Actions + */ + +/* + * View + */ +$page_name = "Establishments"; +llxHeader('', $langs->trans($page_name)); + +$form = new Form($db); + +dol_htmloutput_mesg($mesg); + +// Subheader +$linkback = '' . $langs->trans("BackToModuleList") . ''; +print load_fiche_titre($langs->trans($page_name), $linkback); + +// Configuration header +$head = hrm_admin_prepare_head(); +dol_fiche_head($head, 'establishments', $langs->trans("HRM"), 0, "user"); + +$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.statut"; +$sql.= " FROM ".MAIN_DB_PREFIX."establishment as e"; +$sql.= " WHERE e.entity = ".$conf->entity; + +$result = $db->query($sql); +if ($result) +{ + $var=false; + $num = $db->num_rows($result); + + $i = 0; + + // Load attribute_label + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($num) + { + $establishmentstatic=new Establishment($db); + + while ($i < $num && $i < $max) + { + $obj = $db->fetch_object($result); + $fiscalyearstatic->id=$obj->rowid; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $var=!$var; + $i++; + } + + } + else + { + print ''; + } + + print '
'.$langs->trans("Ref").''.$langs->trans("Name").''.$langs->trans("Address").''.$langs->trans("Zipcode").''.$langs->trans("Town").''.$langs->trans("Statut").'
'.img_object($langs->trans("ShowEstablishment"),"building").' '.$obj->rowid.''.$obj->name.''.$obj->address.''.$obj->zip.''.$obj->town.''.$establishmentstatic->LibStatut($obj->statut,5).'
'.$langs->trans("None").'
'; +} +else +{ + dol_print_error($db); +} + +dol_fiche_end(); + +// Buttons +print ''; + +llxFooter(); +$db->close(); diff --git a/htdocs/hrm/admin/admin_hrm.php b/htdocs/hrm/admin/admin_hrm.php new file mode 100644 index 00000000000..d66185315eb --- /dev/null +++ b/htdocs/hrm/admin/admin_hrm.php @@ -0,0 +1,58 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/hrm/admin/admin_ihrm.php + * \ingroup HRM + * \brief HRM module setup page + */ +require('../../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + +$langs->load("admin"); +$langs->load('hrm'); + +if (! $user->admin) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); + +/* + * Actions + */ + +/* + * View + */ +$page_name = "Parameters"; +llxHeader('', $langs->trans($page_name)); + +$form = new Form($db); + +dol_htmloutput_mesg($mesg); + +// Subheader +$linkback = '' . $langs->trans("BackToModuleList") . ''; +print load_fiche_titre($langs->trans($page_name), $linkback); + +// Configuration header +$head = hrm_admin_prepare_head(); +dol_fiche_head($head, 'parameters', $langs->trans("HRM"), 0, "user"); + +llxFooter(); +$db->close(); diff --git a/htdocs/hrm/admin/index.html b/htdocs/hrm/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php new file mode 100644 index 00000000000..208d38c1fd1 --- /dev/null +++ b/htdocs/hrm/class/establishment.class.php @@ -0,0 +1,324 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/custom/ihrm/class/establishment.class.php + * \ingroup iHRM + * \brief File of class to manage establishments + */ + +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; + +/** + * Class to manage establishments + */ +class Establishment extends CommonObject +{ + public $element='establishment'; + public $table_element='ihrm_establishment'; + public $table_element_line = ''; + public $fk_element = 'fk_establishment'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + var $rowid; + + var $name; + var $address; + var $zip; + var $town; + var $statut; // 0=open, 1=closed + var $entity; + + var $statuts=array(); + var $statuts_short=array(); + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + + $this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); + $this->statuts = array(0 => 'Opened', 1 => 'Closed'); + + return 1; + } + + /** + * Create object in database + * + * @param User $user User making creation + * @return int <0 if KO, >0 if OK + */ + function create($user) + { + global $conf; + + $error = 0; + + $now=dol_now(); + + $this->db->begin(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."ihrm_establishment ("; + $sql.= "name"; + $sql.= ", address"; + $sql.= ", zip"; + $sql.= ", town"; + $sql.= ", statut"; + $sql.= ", entity"; + $sql.= ", datec"; + $sql.= ", fk_user_author"; + $sql.= ") VALUES ("; + $sql.= " '".$this->name."'"; + $sql.= ", '".$this->address."'"; + $sql.= ", '".$this->zip."'"; + $sql.= ", '".$this->town."'"; + $sql.= ", ".$this->statut; + $sql.= ", ".$conf->entity; + $sql.= ", '".$this->db->idate($now)."'"; + $sql.= ", ". $user->id; + $sql.= ")"; + + $this->db->begin(); + + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { + $error ++; + $this->errors[] = "Error " . $this->db->lasterror(); + } + + if (! $error) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "ihrm_establishment"); + } + + // Commit or rollback + if ($error) { + foreach ( $this->errors as $errmsg ) { + dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + $this->db->rollback(); + return - 1 * $error; + } else { + $this->db->commit(); + return $this->id; + } + } + + /** + * Update record + * + * @param User $user User making update + * @return int <0 if KO, >0 if OK + */ + function update($user) + { + global $langs; + + // Check parameters + if (empty($this->name)) + { + $this->error='ErrorBadParameter'; + return -1; + } + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."ihrm_establishment"; + $sql .= " SET name = '".$this->name."'"; + $sql .= ", address = '".$this->address."'"; + $sql .= ", zip = '".$this->zip."'"; + $sql .= ", town = '".$this->town."'"; + $sql .= ", statut = '".$this->statut."'"; + $sql .= ", fk_user_mod = " . $user->id; + $sql .= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return - 1; + } + } + + /** + * Load an object from database + * + * @param int $id Id of record to load + * @return int <0 if KO, >0 if OK + */ + function fetch($id) + { + $sql = "SELECT rowid, name, address, zip, town, statut"; + $sql.= " FROM ".MAIN_DB_PREFIX."ihrm_establishment"; + $sql.= " WHERE rowid = ".$id; + + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $result = $this->db->query($sql); + if ( $result ) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->rowid; + $this->name = $obj->name; + $this->address = $obj->address; + $this->zip = $obj->zip; + $this->town = $obj->town; + $this->statut = $obj->statut; + + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } + + /** + * Delete record + * + * @param int $id Id of record to delete + * @return int <0 if KO, >0 if OK + */ + function delete($id) + { + $this->db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."ihrm_establishment WHERE rowid = ".$id; + + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + } + + /** + * Give a label from a status + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * Give a label from a status + * + * @param int $statut Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label + */ + function LibStatut($statut,$mode=0) + { + global $langs; + + if ($mode == 0) + { + return $langs->trans($this->statuts[$statut]); + } + if ($mode == 1) + { + return $langs->trans($this->statuts_short[$statut]); + } + if ($mode == 2) + { + if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); + if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts_short[$statut]); + } + if ($mode == 3) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); + } + if ($mode == 4) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); + } + if ($mode == 5) + { + if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); + } + } + + /** + * Information on record + * + * @param int $id Id of record + * @return void + */ + function info($id) + { + $sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'ihrm_establishment as e'; + $sql.= ' WHERE e.rowid = '.$id; + + dol_syslog(get_class($this)."::fetch info", LOG_DEBUG); + $result = $this->db->query($sql); + + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + if ($obj->fk_user_modif) + { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_mod); + $this->user_modification = $muser; + } + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->tms); + } + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } + +} diff --git a/htdocs/hrm/class/index.html b/htdocs/hrm/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php new file mode 100644 index 00000000000..dc3b29225c2 --- /dev/null +++ b/htdocs/hrm/establishment/card.php @@ -0,0 +1,415 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/custom/ihrm/establishment/card.php + * \brief Page to show an establishment + */ +$res = @include ("../../main.inc.php"); // For root directory +if (! $res) + $res = @include ("../../../main.inc.php"); // For "custom" directory +if (! $res) + die("Include of main fails"); + +require_once ('../core/lib/ihrm.lib.php'); +require_once ('../class/establishment.class.php'); +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; + +$langs->load("admin"); +$langs->load("compta"); + +// Security check +if (! $user->admin) accessforbidden(); + +$error=0; + +$action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm','alpha'); +$id = GETPOST('id','int'); + +// List of statut +static $tmpstatut2label=array( + '0'=>'OpenEtablishment', + '1'=>'CloseEtablishment' +); +$statut2label=array(''); +foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); + +$object = new Establishment($db); + +/* + * Actions + */ + +if ($action == 'confirm_delete' && $confirm == "yes") +{ + $result=$object->delete($id); + if ($result >= 0) + { + header("Location: ../admin/admin_establishment.php"); + exit; + } + else + { + setEventMessage($object->error, 'errors'); + } +} + +else if ($action == 'add') +{ + if (! $cancel) + { + $error=0; + + $object->name = GETPOST('name', 'alpha'); + if (empty($object->name)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")), 'errors'); + $error++; + } + + if (empty($error)) + { + $tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0); + if (! empty($tmparray['id'])) + { + $object->country_id =$tmparray['id']; + $object->country_code =$tmparray['code']; + $object->country_label=$tmparray['label']; + } + + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->fk_pays = $object->country_id; + $object->statut = GETPOST('statut','int'); + $object->fk_user_author = $user->id; + $object->datec = dol_now(); + + $id = $object->create($user); + + if ($id > 0) + { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); + exit; + } + else + { + setEventMessage($object->error, 'errors'); + $action='create'; + } + } + else + { + $action='create'; + } + } + else + { + header("Location: ../admin/admin_establishment.php"); + exit; + } +} + +// Update record +else if ($action == 'update') +{ + $error = 0; + + if (! $cancel) { + + $name = GETPOST('name', 'alpha'); + if (empty($name)) { + setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('NameProperty')), 'errors'); + $error ++; + } + $typeid = GETPOST('typeid', 'int'); + if (empty($typeid)) { + setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('TypeProperty')), 'errors'); + $error ++; + } + + if (empty($error)) { + $object->name = GETPOST('name', 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->fk_pays = GETPOST('country_id', 'int'); + $object->rowid = GETPOST('id'); + $object->fk_user_mod = $user->id; + + $id = $object->update(); + + if ($id > 0) + { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); + exit; + } + else + { + setEventMessage($object->error, 'errors'); + $action='create'; + } + } + } else { + header("Location: card.php?id=" . $id); + exit; + } +} + +/* + * View + */ + +llxHeader(); + +$form = new Form($db); +$formcompany = new FormCompany($db); + +/* + * Action create + */ +if ($action == 'create') +{ + print load_fiche_titre($langs->trans("NewEstablishment")); + + print '
'; + print ''; + print ''; + + dol_fiche_head(); + + print ''; + + // Name + print ''; + + // Address + print ''; + print ''; + print ''; + print ''; + + // Zipcode + print ''; + print ''; + print ''; + print ''; + + // Town + print ''; + print ''; + print ''; + print ''; + + // Country + print ''; + print ''; + print ''; + print ''; + + // Statut + print ''; + print ''; + print ''; + + print '
'; + print ''; + print '
'; + print $formcompany->select_ziptown(GETPOST('zipcode', 'alpha'), 'zipcode', array ( + 'town', + 'selectcountry_id' + ), 6); + print '
'; + print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array ( + 'zipcode', + 'selectcountry_id' + )); + print '
'; + print $form->select_country($mysoc->country_id,'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print '
'; + print $form->selectarray('statut',$statut2label,GETPOST('statut')); + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; +} +else if ($id) +{ + $result = $object->fetch($id); + if ($result > 0) + { + $head = establishment_prepare_head($object); + + if ($action == 'edit') + { + dol_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building@ihrm'); + + print '
' . "\n"; + print ''; + print ''; + print ''; + + print ''; + + // Ref + print ""; + print ''; + + // Name + print ''; + + // Address + print ''; + print ''; + print ''; + print ''; + + // Zipcode / Town + print ''; + print ''; + + // Country + print ''; + print ''; + print ''; + print ''; + + // Statut + print ''; + + print '
'.$langs->trans("Ref").''; + print $object->rowid; + print '
'; + print ''; + print '
'; + print ''; + print '
'; + print $formcompany->select_ziptown($object->zip, 'zipcode', array ( + 'town', + 'selectcountry_id' + ), 6) . '
'; + print $formcompany->select_ziptown($object->town, 'town', array ( + 'zipcode', + 'selectcountry_id' + )) . '
'; + print $form->select_country($object->fk_pays,'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print '
'; + print $form->selectarray('statut',$statut2label,$object->statut); + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; + } + else + { + /* + * Confirm delete + */ + if ($action == 'delete') + { + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteEstablishment"),$langs->trans("ConfirmDeleteEstablishment"),"confirm_delete"); + + } + + dol_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building@ihrm'); + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Name + print ''; + print ''; + print ''; + print ''; + + // Address + print ''; + print ''; + print ''; + print ''; + + // Zipcode + print ''; + print ''; + print ''; + print ''; + + // Town + print ''; + print ''; + print ''; + print ''; + + // Country + print ''; + print ''; + print ''; + print ''; + + // Statut + print ''; + + print "
'.$langs->trans("Ref").''; + print $object->rowid; + print ''; + print $linkback; + print '
'.$langs->trans("Name").''.$object->name.'
'.$langs->trans("Address").''.$object->address.'
'.$langs->trans("Zipcode").''.$object->zip.'
'.$langs->trans("Town").''.$object->town.'
'.$langs->trans("Country").''.getCountry($object->fk_pays,1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
"; + + dol_fiche_end(); + + /* + * Barre d'actions + */ + + print '
'; + print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Delete').''; + print '
'; + } + } + else + { + dol_print_error($db); + } +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/hrm/establishment/index.html b/htdocs/hrm/establishment/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php new file mode 100644 index 00000000000..06ba9875e58 --- /dev/null +++ b/htdocs/hrm/establishment/info.php @@ -0,0 +1,59 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/custom/ihrm/establishment/info.php + * \brief Page to show info of an establishment + */ + +require '../../main.inc.php'; + +require_once ('../core/lib/ihrm.lib.php'); +require_once ('../class/establishment.class.php'); +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +$langs->load("admin"); +$langs->load("compta"); + +// Security check +if (! $user->admin) accessforbidden(); + +$id = GETPOST('id','int'); + +// View +llxHeader(); + +if ($id) +{ + $object = new Establishment($db); + $object->fetch($id); + $object->info($id); + + $head = establishment_prepare_head($object); + + dol_fiche_head($head, 'info', $langs->trans("Establishment"), 0, 'building@ihrm'); + + print '
'; + dol_print_object_info($object); + print '
'; + + print ''; +} + +$db->close(); + +llxFooter(); diff --git a/htdocs/hrm/index.html b/htdocs/hrm/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/theme/eldy/img/object_building.png b/htdocs/theme/eldy/img/object_building.png new file mode 100644 index 0000000000000000000000000000000000000000..c9d1539dddcdce4f285117d26cab14ee97ddb90b GIT binary patch literal 563 zcmV-30?hr1P)(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZ-xk*GpRCwCNlf91;Q541RJl^EZ5JN#8OeT|1NU;U6Fig~f!it1$rN9siV~oU@ zXktZeBVil=09&xJprYJD3wA3E1qDpd|| z^PZ}z+J3*MrfKE|gTb>(rJ^MQgb>hdHet8hK@>%xX&N|=1FcpI=JPq+!~yH~`-5CA zM<}IK2yxCiKN${(ecQH6H@ShRR;y>n<1r(pyh{jqsVItDuh&1XRx3ZTiHOL@(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZ-xk*GpRCwCNlf91;Q541RJl^EZ5JN#8OeT|1NU;U6Fig~f!it1$rN9siV~oU@ zXktZeBVil=09&xJprYJD3wA3E1qDpd|| z^PZ}z+J3*MrfKE|gTb>(rJ^MQgb>hdHet8hK@>%xX&N|=1FcpI=JPq+!~yH~`-5CA zM<}IK2yxCiKN${(ecQH6H@ShRR;y>n<1r(pyh{jqsVItDuh&1XRx3ZTiHOL@