Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
P/O Authorization overwrites previous comments
03-14-2015, 03:55 AM
Post: #1
P/O Authorization overwrites previous comments
If there are multiple P/O's waiting authorization and you only change the status of 1 P/O, they all get updated with the comment that they were authorised. But only the status get changed to authorised if you change the drop down. And the stat_comments get seriously messed up, overwriting any previous values in that field. All P/O's pending authorization are updated with the last P/O in the lists's previous comments + the authorized comments. because the form doesn't have a hidden field for each P/O's comments - just 1 field.

Unless you can go back through Audit history you lose history. And if you view the P/Os that weren't authorised, they look funny because they contain an authorisation comment but are still pending.


PHP Code:
if (isset($_POST['UpdateAll'])) {
    foreach (
$_POST as $key => $value) {
        if (
mb_substr($key,0,6)=='Status') {
            
$OrderNo=mb_substr($key,6);
            
$Status=$_POST['Status'.$OrderNo];
            
$Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' <a href="mailto:' $EmailRow['email'].'">' $_SESSION['UserID'] . '</a><br />' html_entity_decode($_POST['comment'],ENT_QUOTES,'UTF-8');
            
$sql="UPDATE purchorders
                    SET status='"
.$Status."',
                        stat_comment='"
.$Comment."',
                        allowprint=1
                    WHERE orderno='"
$OrderNo."'";
            
$result=DB_query($sql$db);
        }
    }

Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)