Beispiel #1
0
 /**
  * this function takes in a module name and returns the field information for it
  */
 function getInformationArray($module)
 {
     require_once 'include/utils/utils.php';
     global $adb;
     $tabid = getTabid($module);
     $result = $adb->pquery("select * from vtiger_field where tabid=?", array($tabid));
     $count = $adb->num_rows($result);
     $arr = array();
     $data = array();
     for ($i = 0; $i < $count; $i++) {
         $arr['uitype'] = $adb->query_result($result, $i, "uitype");
         $arr['fieldname'] = $adb->query_result($result, $i, "fieldname");
         $arr['columnname'] = $adb->query_result($result, $i, "columnname");
         $arr['tablename'] = $adb->query_result($result, $i, "tablename");
         $arr['fieldlabel'] = $adb->query_result($result, $i, "fieldlabel");
         $arr['typeofdata'] = $adb->query_result($result, $i, "typeofdata");
         $fieldlabel = strtolower($arr['fieldlabel']);
         $data[$fieldlabel] = $arr;
     }
     if (in_array($module, getInventoryModules())) {
         include_once 'include/fields/InventoryLineField.php';
         $ilfields = new InventoryLineField();
         $data = array_merge($data, $ilfields->getInventoryLineFieldsByLabel());
     }
     return $data;
 }
Beispiel #2
0
function getInventoryFieldsForExport($tableName)
{
    $sql = ',' . $tableName . '.adjustment AS "Adjustment", ' . $tableName . '.total AS "Total", ' . $tableName . '.subtotal AS "Sub Total", ';
    $sql .= $tableName . '.taxtype AS "Tax Type", ' . $tableName . '.discount_amount AS "Discount Amount", ';
    $sql .= $tableName . '.discount_percent AS "Discount Percent", ' . $tableName . '.s_h_amount AS "S&H Amount", ';
    $sql .= 'vtiger_currency_info.currency_name as "Currency",';
    include_once 'include/fields/InventoryLineField.php';
    $ilfields = new InventoryLineField();
    $inventory_fields = $ilfields->getInventoryLineFieldsByLabel();
    foreach ($inventory_fields as $fdesc) {
        $sql .= $fdesc['tablename'] . '.' . $fdesc['columnname'] . ' AS "' . $fdesc['fieldlabel'] . '",';
    }
    $sql = rtrim($sql, ',') . ' ';
    return $sql;
}