Skip to content

Commit

Permalink
Dashboard.php: Replace due date handling with existing function.
Browse files Browse the repository at this point in the history
  • Loading branch information
TurboPT authored and timschofield committed Feb 26, 2018
1 parent 079b5e9 commit 5e94cef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
27 changes: 2 additions & 25 deletions Dashboard.php
Expand Up @@ -260,39 +260,16 @@
$DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'], $CurrDecimalPlaces);
$DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'], $CurrDecimalPlaces);

if($DetailTrans['daysbeforedue'] > 0) {
$AddDays=$DetailTrans['daysbeforedue'] . ' days';
if(function_exists('date_add')) {
$DisplayDueDate = date_add(date_create($DetailTrans['trandate']), date_interval_create_from_date_string($AddDays));
} else {
$DisplayDueDate = strtotime($AddDays,strtotime($DetailTrans['trandate']));
}

} else {
$AddDays=(intval($DetailTrans['dayinfollowingmonth']) - 1) . ' days';
if(function_exists('date_add')) {
$DisplayDueDate = date_create($DetailTrans['trandate']);
$DisplayDueDate->modify('first day of next month');
$DisplayDueDate = date_add($DisplayDueDate, date_interval_create_from_date_string($AddDays));
} else {
$DisplayDueDate = strtotime('first day of next month',strtotime($DetailTrans['trandate']));
$DisplayDueDate = strtotime($DisplayDueDate,strtotime($AddDays));
}
$DisplayDueDate = CalcDueDate($DisplayTranDate, $DetailTrans['dayinfollowingmonth'], $DetailTrans['daysbeforedue']);

}
if(function_exists('date_add')) {
$DisplayDueDate=date_format($DisplayDueDate,$_SESSION['DefaultDateFormat']);
} else {
$DisplayDueDate = Date($_SESSION['DefaultDateFormat'],$DisplayDueDate);
}
if($k == 1) {
echo '<tr class="EvenTableRows">';
$k = 0;
} else {
echo '<tr class="OddTableRows">';
$k = 1;
}
echo '<td style="text-align:center">', _($DetailTrans['typename']), '</td>',// Should it be left (text field) ?
echo '<td class="centre">', _($DetailTrans['typename']), '</td>',// Should it be left (text field) ?
'<td class="number">', $DetailTrans['transno'], '</td>
<td class="centre">', $DisplayTranDate, '</td>
<td class="centre">', $DisplayDueDate, '</td>
Expand Down
1 change: 1 addition & 0 deletions doc/Change.log
@@ -1,5 +1,6 @@
webERP Change Log

2/2/18 PaulT: Dashboard.php: Replace due date handling with existing function.
2/2/18 PaulT: PrintCustTrans.php, PDFTransPageHeader.inc, PrintCustTransPortrait.php, PDFTransPageHeaderPortrait.inc: Add missing stock lot/serial info to landscape output to be consistent with portrait output (reported by HDeriauFF), add Due Date info to invoices (reported by Paul Becker), and (PaulT) add security checks to portrait file, layout improvements, change PDF initialization handling, and more. (A summary of all changes in this commit can be viewed here: http://www.weberp.org/forum/showthread.php?tid=8065&pid=14115#pid14115)
31/1/18 PaulT: Add a 'warning' case to getMsg(), as there is mixed use of 'warn' and 'warning' usage with prnMsg() calls. The 'warning' (before this change) defaults to an 'info' style message.
27/1/18 PaulT: Remove unused $db parameter from DB_query(), DB_error_no(), DB_error_msg() and other DB-related function calls.
Expand Down

0 comments on commit 5e94cef

Please sign in to comment.