diff -ruNa org/modules/customeredit.php current/modules/customeredit.php --- org/modules/customeredit.php 2011-01-17 11:38:44.000000000 +0100 +++ current/modules/customeredit.php 2011-12-08 21:48:18.000000000 +0100 @@ -125,6 +125,38 @@ if(!$error) { + if(isset($customerdata['message'])) + { + $cid = $_GET['id']; + $customerdata['message'] = str_replace('%customer', $LMS->GetCustomerName($cid), $customerdata['message']); + $customerdata['message'] = str_replace('%balance', $LMS->GetCustomerBalance($cid), $customerdata['message']); + $result = $LMS->DB->GetRow('SELECT c.pin AS customerpin + FROM customers c + WHERE c.id = ?', array($cid)); + + $customerdata['message'] = str_replace('%pin', $result['customerpin'], $customerdata['message']); + $customerdata['message'] = str_replace('%cid', sprintf('%04d',$cid), $customerdata['message']); + + $customerdata['message'] = str_replace('%bankaccount', bankaccount($cid), $customerdata['message']); + + if(!(strpos($customerdata['message'], '%last_10_in_a_table') === FALSE)) + { + $last10 = ''; + if($last10_array = $LMS->DB->GetAll('SELECT comment, time, value + FROM cash WHERE customerid = ? + ORDER BY time DESC LIMIT 10', array($cid))) + { + foreach($last10_array as $r) + { + $last10 .= date("Y/m/d | ", $r['time']); + $last10 .= sprintf("%20s | ", sprintf($LANGDEFS[$LMS->ui_lang]['money_format'], $r['value'])); + $last10 .= $r['comment']."\n"; + } + } + $customerdata['message'] = str_replace('%last_10_in_a_table', $last10, $customerdata['message']); + } + } + if($customerdata['cutoffstop']) $customerdata['cutoffstop'] = mktime(23,59,59,date('m'), date('d') + $customerdata['cutoffstop']); diff -ruNa org/modules/customerwarn.php current/modules/customerwarn.php --- org/modules/customerwarn.php 2011-01-17 11:38:44.000000000 +0100 +++ current/modules/customerwarn.php 2011-12-08 21:49:14.000000000 +0100 @@ -41,6 +41,37 @@ $LMS->NodeSetWarnU($uid, FALSE); if(isset($message)) + { + $cid = $uid; + $message = str_replace('%customer', $LMS->GetCustomerName($cid), $message); + $message = str_replace('%balance', $LMS->GetCustomerBalance($cid), $message); + $result = $LMS->DB->GetRow('SELECT c.pin AS customerpin + FROM customers c + WHERE c.id = ?', array($cid)); + + $message = str_replace('%pin', $result['customerpin'], $message); + $message = str_replace('%cid', sprintf('%04d',$cid), $message); + + $message = str_replace('%bankaccount', bankaccount($cid), $message); + + if(!(strpos($message, '%last_10_in_a_table') === FALSE)) + { + $last10 = ''; + if($last10_array = $LMS->DB->GetAll('SELECT comment, time, value + FROM cash WHERE customerid = ? + ORDER BY time DESC LIMIT 10', array($cid))) + { + foreach($last10_array as $r) + { + $last10 .= date("Y/m/d | ", $r['time']); + $last10 .= sprintf("%20s | ", sprintf($LANGDEFS[$LMS->ui_lang]['money_format'], $r['value'])); + $last10 .= $r['comment']."\n"; + } + } + $message = str_replace('%last_10_in_a_table', $last10, $message); + } + } + $DB->Execute('UPDATE customers SET message=? WHERE id=?', array($message, $uid)); } diff -ruNa org/modules/nodewarn.php current/modules/nodewarn.php --- org/modules/nodewarn.php 2011-01-17 11:38:44.000000000 +0100 +++ current/modules/nodewarn.php 2011-12-08 21:49:39.000000000 +0100 @@ -40,6 +40,37 @@ $LMS->NodeSetWarn($value, FALSE); if($message) + { + $cid=$LMS->GetNodeOwner($value); + $message = str_replace('%customer', $LMS->GetCustomerName($cid), $message); + $message = str_replace('%balance', $LMS->GetCustomerBalance($cid), $message); + $result = $LMS->DB->GetRow('SELECT c.pin AS customerpin + FROM customers c + WHERE c.id = ?', array($cid)); + + $message = str_replace('%pin', $result['customerpin'], $message); + $message = str_replace('%cid', sprintf('%04d',$cid), $message); + + $message = str_replace('%bankaccount', bankaccount($cid), $message); + + if(!(strpos($message, '%last_10_in_a_table') === FALSE)) + { + $last10 = ''; + if($last10_array = $LMS->DB->GetAll('SELECT comment, time, value + FROM cash WHERE customerid = ? + ORDER BY time DESC LIMIT 10', array($cid))) + { + foreach($last10_array as $r) + { + $last10 .= date("Y/m/d | ", $r['time']); + $last10 .= sprintf("%20s | ", sprintf($LANGDEFS[$LMS->ui_lang]['money_format'], $r['value'])); + $last10 .= $r['comment']."\n"; + } + } + $message = str_replace('%last_10_in_a_table', $last10, $message); + } + } + $DB->Execute('UPDATE customers SET message=? WHERE id=?', array($message,$LMS->GetNodeOwner($value))); }