Example #1
0
/**
 * Updates the amount and optionally the description on a transaction awaiting reservation
 * @author Paul Heaney
 * @param int $transactionid The transaction ID to update
 * @param int $amount The amount to set the transaction to
 * @param string $description (optional) the description to set on the transaction
 * @return bool TRUE on a sucessful update FALSE otherwise
 */
function update_reservation($transactionid, $amount, $description = '')
{
    return update_transaction($transactionid, $amount, $description, BILLING_RESERVED);
}
                    $a[$m] += $bill[$m]['count'];
                }
            }
            foreach ($multipliers as $m) {
                $s .= sprintf($GLOBALS['strXUnitsAtX'], $a[$m], $m);
                $totalunits += $a[$m];
                $totalbillableunits += $m * $a[$m];
            }
            $unitrate = get_unit_rate(incident_maintid($incidentid));
            $totalrefunds = $bills['refunds'];
            // $numberofunits += $bills['refunds'];
            $cost = ($totalbillableunits + $totalrefunds) * $unitrate * -1;
            $desc = trim("{$numberofunits} {$strUnits} @ {$CONFIG['currency_symbol']}{$unitrate} {$strForIncident} {$incidentid}. {$s}");
            $transactionid = get_incident_transactionid($incidentid);
            if ($transactionid != FALSE) {
                $r = update_transaction($transactionid, $cost, $desc, BILLING_AWAITINGAPPROVAL);
                if ($r) {
                    html_redirect('billable_incidents.php', TRUE, $strUpdateSuccessful);
                } else {
                    html_redirect('billable_incidents.php', FALSE, $strUpdateFailed);
                }
            } else {
                html_redirect('billable_incidents.php', FALSE, $strUpdateFailed);
            }
        } else {
            html_redirect('billable_incidents.php', FALSE, $strUpdateFailed);
        }
    } else {
        html_redirect('billable_incidents.php', FALSE, $strFailedToFindDateIncidentClosed);
    }
}