Commit 2897cfdb authored by Jean-Paul Saman's avatar Jean-Paul Saman

addedit: fix changing status of invoices.

parent 9bc003fb
...@@ -330,7 +330,8 @@ function searchIt() { ...@@ -330,7 +330,8 @@ function searchIt() {
function changeStat() { function changeStat() {
var f=document.frmStatus; var f=document.frmStatus;
f.submit(); f.stat.value = f.status.value;
// f.submit();
} }
var calendarField = ''; var calendarField = '';
...@@ -375,7 +376,7 @@ function checkUncheckAll(theElement) { ...@@ -375,7 +376,7 @@ function checkUncheckAll(theElement) {
</form> </form>
<table cellspacing="0" cellpadding="4" border="0" width="40%" class="std" valign="top"> <table cellspacing="0" cellpadding="4" border="0" width="40%" class="std" valign="top">
<form name="statusFrm" action="./index.php?m=invoice" method="post"> <form name="frmStatus" action="./index.php?m=invoice" method="post">
<input type="hidden" name="dosql" value="do_invoice_aed" /> <input type="hidden" name="dosql" value="do_invoice_aed" />
<input type="hidden" name="del" value="0" /> <input type="hidden" name="del" value="0" />
<input type="hidden" name="invoice_project" value="<?php echo $project_id;?>" /> <input type="hidden" name="invoice_project" value="<?php echo $project_id;?>" />
...@@ -394,7 +395,7 @@ Invoices will not be editable once the status changes from Open for Editing. ...@@ -394,7 +395,7 @@ Invoices will not be editable once the status changes from Open for Editing.
</tr> </tr>
<tr valign="top" width="90%"> <tr valign="top" width="90%">
<td align="right">Invoice Tag</td>; <td align="right">Invoice Tag</td>;
<td align="right"><input type="text" name="tag" value="<?php echo $invoice_tag;?>" class="text" pattern="^\s*\d{8}" size=8 /></td> <td align="right"><input type="text" name="tag" value="<?php echo $invoice_tag;?>" class="text" pattern="^\s*\d{6}" size=8 /></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr valign="top" width="90%"> <tr valign="top" width="90%">
...@@ -411,10 +412,10 @@ Invoices will not be editable once the status changes from Open for Editing. ...@@ -411,10 +412,10 @@ Invoices will not be editable once the status changes from Open for Editing.
</tr> </tr>
<tr> <tr>
<td align="left"> <td align="left">
<input class="button" type="button" name="cancel" value="<?php echo $AppUI->_('cancel');?>" onClick="javascript:if(confirm('Are you sure you want to cancel.')){location.href = './index.php?m=invoice';}" /> <input class="button" type="button" name="cancel" value="<?php echo w2PformSafe('cancel');?>" onClick="javascript:if(confirm('Are you sure you want to cancel.')){location.href = './index.php?m=invoice';}" />
</td> </td>
<td align="right"> <td align="right">
<input class="button" type="submit" name="submit" value="<?php echo $AppUI->_('submit');?>"/> <input class="button" type="submit" name="submit" value="<?php echo w2PformSafe('submit');?>"/>
</td> </td>
</tr> </tr>
</form> </form>
...@@ -463,6 +464,7 @@ for ($s=0; $s < count($tasks); $s++) { ...@@ -463,6 +464,7 @@ for ($s=0; $s < count($tasks); $s++) {
</tr> </tr>
</table> </table>
<!-- // Form to add task_log_id to invoice -->
<table cellspacing="0" cellpadding="4" border="0" width="70%" class="std"> <table cellspacing="0" cellpadding="4" border="0" width="70%" class="std">
<tr valign="top" width="90%"> <tr valign="top" width="90%">
...@@ -546,4 +548,3 @@ if (isset($_POST['start_date'])) ...@@ -546,4 +548,3 @@ if (isset($_POST['start_date']))
</form> </form>
</table> </table>
<?php echo $AppUI->_('requiredField');?>
...@@ -4,7 +4,7 @@ if (!defined('W2P_BASE_DIR')) { ...@@ -4,7 +4,7 @@ if (!defined('W2P_BASE_DIR')) {
} }
$del = w2PgetParam($_POST, 'del', 0); $del = w2PgetParam($_POST, 'del', 0);
$stat = w2PgetParam($_POST,'stat' -1); $stat = w2PgetParam($_POST,'stat', -1);
$tag = w2PgetParam($_POST, 'tag', -1); $tag = w2PgetParam($_POST, 'tag', -1);
$obj = new CInvoice(); $obj = new CInvoice();
...@@ -27,12 +27,14 @@ if ($del) { ...@@ -27,12 +27,14 @@ if ($del) {
if (!$obj->change_status($stat)) { if (!$obj->change_status($stat)) {
$AppUI->setMsg( 'Invoice status change failed', UI_MSG_ERROR ); $AppUI->setMsg( 'Invoice status change failed', UI_MSG_ERROR );
} else { } else {
$AppUI->setMsg( "Invoice updated", UI_MSG_ALERT ); $AppUI->setMsg( "Invoice status updated", UI_MSG_ALERT );
} }
$msg = "m=invoice&a=addedit&invoice_id=".$obj->task_invoice."&project_id=".$obj->invoice_project;
} else if ($tag != '' && $obj->task_invoice != 0) {
if (!$obj->change_invoice_tag($tag)) { if (!$obj->change_invoice_tag($tag)) {
$AppUI->setMsg( "Invoice tag change failed", UI_MSG_ERROR ); $AppUI->setMsg( "Invoice tag change failed", UI_MSG_ERROR );
} else { } else {
$AppUI->setMsg( "Invoice tag updated", UI_MSG_ALERT ); $AppUI->setMsg( "Invoice tag updated ". $tag, UI_MSG_ALERT );
} }
$msg = "m=invoice&a=addedit&invoice_id=".$obj->task_invoice."&project_id=".$obj->invoice_project; $msg = "m=invoice&a=addedit&invoice_id=".$obj->task_invoice."&project_id=".$obj->invoice_project;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment