Skip to content

Commit

Permalink
Merge pull request #187 from delcroip/develop
Browse files Browse the repository at this point in the history
4.5.2
  • Loading branch information
delcroip authored May 29, 2022
2 parents 06e502c + f500827 commit 7765655
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 47 deletions.
10 changes: 10 additions & 0 deletions htdocs/timesheet/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# dolibarr_project_timesheet changelog
4.5.2
- fix missing subordinates on user reports
- add "all" whenever someone have subordinates
- add date sorting in the pdf reports
- trads updates (visa -> signature + DE fixes)
- adds the buttons on top and bottom of the page
- fix bad report url
- fix foreach js syntax (nicolasb827)


4.5.1
- Fix Project data on reports

Expand Down
1 change: 1 addition & 0 deletions htdocs/timesheet/Timesheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
//$ajax = false;
$Form = $task_timesheet->getHTMLNavigation($optioncss);
$Form .= $task_timesheet->getHTMLFormHeader();
$Form .= $task_timesheet->getHTMLActions();
if ($conf->global->TIMESHEET_WHITELIST == 1) {
$Form .= '<div class="tabs" data-role="controlgroup" data-type = "horizontal" >';
$Form .= ' <div '.(($task_timesheet->whitelistmode == 2)?'id = "defaultOpen"':'')
Expand Down
20 changes: 11 additions & 9 deletions htdocs/timesheet/TimesheetReportUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,14 @@
// if the user can see ts for other the user id is diferent
$userIdlist = array();
$userIdlistfull = getSubordinates($db, $userid, 2, array(), $admin ? ADMIN : ALL, $entity = '1', $admin);
$userIdlistfull[] = $userid;
if ($show_all)
{
$userIdlistfull[] = $userid;

$userIdlist = $userIdlistfull;

}else if (!empty($userIdSelected) && $userIdSelected <> $userid) {

$userIdlistfull[] = $userid;
if (in_array($userIdSelected, $userIdlist) || $admin ) {
if (in_array($userIdSelected, $userIdlistfull) || $admin ) {
$userIdlist[] = $userIdSelected;
} else{
setEventMessage($langs->transnoentitiesnoconv("NotAllowed"), 'errors');
Expand All @@ -111,6 +110,7 @@
}
} else{
$userIdlist[] = $userid;
$userIdSelected = $userid;
}

$reportStatic = new TimesheetReport($db);
Expand Down Expand Up @@ -165,11 +165,13 @@
';
if($admin){
$form_output .= $form->select_dolusers($userIdSelected, 'userSelected');
// select short

} else {
$form_output .= $form->select_dolusers($userIdSelected, 'userSelected', 0, null, 0, $userIdlistfull);
}
if (count($userIdlistfull)>1) {
$form_output .= ' <br><input type = "checkbox" name = "showAll" value = "1" ';
$form_output .= ($show_all?'checked >':'>').$langs->trans('All') ;
} else {
$form_output .= $form->select_dolusers($userIdSelected, 'userSelected', 0, null, 0, $userIdlist);
}


Expand Down Expand Up @@ -231,7 +233,7 @@
.dol_print_date( $dateStart, 'dayxcard' )
.'&dateEnd=' . dol_print_date( $dateEnd, 'dayxcard' )
.'&userSelected=' . $userIdSelected
.'&mode=DTU&model=' . $model
.'&mode='.$mode.'&model=' . $model
.'&invoicabletaskOnly=' . $invoicabletaskOnly
.'&ungroup=' . $ungroup
.'&showAll=' . $show_all
Expand All @@ -242,7 +244,7 @@
. dol_print_date( $dateStart, 'dayxcard' )
. '&dateEnd=' . dol_print_date( $dateEnd, 'dayxcard' )
. '&userSelected=' . $userIdSelected
. '&mode=DTU&model=' . $model
. '&mode='.$mode.'&model=' . $model
. '&invoicabletaskOnly=' . $invoicabletaskOnly
. '&ungroup=' . $ungroup
. '&showAll=' . $show_all
Expand Down
42 changes: 27 additions & 15 deletions htdocs/timesheet/class/TimesheetUserTasks.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,14 +752,14 @@ public function updateStatus($user, $status = 0)
$error = ($this->id <= 0)?$this->create($user):$this->update($user);
if ($error>0) {
if ($status == REJECTED)$this->sendRejectedReminders($user);
if (count($this->taskTimesheet)<1) {
if (is_array($this->taskTimesheet) && count($this->taskTimesheet)<1) {
$this->fetch($id);
}
$this->status = DRAFT;// SET THE STATUS TO DRAFT TO GET ALL
$this->fetchTaskTimesheet();
$this->status = $status;
$this->status = $status;
if (count($this->taskTimesheet)>0)foreach ($this->taskTimesheet as $ts) {
if (is_array($this->taskTimesheet) && count($this->taskTimesheet)>0)foreach ($this->taskTimesheet as $ts) {
$tasktime = new TimesheetTask($this->db);
$tasktime->unserialize($ts);
//$tasktime->appId = $this->id;
Expand Down Expand Up @@ -827,6 +827,7 @@ public function getHTMLHeader($search = false)
$html .= '</tr>';
}
$html .= '<tr class = "liste_titre" id = "">'."\n";

foreach ($this->headers as $key => $value) {
$html .= "\t<th ";
if (count($this->headers) == 1) {
Expand Down Expand Up @@ -865,7 +866,7 @@ public function getHTMLFormHeader($ajax = false)
*/
public function getHTMLTotal()
{
$html .= "<tr class = 'liste_titre'>\n";
$html = "<tr class = 'liste_titre'>\n";
$html .= '<th colspan = "'.(count($this->headers)-1).'" align = "right" > TOTAL </th>';
$length = getDayInterval($this->date_start, $this->date_end);
$html .= "<th><div class = \"TotalUser_{$this->id}\">&nbsp;</div></th>\n";
Expand All @@ -883,11 +884,29 @@ public function getHTMLTotal()
*/
public function getHTMLFooter($ajax = false)
{
global $langs, $apflows;
global $langs;
//form button
$html = '<input type = "hidden" id="csrf-token" name = "token" value = "'.$this->token."\"/>\n";
$html .= '<div class = "tabsAction">';
$isOpenSatus = in_array($this->status, array(DRAFT, CANCELLED, REJECTED));
$html .= $this->getHTMLActions();
$html .= "</form>\n";
if ($ajax) {
$html .= '<script type = "text/javascript">'."\n\t";
$html .= 'window.onload = function()
{loadXMLTimesheet("'.$this->date_start.'", '.$this->userId.');}';
$html .= "\n\t".'</script>'."\n";
}
return $html;
}

/**
*
*
*/

public function getHTMLActions(){
global $langs, $apflows;
$html = '<div class = "tabsAction">';
$isOpenSatus = in_array($this->status, array(DRAFT, CANCELLED, REJECTED));
if ($isOpenSatus) {
$html .= '<input type = "submit" class = "butAction" name = "save" value = "'.$langs->trans('Save')."\" />\n";
//$html .= '<input type = "submit" class = "butAction" name = "submit" onClick = "return submitTs();" value = "'.$langs->trans('Submit')."\" />\n";
Expand All @@ -900,15 +919,8 @@ public function getHTMLFooter($ajax = false)
$html .= '<a class = "butActionDelete" href="?action=list&startDate='.$this->date_start.'">'.$langs->trans('Cancel').'</a>';
} elseif ($this->status == SUBMITTED)$html .= '<input type = "submit" class = "butAction" name = "recall" " value = "'.$langs->trans('Recall')."\" />\n";
$html .= '</div>';
$html .= "</form>\n";
if ($ajax) {
$html .= '<script type = "text/javascript">'."\n\t";
$html .= 'window.onload = function()
{loadXMLTimesheet("'.$this->date_start.'", '.$this->userId.');}';
$html .= "\n\t".'</script>'."\n";
}
return $html;
}
return $html;
}
/* function to genegate the timesheet table header
*
* @param int $current number associated with the TS AP
Expand Down
4 changes: 2 additions & 2 deletions htdocs/timesheet/core/js/stopWatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Stopwatch {

if (typeof data.status!== 'undefined' && data.status && data.status!=""){ // display status
var obj=JSON.parse(data.status);
Object.keys(obj).foreach (function(key){
Object.keys(obj).forEach (function(key){
$.jnotify(obj[key].text+obj[key].param,obj[key].type)
});
}
Expand Down Expand Up @@ -266,4 +266,4 @@ function startStop(evt,user,tsk){
function loadSuccess(data){
//workarroun:the call methode can't be called directly because the this doesn't work int he call back
stopwatch.loadSuccess(data);
}
}
4 changes: 2 additions & 2 deletions htdocs/timesheet/core/js/timesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ function updateProgressElement(element){

if (typeof data.status!== 'undefined' && data.status && data.status!=""){ // display status
var obj=JSON.parse(data.status);
Object.keys(obj).foreach (function(key){
Object.keys(obj).forEach (function(key){
$.jnotify(obj[key].text+obj[key].param,obj[key].type)
if (obj[key].type == 'megs'){// only one will be returned
}
Expand All @@ -737,7 +737,7 @@ function updateProgressElement(element){

function updateAllProgress(){
selectElements = document.getElementsByTagName('select')
Object.keys(selectElements).foreach (function(key){
Object.keys(selectElements).forEach (function(key){
current = selectElements[key];
selectName = current.getAttribute("name");
if (selectName && selectName.indexOf("progressTask") === 0) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/timesheet/core/modules/modtimesheet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.1';
$this->version = '4.5.2';
// 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)
Expand Down
20 changes: 10 additions & 10 deletions htdocs/timesheet/langs/de_DE/timesheet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Approval = Freigabe
approvalbyweek = Genehmigung nach Wochen
approvalbyweekDesc = Genehmigung von Wochen statt der Genehmigung durch Benutzer.
approved = Akzeptiert
approvedColorDesc = Farbe für den Urlaub & Arbeitszeitblatt genehmigt
approvedColorDesc = Farbe für: Urlaub & Arbeitszeitblatt genehmigt
approvedOnly = Nur genehmigte
ApproveRightsDesc = Recht auf Arbeitszeittabellen genehmigen
Attendance = Chrono
Expand All @@ -23,10 +23,10 @@ AttendanceDesc = Chrono als Standardzeittabelle
blackWhiteList = Favoriten
blackWhiteListDesc = Aktiviere die Favoritenfilterung
blackWhiteListMode = Favoriten Filterung
blackWhiteListModeDesc = Wählen Sie das Standardverhalten für favoris Filterung
blackWhiteListModeDesc = Wählen Sie das Standardverhalten für die Favoritenfilterung
BoxApproval = Arbeitszeittabelle Approbationen
cancelled = Abgebrochen
cancelledColorDesc = Farbe für den Urlaub & Stundenzettel storniert
cancelledColorDesc = Farbe für: Urlaub & Stundenzettel storniert
challenged = Herausgeforderter
Checkin = Anreise
Checkout = Beenden
Expand All @@ -38,14 +38,14 @@ ConfirmDeleteTimesheetwhitelist = Sind Sie sicher, diesen Rechnungseintrag zu l
Custom = Kundenspezifisch
customer = Kunde
CustomerApprovalDesc = Die Benutzer, die einen Kunden repräsentieren, müssen die Zeitpläne für ihren Kunden genehmigen.
customerSignature = Des Kunden Visum
customerSignature = Unterschrift des Kunden
DateEndColDesc = Zeigt das Enddatum der Aufgabe an
DateStartColDesc = Zeigt das Startdatum der Aufgabe an
DefaultService = Standardservice für die Rechnungsstellung
DeleteTimesheetwhitelist = Eintrag gelöscht
DiplayOptions = Anzeigeoptionen
draft = Feld-Gruppe Entwurf aktualisiert
draftColorDesc = Farbe für den Entwurf Urlaub & Arbeitszeittabelle
draftColorDesc = Farbe für: Entwurf Urlaub & Arbeitszeittabelle
dropdownAjax = Drop-Down-Ajax deaktivieren
dropdownAjaxDesc = Deaktivieren Sie die Ajax für Dolibarr Dropdown-Liste (in einem Fall in Frage, eine neue Favoris einzugeben)
Employee = Mitarbeiter
Expand Down Expand Up @@ -146,7 +146,7 @@ RecordNotUpdated = Datensatz nicht aktualisiert
RecordSucessfullyCreated = Aufnahme erstellt
RecordUpdated = Aufzeichnung aktualisiert
rejected = Abgelehnt
rejectedColorDesc = Farbe für den Urlaub & Zeiterfassung von der Genehmigung abgelehnt
rejectedColorDesc = Farbe für: Urlaub & Zeiterfassung von der Genehmigung abgelehnt
Reminder = Erinnerung
reminderEmailProcess = Sie können die Erinnerung per E-Mail über den Aufgabenplaner von Dolibarr<br>Job type = Call method of a Dolibarr Class<br>Module = timesheet<br>Classes = timesheet/class/TimesheetUserTasks.class.php<br>Instance/Object to create = TimesheetUserTasks<br> Method = sendApprovalReminders
savedDuration = Gespeicherten Dauer
Expand All @@ -158,11 +158,11 @@ ShowTimespentNoteDesc = Aktivieren Sie Notizen pro Tag und pro Aufgabe
splitedWeek = Aufgespaltene Woche
Submit = Abschicken
submitted = Gesendet
submittedColorDesc = Farbe für den Urlaub & Arbeitszeitblatt zur Genehmigung eingereicht
submittedColorDesc = Farbe für: Urlaub & Arbeitszeitblatt zur Genehmigung eingereicht
Subtask = Teilaufgabe hinzufügen
supplier = Lieferant
SupplierApprovalDesc = Die Benutzer, die einen Lieferanten repräsentieren, müssen die Zeitpläne für diesen Lieferanten genehmigen.
supplierSignature = Des Lieferanten Visum
supplierSignature = Unterschrift des Lieferanten
TaskParent = Übergeordnete Aufgabe
TaskParentColDesc = Zeigt die Referenz der übergeordneten Aufgabe und den Titel an, wenn es eine übergeordnete Aufgabe gibt.
TasksColDesc = Zeigt die Referenz und den Titel der Aufgabe an
Expand Down Expand Up @@ -195,7 +195,7 @@ wngMsgHoursExceded = Sie betreten Überstunden
Yearweekdate = Stichtag
YouHaveApprovalPending = Stundenzettel zu genehmigen
YouHaveApprovalPendingMsg = Dears,<br><br>Du hast __NB_TS__ Stundenzettel zu genehmigen, bitte melde dich an dolibar an, um sie zu genehmigen.<br><br>Mit freundlichen Grüßen<br><br>Dein Dolibarr admin.
YouHaveTimesheetRejected = Einer Ihrer vorgelegten Arbeitszeittabelle wurde abgelehnt.
YouHaveTimesheetRejected = Eine Ihrer vorgelegten Arbeitszeittabelle wurde abgelehnt.
YouHaveTimesheetRejectedMsg = Hallo, <br><br>Die Stundenzettel der Woche %s wurde abgelehnt.<br>Bitte überprüfen Sie Ihre Eingaben hier:<br>%s<br><br>Mit freundlichen Grüßen
minSecondsPerEvent = Minimun in Sekunden
maxHoursPerEvent = Maximale Stunden
Expand All @@ -214,7 +214,7 @@ lastMonth = Letzter Monat
thisWeek = Diese Woche
ProgressDeclaredColDesc = Zeige Fortschritt deklariert
frozen = Geschlossen
frozenColorDesc = Hintergrundfarbe für die abgeschlossenen Aufgaben oder Tage
frozenColorDesc = Hintergrundfarbe für abgeschlossenen Aufgaben oder Tage
value = Wert
valueColorDesc = Hintergrundfarbe, wenn ein Eintrag vorhanden ist
pdfHideNameDesc = Verstecken Sie den Namen des Mitarbeiters auf dem Anwesenheitsblatt
Expand Down
4 changes: 2 additions & 2 deletions htdocs/timesheet/langs/en_US/timesheet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ConfirmDeleteTimesheetwhitelist = Are you sure to delete this entry ?
Custom = Customized
customer = Customer
CustomerApprovalDesc = The users representing a customer will have to approve the timesheets concerning their customer.
customerSignature = Customer's visa
customerSignature = Customer's signature
DateEndColDesc = Shows the end date of the task
DateStartColDesc = Shows the start date of the task
DefaultService = Default service for invoicing
Expand Down Expand Up @@ -162,7 +162,7 @@ submittedColorDesc = Color for the holiday & timesheet submitted for approval
Subtask = Subtask
supplier = Supplier
SupplierApprovalDesc = The users representing a supplier will have to approve the timesheets concerning this supplier.
supplierSignature = Supplier's visa
supplierSignature = Supplier's signature
TaskParent = Parent task
TaskParentColDesc = Shows the parent task's reference and the title if there is any parent task.
TasksColDesc = Shows the task's reference and title
Expand Down
4 changes: 2 additions & 2 deletions htdocs/timesheet/langs/es_ES/timesheet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ConfirmDeleteTimesheetwhitelist = Está seguro de eliminar esto?
Custom = Personalizado
customer = Cliente
CustomerApprovalDesc = Los usuarios que representan a un cliente tendrán que aprobar las planillas de tiempo de su cliente.
customerSignature = Visa del cliente
customerSignature = Firma del cliente
DateEndColDesc = Muestra la fecha de finalización de la tarea
DateStartColDesc = Muestra la fecha de inicio de la tarea
DefaultService = Servicio por defecto de facturación.
Expand Down Expand Up @@ -162,7 +162,7 @@ submittedColorDesc = Color para el día festivo y la hoja de horas presentada pa
Subtask = Tarea
supplier = Proveedor
SupplierApprovalDesc = Los usuarios que representan a un proveedor deberán aprobar las planillas de tiempo de este proveedor.
supplierSignature = Visa del proveedor
supplierSignature = firma del proveedor
TaskParent = Tarea principal
TaskParentColDesc = Muestra la referencia de la tarea padre y el título si hay alguna tarea padre.
TasksColDesc = Muestra la referencia y el título de la tarea
Expand Down
4 changes: 2 additions & 2 deletions htdocs/timesheet/langs/fr_FR/timesheet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ConfirmDeleteTimesheetwhitelist = Êtes-vous certain de vouloir supprimer ce fav
Custom = Personnalisé
customer = Client
CustomerApprovalDesc = Les utilisateurs qui représentent un client devront approuver les feuilles de temps concernant leur client.
customerSignature = Visa du client
customerSignature = Signature du client
DateEndColDesc = Indique la date de fin de la tâche
DateStartColDesc = Indique la date de départ de la tâche
DefaultService = Service par défaut pour la facturation
Expand Down Expand Up @@ -162,7 +162,7 @@ submittedColorDesc = Couleur des congés et feuilles de temps envoyées pour val
Subtask = Tâche enfant
supplier = Fournisseur
SupplierApprovalDesc = Les utilisateurs qui représentent un fournisseur devront approuver les feuilles de temps concernant ce fournisseur.
supplierSignature = Visa du fournisseur
supplierSignature = Signature du fournisseur
TaskParent = Tâche parente
TaskParentColDesc = Affiche la référence de la tâche parent et son libellé, s'il existe une tâche parent.
TasksColDesc = Contient la référence et le libellé de la tâche
Expand Down
4 changes: 2 additions & 2 deletions htdocs/timesheet/langs/it_IT/timesheet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ConfirmDeleteTimesheetwhitelist = Sei sicuro di voler eliminare questa voce?
Custom = Personalizzato
customer = Cliente
CustomerApprovalDesc = Gli utenti che rappresentano un cliente dovranno approvare i timesheet relativi al loro cliente.
customerSignature = Visto del cliente
customerSignature = Firma del cliente
DateEndColDesc = Indica la data di fine del compito
DateStartColDesc = Contiene la data di inizio per l'attività
DefaultService = Servizio predefinito per la fatturazione
Expand Down Expand Up @@ -162,7 +162,7 @@ submittedColorDesc = Colore per la festa e scheda attività sottoposto all'appro
Subtask = Bambino Task
supplier = Fornitore
SupplierApprovalDesc = Gli utenti che rappresentano un fornitore dovranno approvare i schede orarie relativi a questo fornitore.
supplierSignature = Visto del fornitore
supplierSignature = Firma del fornitore
TaskParent = attività principale
TaskParentColDesc = Contiene il riferimento e l'etichetta del compito genitore a compito
TasksColDesc = Contiene il riferimento e il compito di etichette
Expand Down

0 comments on commit 7765655

Please sign in to comment.