Skip to content

Commit

Permalink
#30 [TimeSheet] fix: clean code file
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Nov 2, 2022
1 parent a92cc65 commit 77f1cdb
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 159 deletions.
4 changes: 2 additions & 2 deletions class/timesheet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class TimeSheet extends CommonObject
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>170, 'notnull'=>1, 'visible'=>0, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>180, 'notnull'=>-1, 'visible'=>0,),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>82, 'notnull'=>-1, 'visible'=>3, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx',),
'fk_societe' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>101, 'notnull'=>-1, 'visible'=>3, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>101, 'notnull'=>-1, 'visible'=>3, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx',),
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php:1:t.fk_soc IS NULL', 'label'=>'UserAssign', 'enabled'=>'1', 'position'=>85, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx',),
);

Expand All @@ -153,7 +153,7 @@ class TimeSheet extends CommonObject
public $fk_user_creat;
public $fk_user_modif;
public $fk_project;
public $fk_societe;
public $fk_soc;
public $fk_user_assign;

// If this object has a subtable with lines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,18 @@ public function write_file($objectDocument, $outputlangs, $srctemplatepath, $hid
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);

$date = dol_print_date(dol_now(), 'dayxcard');

$date = dol_print_date(dol_now(), 'dayxcard');
$newfiletmp = $objectref . '_' . $date . '_' . $newfiletmp . '_' . $conf->global->MAIN_INFO_SOCIETE_NOM;

$objectDocument->last_main_doc = $newfiletmp;

$sql = "UPDATE " . MAIN_DB_PREFIX . "dolisirh_dolisirhdocuments";
$sql .= " SET last_main_doc =" . ( ! empty($newfiletmp) ? "'" . $this->db->escape($newfiletmp) . "'" : 'null');
$sql .= " WHERE rowid = " . $objectDocument->id;

dol_syslog("admin.lib::Insert last main doc", LOG_DEBUG);
$this->db->query($sql);

// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
Expand Down
51 changes: 24 additions & 27 deletions core/modules/modDolisirh.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,43 +108,40 @@ public function __construct($db)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)

// Constants
$i = 0;
$this->const = array(
// CONST CONFIGURATION
1 => array('DOLISIRH_DEFAUT_TICKET_TIME', 'chaine', '15', 'Default Time', 0, 'current'),
2 => array('DOLISIRH_SHOW_ONLY_FAVORITE_TASKS', 'integer', 1, '', 0, 'current'),
3 => array('DOLISIRH_HR_PROJECT', 'integer', 0, '', 0, 'current'),
4 => array('DOLISIRH_TIMESPENT_BOOKMARK_SET', 'integer', 0, '', 0, 'current'),
5 => array('DOLISIRH_EXCEEDED_TIME_SPENT_COLOR', 'chaine', '#FF0000', '', 0, 'current'),
6 => array('DOLISIRH_NOT_EXCEEDED_TIME_SPENT_COLOR', 'chaine', '#FFA500', '', 0, 'current'),
7 => array('DOLISIRH_PERFECT_TIME_SPENT_COLOR', 'chaine', '#008000', '', 0, 'current'),
8 => array('DOLISIRH_PRODUCT_SERVICE_SET', 'integer', 0, '', 0, 'current'),
$i++ => array('DOLISIRH_DEFAUT_TICKET_TIME', 'chaine', '15', 'Default Time', 0, 'current'),
$i++ => array('DOLISIRH_SHOW_ONLY_FAVORITE_TASKS', 'integer', 1, '', 0, 'current'),
$i++ => array('DOLISIRH_HR_PROJECT', 'integer', 0, '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESPENT_BOOKMARK_SET', 'integer', 0, '', 0, 'current'),
$i++ => array('DOLISIRH_EXCEEDED_TIME_SPENT_COLOR', 'chaine', '#FF0000', '', 0, 'current'),
$i++ => array('DOLISIRH_NOT_EXCEEDED_TIME_SPENT_COLOR', 'chaine', '#FFA500', '', 0, 'current'),
$i++ => array('DOLISIRH_PERFECT_TIME_SPENT_COLOR', 'chaine', '#008000', '', 0, 'current'),
$i++ => array('DOLISIRH_PRODUCT_SERVICE_SET', 'integer', 0, '', 0, 'current'),

// CONST TIME SHEET
10 => array('MAIN_AGENDA_ACTIONAUTO_TIMESHEET_CREATE', 'integer', 1, '', 0, 'current'),
11 => array('MAIN_AGENDA_ACTIONAUTO_TIMESHEET_EDIT', 'integer', 1, '', 0, 'current'),
12 => array('DOLISIRH_TIMESHEET_ADDON', 'chaine', 'mod_timesheet_standard', '', 0, 'current'),
13 => array('DOLISIRH_TIMESHEET_PREFILL_DATE', 'integer', 1, '', 0, 'current'),
14 => array('DOLISIRH_TIMESHEET_ADD_ATTENDANTS', 'integer', 0, '', 0, 'current'),
15 => array('DOLISIRH_TIMESHEET_CHECK_DATE_END', 'integer', 1, '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEET_ADDON', 'chaine', 'mod_timesheet_standard', '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEET_PREFILL_DATE', 'integer', 1, '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEET_ADD_ATTENDANTS', 'integer', 0, '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEET_CHECK_DATE_END', 'integer', 1, '', 0, 'current'),

// CONST TIMESHEET DOCUMENT
20 => array('MAIN_AGENDA_ACTIONAUTO_TIMESHEETDOCUMENT_CREATE', 'integer', 1, '', 0, 'current'),
21 => array('DOLISIRH_TIMESHEETDOCUMENT_ADDON', 'chaine', 'mod_timesheetdocument_standard', '', 0, 'current'),
22 => array('DOLISIRH_TIMESHEETDOCUMENT_ADDON_ODT_PATH', 'chaine', 'DOL_DOCUMENT_ROOT/custom/dolisirh/documents/doctemplates/timesheetdocument/', '', 0, 'current'),
23 => array('DOLISIRH_TIMESHEETDOCUMENT_CUSTOM_ADDON_ODT_PATH', 'chaine', 'DOL_DATA_ROOT' . (($conf->entity == 1 ) ? '/' : '/' . $conf->entity . '/') . 'ecm/dolisirh/timesheetdocument/', '', 0, 'current'),
24 => array('DOLISIRH_TIMESHEETDOCUMENT_DEFAULT_MODEL', 'chaine', 'timesheetdocument_odt', '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEETDOCUMENT_ADDON', 'chaine', 'mod_timesheetdocument_standard', '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEETDOCUMENT_ADDON_ODT_PATH', 'chaine', 'DOL_DOCUMENT_ROOT/custom/dolisirh/documents/doctemplates/timesheetdocument/', '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEETDOCUMENT_CUSTOM_ADDON_ODT_PATH', 'chaine', 'DOL_DATA_ROOT' . (($conf->entity == 1 ) ? '/' : '/' . $conf->entity . '/') . 'ecm/dolisirh/timesheetdocument/', '', 0, 'current'),
$i++ => array('DOLISIRH_TIMESHEETDOCUMENT_DEFAULT_MODEL', 'chaine', 'timesheetdocument_odt', '', 0, 'current'),

// CONST CERTIFICATE
30 => array('MAIN_AGENDA_ACTIONAUTO_CERTIFICATE_CREATE', 'integer', 1, '', 0, 'current'),
31 => array('MAIN_AGENDA_ACTIONAUTO_CERTIFICATE_EDIT', 'integer', 1, '', 0, 'current'),
32 => array('DOLISIRH_CERTIFICATE_ADDON', 'chaine', 'mod_certificate_standard', '', 0, 'current'),
$i++ => array('MAIN_AGENDA_ACTIONAUTO_CERTIFICATE_CREATE', 'integer', 1, '', 0, 'current'),
$i++ => array('MAIN_AGENDA_ACTIONAUTO_CERTIFICATE_EDIT', 'integer', 1, '', 0, 'current'),
$i++ => array('DOLISIRH_CERTIFICATE_ADDON', 'chaine', 'mod_certificate_standard', '', 0, 'current'),

// CONST CERTIFICATE DOCUMENT
40 => array('MAIN_AGENDA_ACTIONAUTO_CERTIFICATEDOCUMENT_CREATE', 'integer', 1, '', 0, 'current'),
41 => array('DOLISIRH_CERTIFICATEDOCUMENT_ADDON', 'chaine', 'mod_certificatedocument_standard', '', 0, 'current'),
42 => array('DOLISIRH_CERTIFICATEDOCUMENT_ADDON_ODT_PATH', 'chaine', 'DOL_DOCUMENT_ROOT/custom/dolisirh/documents/doctemplates/certificatedocument/', '', 0, 'current'),
43 => array('DOLISIRH_CERTIFICATEDOCUMENT_CUSTOM_ADDON_ODT_PATH', 'chaine', 'DOL_DATA_ROOT' . (($conf->entity == 1 ) ? '/' : '/' . $conf->entity . '/') . 'ecm/dolisirh/certificatedocument/', '', 0, 'current'),
44 => array('DOLISIRH_CERTIFICATEDOCUMENT_DEFAULT_MODEL', 'chaine', 'certificatedocument_odt', '', 0, 'current'),
$i++ => array('DOLISIRH_CERTIFICATEDOCUMENT_ADDON', 'chaine', 'mod_certificatedocument_standard', '', 0, 'current'),
$i++ => array('DOLISIRH_CERTIFICATEDOCUMENT_ADDON_ODT_PATH', 'chaine', 'DOL_DOCUMENT_ROOT/custom/dolisirh/documents/doctemplates/certificatedocument/', '', 0, 'current'),
$i++ => array('DOLISIRH_CERTIFICATEDOCUMENT_CUSTOM_ADDON_ODT_PATH', 'chaine', 'DOL_DATA_ROOT' . (($conf->entity == 1 ) ? '/' : '/' . $conf->entity . '/') . 'ecm/dolisirh/certificatedocument/', '', 0, 'current'),
$i++ => array('DOLISIRH_CERTIFICATEDOCUMENT_DEFAULT_MODEL', 'chaine', 'certificatedocument_odt', '', 0, 'current'),
);

if (!isset($conf->dolisirh) || !isset($conf->dolisirh->enabled)) {
Expand Down
2 changes: 1 addition & 1 deletion sql/timesheet/llx_dolisirh_timesheet.key.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ALTER TABLE llx_dolisirh_timesheet ADD INDEX idx_dolisirh_timesheet_rowid (rowid);
ALTER TABLE llx_dolisirh_timesheet ADD INDEX idx_dolisirh_timesheet_ref (ref);
ALTER TABLE llx_dolisirh_timesheet ADD INDEX idx_dolisirh_timesheet_status (status);
ALTER TABLE llx_dolisirh_timesheet ADD INDEX idx_dolisirh_timesheet_fk_societe (fk_societe);
ALTER TABLE llx_dolisirh_timesheet ADD INDEX idx_dolisirh_timesheet_fk_soc (fk_soc);
ALTER TABLE llx_dolisirh_timesheet ADD INDEX idx_dolisirh_timesheet_fk_project (fk_project);
ALTER TABLE llx_dolisirh_timesheet ADD UNIQUE INDEX uk_dolisirh_timesheet_ref (ref, entity);
ALTER TABLE llx_dolisirh_timesheet ADD CONSTRAINT llx_dolisirh_timesheet_fk_user_assign FOREIGN KEY (fk_user_assign) REFERENCES llx_user(rowid);
Expand Down
2 changes: 1 addition & 1 deletion sql/timesheet/llx_dolisirh_timesheet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CREATE TABLE llx_dolisirh_timesheet(
model_odt varchar(255),
status integer NOT NULL,
fk_user_assign integer NOT NULL,
fk_societe integer,
fk_soc integer,
fk_project integer,
fk_user_creat integer NOT NULL,
fk_user_modif integer
Expand Down
84 changes: 23 additions & 61 deletions view/timesheet/timesheet_agenda.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2023 EVARISK <dev@evarisk.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
Expand All @@ -22,27 +21,6 @@
* \brief Tab of events on TimeSheet
*/

//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification

// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
Expand Down Expand Up @@ -77,22 +55,26 @@
die("Include of main fails");
}

// Libraries
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
dol_include_once('/dolisirh/class/timesheet.class.php');
dol_include_once('/dolisirh/lib/dolisirh_timesheet.lib.php');

require_once __DIR__ . '/../../class/timesheet.class.php';
require_once __DIR__ . '/../../lib/dolisirh_timesheet.lib.php';

// Global variables definitions
global $conf, $db, $hookmanager, $langs, $user;

// Load translation files required by the page
$langs->loadLangs(array("dolisirh@dolisirh", "other"));

// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');

if (GETPOST('actioncode', 'array')) {
Expand Down Expand Up @@ -123,40 +105,26 @@
}

// Initialize technical objects
$object = new TimeSheet($db);
$object = new TimeSheet($db);
$extrafields = new ExtraFields($db);
$project = new Project($db);
$diroutputmassaction = $conf->dolisirh->dir_output.'/temp/massgeneration/'.$user->id;
$project = new Project($db);

$hookmanager->initHooks(array('timesheetagenda', 'globalcard')); // Note that conf->hooks_modules contains array

// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);

// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->dolisirh->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}

// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->dolisirh->timesheet->read;
$permissiontoadd = $user->rights->dolisirh->timesheet->write;
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
}
$permissiontoread = $user->rights->dolisirh->timesheet->read;
$permissiontoadd = $user->rights->dolisirh->timesheet->write;

// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->dolisirh->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();


/*
* Actions
*/
Expand Down Expand Up @@ -187,12 +155,12 @@
* View
*/

// Initialize view objects
$form = new Form($db);

if ($object->id > 0) {
$title = $langs->trans("Agenda");
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$help_url = 'EN:Module_Agenda_En';
$title = $langs->trans('TimeSheet') . ' - ' .$langs->trans("Agenda");
$help_url = '';
$morejs = array("/dolisirh/js/dolisirh.js.php");
$morecss = array("/dolisirh/css/dolisirh.css");

Expand All @@ -203,12 +171,11 @@
}
$head = timesheetPrepareHead($object);


print dol_get_fiche_head($head, 'agenda', $langs->trans("TimeSheet"), -1, $object->picto);

// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/dolisirh/view/timesheet/timesheet_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.dol_buildpath('/dolisirh/view/timesheet/timesheet_list.php', 1).'">'.$langs->trans("BackToList").'</a>';

$morehtmlref = '<div class="refidno">';
// Thirdparty
Expand Down Expand Up @@ -242,10 +209,7 @@

print dol_get_fiche_end();



// Actions buttons

$objthirdparty = $object;
$objcon = new stdClass();

Expand All @@ -264,7 +228,6 @@
//$out.="</a>";
}


print '<div class="tabsAction">';

if (!empty($conf->agenda->enabled)) {
Expand All @@ -278,16 +241,15 @@
print '</div>';

if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$param = '&id='.$object->id.'&socid='.$socid;
$param = '&id='.$object->id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}


//print load_fiche_titre($langs->trans("ActionsOnTimeSheet"), '', '');
print load_fiche_titre($langs->trans("ActionsOnTimeSheet"), '', '');

// List of all actions
$filters = array();
Expand Down
14 changes: 6 additions & 8 deletions view/timesheet/timesheet_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
}

// Libraries
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
Expand Down Expand Up @@ -126,6 +123,7 @@
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.

// There is several ways to check permission.
$permissiontoread = $user->rights->dolisirh->timesheet->read;
$permissiontoadd = $user->rights->dolisirh->timesheet->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->dolisirh->timesheet->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
Expand Down Expand Up @@ -436,9 +434,8 @@
* View
*/

$form = new Form($db);
$formfile = new FormFile($db);
$formproject = new FormProjets($db);
// Initialize view objects
$form = new Form($db);

$title = $langs->trans("TimeSheet");
$help_url = '';
Expand Down Expand Up @@ -498,8 +495,9 @@
$_POST['date_endmonth'] = $lastday['mon'];
$_POST['date_endyear'] = $lastday['year'];
}
$object->fields['note_public']['visible'] = 1;
$object->fields['note_private']['visible'] = 1;

// $object->fields['note_public']['visible'] = 1;
// $object->fields['note_private']['visible'] = 1;

// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
Expand Down
Loading

0 comments on commit 77f1cdb

Please sign in to comment.