vtiger Forum Index vtiger
The Honest Open Source CRM
 

Unique serial number of Product - AJAX
Click here to go to the original topic

 
       vtiger Forum Index -> Usability & Themes - 5.0.4
Previous topic :: Next topic  
Author Message
jagi



Joined: 17 Jan 2006
Posts: 115
Location: Poland

Posted: Sun May 18, 2008 7:37 pm    Post subject: Unique serial number of Product - AJAX  

1. add in
\modules\Products\DetailViewAjax.php

after line:
$modObj->column_fields[$fieldname] = $fieldvalue;
Code:
//artcode      
if($fieldname == 'serial_no')//unique serialno
      {
   $query = "SELECT serialno FROM vtiger_products, vtiger_crmentity WHERE serialno =? and vtiger_products.productid = vtiger_crmentity.crmid and vtiger_crmentity.deleted != 1";
   $result = $adb->pquery($query, array($fieldvalue));
   $result_nrs = $adb->num_rows($result);
   if($result_nrs > 0)
   {
   echo ":#:serialno";
   echo " - ".$mod_strings['LBL_SERIALNO_EXIST'].$result_nrs;
   die;
   }
   }
//Ended   

2. add in
\include\js\dtlviewajax.js

after
Code:
 onComplete: function(response) {
                              
                        if(response.responseText.indexOf(":#:FAILURE")>-1)
                              {
                                 alert(alert_arr.ERROR_WHILE_EDITING);
                              }
add
Code:
else if(response.responseText.indexOf(":#:serialno")>-1)
                        {
                                 alert(response.responseText);
                              }

In this way You can remove bug - duplicated account name - with AJAX edit
Back to top  
 
       vtiger Forum Index -> Usability & Themes - 5.0.4
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.15 © 2001, 2002 phpBB Group