[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Products/ -> addPbProductRelToDB.php (source)

   1  <?php
   2  
   3  
   4  /*********************************************************************************
   5  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   6   * ("License"); You may not use this file except in compliance with the License
   7   * The Original Code is:  vtiger CRM Open Source
   8   * The Initial Developer of the Original Code is vtiger.
   9   * Portions created by vtiger are Copyright (C) vtiger.
  10   * All Rights Reserved.
  11  *
  12   ********************************************************************************/
  13  
  14  require_once ('include/database/PearDatabase.php');
  15  require_once ('user_privileges/default_module_view.php');
  16  global $adb,$singlepane_view;    
  17  global $log;
  18  $idlist = $_POST['idlist'];
  19  $returnmodule=$_REQUEST['return_module'];
  20  $pricebook_id=$_REQUEST['pricebook_id'];
  21  $productid=$_REQUEST['product_id'];
  22  if(isset($_REQUEST['pricebook_id']) && $_REQUEST['pricebook_id']!='')
  23  {
  24      //split the string and store in an array
  25      $storearray = explode(";",$idlist);
  26      foreach($storearray as $id)
  27      {
  28          if($id != '') {
  29              $lp_name = $id.'_listprice';
  30              $list_price = $_REQUEST[$lp_name];
  31              //Updating the vtiger_pricebook product rel vtiger_table
  32               $log->info("Products :: Inserting vtiger_products to price book");
  33              $query= "insert into vtiger_pricebookproductrel (pricebookid,productid,listprice) values(".$pricebook_id.",".$id.",".$list_price.")";
  34              $adb->query($query);
  35          }
  36      }
  37      if($singlepane_view == 'true')
  38          header("Location: index.php?module=PriceBooks&action=DetailView&record=".$pricebook_id);
  39      else
  40          header("Location: index.php?module=PriceBooks&action=CallRelatedList&record=".$pricebook_id);
  41  }
  42  elseif(isset($_REQUEST['product_id']) && $_REQUEST['product_id']!='')
  43  {
  44      //split the string and store in an array
  45      $storearray = explode(";",$idlist);
  46      foreach($storearray as $id)
  47      {
  48          if($id != '') {
  49              $lp_name = $id.'_listprice';
  50              $list_price = $_REQUEST[$lp_name];
  51              //Updating the vtiger_pricebook product rel vtiger_table
  52               $log->info("Products :: Inserting PriceBooks to Product");
  53              $query= "insert into vtiger_pricebookproductrel (pricebookid,productid,listprice) values(".$id.",".$productid.",".$list_price.")";
  54              $adb->query($query);
  55          }
  56      }
  57      if($singlepane_view == 'true')
  58          header("Location: index.php?module=Products&action=DetailView&record=".$productid);
  59      else
  60          header("Location: index.php?module=Products&action=CallRelatedList&record=".$productid);
  61  }
  62  
  63  ?>
  64  


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7