[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/ -> Popup.php (source)

   1  <?php
   2  /*********************************************************************************
   3   * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
   4   * ("License"); You may not use this file except in compliance with the
   5   * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
   6   * Software distributed under the License is distributed on an  "AS IS"  basis,
   7   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   8   * the specific language governing rights and limitations under the License.
   9   * The Original Code is:  SugarCRM Open Source
  10   * The Initial Developer of the Original Code is SugarCRM, Inc.
  11   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
  12   * All Rights Reserved.
  13   * Contributor(s): ______________________________________.
  14   ********************************************************************************/
  15  require_once ('Smarty_setup.php');
  16  require_once ("data/Tracker.php");
  17  require_once('themes/'.$theme.'/layout_utils.php');
  18  require_once ('include/logging.php');
  19  require_once ('include/ListView/ListView.php');
  20  require_once ('include/database/PearDatabase.php');
  21  require_once ('include/ComboUtil.php');
  22  require_once ('include/utils/utils.php');
  23  
  24  global $app_strings;
  25  global $currentModule;
  26  global $theme;
  27  $url_string = '';
  28  $smarty = new vtigerCRM_Smarty;
  29  if (!isset($where)) $where = "";
  30  
  31  $popuptype = '';
  32  $popuptype = $_REQUEST["popuptype"];
  33  switch($currentModule)
  34  {
  35      case 'Contacts':
  36          require_once("modules/$currentModule/Contacts.php");
  37          $focus = new Contacts();
  38          $log = LoggerManager::getLogger('contact_list');
  39          $comboFieldNames = Array('leadsource'=>'leadsource_dom');
  40          $comboFieldArray = getComboArray($comboFieldNames);
  41          $smarty->assign("SINGLE_MOD",'Contact');
  42          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
  43              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
  44          else
  45              $smarty->assign("RETURN_MODULE",'Emails');
  46          if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
  47          $alphabetical = AlphabeticalSearch($currentModule,'Popup','lastname','true','basic',$popuptype,"","","");
  48          break;
  49      case 'Campaigns':
  50          require_once("modules/$currentModule/Campaigns.php");
  51          $focus = new Campaigns();
  52          $log = LoggerManager::getLogger('campaign_list');
  53          $comboFieldNames = Array('campaignstatus'=>'campaignstatus_dom',
  54                       'campaigntype'=>'campaigntype_dom');
  55          $comboFieldArray = getComboArray($comboFieldNames);
  56          $smarty->assign("SINGLE_MOD",'Campaign');
  57          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
  58              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
  59          if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
  60          $alphabetical = AlphabeticalSearch($currentModule,'Popup','campaignname','true','basic',$popuptype,"","","");
  61          break;
  62      case 'Accounts':
  63          require_once("modules/$currentModule/Accounts.php");
  64          $focus = new Accounts();
  65          $log = LoggerManager::getLogger('account_list');
  66          $comboFieldNames = Array('accounttype'=>'account_type_dom'
  67                  ,'industry'=>'industry_dom');
  68          $comboFieldArray = getComboArray($comboFieldNames);
  69          $smarty->assign("SINGLE_MOD",'Account');
  70          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
  71              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
  72          else
  73              $smarty->assign("RETURN_MODULE",'Emails');
  74          $alphabetical = AlphabeticalSearch($currentModule,'Popup','accountname','true','basic',$popuptype,"","","");
  75          break;
  76      case 'Leads':
  77          require_once("modules/$currentModule/Leads.php");
  78          $focus = new Leads();
  79          $log = LoggerManager::getLogger('contact_list');
  80          $comboFieldNames = Array('leadsource'=>'leadsource_dom'
  81                  ,'leadstatus'=>'leadstatus_dom'
  82                  ,'rating'=>'rating_dom'
  83                  ,'industry'=>'industry_dom');
  84          $comboFieldArray = getComboArray($comboFieldNames);
  85          $smarty->assign("SINGLE_MOD",'Lead');
  86          if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
  87          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
  88              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
  89          else
  90              $smarty->assign("RETURN_MODULE",'Emails');
  91          $alphabetical = AlphabeticalSearch($currentModule,'Popup','lastname','true','basic',$popuptype,"","","");
  92          break;
  93      case 'Potentials':
  94          require_once("modules/$currentModule/Potentials.php");
  95          $focus = new Potentials();
  96          $log = LoggerManager::getLogger('potential_list');
  97          $comboFieldNames = Array('leadsource'=>'leadsource_dom'
  98                  ,'opportunity_type'=>'opportunity_type_dom'
  99                  ,'sales_stage'=>'sales_stage_dom');
 100          $comboFieldArray = getComboArray($comboFieldNames);
 101          $smarty->assign("SINGLE_MOD",'Opportunity');
 102          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 103              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 104          $alphabetical = AlphabeticalSearch($currentModule,'Popup','potentialname','true','basic',$popuptype,"","","");
 105          break;
 106      case 'Quotes':
 107          require_once("modules/$currentModule/Quotes.php");    
 108          $focus = new Quotes();
 109          $log = LoggerManager::getLogger('quotes_list');
 110          $comboFieldNames = Array('quotestage'=>'quotestage_dom');
 111          $comboFieldArray = getComboArray($comboFieldNames);
 112          $smarty->assign("SINGLE_MOD",'Quote');
 113          $alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 114          break;
 115      case 'Invoice':
 116          require_once("modules/$currentModule/Invoice.php");
 117          $focus = new Invoice();
 118          $smarty->assign("SINGLE_MOD",'Invoice');
 119          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 120              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 121          $alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 122          break;
 123      case 'Products':
 124          require_once("modules/$currentModule/Products.php");
 125          $focus = new Products();
 126          $smarty->assign("SINGLE_MOD",'Product');
 127          if(isset($_REQUEST['curr_row']))
 128          {
 129              $curr_row = $_REQUEST['curr_row'];
 130              $smarty->assign("CURR_ROW", $curr_row);
 131              $url_string .="&curr_row=".$_REQUEST['curr_row'];
 132          }
 133          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 134              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 135          $alphabetical = AlphabeticalSearch($currentModule,'Popup','productname','true','basic',$popuptype,"","","");
 136          break;
 137      case 'Vendors':
 138          require_once("modules/$currentModule/Vendors.php");
 139          $focus = new Vendors();
 140          $smarty->assign("SINGLE_MOD",'Vendor');
 141          $alphabetical = AlphabeticalSearch($currentModule,'Popup','vendorname','true','basic',$popuptype,"","","");
 142          break;
 143      case 'SalesOrder':
 144          require_once("modules/$currentModule/SalesOrder.php");
 145          $focus = new SalesOrder();
 146          $smarty->assign("SINGLE_MOD",'SalesOrder');
 147          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 148              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 149          $alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 150          break;
 151      case 'PurchaseOrder':
 152          require_once("modules/$currentModule/PurchaseOrder.php");
 153          $focus = new PurchaseOrder();
 154          $smarty->assign("SINGLE_MOD",'PurchaseOrder');
 155          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 156              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 157          $alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 158          break;
 159      case 'PriceBooks':
 160          require_once("modules/$currentModule/PriceBooks.php");
 161          $focus = new PriceBooks();
 162          $smarty->assign("SINGLE_MOD",'PriceBook');
 163          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 164              $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 165          if(isset($_REQUEST['fldname']) && $_REQUEST['fldname'] !='')
 166          {
 167              $smarty->assign("FIELDNAME",$_REQUEST['fldname']);
 168              $url_string .="&fldname=".$_REQUEST['fldname'];
 169          }
 170          if(isset($_REQUEST['productid']) && $_REQUEST['productid'] !='')
 171          {
 172              $smarty->assign("PRODUCTID",$_REQUEST['productid']);
 173              $url_string .="&productid=".$_REQUEST['productid'];
 174          }
 175          $alphabetical = AlphabeticalSearch($currentModule,'Popup','bookname','true','basic',$popuptype,"","","");
 176          break;
 177      case 'Users':
 178                  require_once("modules/$currentModule/Users.php");
 179                  $focus = new Users();
 180                  $smarty->assign("SINGLE_MOD",'Users');
 181                  if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 182                      $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 183                  $alphabetical = AlphabeticalSearch($currentModule,'Popup','user_name','true','basic',$popuptype,"","","");
 184          if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
 185                  break;    
 186      case 'HelpDesk':
 187          require_once("modules/$currentModule/HelpDesk.php");
 188          $focus = new HelpDesk();
 189          $smarty->assign("SINGLE_MOD",'HelpDesk');
 190          if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 191          $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 192          $alphabetical = AlphabeticalSearch($currentModule,'Popup','ticket_title','true','basic',$popuptype,"","","");
 193          if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
 194          break;
 195  
 196  
 197  }
 198  $smarty->assign("RETURN_ACTION",$_REQUEST['return_action']);
 199  
 200  
 201  $theme_path="themes/".$theme."/";
 202  $image_path=$theme_path."images/";
 203  $smarty->assign("MOD", $mod_strings);
 204  $smarty->assign("APP", $app_strings);
 205  $smarty->assign("IMAGE_PATH",$image_path);
 206  $smarty->assign("THEME_PATH",$theme_path);
 207  $smarty->assign("MODULE",$currentModule);
 208  
 209  
 210  //Retreive the list from Database
 211  if($currentModule == 'PriceBooks')
 212  {
 213      $productid=$_REQUEST['productid'];
 214      $query = 'select vtiger_pricebook.*, vtiger_pricebookproductrel.productid, vtiger_pricebookproductrel.listprice, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_pricebook inner join vtiger_pricebookproductrel on vtiger_pricebookproductrel.pricebookid = vtiger_pricebook.pricebookid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_pricebook.pricebookid where vtiger_pricebookproductrel.productid='.$productid.' and vtiger_crmentity.deleted=0';
 215  }
 216  else
 217  {
 218          if(isset($_REQUEST['recordid']) && $_REQUEST['recordid'] != '')
 219          {        
 220              $smarty->assign("RECORDID",$_REQUEST['recordid']);
 221              $url_string .='&recordid='.$_REQUEST['recordid'];
 222          }
 223          $where_relquery = getRelCheckquery($currentModule,$_REQUEST['return_module'],$_REQUEST['recordid']);
 224          $query = getListQuery($currentModule,$where_relquery);
 225  }
 226              
 227  
 228  if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
 229  {
 230      list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));
 231      $url_string .="&query=true".$ustring;
 232  }
 233  
 234  if(isset($where) && $where != '')
 235  {
 236          $query .= ' and '.$where;
 237  }
 238  
 239  if (isset($_REQUEST['order_by'])) $order_by = $_REQUEST['order_by'];
 240  if(isset($_REQUEST['sorder']) && $_REQUEST['sorder'] != '')    $sorder = $_REQUEST['sorder'];
 241  
 242  if(isset($order_by) && $order_by != '')
 243  {
 244          $query .= ' ORDER BY '.$order_by.' '.$sorder;
 245  }
 246  $list_result = $adb->query($query);
 247  //Retreiving the no of rows
 248  $noofrows = $adb->num_rows($list_result);
 249  
 250  //Retreiving the start value from request
 251  if(isset($_REQUEST['start']) && $_REQUEST['start'] != '')
 252  {
 253          $start = $_REQUEST['start'];
 254  }
 255  else
 256  {
 257  
 258          $start = 1;
 259  }
 260  //Retreive the Navigation array
 261  $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
 262  // Setting the record count string
 263  /*
 264  if ($navigation_array['start'] == 1)
 265  {
 266          if($noofrows != 0)
 267          $start_rec = $navigation_array['start'];
 268          else
 269          $start_rec = 0;
 270          if($noofrows > $list_max_entries_per_page)
 271          {
 272                  $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
 273          }
 274          else
 275          {
 276                  $end_rec = $noofrows;
 277          }
 278  
 279  }
 280  else
 281  {
 282          if($navigation_array['next'] > $list_max_entries_per_page)
 283          {
 284                  $start_rec = $navigation_array['next'] - $list_max_entries_per_page;
 285                  $end_rec = $navigation_array['next'] - 1;
 286          }
 287          else
 288          {
 289                  $start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
 290                  $end_rec = $noofrows;
 291          }
 292  }*/
 293  
 294  $start_rec = $navigation_array['start'];
 295  $end_rec = $navigation_array['end_val']; 
 296  if($navigation_array['start'] != 0)
 297      $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 298  
 299  //Retreive the List View Table Header
 300  
 301  $focus->list_mode="search";
 302  $focus->popup_type=$popuptype;
 303  $url_string .='&popuptype='.$popuptype;
 304  if(isset($_REQUEST['select']) && $_REQUEST['select'] == 'enable')
 305      $url_string .='&select=enable';
 306  if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != '')
 307      $url_string .='&return_module='.$_REQUEST['return_module'];
 308  $listview_header_search=getSearchListHeaderValues($focus,"$currentModule",$url_string,$sorder,$order_by);
 309  $smarty->assign("SEARCHLISTHEADER", $listview_header_search);
 310  
 311  $smarty->assign("ALPHABETICAL", $alphabetical);
 312  
 313  
 314  $listview_header = getSearchListViewHeader($focus,"$currentModule",$url_string,$sorder,$order_by);
 315  $smarty->assign("LISTHEADER", $listview_header);
 316  
 317  
 318  $listview_entries = getSearchListViewEntries($focus,"$currentModule",$list_result,$navigation_array);
 319  $smarty->assign("LISTENTITY", $listview_entries);
 320  
 321  $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string,$currentModule,"Popup");
 322  $smarty->assign("NAVIGATION", $navigationOutput);
 323  $smarty->assign("RECORD_COUNTS", $record_string);
 324  $smarty->assign("POPUPTYPE", $popuptype);
 325  
 326  
 327  if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
 328      $smarty->display("PopupContents.tpl");
 329  else
 330      $smarty->display("Popup.tpl");
 331  
 332  ?>
 333  


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