Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#584 [TimespentRange] fix: remove dead code #618

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/dolisirh.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 0 additions & 44 deletions js/modules/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ window.dolisirh.task.event = function() {
$(document).on('click', '.show-sticky-total-timespent-info', window.dolisirh.task.showStickyTotalTimeSpentInfo);
$(document).on('click', '.timespent-create', window.dolisirh.task.createTimeSpent);
$(document).on('click', '.toggleTaskFavorite', window.dolisirh.task.toggleTaskFavorite);
$(document).on('submit', '#addtimeform', window.dolisirh.task.searchForm );
};

/**
Expand Down Expand Up @@ -421,46 +420,3 @@ window.saturne.modal.addMoreOpenModalData = function(modalToOpen, elementFrom) {
$('.timespent-create').attr('value', taskID);
$('.timespent-date').html(date);
};

/**
* Submit form dynamically to avoid 406 errors.
*
* @memberof DoliSIRH_Task
*
* @since 1.4.0
* @version 1.4.0
*
* @return {void}
*/
window.dolisirh.task.searchForm = function(event) {
event.preventDefault()

var addTimeForm = document.getElementById('addtimeform');
var formData = new FormData(addTimeForm);
let newFormData = new FormData();

for (const pair of formData.entries()) {
if (pair[1] != '') {
newFormData.append(pair[0], pair[1])
}
}
window.saturne.loader.display($('#addtimeform'));

let url = new URL(document.URL);
url.searchParams.set('search_user_id', newFormData.get('search_user_id'));

// rewrite url without reload
window.history.pushState({}, '', url.href);

$.ajax({
url: url.href,
type: "POST",
data: newFormData,
processData: false,
contentType: false,
success: function (resp) {
$('.wpeo-loader').removeClass('wpeo-loader');
$('#addtimeform').html($(resp).find('#addtimeform').children())
},
});
}
2 changes: 1 addition & 1 deletion lib/dolisirh_timespent.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ function task_lines_within_range(int &$inc, int $timestampStart, int $timestampE

$tableCell .= '<div class="modal-open">';
$tableCell .= '<input hidden class="modal-options" data-modal-to-open="timespent" data-from-id="' . $lines[$i]->id . '" data-from-module="dolisirh">';
$tableCell .= '<input type="text" alt="' . ($disabledTaskDay ? '' : $altTitle) . '" title="' . ($disabledTaskDay ? '' : $altTitle) . '" ' . ($disabledTaskDay ? 'disabled' : '') . ' class="center smallpadd timespent" size="2" id="timeadded[' . $inc . '][' . $idw.']" name="task[' . $lines[$i]->id . '][' . $idw . ']" data-task-id=' . $lines[$i]->id . ' data-timestamp=' . $dayInLoop . ' data-date="' . dol_print_date($dayInLoop, '%a') . ' - ' . dol_print_date($dayInLoop, 'dayreduceformat') . '" data-cell=' . $idw . ' value="" cols="2" maxlength="5">';
$tableCell .= '<input type="text" alt="' . ($disabledTaskDay ? '' : $altTitle) . '" title="' . ($disabledTaskDay ? '' : $altTitle) . '" ' . ($disabledTaskDay ? 'disabled' : '') . ' class="center smallpadd timespent" size="2" id="timeadded[' . $inc . '][' . $idw.']" data-task-id=' . $lines[$i]->id . ' data-timestamp=' . $dayInLoop . ' data-date="' . dol_print_date($dayInLoop, '%a') . ' - ' . dol_print_date($dayInLoop, 'dayreduceformat') . '" data-cell=' . $idw . ' value="" cols="2" maxlength="5">';
$tableCell .= '</div></td>';
print $tableCell;
}
Expand Down