'."\n";
@@ -848,12 +850,14 @@ public function getHTMLHeader()
*/
public function getHTMLFormHeader($ajax = false)
{
- global $langs;
+ global $langs, $conf;
$html = ' ';
+ return $HTML;
}
- $HTML .= ' ';
- return $HTML;
-}
/**
* Initialise object with example values
* Id must be 0 if object instance is a specimen
@@ -1173,6 +1180,7 @@ public function initAsSpecimen($test = false)
$this->note = 'this is a test usertasktime';
}
}
+
/******************************************************************************
*
* AJAX methods
@@ -1310,21 +1318,73 @@ public function sendApprovalReminders()
*/
public function sendTimesheetReminders()
{
- //check date: was yesterday a period end day ?
- $yesteday = date("Y-m-d"); - 24 * 60 *60;
- $date_end = getEndDate($yesteday);
- if ($yesteday == $date_end) {
+ //check date: was yesterday a period end day ?
+ $date_start = getStartDate(time(), -1);
+ $date_end = getEndDate($date_start);
+ $ret = true;
+ $sql = "SELECT SUM(pt.task_duration)/3600 as duration, u.weeklyhours
+ u.email, u.weeklyhours
+ FROM ".MAIN_DB_PREFIX."element_contact as ec ON t.rowid = ec.element_id
+ LEFT JOIN '.MAIN_DB_PREFIX.'c_type_contact as ctc ON ctc.rowid = fk_c_type_contact
+ LEFT JOIN llx_projet_task_time pt ON pt.fk_user = fk_socpeople
+ LEFT JOIN llx_user u ON u.rowid = fk_socpeople
+ WHERE (ctc.element in (\'project\')
+ and pt.task_date BETWEEN $date_start AND $date_end
+ GROUP BY u.rowid ";
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+ $emails = array();
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+ for ($i = 0;$i<$num;$i++) {
+ $obj = $this->db->fetch_object($resql);
+ // FIXME: addapt weekhour to openday / without holidays (union)
+ if ($obj->weeklyhours > $obj->duration) {
+ $emails[$obj->email][] = array(
+ "weeklyhour" => $obj->date_start,
+ "duration" => $obj->date_end
+ );
+ }
+ }
+ } else {
+ dol_print_error($db);
+ $list = array();
+ $ret = false;
+ }
+ if ($ret != false) {
+ foreach ($emails as $email => $data) {
//get the list of user that have the ts right
- $users = [];
- //foreach user check if there is: no timesheet approaval or a tta in draft or rejected
- // SELECT userid, "-1" as status FROM $user LEFT JOIN tta on userid=fk_user and $yesteray = date_end WHERE tta.id = NULL
- // UNION
- // SELECT userid, status FROM tta where status in (DRAFT, REJECTED) and $yesteray = date_end
+ $$url .= '/timesheet/Timesheet.php?dateStart='.$date_start;
+ $message = $langs->trans(
+ 'YouHaveMissingTimesheetMsg',
+ date(' d', $date_start),
+ $url
+ );
+ $sendto = $email;
+
+ $subject = $langs->transnoentities("YouHaveMissingTimesheet");
+ if (!empty($sendto) && $sendto!="NULL") {
+ include_once DOL_DOCUMENT_ROOT .'/core/class/CMailFile.class.php';
+ $mailfile = new CMailFile(
+ $subject,
+ $sendto,
+ null,
+ $message,
+ $filename_list = array(),
+ $mimetype_list = array(),
+ $mimefilename_list = array(),
+ $addr_cc, $addr_bcc = 0,
+ $deliveryreceipt = 0,
+ $msgishtml = 1
+ );
+ $mailfile->sendfile();
+ }
+ }
- //send email to user that need to submit a timesheet
-
}
- return false;
+
+
}
diff --git a/htdocs/timesheet/core/boxes/box_approval.php b/htdocs/timesheet/core/boxes/box_approval.php
index 829a38b4..636d3d4a 100644
--- a/htdocs/timesheet/core/boxes/box_approval.php
+++ b/htdocs/timesheet/core/boxes/box_approval.php
@@ -48,7 +48,7 @@ public function loadBox($max = 5)
global $conf, $user, $langs, $db;
$this->max = $max;
$userid = is_object($user)?$user->id:$user;
- $text = $langs->trans('Timesheet');
+ $text = $langs->trans('Approval');
$this->info_box_head = array(
'text' => $text,
'limit' => dol_strlen($text)
diff --git a/htdocs/timesheet/core/boxes/box_time.php b/htdocs/timesheet/core/boxes/box_time.php
new file mode 100644
index 00000000..3395d754
--- /dev/null
+++ b/htdocs/timesheet/core/boxes/box_time.php
@@ -0,0 +1,187 @@
+
+ * This program is free software;you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation;either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY;without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+/**
+ * \file htdocs/core/boxes/box_time.php
+ * \ingroup factures
+ * \brief Module de generation de l'affichage de la box factures
+ */
+include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
+$path = dirname(dirname(dirname(__FILE__)));
+set_include_path($path);
+require_once 'core/lib/timesheet.lib.php';
+global $dolibarr_main_url_root_alt;
+$res = 0;
+/**
+ * Class to manage the box to show last invoices
+ */
+class box_time extends ModeleBoxes
+{
+ public $boxcode = "timecount";
+ public $boximg = "timesheet";
+ public $boxlabel = "TimesheetDelta";
+ public $depends = array("timesheet");
+ public $db;
+ public $param;
+ public $info_box_head = array();
+ public $info_box_contents = array();
+ /**
+ * Load data into info_box_contents array to show array later.
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
+ */
+ public function loadBox($max = 5)
+ {
+ global $conf, $user, $langs, $db;
+ $this->max = $max;
+ $userid = is_object($user)?$user->id:$user;
+ $text = $langs->trans('TimesheetDelta');
+ $this->info_box_head = array(
+ 'text' => $text,
+ 'limit' => dol_strlen($text)
+ );
+ $admin = $user->admin || $user->rights->timesheet->timesheet->admin;
+ if ($user->rights->timesheet->timesheet->user ||$admin) {
+ $sqlweek = '';
+ if ($this->db->type!='pgsql') {
+ $sqlweek = "
+ with digit as (
+ select 0 as d union all
+ select 1 union all select 2 union all select 3 union all
+ select 4 union all select 5 union all select 6 union all
+ select 7 union all select 8 union all select 9
+ ),
+ seq as (
+ select a.d + (10 * b.d) + (100 * c.d) + (1000 * d.d) as num
+ from digit a
+ cross join
+ digit b
+ cross join
+ digit c
+ cross join
+ digit d
+ order by 1
+ )
+ SELECT SUM(pt.task_duration)/3600 as duration,
+ w.week, u.weeklyhours
+ FROM (SELECT YEARWEEK(DATE_ADD(NOW(), INTERVAL - num WEEK)) as week
+ FROM seq WHERE num <= ".$conf->global->TIMESHEET_OVERTIME_CHECK_WEEKS."
+ AND num > 1 ) as w
+ LEFT JOIN llx_projet_task_time pt ON YEARWEEK(pt.task_date) = w.week
+ LEFT JOIN llx_user u ON u.rowid = ".$userid."
+
+ WHERE pt.fk_user = ".$userid." OR pt.fk_user is null
+ GROUP BY w.week;";
+ }else {
+ // to be validated
+ $sqlweek = " SELECT SUM(pt.task_duration)/3600 as duration,
+ TO_CHAR(generate_series, 'YYYYWW') week, u.weeklyhours
+ FROM (generate_series(DATE_TRUNC('week', NOW() - INTERVAL '".$conf->global->TIMESHEET_OVERTIME_CHECK_WEEKS." WEEK'), DATE_TRUNC('week',NOW()) - INTERVAL 1 WEEK' ))
+ LEFT JOIN llx_projet_task_time pt ON generate_series = DATE_TRUNC('week',pt.task_date)
+ LEFT JOIN llx_user u on pt.fk_user = ".$userid."
+ WHERE pt.fk_user = ".$userid." OR pt.fk_user is null
+ GROUP BY generate_series;";
+ }
+ $result = $db->query($sqlweek);
+ $delta = array();
+ if ($result) {
+ $p_duration = array(); // FIXME take worktime as delfaut nb day in week * nb hour per day
+ $a_duration = array();
+ $h_duration = array();
+ $num = $db->num_rows($result);
+ while($num>0)
+ {
+ $obj = $db->fetch_object($result);
+ $p_duration[$obj->week] = isset($obj->weeklyhours) ? $obj->weeklyhours : $conf->global->TIMESHEET_DAY_DURATION * 5; // FIXME take worktime as delfaut nb day in week * nb hour per day
+ $a_duration[$obj->week] = isset($obj->duration) ? $obj->duration : 0;
+ $h_duration[$obj->week] = $this->getHolidayTime($obj->week, $userid, $obj->weeklyhours);
+ $delta[$obj->week] = ($p_duration[$obj->week] - $h_duration[$obj->week] - $a_duration[$obj->week]);
+ $num--;
+ }
+ $i=0;
+ // create the sums
+ $max_delta = max($delta);
+ $sum_delta = array_sum($delta);
+ if ($max_delta > 0){
+ $this->info_box_contents[$i][] = array(
+ 'td' => 'align = "left"',
+ 'text' => $langs->trans('Max').': ',
+ 'text2'=> $conf->global->TIMESHEET_OVERTIME_CHECK_WEEKS.' '.$langs->trans('Weeks'),
+ 'asis' => 1,
+ );
+ $this->info_box_contents[$i][] = array(
+ 'td' => 'align = "right"',
+ 'text' => $max_delta,
+ 'asis' => 1,
+ );
+ $i++;
+ }
+ if ($sum_delta){
+ $this->info_box_contents[$i][] = array(
+ 'td' => 'align = "left"',
+ 'text' => $langs->trans('Sum').': ',
+ 'text2'=> $conf->global->TIMESHEET_OVERTIME_CHECK_WEEKS.' '.$langs->trans('Weeks'),
+ 'asis' => 1,
+ );
+ $this->info_box_contents[$i][] = array(
+ 'td' => 'align = "right"',
+ 'text' => $sum_delta,
+ 'asis' => 1,
+ );
+ $i++;
+ }
+ $db->free($result);
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'align = "left"',
+ 'maxlength' => 500,
+ 'text' =>($db->error().' sql='.$sqlweek),
+ );
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'align = "left"',
+ 'text' => $langs->trans("ReadPermissionNotAllowed"),
+ );
+ }
+ }
+ // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed
+ /**
+ * Method to show box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ * @param INT $nooutput BLOCK OUTPUT
+ * @return void
+ */
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ Parent::showBox($this->info_box_head, $this->info_box_contents);
+ }
+
+ /**
+ * Method get the holiday duration
+ *
+ * @param int $yearweek yearweek to use
+ * @param INT $userid id of the user
+ * @param int $weeklyhours number of
+ * @return void
+ */
+ public function getHolidayTime($yearweek, $userid, $weeklyhours){ // FIXME should use weeklyhours to get the amout of hours per day. new custom fields nb day worked per week ?
+ // FIXME should use weeklyhours to get the amout of hours per day. new custom fields nb day worked per week ?
+ return 0;
+ }
+}
diff --git a/htdocs/timesheet/core/js/timesheet.js b/htdocs/timesheet/core/js/timesheet.js
index 852085df..d5637992 100644
--- a/htdocs/timesheet/core/js/timesheet.js
+++ b/htdocs/timesheet/core/js/timesheet.js
@@ -105,6 +105,7 @@ function updateAll(){
err=false;
total=0;
for(j=0;j TOTAL ';
+ html += "
";
+ for (var d = 0; d < daysLenth ; d++)
+ {
+ html += "
";
+ }
+ newRow.innerHTML= html + '
';
+ newRow.className = 'lineDynTotal';
+ }
+ nld++;// count to row actually displayed
+ }
+ }
+
+
+}
+
+
/*
* Function to update the line Total when there is any
* @param
@@ -269,7 +326,7 @@ function validateTime(object,col_id){
function updateAllLinesTotal(){
- var TotalList=document.getElementsByClassName('lineTotal');
+ var TotalList=document.querySelectorAll('.lineTotal');
var nblineTotal = TotalList.length;
for(i=0;i$conf->global->TIMESHEET_COL_DRAFT,
@@ -115,31 +116,35 @@ function getSubordinates($db, $userid, $depth = 5, $ecludeduserid = array(), $ro
$list = $user->getAllChildIds();
}
- if ($role == PROJECT || $role == ALL){
+ if ($role == PROJECT || $role == ALL || $role == ADMIN){
$sql[0] = 'SELECT DISTINCT fk_socpeople as userid FROM '.MAIN_DB_PREFIX.'element_contact';
- $sql[0] .= ' WHERE element_id in (SELECT element_id';
- $sql[0] .= ' FROM '.MAIN_DB_PREFIX.'element_contact AS ec';
- $sql[0] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_contact as ctc ON ctc.rowid = ec.fk_c_type_contact';
- $sql[0] .= ' WHERE ctc.active = \'1\' AND ctc.element in (\'project\', \'project_task\') AND (ctc.code LIKE \'%LEADER%\' OR ctc.code LIKE \'%BILLING%\' OR ctc.code LIKE \'%EXECUTIVE%\')';
- $sql[0] .= ' AND fk_socpeople in (';
- $sql[2] = ')) AND fk_socpeople not in (';
- $sql[4] = ')';
- $idlist = '';
- if (is_array($userid)) {
- $ecludeduserid = array_merge($userid, $ecludeduserid);
- $idlist = implode(", ", $userid);
- } else{
- $ecludeduserid[] = $userid;
- $idlist = $userid;
- }
- $sql[1] = $idlist;
- $idlist = '';
- if (is_array($ecludeduserid)) {
- $idlist = implode(", ", $ecludeduserid);
- } elseif (!empty($ecludeduserid)) {
- $idlist = $ecludeduserid;
+ if ($role != ADMIN){
+ $sql[0] .= ' WHERE element_id in (SELECT element_id';
+ $sql[0] .= ' FROM '.MAIN_DB_PREFIX.'element_contact AS ec';
+ $sql[0] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_contact as ctc ON ctc.rowid = ec.fk_c_type_contact';
+ if($role == PROJECT)$sql[0] .= ' WHERE ctc.active = \'1\' AND ctc.element in (\'project\', \'project_task\') AND (ctc.code LIKE \'%LEADER%\' OR ctc.code LIKE \'%BILLING%\' OR ctc.code LIKE \'%EXECUTIVE%\')';
+ // only billing can see all
+ if($role == ALL)$sql[0] .= ' WHERE ctc.active = \'1\' AND ctc.element in (\'project\', \'project_task\') AND (ctc.code LIKE \'%BILLING%\')';
+ $sql[0] .= ' AND fk_socpeople in (';
+ $sql[2] = ')) AND fk_socpeople not in (';
+ $sql[4] = ')';
+ $idlist = '';
+ if (is_array($userid)) {
+ $ecludeduserid = array_merge($userid, $ecludeduserid);
+ $idlist = implode(", ", $userid);
+ } else{
+ $ecludeduserid[] = $userid;
+ $idlist = $userid;
+ }
+ $sql[1] = $idlist;
+ $idlist = '';
+ if (is_array($ecludeduserid)) {
+ $idlist = implode(", ", $ecludeduserid);
+ } elseif (!empty($ecludeduserid)) {
+ $idlist = $ecludeduserid;
+ }
+ $sql[3] = $idlist;
}
- $sql[3] = $idlist;
ksort($sql, SORT_NUMERIC);
$sqlused = implode($sql);
dol_syslog('form::get_subordinate role='.$role, LOG_DEBUG);
diff --git a/htdocs/timesheet/core/modules/modtimesheet.class.php b/htdocs/timesheet/core/modules/modtimesheet.class.php
index da6bc738..798cbbd0 100644
--- a/htdocs/timesheet/core/modules/modtimesheet.class.php
+++ b/htdocs/timesheet/core/modules/modtimesheet.class.php
@@ -54,7 +54,7 @@ public function __construct($db)
$this->editor_name = 'Patrick Delcroix';
$this->editor_url = 'https://github.com/delcroip';
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
- $this->version = '4.4.11';
+ $this->version = '4.5.0';
// Key used in llx_cons table to save module status enabled/disabled(where timesheet 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)
@@ -208,8 +208,13 @@ public function __construct($db)
$r++;
$this->const[$r] = array("MAIN_DISABLE_AJAX_COMBOX", "int", "0", "disable combo box");// hours or days
$r++;
- $this->const[$r] = array("TIMESHEET_ALLOW_PUBLIC", "int", "0", "Allow all internal contact to book time on public projects");// hours or days
+ $this->const[$r] = array("MAIN_DISABLE_AJAX_COMBOX", "int", "0", "disable combo box");// hours or days
+ $r++;
+ $this->const[$r] = array("TIMESHEET_OVERTIME_CHECK_WEEKS", "int", "30", "Number of week used for the overwork box");// hours or days
+ $r++;
+ $this->const[$r] = array("TIMESHEET_TIMESHEET_IMPORT_AGENDA", "int", "0", "Enable the import agenda button");// hours or days
$r++;
+
//$this->const[2] = array("CONST3", "chaine", "valeur3", "Libelle3");
// Array to add new pages in new tabs
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@timesheet:$user->rights->timesheet->read:/timesheet/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
@@ -263,10 +268,15 @@ public function __construct($db)
// Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
$this->boxes = array(
- 0 => array(
- 'file' => 'box_approval.php@timesheet',
- 'note' => 'timesheetApproval',
- 'enabledbydefaulton' => 'Home')); // List of boxes
+ 0 => array(
+ 'file' => 'box_approval.php@timesheet',
+ 'note' => 'timesheetApproval',
+ 'enabledbydefaulton' => 'Home'),
+ 1 => array(
+ 'file' => 'box_time.php@timesheet',
+ 'note' => 'timesheet',
+ 'enabledbydefaulton' => 'Home')
+ ); // List of boxes
// Example:
//$this->boxes=array(array(0 => array('file' => 'myboxa.php', 'note' => '', 'enabledbydefaulton' => 'Home'), 1 => array('file' => 'myboxb.php', 'note' => ''), 2 => array('file' => 'myboxc.php', 'note' => '')););
// Permissions
diff --git a/htdocs/timesheet/langs/de_DE/timesheet.lang b/htdocs/timesheet/langs/de_DE/timesheet.lang
index eeb2edec..47c469bd 100644
--- a/htdocs/timesheet/langs/de_DE/timesheet.lang
+++ b/htdocs/timesheet/langs/de_DE/timesheet.lang
@@ -261,3 +261,10 @@ addpublicholidaytimeDesc = Schließen Sie die Feiertagszeit in die Gesamtzeile e
blockholidayDesc = Zeiteinträge während der Ferien sperren
blockpublicholidayDesc = Sperrzeiteingabe am Feiertag
blockpublicholiday = Feiertag sperren
+never2invoice = überprüft - nie in Rechnung gestellt
+TimesheetDelta = Arbeitszeittabellen-Delta mit Vertragsstunden
+Lumpsum = Pauschalbetrag
+YouHaveMissingTimesheetMsg = Sie haben einen fehlenden Stundenzettel. \n\n es gibt nur %d h in den Systemen zu Ihren %d Wochenstunden für den Zeitraum %s - %s \n\n
+YouHaveMissingTimesheet = Sie haben einen fehlenden Stundenzettel
+SaveNext = Speichern & Weiter
+SubmitNext = Einreichen & Weiter
diff --git a/htdocs/timesheet/langs/en_US/timesheet.lang b/htdocs/timesheet/langs/en_US/timesheet.lang
index 65e4ecbe..72dfafea 100644
--- a/htdocs/timesheet/langs/en_US/timesheet.lang
+++ b/htdocs/timesheet/langs/en_US/timesheet.lang
@@ -261,3 +261,10 @@ addpublicholidaytimeDesc = Include the public holiday time in the total line
blockholidayDesc = Block time entries during holidays
blockpublicholidayDesc = Block time entry on public holiday
blockpublicholiday = Block public holiday
+never2invoice = reviewed - Never to invoice
+TimesheetDelta = Timesheet delta with contract hours
+Lumpsum = Lumpsum
+YouHaveMissingTimesheetMsg = You have missing timesheet.\n\nthere is only %d h in the systems on your %d weeklyhours for the period %s - %s\n\n
+YouHaveMissingTimesheet = You have missing timesheet
+SaveNext = Save & Next
+SubmitNext = Submit & Next
diff --git a/htdocs/timesheet/langs/es_ES/timesheet.lang b/htdocs/timesheet/langs/es_ES/timesheet.lang
index ac9b2e9e..e0ea477f 100644
--- a/htdocs/timesheet/langs/es_ES/timesheet.lang
+++ b/htdocs/timesheet/langs/es_ES/timesheet.lang
@@ -261,3 +261,10 @@ addpublicholidaytimeDesc = Incluya el tiempo de los días festivos en la línea
blockholidayDesc = Bloquear las entradas de tiempo durante las vacaciones
blockpublicholidayDesc = Bloqueo de la entrada de tiempo en días festivos
blockpublicholiday = Bloquear el día festivo
+never2invoice = revisado - Nunca para facturar
+TimesheetDelta = Delta de hoja de tiempo con horas de contrato
+Lumpsum = Suma fija
+YouHaveMissingTimesheetMsg = Le falta la hoja de tiempo. \n\n solo hay %d h en los sistemas en sus %d horas semanales para el período %s - %s \n\n
+YouHaveMissingTimesheet = Le falta la hoja de tiempo
+SaveNext = Guardar y Siguiente
+SubmitNext = Enviar y Siguiente
diff --git a/htdocs/timesheet/langs/fr_FR/timesheet.lang b/htdocs/timesheet/langs/fr_FR/timesheet.lang
index 7b475e04..373c80b9 100644
--- a/htdocs/timesheet/langs/fr_FR/timesheet.lang
+++ b/htdocs/timesheet/langs/fr_FR/timesheet.lang
@@ -261,3 +261,10 @@ addpublicholidaytimeDesc = Inclure le temps du jour férié dans la ligne totale
blockholidayDesc = Bloquer les entrées de temps pendant les vacances
blockpublicholidayDesc = Blocage de la saisie des heures les jours fériés
blockpublicholiday = Bloquer les jours fériés
+never2invoice = Traité - Ne jamais facturer
+TimesheetDelta = Delta de la feuille de temps avec les heures du contrat
+Lumpsum = forfaitaire
+YouHaveMissingTimesheetMsg = Vous avez une feuille de temps manquante. \n\n il n'y a que %d h dans les systèmes sur vos %d heures hebdomadaires pour la période %s - %s \n\n
+YouHaveMissingTimesheet = Il vous manque une feuille de temps
+SaveNext = Enregistrer et suivant
+SubmitNext = Soumettre & Suivant
diff --git a/htdocs/timesheet/langs/it_IT/timesheet.lang b/htdocs/timesheet/langs/it_IT/timesheet.lang
index 063bc6a0..348ffbcc 100644
--- a/htdocs/timesheet/langs/it_IT/timesheet.lang
+++ b/htdocs/timesheet/langs/it_IT/timesheet.lang
@@ -261,3 +261,10 @@ addpublicholidaytimeDesc = Includere il tempo del giorno festivo nella linea tot
blockholidayDesc = Bloccare le voci di tempo durante le vacanze
blockpublicholidayDesc = Blocca l'inserimento del tempo nei giorni festivi
blockpublicholiday = Blocca il giorno festivo
+never2invoice = rivisto - Non fatturare mai
+TimesheetDelta = Delta del foglio di lavoro con ore di contratto
+Lumpsum = Forfettario
+YouHaveMissingTimesheetMsg = Hai il foglio presenze mancante. \n\n ci sono solo %d h nei sistemi nelle tue %d ore settimanali per il periodo %s - %s \n\n
+YouHaveMissingTimesheet = Hai il foglio presenze mancante
+SaveNext = Salva & Avanti
+SubmitNext = Invia & Avanti
diff --git a/htdocs/timesheet/sql/llx_attendance_event.key.sql b/htdocs/timesheet/sql/llx_attendance_event.key.sql
index a7a3bb8e..5446d7e2 100644
--- a/htdocs/timesheet/sql/llx_attendance_event.key.sql
+++ b/htdocs/timesheet/sql/llx_attendance_event.key.sql
@@ -20,8 +20,8 @@
-- this table is used to store the timesheet favorit
-ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_user_idm FOREIGN KEY (fk_user_modification) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_user_id FOREIGN KEY (fk_userid) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_project_id FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_third_party FOREIGN KEY (fk_third_party REFERENCES llx_soc(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_task FOREIGN KEY (fk_task) REFERENCES llx_projet_task(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
+ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_user_idm FOREIGN KEY (fk_user_modification) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_user_id FOREIGN KEY (fk_userid) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_project_id FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_third_party FOREIGN KEY (fk_third_party REFERENCES llx_soc(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_attendance_event ADD CONSTRAINT fk_ts_ae_task FOREIGN KEY (fk_task) REFERENCES llx_projet_task(rowid) ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/htdocs/timesheet/sql/llx_project_task_time_approval.key.sql b/htdocs/timesheet/sql/llx_project_task_time_approval.key.sql
index e8ee996a..94dc3982 100644
--- a/htdocs/timesheet/sql/llx_project_task_time_approval.key.sql
+++ b/htdocs/timesheet/sql/llx_project_task_time_approval.key.sql
@@ -20,16 +20,16 @@
-- this table is used to store the timesheet favorite
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idat FOREIGN KEY (fk_user_app_team) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idap FOREIGN KEY (fk_user_app_project) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idac FOREIGN KEY (fk_user_app_customer) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idas FOREIGN KEY (fk_user_app_suplier) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idac FOREIGN KEY (fk_user_app_other) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idat FOREIGN KEY (fk_user_app_team) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idap FOREIGN KEY (fk_user_app_project) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idac FOREIGN KEY (fk_user_app_customer) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idas FOREIGN KEY (fk_user_app_suplier) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idac FOREIGN KEY (fk_user_app_other) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idc FOREIGN KEY (fk_user_creation) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idm FOREIGN KEY (fk_user_modification) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_id FOREIGN KEY (fk_userid) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_task_id FOREIGN KEY (fk_projet_task) REFERENCES llx_projet_task(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idc FOREIGN KEY (fk_user_creation) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_idm FOREIGN KEY (fk_user_modification) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_user_id FOREIGN KEY (fk_userid) REFERENCES llx_user(rowid) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_time_approval ADD CONSTRAINT fk_ptta_task_id FOREIGN KEY (fk_projet_task) REFERENCES llx_projet_task(rowid) ON DELETE CASCADE ON UPDATE CASCADE;
--/*llx_project_task_time_approval remove enum 2.3.3.5 --> 2.4 */
diff --git a/htdocs/timesheet/sql/llx_project_task_timesheet.key.sql b/htdocs/timesheet/sql/llx_project_task_timesheet.key.sql
index af3d992e..a71b7c5d 100644
--- a/htdocs/timesheet/sql/llx_project_task_timesheet.key.sql
+++ b/htdocs/timesheet/sql/llx_project_task_timesheet.key.sql
@@ -17,8 +17,8 @@
-- ===================================================================
-- TS Revision 2.0.2
-ALTER TABLE llx_project_task_timesheet ADD CONSTRAINT fk_ptts_user_idc FOREIGN KEY (fk_userid) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
-ALTER TABLE llx_project_task_timesheet ADD CONSTRAINT fk_ptts_user_idm FOREIGN KEY (fk_user_modification) REFERENCES llx_user(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_timesheet ADD CONSTRAINT fk_ptts_user_idc FOREIGN KEY (fk_userid) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
+ALTER TABLE llx_project_task_timesheet ADD CONSTRAINT fk_ptts_user_idm FOREIGN KEY (fk_user_modification) REFERENCES llx_user(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
--/*llx_project_task_timesheet remove enum 2.3.3.5 --> 2.4*/
ALTER TABLE llx_project_task_timesheet MODIFY COLUMN status integer default 1;
diff --git a/htdocs/timesheet/sql/llx_projet_task_time.key.sql b/htdocs/timesheet/sql/llx_projet_task_time.key.sql
index c59bc731..f6379502 100644
--- a/htdocs/timesheet/sql/llx_projet_task_time.key.sql
+++ b/htdocs/timesheet/sql/llx_projet_task_time.key.sql
@@ -21,7 +21,7 @@ ALTER TABLE llx_projet_task_time ADD COLUMN status integer default 1; -- enum(
ALTER TABLE llx_projet_task_time ADD COLUMN fk_task_time_approval integer;
-ALTER TABLE llx_projet_task_time ADD CONSTRAINT fk_ptt_ptta_id FOREIGN KEY (fk_task_time_approval) REFERENCES llx_project_task_time_approval(rowid) ON DELETE NO ACTION ON UPDATE CASCADE;
+ALTER TABLE llx_projet_task_time ADD CONSTRAINT fk_ptt_ptta_id FOREIGN KEY (fk_task_time_approval) REFERENCES llx_project_task_time_approval(rowid) ON DELETE SET NULL ON UPDATE CASCADE;
--/*llx_projet_task_tim remove enum 2.3.3.5 --> 2.4*/
ALTER TABLE llx_projet_task_time MODIFY COLUMN status integer default 1;