Additional access control related ui helpers added: check_edit_access, access_post...
[fa-stable.git] / reporting / includes / doctext.inc
index de3082a9e1eadd6dfe906313b37786ac1219ccad..439d7b8f0e11f44297aea5b74774ec5310b6d92c 100644 (file)
@@ -14,6 +14,8 @@
 *      Set document type dependent elements of common page layout.
 *
 */
+       global $SysPrefs;
+
        $Addr1 = array(
                        'title' => _("Charge To"),
                        'name' => @$this->formData['br_name'] ? $this->formData['br_name'] : @$this->formData['DebtorName'],
 
        if (!in_array($this->formData['doctype'], array(ST_STATEMENT, ST_WORKORDER)))
        {
-               $id = $this->formData['payment_terms'];
-               $sql = "SELECT terms, days_before_due FROM ".TB_PREF."payment_terms WHERE terms_indicator=".db_escape($id);
-               $result = db_query($sql,"could not get paymentterms");
-               $row = db_fetch($result);
+               $row = get_payment_terms($this->formData['payment_terms']);
                $Payment_Terms = _("Payment Terms") . ': ' . $row["terms"];
                if ($this->formData['doctype'] == ST_SALESINVOICE && $this->formData['prepaid'])
                        $this->formData['prepaid'] = ($row['days_before_due'] >= 0) ? 'final' : 'partial';