function updateInvoiceRefNumber() { $irnumber = getInvoiceRefNumber(); // Here "?" specifies a minimal match, to get the most digits possible: if (preg_match('/^(.*?)(\\d+)(\\D*)$/', $irnumber, $matches)) { $newdigs = sprintf('%0' . strlen($matches[2]) . 'd', $matches[2] + 1); $newnumber = $matches[1] . $newdigs . $matches[3]; sqlStatement("UPDATE users AS u, list_options AS lo " . "SET lo.notes = ? WHERE " . "u.username = ? AND " . "lo.list_id = 'irnpool' AND lo.option_id = u.irnpool", array($newnumber, $_SESSION['authUser'])); } return $irnumber; }
' title='yyyy-mm-dd date of service' onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' /> <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22' id='img_date' border='0' alt='[?]' style='cursor:pointer' title='<?php echo xla("Click here to choose a date"); ?> '> </td> </tr> <?php // If this user has a non-empty irnpool assigned, show the pending // invoice reference number. $irnumber = getInvoiceRefNumber(); if (!empty($irnumber)) { ?> <tr> <td> <?php echo xlt('Tentative Invoice Ref No'); ?> : </td> <td> <?php echo text($irnumber); ?> </td> </tr>