NEW Extrafields on salaries
This commit is contained in:
parent
27ba3408b4
commit
79d8351dda
117
htdocs/admin/salaries_extrafields.php
Normal file
117
htdocs/admin/salaries_extrafields.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/admin/salaries_extrafields.php
|
||||||
|
* \ingroup member
|
||||||
|
* \brief Page to setup extra fields of salaries
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
// Load translation files required by the page
|
||||||
|
$langs->loadLangs(array("admin","salaries"));
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
// List of supported format
|
||||||
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
|
$type2label=array('');
|
||||||
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||||
|
|
||||||
|
$action=GETPOST('action', 'alpha');
|
||||||
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
$elementtype='adherent'; //Must be the $table_element of the class that manage extrafield
|
||||||
|
|
||||||
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$textobject = $langs->transnoentitiesnoconv("Members");
|
||||||
|
|
||||||
|
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||||
|
llxHeader('', $langs->trans("MembersSetup"), $help_url);
|
||||||
|
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
|
||||||
|
|
||||||
|
|
||||||
|
$head = member_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'attributes', $langs->trans("Members"), -1, 'user');
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
if ($action != 'create' && $action != 'edit')
|
||||||
|
{
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Creation of an optional field */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
|
print '<div name="topofform"></div><br>';
|
||||||
|
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Edition of an optional field */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
if ($action == 'edit' && ! empty($attrname))
|
||||||
|
{
|
||||||
|
print '<div name="topofform"></div><br>';
|
||||||
|
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
||||||
|
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -27,15 +28,15 @@
|
|||||||
function salaries_prepare_head($object)
|
function salaries_prepare_head($object)
|
||||||
{
|
{
|
||||||
|
|
||||||
global $db, $langs, $conf;
|
global $db, $langs, $conf;
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Card");
|
$head[$h][1] = $langs->trans("Card");
|
||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
@ -43,23 +44,56 @@ function salaries_prepare_head($object)
|
|||||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries');
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Info");
|
$head[$h][1] = $langs->trans("Info");
|
||||||
$head[$h][2] = 'info';
|
$head[$h][2] = 'info';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return array head with list of tabs to view object informations
|
||||||
|
*
|
||||||
|
* @return array head
|
||||||
|
*/
|
||||||
|
function salaries_admin_prepare_head()
|
||||||
|
{
|
||||||
|
global $langs, $conf, $user;
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/admin/salaries.php';
|
||||||
|
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||||
|
$head[$h][2] = 'general';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||||
|
complete_head_from_modules($conf, $langs, '', $head, $h, 'salaries_admin');
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/admin/salaries_extrafields.php';
|
||||||
|
$head[$h][1] = $langs->trans("ExtraFieldsSalaries");
|
||||||
|
$head[$h][2] = 'attributes';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf, $langs, '', $head, $h, 'salaries_admin', 'remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2014 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2014-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -68,8 +68,7 @@ class modSalaries extends DolibarrModules
|
|||||||
$this->dirs = array("/salaries/temp");
|
$this->dirs = array("/salaries/temp");
|
||||||
|
|
||||||
// Config pages
|
// Config pages
|
||||||
//$this->config_page_url = array('salaries.php');
|
$this->config_page_url = array('salaries.php');
|
||||||
$this->config_page_url = array();
|
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->hidden = false; // A condition to hide module
|
$this->hidden = false; // A condition to hide module
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
-- ===================================================================
|
||||||
|
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
-- Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
-- Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
|
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
--
|
||||||
|
-- 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 <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_adherent_extrafields ADD INDEX idx_adherent_extrafields (fk_object);
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
-- ===================================================================
|
||||||
|
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
-- Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
-- Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
|
--
|
||||||
|
-- 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 <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
create table llx_adherent_extrafields
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL, -- member id
|
||||||
|
import_key varchar(14) -- import key
|
||||||
|
)ENGINE=innodb;
|
||||||
Loading…
Reference in New Issue
Block a user