From: Nik Okuntseff Date: Thu, 29 Nov 2018 23:54:09 +0000 (+0000) Subject: Initial work done on confirmSave dialogs when date is changed. X-Git-Tag: timetracker_1.19-1~523 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=722638fd8cc9400c5228106537effa1dcd0f7fa5;p=timetracker.git Initial work done on confirmSave dialogs when date is changed. --- diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index eae6b83f..8b98caa3 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -60,6 +60,7 @@ class ttUser { var $allow_overlap = 0; // Whether to allow overlapping time entries. var $future_entries = 0; // Whether to allow creating future entries. var $uncompleted_indicators = 0; // Uncompleted time entry indicators (show nowhere or on users page). + var $confirm_save = 1; // Work in progress. TODO: change default to 0 and get from group config upon init. var $bcc_email = null; // Bcc email. var $allow_ip = null; // Specification from where user is allowed access. var $password_complexity = null; // Password complexity example. diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index 3d7ff858..dede24ed 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -103,7 +103,7 @@ $i18n_key_words = array( // Warning messages. 'warn.sure' => 'Вы уверены?', -'warn.confirm_save' => 'Дата изменена. Подвердите сохранение, а не копирование этой записи.', +'warn.confirm_save' => 'Дата изменена. Подтвердите сохранение, а не копирование записи.', // Success messages. 'msg.success' => 'Операция завершена успешно.', diff --git a/WEB-INF/templates/expense_edit.tpl b/WEB-INF/templates/expense_edit.tpl index 953f78d5..9e447a30 100644 --- a/WEB-INF/templates/expense_edit.tpl +++ b/WEB-INF/templates/expense_edit.tpl @@ -34,6 +34,18 @@ var defined_expenses = new Array(); idx++; {/foreach} +// TODO: improve on conditional confirmSave. +// Existing entry date for confirm save warnings. +var original_date = "{$entry_date}"; + +function confirmSave() { + var date_on_save = document.getElementById("date").value; + if (original_date != date_on_save) { + return confirm("{$i18n.warn.confirm_save}"); + } +} +// TODO: improve on conditional confirmSave above. + // The fillProjectDropdown function populates the project combo box with // projects associated with a selected client (client id is passed here as id). function fillProjectDropdown(id) { diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 86f7c491..5879e889 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.28.4541 | Copyright © Anuko | +  Anuko Time Tracker 1.18.28.4542 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/time_edit.tpl b/WEB-INF/templates/time_edit.tpl index a5017ce7..f6f46939 100644 --- a/WEB-INF/templates/time_edit.tpl +++ b/WEB-INF/templates/time_edit.tpl @@ -1,5 +1,19 @@ {include file="time_script.tpl"} + + {$forms.timeRecordForm.open} diff --git a/expense_edit.php b/expense_edit.php index 049bc4be..cca8225a 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -147,7 +147,8 @@ $form->addInput(array('type'=>'datefield','name'=>'date','maxlength'=>'20','valu // Hidden control for record id. $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_save or btn_copy click. -$form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.save'))); +// TODO: improve on conditional confirmSave. +$form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date();return(confirmSave())','value'=>$i18n->get('button.save'))); $form->addInput(array('type'=>'submit','name'=>'btn_copy','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.copy'))); $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'))); @@ -220,6 +221,9 @@ if ($request->isPost()) { } } // isPost +// TODO: improve on conditional confirmSave. +$smarty->assign('entry_date', $cl_date); + $smarty->assign('predefined_expenses', $predefined_expenses); $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list); diff --git a/time_edit.php b/time_edit.php index 5670f193..17ba34b4 100644 --- a/time_edit.php +++ b/time_edit.php @@ -210,7 +210,8 @@ if ($user->isPluginEnabled('iv')) if ($user->can('manage_invoices') && $user->isPluginEnabled('ps')) $form->addInput(array('type'=>'checkbox','name'=>'paid','value'=>$cl_paid)); $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_save or btn_copy click. -$form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.save'))); +// TODO: improve on conditional confirmSave. +$form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date();return(confirmSave())','value'=>$i18n->get('button.save'))); $form->addInput(array('type'=>'submit','name'=>'btn_copy','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.copy'))); $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'))); @@ -400,6 +401,9 @@ if ($request->isPost()) { } } // isPost +// TODO: improve on conditional confirmSave. +$smarty->assign('entry_date', $cl_date); + $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list); $smarty->assign('task_list', $task_list);