require_once 'include/database/PearDatabase.php';
global $adb;
$local_log =& LoggerManager::getLogger('AccountsAjax');
global $currentModule;
$acntObj = CRMEntity::getInstance($currentModule);
$ajaxaction = $_REQUEST["ajxaction"];
if ($ajaxaction == "DETAILVIEW") {
    $crmid = $_REQUEST["recordid"];
    $tablename = $_REQUEST["tableName"];
    $fieldname = $_REQUEST["fldName"];
    $fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);
    if ($crmid != "") {
        $acntObj->retrieve_entity_info($crmid, "Accounts");
        $acntObj->column_fields[$fieldname] = $fieldvalue;
        if ($fieldname == 'annual_revenue') {
            $acntObj->column_fields[$fieldname] = getConvertedPrice($fieldvalue);
        }
        $acntObj->id = $crmid;
        $acntObj->mode = "edit";
        $acntObj->save("Accounts");
        if ($acntObj->column_fields['notify_owner'] == 1) {
            sendNotificationToOwner('Accounts', &$acntObj);
        }
        if ($acntObj->id != "") {
            echo ":#:SUCCESS";
        } else {
            echo ":#:FAILURE";
        }
    } else {
        echo ":#:FAILURE";
    }
Esempio n. 2
0
 /**	Function used to save the Inventory product details for the passed entity
  *	@param object reference $this - object reference to which we want to save the product details from REQUEST values where as the entity will be Purchase Order, Sales Order, Quotes or Invoice
  *	@param string $module - module name
  *	@param $update_prod_stock - true or false (default), if true we have to update the stock for PO only
  *	@return void
  */
 function saveInventoryProductDetails()
 {
     global $log;
     $log->debug("Entering into function saveInventoryProductDetails().");
     global $app_strings;
     if ($this->mode == 'edit') {
         $inventarr = $this->getInventProInfo($this->id);
         //			$update_productsql2 = "update ec_products set num = num +".$inventarr['quantity']." where productid =".$inventarr['productid'];
         //			$this->db->query($update_productsql2);
         deleteInventoryProductDetails($this->id, '');
     }
     $tot_no_prod = $_REQUEST['totalProductCount'];
     $prod_seq = 1;
     for ($i = 1; $i <= $tot_no_prod; $i++) {
         $prod_id = $_REQUEST['hdnProductId' . $i];
         $qty = $_REQUEST['qty' . $i];
         $listprice = $_REQUEST['listPrice' . $i];
         $listprice = getConvertedPrice($listprice);
         //convert the listPrice into $
         $comment = addslashes($_REQUEST['comment' . $i]);
         //if the product is deleted then we should avoid saving the deleted products
         if ($_REQUEST["deleted" . $i] == 1) {
             continue;
         }
         $query = "insert into ec_inventoryproductrel(id, productid, sequence_no, quantity, listprice, comment) values({$this->id}, {$prod_id} , {$prod_seq}, {$qty}, {$listprice}, '{$comment}')";
         $prod_seq++;
         $this->db->query($query);
     }
     //we should update the netprice (subtotal), taxtype, group discount, S&H charge, S&H taxes, adjustment and total
     //netprice, group discount, taxtype, S&H amount, adjustment and total to entity table
     $updatequery = " update {$this->table_name} set ";
     $total = getConvertedPrice($_REQUEST['total']);
     //convert total to $
     $updatequery .= " total='" . $total . "'";
     $updatequery .= " where salesorderid={$this->id}";
     $this->db->query($updatequery);
     $log->debug("Exit from function saveInventoryProductDetails().");
 }