mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Add the holiday module (provided by teclib with permission to add
it by default).
This commit is contained in:
parent
55a5d56ebb
commit
246f3b5bb8
|
|
@ -41,8 +41,11 @@ For users:
|
|||
- New: Add unit foot2, inch2, foot3 and inch3 for surface and volumes.
|
||||
- New: Can select thirdparties into emailing targets, even if module category is not enabled.
|
||||
- New: [ task #498 ] Improvement of the block to add products/services lines.
|
||||
- New: Add margin and commissions management module.
|
||||
- New: ECM autodir works also for files joined to products and services.
|
||||
New experimental modules:
|
||||
- New: Add margin and commissions management module.
|
||||
- New: Add holiday module.
|
||||
|
||||
- Fix: [ bug #499 ]: Supplier order input method not translated
|
||||
- Fix: No images into product description lines as PDF generation does
|
||||
not work with this.
|
||||
|
|
|
|||
292
htdocs/core/modules/modHoliday.class.php
Normal file
292
htdocs/core/modules/modHoliday.class.php
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.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 2 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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup holiday Payes Module holiday Payes
|
||||
* \brief Module de gestion des congés payés
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/includes/modules/modLeave.class.php
|
||||
* \ingroup holiday
|
||||
* \brief Description and activation file for module holiday
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* Description and activation class for module holiday
|
||||
*/
|
||||
class modHoliday extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 20000;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'holiday';
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "hr";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Leave management";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'experimental';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||
$this->special = 0;
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='holiday';
|
||||
|
||||
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not
|
||||
$this->triggers = 0;
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mymodule/temp");
|
||||
$this->dirs = array();
|
||||
$r=0;
|
||||
|
||||
// Relative path to module style sheet if exists. Example: '/mymodule/css/mycss.css'.
|
||||
//$this->style_sheet = '/mymodule/mymodule.css.php';
|
||||
|
||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
||||
$this->config_page_url = array("holiday.php?leftmenu=setup@holiday");
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->phpmin = array(4,3); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
|
||||
$this->langfiles = array("holiday");
|
||||
|
||||
// Constants
|
||||
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
|
||||
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
|
||||
// 2=>array('MAIN_MODULE_MYMODULE_NEEDSMARTY','chaine',1,'Constant to say module need smarty',0)
|
||||
$this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities')
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
// Example: $this->tabs = array('objecttype:+tabname1:Title1:@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
|
||||
// 'objecttype:+tabname2:Title2:@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
|
||||
// 'objecttype:-tabname'); // To remove an existing tab identified by code tabname
|
||||
// where objecttype can be
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'product' to add a tab in product view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'user' to add a tab in user view
|
||||
// 'group' to add a tab in group view
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
$this->tabs = array('user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->write:/holiday/index.php?mainmenu=holiday&id=__ID__');
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(); // List of boxes
|
||||
$r=0;
|
||||
|
||||
// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
|
||||
// Example:
|
||||
//$this->boxes[$r][1] = "myboxa.php";
|
||||
//$r++;
|
||||
//$this->boxes[$r][1] = "myboxb.php";
|
||||
//$r++;
|
||||
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r=0;
|
||||
|
||||
$this->rights[$r][0] = 20001; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Créer / Modifier / Lire ses demandes de congés payés'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20002; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Lire / Modifier toutes les demandes de congés payés'; // Permission label
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'lire_tous'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20003; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Supprimer des demandes de congés payés'; // Permission label
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20004; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Définir les congés payés des utilisateurs'; // Permission label
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'define_holiday'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20005; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Voir les logs de modification des congés payés'; // Permission label
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'view_log'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20006; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Accéder au rapport mensuel des congés payés'; // Permission label
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'month_report'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
// Main menu entries
|
||||
$this->menus = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
$this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
||||
'type'=>'top', // This is a Top menu entry
|
||||
'titre'=>'CPTitreMenu',
|
||||
'mainmenu'=>'holiday',
|
||||
'url'=>'/holiday/index.php?leftmenu=holiday',
|
||||
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
//
|
||||
// Example to declare a Left Menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
// 'type'=>'left', // This is a Left menu entry
|
||||
// 'titre'=>'MyModule left menu 1',
|
||||
// 'mainmenu'=>'mymodule',
|
||||
// 'url'=>'/mymodule/pagelevel1.php',
|
||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
// 'position'=>100,
|
||||
// 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
// 'target'=>'',
|
||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
//
|
||||
// Example to declare another Left Menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
// 'type'=>'left', // This is a Left menu entry
|
||||
// 'titre'=>'MyModule left menu 2',
|
||||
// 'mainmenu'=>'mymodule',
|
||||
// 'url'=>'/mymodule/pagelevel2.php',
|
||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
// 'position'=>100,
|
||||
// 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
// 'target'=>'',
|
||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
|
||||
|
||||
// Agenda
|
||||
$this->Agenda = 1;
|
||||
$this->agendas = array('holiday:holidayAgenda');
|
||||
|
||||
// Example:
|
||||
// $this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
// $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
// $this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
// $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef');
|
||||
// $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
|
||||
// $this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.price'=>"lineprice",'fd.total_ht'=>"linetotalht",'fd.total_tva'=>"linetotaltva",'fd.total_ttc'=>"linetotalttc",'fd.tva_tx'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend",'fd.fk_product'=>'productid','p.ref'=>'productref');
|
||||
// $this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
// $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)';
|
||||
// $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
|
||||
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
|
||||
// $r++;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories.
|
||||
* \return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
$result=$this->load_tables();
|
||||
|
||||
return $this->_init($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted.
|
||||
* \return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief 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 /mymodule/sql/
|
||||
* This function is called by this->init.
|
||||
* \return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function load_tables()
|
||||
{
|
||||
return $this->_load_tables('');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
422
htdocs/holiday/admin/holiday.php
Normal file
422
htdocs/holiday/admin/holiday.php
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Page module configuration paid holiday.
|
||||
*
|
||||
* \file holiday.php
|
||||
* \ingroup holiday
|
||||
* \brief Page module configuration paid holiday.
|
||||
*/
|
||||
|
||||
$res=0;
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); // For root directory
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); // For "custom" directory
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
dol_include_once("/holiday/class/holiday.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.form.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/usergroup.class.php");
|
||||
|
||||
$action=GETPOST('action');
|
||||
|
||||
$langs->load("holiday");
|
||||
|
||||
// Si pas administrateur
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// Vérification si module activé
|
||||
if (! $conf->holiday->enabled) print $langs->trans('NotActiveModCP');
|
||||
|
||||
llxheader('',$langs->trans('TitleAdminCP'));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans('ConfCP'), $linkback);
|
||||
|
||||
$cp = new Holiday($db);
|
||||
|
||||
// Contrôle du formulaire
|
||||
if ($action == "add")
|
||||
{
|
||||
$message = '';
|
||||
$error = false;
|
||||
|
||||
// Option du groupe de validation
|
||||
if (!$cp->updateConfCP('userGroup',$_POST['userGroup']))
|
||||
{
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// Option du délai pour faire une demande de congés payés
|
||||
if (!$cp->updateConfCP('delayForRequest',$_POST['delayForRequest']))
|
||||
{
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// Option du nombre de jours à ajouter chaque mois
|
||||
$nbHolidayEveryMonth = price2num($_POST['nbHolidayEveryMonth'],2);
|
||||
|
||||
if(!$cp->updateConfCP('nbHolidayEveryMonth',$nbHolidayEveryMonth))
|
||||
{
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un mariage
|
||||
$OptMariageCP = price2num($_POST['OptMariage'],2);
|
||||
|
||||
if(!$cp->updateConfCP('OptMariage',$OptMariageCP)) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un décés d'un proche
|
||||
$OptDecesProcheCP = price2num($_POST['OptDecesProche'],2);
|
||||
|
||||
if(!$cp->updateConfCP('OptDecesProche',$OptDecesProcheCP)) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un mariage d'un enfant
|
||||
$OptMariageProcheCP = price2num($_POST['OptMariageProche'],2);
|
||||
|
||||
if(!$cp->updateConfCP('OptMariageProche',$OptMariageProcheCP)) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un décés d'un parent
|
||||
$OptDecesParentsCP = price2num($_POST['OptDecesParents'],2);
|
||||
|
||||
if(!$cp->updateConfCP('OptDecesParents',$OptDecesParentsCP)) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
// Option pour avertir le valideur si délai de demande incorrect
|
||||
if(isset($_POST['AlertValidatorDelay'])) {
|
||||
if(!$cp->updateConfCP('AlertValidatorDelay','1')) {
|
||||
$error = true;
|
||||
}
|
||||
} else {
|
||||
if(!$cp->updateConfCP('AlertValidatorDelay','0')) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Option pour avertir le valideur si solde des congés de l'utilisateur inccorect
|
||||
if(isset($_POST['AlertValidatorSolde'])) {
|
||||
if(!$cp->updateConfCP('AlertValidatorSolde','1')) {
|
||||
$error = true;
|
||||
}
|
||||
} else {
|
||||
if(!$cp->updateConfCP('AlertValidatorSolde','0')) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Option du nombre de jours à déduire pour 1 jour de congés
|
||||
$nbHolidayDeducted = price2num($_POST['nbHolidayDeducted'],2);
|
||||
|
||||
if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$message = '<div class="error">'.$langs->trans('ErrorUpdateConfCP').'</div>';
|
||||
} else {
|
||||
$message = '<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>';
|
||||
}
|
||||
|
||||
// Si première mise à jour, prévenir l'utilisateur de mettre à jour le solde des congés payés
|
||||
$sql = "SELECT *";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($sql);
|
||||
|
||||
if($num < 1) {
|
||||
$cp->createCPusers();
|
||||
$message.= '<br /><div class="warning">'.$langs->trans('AddCPforUsers').'</div>';
|
||||
}
|
||||
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
|
||||
// Si il s'agit de créer un event
|
||||
}
|
||||
elseif ($action == 'create_event')
|
||||
{
|
||||
$error = false;
|
||||
|
||||
if (!empty($_POST['optName']))
|
||||
{
|
||||
$optName = trim($_POST['optName']);
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!empty($_POST['optValue']))
|
||||
{
|
||||
$optValue = price2num($_POST['optValue'],2);
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
$cp->optName = $optName;
|
||||
$cp->optValue = $optValue;
|
||||
|
||||
if($error)
|
||||
{
|
||||
$message = 'ErrorCreateEventCP';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $cp->createEventCP($user);
|
||||
|
||||
if($result > 0)
|
||||
{
|
||||
$message = 'OkCreateEventCP';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = 'ErrorCreateEventCP';
|
||||
}
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
}
|
||||
elseif($action == 'event' && isset($_POST['update_event']))
|
||||
{
|
||||
$error = false;
|
||||
|
||||
$eventId = array_keys($_POST['update_event']);
|
||||
$eventId = $eventId[0];
|
||||
|
||||
$eventName = $_POST['optName'];
|
||||
$eventName = $eventName[$eventId];
|
||||
|
||||
$eventValue = $_POST['optValue'];
|
||||
$eventValue = $eventValue[$eventId];
|
||||
|
||||
if(!empty($eventName)) {
|
||||
$eventName = trim($eventName);
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if(!empty($eventValue)) {
|
||||
$eventValue = price2num($eventValue,2);
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if(!$error)
|
||||
{
|
||||
// Mise à jour des congés de l'utilisateur
|
||||
$update = $cp->updateEventCP($eventId,$eventName,$eventValue);
|
||||
if(!$update) {
|
||||
$message='ErrorUpdateEventCP';
|
||||
} else {
|
||||
$message='UpdateEventOkCP';
|
||||
}
|
||||
} else {
|
||||
$message='ErrorUpdateEventCP';
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
}
|
||||
elseif($action && isset($_POST['delete_event']))
|
||||
{
|
||||
$eventId = array_keys($_POST['delete_event']);
|
||||
$eventId = $eventId[0];
|
||||
|
||||
$result = $cp->deleteEventCP($eventId);
|
||||
|
||||
if($result) {
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('DeleteEventOkCP');
|
||||
print '</div>';
|
||||
} else {
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('ErrorDeleteEventCP');
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Affichage de la page de configuation
|
||||
print '<div class="tabBar">';
|
||||
|
||||
print '<h3>'.$langs->trans('TitleOptionMainCP').'</h3>';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?leftmenu=setup" name="config">'."\n";
|
||||
print '<input type="hidden" name="action" value="add" />'."\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tbody>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre">'.$langs->trans('DescOptionCP').'</td>';
|
||||
print '<th class="liste_titre">'.$langs->trans('ValueOptionCP').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px; width: 40%;">'.$langs->trans('GroupToValidateCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;">'.$cp->selectUserGroup('userGroup').'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('DelayForSubmitCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;"><input type="text" name="delayForRequest" value="'.$cp->getConfCP('delayForRequest').'" size="2" /> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('AlertValidatorDelayCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;"><input type="checkbox" name="AlertValidatorDelay" '.$cp->getCheckOption('AlertValidatorDelay').'/></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('AlertValidorSoldeCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;"><input type="checkbox" name="AlertValidatorSolde" '.$cp->getCheckOption('AlertValidatorSolde').'/></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('nbHolidayEveryMonthCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;"><input type="text" name="nbHolidayEveryMonth" value="'.$cp->getConfCP('nbHolidayEveryMonth').'" size="2"/> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('nbHolidayDeductedCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;"><input type="text" name="nbHolidayDeducted" value="'.$cp->getConfCP('nbHolidayDeducted').'" size="2"/> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('nbUserCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;"><input type="text" name="nbUser" value="'.$cp->getConfCP('nbUser').'" disabled="disabled" size="4"/></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding:5px;">'.$langs->trans('LastUpdateCP').'</td>'."\n";
|
||||
print '<td style="padding:5px;"><input type="text" name="lastUpdate" value="'.date('d-m-Y à H:i:s',$cp->getConfCP('lastUpdate')).'" disabled="disabled"/></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '</tbody>'."\n";
|
||||
print '</table>'."\n";
|
||||
|
||||
print '<br /><input type="submit" value="'.$langs->trans("ConfirmConfigCP").'" name="bouton" class="button"/>'."\n";
|
||||
print '</form>'."\n\n";
|
||||
|
||||
print '<br /><h3>'.$langs->trans('TitleOptionEventCP').'</h3>'."\n\n";
|
||||
|
||||
$cp_events = $cp->fetchEventsCP();
|
||||
|
||||
if($cp_events == 1) {
|
||||
|
||||
$var = false;
|
||||
$i = 0;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?leftmenu=setup" name="event_update">'."\n";
|
||||
print '<input type="hidden" name="action" value="event" />'."\n";
|
||||
|
||||
print '<h5>'.$langs->trans('TitleUpdateEventCP').'</h5>'."\n";
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tbody>'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
|
||||
print '<td class="liste_titre" width="40%">'.$langs->trans('NameEventCP').'</td>'."\n";
|
||||
print '<td class="liste_titre">'.$langs->trans('ValueOptionCP').'</td>'."\n";
|
||||
print '<td class="liste_titre">'.$langs->trans('UpdateEventOptionCP').'</td>'."\n";
|
||||
print '<td class="liste_titre">'.$langs->trans('DeleteEventOptionCP').'</td>'."\n";
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach($cp->events as $infos_event) {
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td style="padding: 5px;"><input type="text" size="40" name="optName['.$infos_event['rowid'].']" value="'.$infos_event['name'].'" /></td>'."\n";
|
||||
print '<td width="10%"><input type="text" size="2" name="optValue['.$infos_event['rowid'].']" value="'.$infos_event['value'].'" /> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '<td width="10%"><input type="submit" class="button" name="update_event['.$infos_event['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Update")).'"/></td>'."\n";
|
||||
print '<td width="10%"><input type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" name="delete_event['.$infos_event['rowid'].']" style="border:0;"/></td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</tbody>'."\n";
|
||||
print '</table>'."\n";
|
||||
print '</form>'."\n";
|
||||
print '<br />'."\n\n";
|
||||
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?leftmenu=setup" name="event_create">'."\n";
|
||||
|
||||
print '<h5>'.$langs->trans('TitleCreateEventCP').'</h5>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tbody>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre" width="40%">'.$langs->trans('NameEventCP').'</td>';
|
||||
print '<td class="liste_titre" width="20%">'.$langs->trans('ValueOptionCP').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('CreateEventCP').'</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<input type="hidden" name="action" value="create_event" />'."\n";
|
||||
|
||||
print '<tr class="pair">';
|
||||
print '<td style="padding: 5px;"><input type="text" size="40" name="optName" value="" /></td>'."\n";
|
||||
print '<td><input type="text" size="2" name="optValue" value="" /> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '<td><input type="submit" class="button" name="button" value="'.$langs->trans('ValidEventCP').'" /></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '</tbody>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Fin de page
|
||||
llxFooter();
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
1592
htdocs/holiday/class/holiday.class.php
Normal file
1592
htdocs/holiday/class/holiday.class.php
Normal file
File diff suppressed because it is too large
Load Diff
279
htdocs/holiday/class/holidayagenda.class.php
Normal file
279
htdocs/holiday/class/holidayagenda.class.php
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
<?php
|
||||
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Anthony Hebert <ahebert@teclib.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file holidayagenda.class.php
|
||||
* \ingroup holiday
|
||||
* \brief Fichier d'agenda pour le module Congés Payés
|
||||
* \version $Id: holidayagenda.class.php,v 1.00 2011/09/15 11:00:00 ahebert Exp $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \class CommonAgenda
|
||||
* \brief Classe mere pour heritage des classes Agenda
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonagenda.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php");
|
||||
|
||||
|
||||
class HolidayAgenda extends CommonAgenda
|
||||
{
|
||||
var $db;
|
||||
|
||||
// Nombre de seconde à ajouter ou soustraire pour être GMT?
|
||||
var $offset = 3600;
|
||||
|
||||
// Pays ou calendrier assujetti à l'heure d'été?
|
||||
var $summerTime = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructeur de la classe
|
||||
* @param DB Handler acces base de donnees
|
||||
*/
|
||||
function construct($DB)
|
||||
{
|
||||
$this->db = $DB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction permettant d'altérer les paramètres javascript
|
||||
* du calendrier
|
||||
* @what string clé de paramètre recherché
|
||||
*/
|
||||
function getParams($what = ''){
|
||||
|
||||
$params = array( 'timeslotsPerHour' => 2,
|
||||
'businessHours' => '{start: 0, end: 24, limitDisplay: true }');
|
||||
|
||||
if(empty($what)){
|
||||
return $params;
|
||||
}elseif(array_key_exists($what,$params)){
|
||||
return $params[$what];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accesseur des évènements à mettre dans l'agenda
|
||||
* @param $start Timestamp de début
|
||||
* @param $end Timestamp de fin
|
||||
* @param $options Array stockage de paramètre à utiliser au besoin.
|
||||
* @return $events Events encodés en Json
|
||||
*/
|
||||
function getEvents($start,$end,$options)
|
||||
{
|
||||
global $langs,$conf,$user,$db;
|
||||
|
||||
$langs->load('holiday');
|
||||
$data = array();
|
||||
|
||||
if(!isset($options['user']) or empty($options['user'])):
|
||||
$users_id = $user->id;
|
||||
else:
|
||||
$users_id = $options['user'];
|
||||
endif;
|
||||
|
||||
$sql = "SELECT lcp.rowid as id,
|
||||
UNIX_TIMESTAMP(date_debut) as start,
|
||||
UNIX_TIMESTAMP(CONCAT(date_fin, ' 23:59:59')) as end,
|
||||
lu.firstname as prenom,
|
||||
lu.name as nom,
|
||||
lcp.description as title,
|
||||
lcp.statut as statut
|
||||
FROM llx_holiday lcp
|
||||
INNER JOIN llx_user lu
|
||||
ON lu.rowid = lcp.fk_user
|
||||
WHERE lcp.fk_user = {$users_id}
|
||||
AND lcp.statut in (1,3)
|
||||
AND (UNIX_TIMESTAMP(date_debut) BETWEEN LEFT('$start',10) AND LEFT('$end',10)
|
||||
OR UNIX_TIMESTAMP(CONCAT(date_fin, ' 23:59:59')) BETWEEN LEFT('$start',10) AND LEFT('$end',10))
|
||||
";
|
||||
|
||||
$qry = $db->query($sql);
|
||||
$nbr = $db->num_rows($qry);
|
||||
|
||||
if($nbr)
|
||||
{
|
||||
$i = 0;
|
||||
while($res = $db->fetch_object($qry))
|
||||
{
|
||||
$data[$i]['eventid'] = $res->id;
|
||||
$data[$i]['readonly'] = 0;
|
||||
$data[$i]['draggable'] = 0;
|
||||
$data[$i]['resizable'] = 0;
|
||||
$data[$i]['eventstart'] = (string)$res->start;
|
||||
$data[$i]['eventend'] = (string)$res->end;
|
||||
$data[$i]['eventmessage'] = $res->message;
|
||||
$data[$i]['extraInfo'] = $res->message;
|
||||
$data[$i]['color'] = "#7AAC22";
|
||||
$data[$i]['type'] = $langs->trans('CPTitreMenu');
|
||||
$data[$i]['icon'] = "<img src='".DOL_URL_ROOT."/holiday/img/holiday.png' height=13 width=13 />";
|
||||
|
||||
|
||||
$data[$i]['eventtitle'] = "<strong>{$res->prenom} {$res->nom}<br />{$res->title}</strong>";
|
||||
$data[$i]['eventtitle'] .= ($res->statut == 1) ? "<br />{$langs->trans('ToValidateCP')}" : "<br />{$langs->trans('ValidateCP')}";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
function getFormItems()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$fields = array(
|
||||
'selectedTab' => 'input',
|
||||
'user' => 'select'
|
||||
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accesseur d'un formulaire à mettre en en-tête de l'agenda
|
||||
* @return $form code html
|
||||
*/
|
||||
function getForm($get,$post)
|
||||
{
|
||||
global $user,$langs,$conf,$db;
|
||||
|
||||
$post = $get + $post;
|
||||
|
||||
if($user->admin){
|
||||
$sql = "SELECT * from llx_user where statut = 1";
|
||||
$options = "";
|
||||
$qry = $db->query($sql);
|
||||
while($res = $db->fetch_object($qry)){
|
||||
$options .= ((isset($_POST['user']) && $res->rowid == $_POST['user']) or ($res->rowid == $user->id and !isset($_POST['user'])))
|
||||
? "<option value={$res->rowid} selected='selected'>{$res->firstname} {$res->name}</option>"
|
||||
: "<option value={$res->rowid}>{$res->firstname} {$res->name}</option>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
$options = "<option value={$user->id} selected='selected'>{$user->prenom} {$user->nom}</option>";
|
||||
}
|
||||
|
||||
$HTML = <<<HTML
|
||||
<form method='post' action="{$_SERVER["PHP_SELF"]}">
|
||||
<table class='border' width='100%'>
|
||||
<tr>
|
||||
<td>
|
||||
{$langs->trans('Collab')}
|
||||
</td>
|
||||
<td>
|
||||
<select name='user' id='user'>
|
||||
{$options}
|
||||
</select>
|
||||
<input type='hidden' name='selectedTab' value='holidayagenda' />
|
||||
<input type='submit' value='Envoyer' class='button' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
HTML;
|
||||
$form = $HTML;
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exporteur au format iCal
|
||||
* @see http://tools.ietf.org/html/rfc5545
|
||||
* @todo Export en iCal
|
||||
* @return $iCal calendrier au format iCal
|
||||
*/
|
||||
static function exportIniCal()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Générateur du lien public d'accès au calendrier iCal
|
||||
* @see http://tools.ietf.org/html/rfc5545
|
||||
* @todo Générer le lien
|
||||
* @return $iCal calendrier au format iCal
|
||||
*/
|
||||
function getiCalLink()
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Accesseur du label à afficher par print_fiche_titre()
|
||||
* @return $label Label de l'agenda
|
||||
*/
|
||||
function getLabel()
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
$langs->load('holiday');
|
||||
ob_start();
|
||||
print_fiche_titre($langs->trans('ListeCP'));
|
||||
$label = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getTitle()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('holiday');
|
||||
return $langs->trans('CPTitreMenu');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getLink($action = "")
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
$action = ($action == 'create') ? 'request' : '';
|
||||
$url = DOL_URL_ROOT."/holiday/fiche.php";
|
||||
|
||||
return (empty($action)) ? $url : $url."?action={$action}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
173
htdocs/holiday/define_holiday.php
Normal file
173
htdocs/holiday/define_holiday.php
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* File that defines the balance of paid holiday of users.
|
||||
*
|
||||
* \file define_holiday.php
|
||||
* \ingroup holiday
|
||||
* \brief File that defines the balance of paid holiday of users.
|
||||
* \author dmouillard@teclib.com <Dimitri Mouillard>
|
||||
*/
|
||||
|
||||
require('pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// Si l'utilisateur n'a pas le droit de lire cette page
|
||||
if(!$user->rights->holiday->define_holiday) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader($langs->trans('CPTitreMenu'));
|
||||
|
||||
print_fiche_titre($langs->trans('MenuConfCP'));
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$listUsers = $holiday->fetchUsers(false,false);
|
||||
$userstatic=new User($db);
|
||||
|
||||
// Si il y a une action de mise à jour
|
||||
if(isset($_POST['action']) && $_POST['action'] == 'update' && isset($_POST['update_cp'])) {
|
||||
|
||||
$userID = array_keys($_POST['update_cp']);
|
||||
$userID = $userID[0];
|
||||
|
||||
$userValue = $_POST['nb_holiday'];
|
||||
$userValue = $userValue[$userID];
|
||||
|
||||
if(!empty($userValue)) {
|
||||
$userValue = price2num($userValue,2);
|
||||
} else {
|
||||
$userValue = 0;
|
||||
}
|
||||
|
||||
// On ajoute la modification dans le LOG
|
||||
$holiday->addLogCP($user->id,$userID,'Event : Manual update',$userValue);
|
||||
|
||||
// Mise à jour des congés de l'utilisateur
|
||||
$holiday->updateSoldeCP($userID,$userValue);
|
||||
|
||||
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('UpdateConfCPOK');
|
||||
print '</div>';
|
||||
|
||||
|
||||
} elseif(isset($_POST['action']) && $_POST['action'] == 'add_event') {
|
||||
|
||||
$error = false;
|
||||
|
||||
if(!empty($_POST['list_event']) && $_POST['list_event'] > 0) {
|
||||
$event = $_POST['list_event'];
|
||||
} else { $error = true;
|
||||
}
|
||||
|
||||
if(!empty($_POST['userCP']) && $_POST['userCP'] > 0) {
|
||||
$userCP = $_POST['userCP'];
|
||||
} else { $error = true;
|
||||
}
|
||||
|
||||
if($error) {
|
||||
$message = '<div class="error">'.$langs->trans('ErrorAddEventToUserCP').'</div>';
|
||||
} else {
|
||||
$nb_holiday = $holiday->getCPforUser($userCP);
|
||||
$add_holiday = $holiday->getValueEventCp($event);
|
||||
$new_holiday = $nb_holiday + $add_holiday;
|
||||
|
||||
// On ajoute la modification dans le LOG
|
||||
$holiday->addLogCP($user->id,$userCP,'Event : '.$holiday->getNameEventCp($event),$new_holiday);
|
||||
|
||||
$holiday->updateSoldeCP($userCP,$new_holiday);
|
||||
|
||||
$message = $langs->trans('AddEventToUserOkCP');
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
}
|
||||
|
||||
$var=true;
|
||||
$i = 0;
|
||||
|
||||
print '<div class="tabBar">';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<input type="hidden" name="action" value="update" />';
|
||||
print '<table class="noborder" width="100%;">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td width="5%">User ID</td>';
|
||||
print '<td width="20%">'.$langs->trans('UserName').'</td>';
|
||||
print '<td width="10%">'.$langs->trans('Available').'</td>';
|
||||
print '<td>'.$langs->trans('UpdateButtonCP').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
foreach($listUsers as $users)
|
||||
{
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print '<tr '.$bc[$var].' style="height: 20px;">';
|
||||
print '<td>'.$users['rowid'].'</td>';
|
||||
print '<td>';
|
||||
$userstatic->id=$users['rowid'];
|
||||
$userstatic->nom=$users['name'];
|
||||
$userstatic->prenom=$users['firstname'];
|
||||
print $userstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" value="'.$holiday->getCPforUser($users['rowid']).'" name="nb_holiday['.$users['rowid'].']" size="5" style="text-align: center;"/>';
|
||||
print ' jours</td>'."\n";
|
||||
print '<td><input type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/edit.png" name="update_cp['.$users['rowid'].']" style="border:0;"/></td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
$cp_events = $holiday->fetchEventsCP();
|
||||
|
||||
if($cp_events == 1) {
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<input type="hidden" name="action" value="add_event" />';
|
||||
|
||||
print '<h3>'.$langs->trans('DefineEventUserCP').'</h3>';
|
||||
print $langs->trans('MotifCP').' : ';
|
||||
print $holiday->selectEventCP();
|
||||
print ' '.$langs->trans('UserCP').' : ';
|
||||
print $html->select_users('',"userCP",1,"",0,'');
|
||||
print ' <input type="submit" value="'.$langs->trans("addEventToUserCP").'" name="bouton" class="button"/>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
print '</div>';
|
||||
// Fin de page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
1051
htdocs/holiday/fiche.php
Normal file
1051
htdocs/holiday/fiche.php
Normal file
File diff suppressed because it is too large
Load Diff
BIN
htdocs/holiday/img/conges.png
Normal file
BIN
htdocs/holiday/img/conges.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
330
htdocs/holiday/index.php
Normal file
330
htdocs/holiday/index.php
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file index.php
|
||||
* \ingroup holiday
|
||||
* \brief List of holiday.
|
||||
*/
|
||||
|
||||
require('pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.form.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.formother.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/usergroup.class.php");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader($langs->trans('CPTitreMenu'));
|
||||
|
||||
/*****************************************
|
||||
* Tri du tableau
|
||||
*****************************************/
|
||||
|
||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page = isset($_GET["page"])? $_GET["page"]:$_POST["page"];
|
||||
$page = is_numeric($page) ? $page : 0;
|
||||
$page = $page == -1 ? 0 : $page;
|
||||
|
||||
if (! $sortfield) $sortfield="cp.rowid";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$order = " ORDER BY $sortfield $sortorder " . $db->plimit( $conf->liste_limit + 1 ,$offset);
|
||||
|
||||
|
||||
/*************************************
|
||||
* Filtres de recherche
|
||||
*************************************/
|
||||
|
||||
$max_year = 5;
|
||||
$min_year = 5;
|
||||
|
||||
$search_ref = $_GET['search_ref'];
|
||||
$month_create = $_GET['month_create'];
|
||||
$year_create = $_GET['year_create'];
|
||||
$month_start = $_GET['month_start'];
|
||||
$year_start = $_GET['year_start'];
|
||||
$month_end = $_GET['month_end'];
|
||||
$year_end = $_GET['year_end'];
|
||||
$search_employe = $_GET['search_employe'];
|
||||
$search_valideur = $_GET['search_valideur'];
|
||||
$search_statut = $_GET['select_statut'];
|
||||
|
||||
// WHERE
|
||||
if(!empty($search_ref)){
|
||||
$filter.= " AND cp.rowid LIKE '%$search_ref%'\n";
|
||||
}
|
||||
|
||||
// DATE START
|
||||
if($year_start > 0) {
|
||||
if($month_start > 0) {
|
||||
$filter.= " AND date_format(cp.date_debut, '%Y-%m') = '$year_start-$month_start'";
|
||||
} else {
|
||||
$filter.= " AND date_format(cp.date_debut, '%Y') = '$year_start'";
|
||||
}
|
||||
} else {
|
||||
if($month_start > 0) {
|
||||
$filter.= " AND date_format(cp.date_debut, '%m') = '$month_start'";
|
||||
}
|
||||
}
|
||||
|
||||
// DATE FIN
|
||||
if($year_end > 0) {
|
||||
if($month_end > 0) {
|
||||
$filter.= " AND date_format(cp.date_fin, '%Y-%m') = '$year_end-$month_end'";
|
||||
} else {
|
||||
$filter.= " AND date_format(cp.date_fin, '%Y') = '$year_end'";
|
||||
}
|
||||
} else {
|
||||
if($month_end > 0) {
|
||||
$filter.= " AND date_format(cp.date_fin, '%m') = '$month_end'";
|
||||
}
|
||||
}
|
||||
|
||||
// DATE CREATE
|
||||
if($year_create > 0) {
|
||||
if($month_create > 0) {
|
||||
$filter.= " AND date_format(cp.date_create, '%Y-%m') = '$year_create-$month_create'";
|
||||
} else {
|
||||
$filter.= " AND date_format(cp.date_create, '%Y') = '$year_create'";
|
||||
}
|
||||
} else {
|
||||
if($month_create > 0) {
|
||||
$filter.= " AND date_format(cp.date_create, '%m') = '$month_create'";
|
||||
}
|
||||
}
|
||||
|
||||
// EMPLOYE
|
||||
if(!empty($search_employe) && $search_employe != -1) {
|
||||
$filter.= " AND cp.fk_user = '$search_employe'\n";
|
||||
}
|
||||
|
||||
// VALIDEUR
|
||||
if(!empty($search_valideur) && $search_valideur != -1) {
|
||||
$filter.= " AND cp.fk_validator = '$search_valideur'\n";
|
||||
}
|
||||
|
||||
// STATUT
|
||||
if(!empty($search_statut) && $search_statut != -1) {
|
||||
$filter.= " AND cp.statut = '$search_statut'\n";
|
||||
}
|
||||
|
||||
/*************************************
|
||||
* Fin des filtres de recherche
|
||||
*************************************/
|
||||
|
||||
// Récupération de l'ID de l'utilisateur
|
||||
$user_id = $user->id;
|
||||
|
||||
// Récupération des congés payés de l'utilisateur ou de tous les users
|
||||
if(!$user->rights->holiday->lire_tous)
|
||||
{
|
||||
$holiday = new Holiday($db);
|
||||
$holiday_payes = $holiday->fetchByUser($user_id,$order,$filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
$holiday = new Holiday($db);
|
||||
$holiday_payes = $holiday->fetchAll($order,$filter);
|
||||
}
|
||||
|
||||
// Si pas de congés payés
|
||||
if($holiday_payes == 0)
|
||||
{
|
||||
print_fiche_titre($langs->trans('CPTitreMenu'));
|
||||
|
||||
print '<div class="tabBar">';
|
||||
print '<span>'.$langs->trans('NoCPforUser').'<br /><br />';
|
||||
print '<a href="./fiche.php?mainmenu=agenda&action=request" class="butAction">'.$langs->trans('AddCP').'</a></span>';
|
||||
print '</div>';
|
||||
exit();
|
||||
}
|
||||
|
||||
// Si erreur SQL
|
||||
if($holiday_payes == '-1')
|
||||
{
|
||||
print_fiche_titre($langs->trans('CPTitreMenu'));
|
||||
|
||||
print '<div class="tabBar">';
|
||||
print '<span>'.$langs->trans('CPErrorSQL');
|
||||
print ' '.$holiday->error.'</span>';
|
||||
print '</div>';
|
||||
exit();
|
||||
}
|
||||
|
||||
/*************************************
|
||||
* Affichage du tableau des congés payés
|
||||
*************************************/
|
||||
|
||||
$var=true; $num = count($holiday->holiday);
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num,$nbtotalofrecords);
|
||||
|
||||
print '<div class="tabBar">';
|
||||
|
||||
$nbaquis=$holiday->getCPforUser($user->id);
|
||||
$nbdeduced=$holiday->getConfCP('nbHolidayDeducted');
|
||||
$nb_holiday = $nbaquis / $nbdeduced;
|
||||
print $langs->trans('SoldeCPUser',round($nb_holiday,2)).($nbdeduced != 1 ? ' ('.$nbaquis.' / '.$nbdeduced.')' : '');
|
||||
print '</div>';
|
||||
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<table class="noborder" width="100%;">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("ID"),"index.php","cp.rowid","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreateCP"),"index.php","cp.date_create","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Employe"),"index.php","cp.fk_user","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ValidatorCP"),"index.php","cp.fk_validator","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDebCP"),"index.php","cp.date_debut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateFinCP"),"index.php","cp.date_fin","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Duration"));
|
||||
print_liste_field_titre($langs->trans("Statut"),"index.php","cp.statut","",'','align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// FILTRES
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left" width="50">';
|
||||
print '<input class="flat" size="4" type="text" name="search_ref" value="'.$_GET['search_ref'].'">';
|
||||
|
||||
// DATE CREATE
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_create" value="'.$month_create.'">';
|
||||
$htmlother->select_year($year_create,'year_create',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// UTILISATEUR
|
||||
if($user->rights->holiday->lire_tous) {
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$html->select_users($search_employe,"search_employe",1,"",0,'');
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
// VALIDEUR
|
||||
if($user->rights->holiday->lire_tous){
|
||||
print '<td class="liste_titre" align="left">';
|
||||
|
||||
// Liste des utiliseurs du groupes Comptabilité
|
||||
|
||||
$idGroupValid = $holiday->getConfCP('userGroup');
|
||||
|
||||
$validator = new UserGroup($db,$idGroupValid);
|
||||
$valideur = $validator->listUsersForGroup();
|
||||
|
||||
$html->select_users($search_valideur,"search_valideur",1,"",0,$valideur,'');
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
// DATE DEBUT
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_start" value="'.$month_start.'">';
|
||||
$htmlother->select_year($year_start,'year_start',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// DATE FIN
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
|
||||
$htmlother->select_year($year_end,'year_end',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// DUREE
|
||||
print '<td> </td>';
|
||||
|
||||
// STATUT
|
||||
print '<td class="liste_titre" width="70px;" align="center">';
|
||||
$holiday->selectStatutCP($search_statut);
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans('Search').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
if (! empty($holiday->holiday))
|
||||
{
|
||||
foreach($holiday->holiday as $infos_CP)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
// Utilisateur
|
||||
$user = new User($db);
|
||||
$user->fetch($infos_CP['fk_user']);
|
||||
|
||||
// Valideur
|
||||
$validator = new User($db);
|
||||
$validator->fetch($infos_CP['fk_validator']);
|
||||
|
||||
$date = date_create($infos_CP['date_create']);
|
||||
$date = date_format($date,'Y-m-d');
|
||||
|
||||
$statut = $holiday->getStatutCP($infos_CP['statut']);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="./fiche.php?id='.$infos_CP['rowid'].'">CP '.$infos_CP['rowid'].'</a></td>';
|
||||
print '<td style="text-align: center;">'.$date.'</td>';
|
||||
print '<td>'.$user->getNomUrl('1').'</td>';
|
||||
print '<td>'.$validator->getNomUrl('1').'</td>';
|
||||
print '<td style="text-align: center;">'.$infos_CP['date_debut'].'</td>';
|
||||
print '<td style="text-align: center;">'.$infos_CP['date_fin'].'</td>';
|
||||
print '<td>'.$holiday->getOpenDays(strtotime($infos_CP['date_debut']),strtotime($infos_CP['date_fin'])).' '.$langs->trans('Jours').'</td>';
|
||||
print '<td align="center"><a href="./fiche.php?id='.$infos_CP['rowid'].'">'.$statut.'</a></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Si il n'y a pas d'enregistrement suite à une recherche
|
||||
if($holiday_payes == '2')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td colspan="8" class="pair" style="text-align: center; padding: 5px;">'.$langs->trans('None').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
print '<div style="float: right; margin-top: 8px;">';
|
||||
print '<a href="./fiche.php?action=request" class="butAction">'.$langs->trans('AddCP').'</a>';
|
||||
print '</div>';
|
||||
|
||||
// Fin de page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
138
htdocs/holiday/month_report.php
Normal file
138
htdocs/holiday/month_report.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 François Legastelois <flegastelois@teclib.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file month_report.php
|
||||
* \ingroup holiday
|
||||
* \brief Monthly report of paid holiday.
|
||||
* \version $Id: month_report.php,v 1.00 2011/09/15 11:00:00 flegastelois Exp $
|
||||
* \author flegastelois@teclib.com <François Legastelois>
|
||||
* \remarks Monthly report of paid holiday.
|
||||
*/
|
||||
require('pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/user/class/user.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php');
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
// Si l'utilisateur n'a pas le droit de lire cette page
|
||||
if(!$user->rights->holiday->month_report) accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
|
||||
|
||||
llxHeader($langs->trans('CPTitreMenu'));
|
||||
|
||||
$cp = new Holiday($db);
|
||||
|
||||
$month = GETPOST('month_start');
|
||||
$year = GETPOST('year_start');
|
||||
|
||||
if(empty($month)) {
|
||||
$month = date('m');
|
||||
}
|
||||
if(empty($year)) {
|
||||
$year = date('Y');
|
||||
}
|
||||
|
||||
$sql = "SELECT cp.fk_user, cp.date_debut, cp.date_fin";
|
||||
$sql.= " FROM llx_holiday cp";
|
||||
$sql.= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid";
|
||||
$sql.= " WHERE cp.rowid > '0'";
|
||||
$sql.= " AND cp.statut = 3";
|
||||
$sql.= " AND (date_format(cp.date_debut, '%Y-%m') = '$year-$month'
|
||||
OR date_format(cp.date_fin, '%Y-%m') = '$year-$month')";
|
||||
$sql.= " ORDER BY u.name,cp.date_debut";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print_fiche_titre($langs->trans('MenuReportMonth'));
|
||||
|
||||
print '<div class="tabBar">';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
print 'Choix mois : <input class="flat" type="text" size="1" maxlength="2"
|
||||
name="month_start" value="'.$month.'"> ';
|
||||
$htmlother->select_year($year,'year_start',1,10,3);
|
||||
|
||||
print '<input type="submit" value="'.$langs->trans("Refresh").'" class="button" />';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br />';
|
||||
|
||||
$var=true;
|
||||
print '<table class="noborder" width="40%;">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Employee').'</td>';
|
||||
print '<td>'.$langs->trans('DateDebCP').'</td>';
|
||||
print '<td>'.$langs->trans('DateFinCP').'</td>';
|
||||
print '<td>'.$langs->trans('nbJours').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if($num == '0') {
|
||||
|
||||
print '<tr class="pair">';
|
||||
print '<td colspan="4" style="text-align: center; padding: 3px;">'.$langs->trans('NoCPforMonth').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
} else {
|
||||
|
||||
while($holiday = $db->fetch_array($result)){
|
||||
$user = new User($db);
|
||||
$user->fetch($holiday['fk_user']);
|
||||
$var=!$var;
|
||||
|
||||
if(substr($holiday['date_debut'],5,2)==$month-1){
|
||||
$holiday['date_debut'] = date('Y-'.$month.'-01');
|
||||
}
|
||||
|
||||
if(substr($holiday['date_fin'],5,2)==$month+1){
|
||||
$holiday['date_fin'] = date('Y-'.$month.'-t');
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$user->nom.' '.$user->prenom.'</td>';
|
||||
print '<td>'.$holiday['date_debut'].'</td>';
|
||||
print '<td>'.$holiday['date_fin'].'</td>';
|
||||
print '<td>'.$cp->getOpenDays(strtotime($holiday['date_debut']),strtotime($holiday['date_fin'])).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Fin de page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
113
htdocs/holiday/pre.inc.php
Normal file
113
htdocs/holiday/pre.inc.php
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file pre.inc.php
|
||||
* \ingroup holiday
|
||||
* \brief Load files and menus.
|
||||
*/
|
||||
|
||||
$res=0;
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); // For root directory
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); // For "custom" directory
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
dol_include_once("/holiday/class/holiday.class.php");
|
||||
|
||||
$langs->load("user");
|
||||
$langs->load("other");
|
||||
$langs->load("holiday");
|
||||
|
||||
|
||||
if (empty($conf->holiday->enabled))
|
||||
{
|
||||
llxHeader('',$langs->trans('CPTitreMenu'));
|
||||
print '<div class="tabBar">';
|
||||
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
|
||||
print '</div>';
|
||||
llxFooter();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$verifConf.= "SELECT value";
|
||||
$verifConf.= " FROM ".MAIN_DB_PREFIX."holiday_config";
|
||||
$verifConf.= " WHERE name = 'userGroup'";
|
||||
|
||||
$result = $db->query($verifConf);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if($obj->value == NULL)
|
||||
{
|
||||
llxHeader('',$langs->trans('CPTitreMenu'));
|
||||
print '<div class="tabBar">';
|
||||
print '<span style="color: #FF0000;">'.$langs->trans('NotConfigModCP').'</span>';
|
||||
print '</div>';
|
||||
llxFooter();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function llxHeader($title)
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
top_htmlhead('',$title);
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add("/holiday/index.php?mainmenu=holiday",$langs->trans("CPTitreMenu"));
|
||||
if($user->rights->holiday->create_edit_read) {
|
||||
$menu->add("/holiday/fiche.php?mainmenu=holiday&action=request",$langs->trans("MenuAddCP"),2);
|
||||
}
|
||||
if($user->rights->holiday->define_holiday) {
|
||||
$menu->add("/holiday/define_holiday.php?leftmenu=setup&mainmenu=holiday",$langs->trans("MenuConfCP"),2);
|
||||
}
|
||||
if($user->rights->holiday->view_log) {
|
||||
$menu->add("/holiday/view_log.php?mainmenu=holiday",$langs->trans("MenuLogCP"),2);
|
||||
}
|
||||
if($user->rights->holiday->view_log) {
|
||||
$menu->add("/holiday/month_report.php?mainmenu=holiday",$langs->trans("MenuReportMonth"),2);
|
||||
}
|
||||
|
||||
if(in_array('employees', $conf->modules) && $user->rights->employees->module_access)
|
||||
{
|
||||
$menu->add("/employees/index.php",$langs->trans("Menu_Title_EMPLOYEE"));
|
||||
$menu->add("/employees/index.php",$langs->trans("Menu_List_EMPLOYEE"),2);
|
||||
$menu->add("/employees/fiche.php?action=create",$langs->trans("Menu_Add_EMPLOYEE"),2);
|
||||
$menu->add("/employees/hire.php?action=create",$langs->trans("Menu_Add_HIRE"),2);
|
||||
$menu->add("/employees/salary.php?action=create",$langs->trans("Menu_Add_SALARY"),2);
|
||||
$menu->add("/employees/job.php?action=create",$langs->trans("Menu_Add_JOB"),2);
|
||||
$menu->add("/employees/disease.php?action=create",$langs->trans("Menu_Add_DISEASE"),2);
|
||||
$menu->add("/employees/month_report_disease.php",$langs->trans("Menu_Report_Disease"),2);
|
||||
$menu->add("/employees/set_hire_type.php",$langs->trans("Menu_Set_Hire_type"),2);
|
||||
|
||||
if(!isset($_SESSION['employees_passphrase'])){
|
||||
$menu->add("/employees/store_secure.php",$langs->trans("Menu_Store_Secure"),2);
|
||||
}
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
101
htdocs/holiday/view_log.php
Normal file
101
htdocs/holiday/view_log.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Displays the log of actions performed in the module.
|
||||
*
|
||||
* \file view_log.php
|
||||
* \ingroup holiday
|
||||
*/
|
||||
|
||||
require('pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// Si l'utilisateur n'a pas le droit de lire cette page
|
||||
if(!$user->rights->holiday->view_log) accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader($langs->trans('CPTitreMenu'));
|
||||
|
||||
|
||||
$cp = new Holiday($db);
|
||||
$log_holiday = $cp->fetchLog('','');
|
||||
|
||||
print_fiche_titre($langs->trans('LogCP'));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tbody>';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre">'.$langs->trans('ID').'</td>';
|
||||
print '<td class="liste_titre" align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('ActionByCP').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('UserUpdateCP').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('ActionTypeCP').'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('PrevSoldeCP').'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('NewSoldeCP').'</td>';
|
||||
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
|
||||
foreach($cp->logs as $logs_CP)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
$user_action = new User($db);
|
||||
$user_action->fetch($logs_CP['fk_user_action']);
|
||||
|
||||
$user_update = new User($db);
|
||||
$user_update->fetch($logs_CP['fk_user_update']);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$logs_CP['rowid'].'</td>';
|
||||
print '<td style="text-align: center;">'.$logs_CP['date_action'].'</td>';
|
||||
print '<td>'.$user_action->getFullName($langs).'</td>';
|
||||
print '<td>'.$user_update->getFullName($langs).'</td>';
|
||||
print '<td>'.$logs_CP['type_action'].'</td>';
|
||||
print '<td style="text-align: right;">'.$logs_CP['prev_solde'].' jours</td>';
|
||||
print '<td style="text-align: right;">'.$logs_CP['new_solde'].' jours</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
}
|
||||
|
||||
if($log_holiday == '2')
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td colspan="7" class="pair" style="text-align: center; padding: 5px;">'.$langs->trans('NoResult').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</tbody>'."\n";
|
||||
print '</table>'."\n";
|
||||
|
||||
|
||||
// Fin de page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
8
htdocs/install/mysql/data/llx_holiday_config.sql
Normal file
8
htdocs/install/mysql/data/llx_holiday_config.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'userGroup', NULL);
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'lastUpdate', NULL);
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbUser', NULL);
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'delayForRequest', '31');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'AlertValidatorDelay', '0');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'AlertValidatorSolde', '0');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayDeducted', '1');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayEveryMonth', '2.5');
|
||||
|
|
@ -123,3 +123,70 @@ create table llx_element_tag
|
|||
|
||||
ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag, fk_element, element);
|
||||
-- END TASK #107
|
||||
|
||||
|
||||
CREATE TABLE llx_holiday_config
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR( 255 ) NOT NULL UNIQUE,
|
||||
value TEXT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE llx_holiday_events
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT ,
|
||||
name VARCHAR( 255 ) NOT NULL ,
|
||||
value TEXT NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE llx_holiday_logs
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
date_action DATETIME NOT NULL ,
|
||||
fk_user_action INT( 11 ) NOT NULL ,
|
||||
fk_user_update INT( 11 ) NOT NULL ,
|
||||
type_action VARCHAR( 255 ) NOT NULL ,
|
||||
prev_solde VARCHAR( 255 ) NOT NULL ,
|
||||
new_solde VARCHAR( 255 ) NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE llx_holiday_users
|
||||
(
|
||||
fk_user INT( 11 ) NOT NULL PRIMARY KEY,
|
||||
nb_holiday FLOAT( 5 ) NOT NULL DEFAULT '0'
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE llx_holiday
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_user INT( 11 ) NOT NULL ,
|
||||
date_create DATETIME NOT NULL ,
|
||||
description VARCHAR( 255 ) NOT NULL ,
|
||||
date_debut DATE NOT NULL ,
|
||||
date_fin DATE NOT NULL ,
|
||||
statut INT( 11 ) NOT NULL DEFAULT '1',
|
||||
fk_validator INT( 11 ) NOT NULL ,
|
||||
date_valid DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_valid INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_refuse DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_refuse INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_cancel DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_cancel INT( 11 ) NULL DEFAULT NULL,
|
||||
detail_refuse varchar( 250 ) NULL DEFAULT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'userGroup', NULL);
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'lastUpdate', NULL);
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbUser', NULL);
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'delayForRequest', '31');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'AlertValidatorDelay', '0');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'AlertValidatorSolde', '0');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayDeducted', '1');
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayEveryMonth', '2.5');
|
||||
|
||||
|
|
|
|||
19
htdocs/install/mysql/tables/llx_holiday.sql
Normal file
19
htdocs/install/mysql/tables/llx_holiday.sql
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
CREATE TABLE llx_holiday
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_user INT( 11 ) NOT NULL ,
|
||||
date_create DATETIME NOT NULL ,
|
||||
description VARCHAR( 255 ) NOT NULL ,
|
||||
date_debut DATE NOT NULL ,
|
||||
date_fin DATE NOT NULL ,
|
||||
statut INT( 11 ) NOT NULL DEFAULT '1',
|
||||
fk_validator INT( 11 ) NOT NULL ,
|
||||
date_valid DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_valid INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_refuse DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_refuse INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_cancel DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_cancel INT( 11 ) NULL DEFAULT NULL,
|
||||
detail_refuse varchar( 250 ) NULL DEFAULT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
7
htdocs/install/mysql/tables/llx_holiday_config.sql
Normal file
7
htdocs/install/mysql/tables/llx_holiday_config.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE llx_holiday_config
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR( 255 ) NOT NULL UNIQUE,
|
||||
value TEXT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
7
htdocs/install/mysql/tables/llx_holiday_events.sql
Normal file
7
htdocs/install/mysql/tables/llx_holiday_events.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE llx_holiday_events
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT ,
|
||||
name VARCHAR( 255 ) NOT NULL ,
|
||||
value TEXT NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
11
htdocs/install/mysql/tables/llx_holiday_logs.sql
Normal file
11
htdocs/install/mysql/tables/llx_holiday_logs.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
CREATE TABLE llx_holiday_logs
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
date_action DATETIME NOT NULL ,
|
||||
fk_user_action INT( 11 ) NOT NULL ,
|
||||
fk_user_update INT( 11 ) NOT NULL ,
|
||||
type_action VARCHAR( 255 ) NOT NULL ,
|
||||
prev_solde VARCHAR( 255 ) NOT NULL ,
|
||||
new_solde VARCHAR( 255 ) NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
6
htdocs/install/mysql/tables/llx_holiday_users.sql
Normal file
6
htdocs/install/mysql/tables/llx_holiday_users.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
CREATE TABLE llx_holiday_users
|
||||
(
|
||||
fk_user INT( 11 ) NOT NULL PRIMARY KEY,
|
||||
nb_holiday FLOAT( 5 ) NOT NULL DEFAULT '0'
|
||||
)
|
||||
ENGINE=innodb;
|
||||
130
htdocs/langs/en_US/holiday.lang
Executable file
130
htdocs/langs/en_US/holiday.lang
Executable file
|
|
@ -0,0 +1,130 @@
|
|||
# Dolibarr language file - en_US - holiday
|
||||
CHARSET= UTF-8
|
||||
|
||||
CPTitreMenu=Holidays
|
||||
MenuReportMonth=Monthly statement
|
||||
MenuAddCP=Demand for holidays
|
||||
NotActiveModCP=You must enable the module holidays to view this page.
|
||||
NotConfigModCP=You must configure the module holidays to view this page. To do this, <a href="./admin/holiday.php?leftmenu=setup&mainmenu=home" style="font-weight: normal; color: red; text-decoration: underline;"> click here </ a>.
|
||||
NoCPforUser=You don't have a demand for holidays.
|
||||
AddCP=Apply for holidays
|
||||
CPErrorSQL=An SQL error occurred:
|
||||
Employe=Employee
|
||||
DateDebCP=Start date
|
||||
DateFinCP=End date
|
||||
DateCreateCP=Creation date
|
||||
DraftCP=Draft
|
||||
ToValidateCP=Awaiting approval
|
||||
ValidateCP=Validated
|
||||
CancelCP=Canceled
|
||||
RefuseCP=Refused
|
||||
ValidatorCP=Validator
|
||||
ListeCP=List of holidays
|
||||
ValidateByCP=Will be validated by
|
||||
DescCP=Description
|
||||
SendRequestCP=Creating demand for holidays
|
||||
DelayToRequestCP=Applications for holidays must be made at least <b>% s day </ b> before them.
|
||||
MenuConfCP=Define the holidays
|
||||
UpdateAllCP=Update the holidays
|
||||
SoldeCPUser=Your balance of holidays is <b>%s</b> days.
|
||||
ErrorEndDateCP=You must select an end date greater than the start date.
|
||||
ErrorSQLCreateCP=An SQL error occurred during the creation:
|
||||
ErrorIDFicheCP=An error has occurred, the request for holidays does not exist.
|
||||
ReturnCP=Return to previous page
|
||||
ErrorUserViewCP=You are not authorized to read this request for holidays.
|
||||
InfosCP=Information of the demand of holidays
|
||||
InfosWorkflowCP=Information Workflow
|
||||
DateCreateCP=Creation date
|
||||
RequestByCP=Requested by
|
||||
TitreRequestCP=Sheet of holidays
|
||||
NbUseDaysCP=Number of days of holidays consumed
|
||||
EditCP=Edit
|
||||
DeleteCP=Delete
|
||||
ActionValidCP=Validate
|
||||
ActionRefuseCP=Refuse
|
||||
ActionCancelCP=Cancel
|
||||
StatutCP=Status
|
||||
SendToValidationCP=Send to validation
|
||||
TitleDeleteCP=Delete the request of holidays
|
||||
ConfirmDeleteCP=Confirm the deletion of this request for holidays?
|
||||
ErrorCantDeleteCP=Error you don't have the right to delete this request of holidays.
|
||||
CantCreateCP=You don't have the right to apply for holidays.
|
||||
InvalidValidatorCP=You must choose a validator to your request of holidays.
|
||||
UpdateButtonCP=Update
|
||||
CantUpdate=You cannot update this request of holidays.
|
||||
NoDateDebut=You must select a start date.
|
||||
NoDateFin=You must select an end date.
|
||||
ErrorDureeCP=Your request for holidays does not contain working day.
|
||||
TitleValidCP=Validate the request holidays
|
||||
ConfirmValidCP=Are you sure you want to validate the request of holidays?
|
||||
DateValidCP=Date validation
|
||||
TitleToValidCP=Send request holidays
|
||||
ConfirmToValidCP=Are you sure you want to send the request of holidays?
|
||||
TitleRefuseCP=Refuse the request holidays
|
||||
ConfirmRefuseCP=Are you sure you want to refuse the request of holidays?
|
||||
NoMotifRefuseCP=You must choose a reason for refusing the request.
|
||||
TitleCancelCP=Cancel the request holidays
|
||||
ConfirmCancelCP=Are you sure you want to cancel the request of holidays?
|
||||
DetailRefusCP=Reason for refusal
|
||||
DateRefusCP=Date of refusal
|
||||
DateCancelCP=Date of cancellation
|
||||
DefineEventUserCP=Assign an exceptional leave for a user
|
||||
addEventToUserCP=Assign leave
|
||||
MotifCP=Reason
|
||||
UserCP=User
|
||||
ErrorAddEventToUserCP=An error occurred while adding the exceptional leave.
|
||||
AddEventToUserOkCP=The addition of the exceptional leave has been completed.
|
||||
MenuLogCP=View logs of holidays
|
||||
LogCP=Log of updates of holidays
|
||||
ActionByCP=Performed by
|
||||
UserUpdateCP=For the user
|
||||
ActionTypeCP=Type
|
||||
PrevSoldeCP=Previous Balance
|
||||
NewSoldeCP=New Balance
|
||||
alreadyCPexist=A request for holidays has already been done on this period.
|
||||
UserName=Name
|
||||
Employee=Employee
|
||||
|
||||
|
||||
## Configuration du Module ##
|
||||
ConfCP=Configuration of holidays module
|
||||
DescOptionCP=Description of the option
|
||||
ValueOptionCP=Value
|
||||
GroupToValidateCP=Group with the ability to validate holidays
|
||||
ConfirmConfigCP=Validate the configuration
|
||||
LastUpdateCP=Last updated automatically of holidays
|
||||
UpdateConfCPOK=Updated successfully.
|
||||
ErrorUpdateConfCP=An error occurred during the update, please try again.
|
||||
AddCPforUsers=Please add the balance of holidays of users by <a href="../define_holiday.php" style="font-weight: normal; color: red; text-decoration: underline;">clicking here</a>.
|
||||
DelayForSubmitCP=Deadline to apply for holidays
|
||||
AlertValidatorDelayCP=Prevent the validator if the request for leave to meet the deadline
|
||||
AlertValidorSoldeCP=Prevent the validator if the user requests holidays exceeding the balance
|
||||
nbUserCP=Number of users supported in the module holidays
|
||||
nbHolidayDeductedCP=Number of holidays to be deducted per day of holiday taken
|
||||
nbHolidayEveryMonthCP=Number of holidays added every month
|
||||
Module27130Name= Management of holidays
|
||||
Module27130Desc= Management of holidays
|
||||
TitleOptionMainCP=Main settings of holidays
|
||||
TitleOptionEventCP=Settings of holidays related to events
|
||||
ValidEventCP=Validate
|
||||
UpdateEventCP=Update events
|
||||
CreateEventCP=Create
|
||||
NameEventCP=Event name
|
||||
OkCreateEventCP=The addition of the event went well.
|
||||
ErrorCreateEventCP=Error creating the event.
|
||||
UpdateEventOkCP=The update of the event went well.
|
||||
ErrorUpdateEventCP=Error while updating the event.
|
||||
DeleteEventCP=Delete Event
|
||||
DeleteEventOkCP=The event has been deleted.
|
||||
ErrorDeleteEventCP=Error while deleting the event.
|
||||
TitleDeleteEventCP=Delete a exceptional leave
|
||||
TitleCreateEventCP=Create a exceptional leave
|
||||
TitleUpdateEventCP=Edit or delete a exceptional leave
|
||||
DeleteEventOptionCP=Delete
|
||||
UpdateEventOptionCP=Update
|
||||
ErrorMailNotSend=An error occurred while sending email:
|
||||
NoCPforMonth=No leave this month.
|
||||
Jours=days
|
||||
nbJours=Number days
|
||||
TitleAdminCP=Configuration of Holidays
|
||||
Permission20001=Read / Modify all requests of holidays
|
||||
129
htdocs/langs/fr_FR/holiday.lang
Normal file
129
htdocs/langs/fr_FR/holiday.lang
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
# Dolibarr language file - fr_FR - holiday
|
||||
CHARSET= UTF-8
|
||||
|
||||
CPTitreMenu=Congés
|
||||
MenuReportMonth=Etat mensuel
|
||||
MenuAddCP=Nouvelle demande
|
||||
NotActiveModCP=Vous devez activer le module Congés pour afficher cette page.
|
||||
NotConfigModCP=Vous devez configurer le module Congés pour afficher cette page. Pour effectuer cette opération, <a href="./admin/holiday.php?leftmenu=setup&mainmenu=home" style="font-weight: normal; color: red; text-decoration: underline;">cliquer ici</a>.
|
||||
NoCPforUser=Vous n'avez pas encore de demande de congés.
|
||||
AddCP=Créer demande de congés
|
||||
CPErrorSQL=Une erreur SQL est survenue :
|
||||
Employe=Employé
|
||||
DateDebCP=Date Début
|
||||
DateFinCP=Date Fin
|
||||
DateCreateCP=Date de création
|
||||
DraftCP=Brouillon
|
||||
ToValidateCP=En attente de validation
|
||||
ValidateCP=Validée
|
||||
CancelCP=Annulée
|
||||
RefuseCP=Refusée
|
||||
ValidatorCP=Valideur
|
||||
ListeCP=Liste des congés
|
||||
ValidateByCP=Sera validée par
|
||||
DescCP=Description
|
||||
SendRequestCP=Envoyer la demande de congés
|
||||
DelayToRequestCP=Les demandes de congés doivent être faites au moins <b>%s jours</b> avant la date</b> de ceux-ci.
|
||||
MenuConfCP=Définir les congés
|
||||
UpdateAllCP=Mettre à jour les congés
|
||||
SoldeCPUser=Votre solde de congés est de <b>%s jours</b>.
|
||||
ErrorEndDateCP=Vous devez choisir une date de fin supérieur à la date de début.
|
||||
ErrorSQLCreateCP=Une erreur SQL est survenue durant la création :
|
||||
ErrorIDFicheCP=Une erreur est survenue, cette demande de congés n'existe pas.
|
||||
ReturnCP=Retour à la page précédente
|
||||
ErrorUserViewCP=Vous n'êtes pas autorisé à lire cette demande de congés.
|
||||
InfosCP=Informations de la demande de congés
|
||||
InfosWorkflowCP=Informations du workflow
|
||||
DateCreateCP=Date de création
|
||||
RequestByCP=Demandée par
|
||||
TitreRequestCP=Fiche Congés
|
||||
NbUseDaysCP=Nombre de jours de congés consommés
|
||||
EditCP=Modifier
|
||||
DeleteCP=Supprimer
|
||||
ActionValidCP=Valider
|
||||
ActionRefuseCP=Refuser
|
||||
ActionCancelCP=Annuler
|
||||
StatutCP=Statut
|
||||
SendToValidationCP=Envoyer en validation
|
||||
TitleDeleteCP=Supprimer la demande de Congés
|
||||
ConfirmDeleteCP=Confirmer la suppression de cette demande de congés ?
|
||||
ErrorCantDeleteCP=Erreur, vous n'avez pas le droit de supprimer cette demande de congés.
|
||||
CantCreateCP=Vous n'avez pas le droit de faire des demandes de congés.
|
||||
InvalidValidatorCP=Vous devez choisir un valideur pour votre demande de congés.
|
||||
UpdateButtonCP=Mettre à jour
|
||||
CantUpdate=Vous ne pouvez pas mettre à jour cette demande de congés.
|
||||
NoDateDebut=Vous devez choisir une date de début.
|
||||
NoDateFin=Vous devez choisir une date de fin.
|
||||
ErrorDureeCP=Votre demande de congés payés ne contient aucun jour ouvré.
|
||||
TitleValidCP=Valider la demande de Congés Payés
|
||||
ConfirmValidCP=Êtes-vous sûr de vouloir valider la demande de congés ?
|
||||
DateValidCP=Date de validation
|
||||
TitleToValidCP=Envoyer la demande de Congés Payés
|
||||
ConfirmToValidCP=Êtes-vous sûr de vouloir envoyer la demande de congés ?
|
||||
TitleRefuseCP=Refuser la demande de Congés Payés
|
||||
ConfirmRefuseCP=Êtes-vous sûr de vouloir refuser la demande de congés ?
|
||||
NoMotifRefuseCP=Vous devez choisir un motif pour refuser cette demande.
|
||||
TitleCancelCP=Annuler la demande de Congés Payés
|
||||
ConfirmCancelCP=Êtes-vous sûr de vouloir annuler la demande de congés ?
|
||||
DetailRefusCP=Motif du refus
|
||||
DateRefusCP=Date du refus
|
||||
DateCancelCP=Date de l'annulation
|
||||
DefineEventUserCP=Attribuer un congé exceptionnel à un utilisateur
|
||||
addEventToUserCP=Attribuer ce congé
|
||||
MotifCP=Motif
|
||||
UserCP=Utilisateur
|
||||
ErrorAddEventToUserCP=Une erreur est survenue durant l'ajout du congé exceptionnel.
|
||||
AddEventToUserOkCP=L'ajout du congé exceptionnel à bien été effectué.
|
||||
MenuLogCP=Voir les logs des congés
|
||||
LogCP=Logs des mises à jours des congés
|
||||
ActionByCP=Réalisée par
|
||||
UserUpdateCP=Pour l'utilisateur
|
||||
ActionTypeCP=Type
|
||||
PrevSoldeCP=Précédent Solde
|
||||
NewSoldeCP=Nouveau Solde
|
||||
alreadyCPexist=Une demande de congés à déjà été effectuée sur cette période.
|
||||
UserName=Nom Prénom
|
||||
Employee=Salarié
|
||||
|
||||
|
||||
## Configuration du Module ##
|
||||
ConfCP=Configuration du module Congés
|
||||
DescOptionCP=Description de l'option
|
||||
ValueOptionCP=Valeur
|
||||
GroupToValidateCP=Groupe ayant la possibilité de valider les congés
|
||||
ConfirmConfigCP=Valider la configuration
|
||||
LastUpdateCP=Dernière mise à jour automatique des congés
|
||||
UpdateConfCPOK=Mise à jour effectuée avec succès.
|
||||
ErrorUpdateConfCP=Une erreur à eu lieu durant la mise à jour, merci de réessayer.
|
||||
AddCPforUsers=Veuillez ajouter le solde des congés des utilisateurs en <a href="../define_holiday.php" style="font-weight: normal; color: red; text-decoration: underline;">cliquant ici</a>.
|
||||
DelayForSubmitCP=Délai pour faire une demande de congés avant ceux-ci
|
||||
AlertValidatorDelayCP=Prévenir le valideur si la demande de congés ne respecte le délai prévu
|
||||
AlertValidorSoldeCP=Prévenir le valideur si l'utilisateur demande des congés dépassant son solde
|
||||
nbUserCP=Nombre d'utilisateur pris en charge dans le module congés
|
||||
nbHolidayDeductedCP=Nombre de congés payés à déduire par jour de congé pris
|
||||
nbHolidayEveryMonthCP=Nombre de congés payés ajoutés chaque mois
|
||||
Module27130Name= Gestion des congés
|
||||
TitleOptionMainCP=Réglages principaux des congés
|
||||
TitleOptionEventCP=Réglages des congés liés à des évènements
|
||||
ValidEventCP=Valider
|
||||
UpdateEventCP=Mettre à jour les évènements
|
||||
CreateEventCP=Créer
|
||||
NameEventCP=Nom de l'évènement
|
||||
OkCreateEventCP=L'ajout de l'évènement s'est bien déroulé.
|
||||
ErrorCreateEventCP=Erreur lors de la création de l'évènement.
|
||||
UpdateEventOkCP=La mise à jour de l'évènement s'est bien déroulé.
|
||||
ErrorUpdateEventCP=Erreur lors de la mise à jour de l'évènement.
|
||||
DeleteEventCP=Supprimer l'évènement
|
||||
DeleteEventOkCP=L'évènement à bien été supprimé.
|
||||
ErrorDeleteEventCP=Erreur lors de la suppression de l'évènement.
|
||||
TitleDeleteEventCP=Supprimer un congé exceptionnel
|
||||
TitleCreateEventCP=Créer un congé exceptionnel
|
||||
TitleUpdateEventCP=Modifier ou supprimer un congé exceptionnel
|
||||
DeleteEventOptionCP=Supprimer
|
||||
UpdateEventOptionCP=Mettre à jour
|
||||
ErrorMailNotSend=Une erreur est survenue lors de l'envoi du mail :
|
||||
NoCPforMonth=Aucun congé ce mois-ci.
|
||||
Jours=jours
|
||||
nbJours=Nombre jours
|
||||
TitleAdminCP=Configuration des Congés
|
||||
Permission20001=Lire / Créer / modifier ses congès
|
||||
BIN
htdocs/theme/amarok/img/object_holiday.png
Normal file
BIN
htdocs/theme/amarok/img/object_holiday.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
BIN
htdocs/theme/auguria/img/object_holiday.png
Normal file
BIN
htdocs/theme/auguria/img/object_holiday.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
BIN
htdocs/theme/bureau2crea/img/object_holiday.png
Normal file
BIN
htdocs/theme/bureau2crea/img/object_holiday.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
BIN
htdocs/theme/cameleo/img/object_holiday.png
Normal file
BIN
htdocs/theme/cameleo/img/object_holiday.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
BIN
htdocs/theme/eldy/img/object_holiday.png
Normal file
BIN
htdocs/theme/eldy/img/object_holiday.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
Loading…
Reference in New Issue
Block a user