iTx Technologies offre gratuitement
cet espace pour SugarCRM !

title

Body

[fermer]

/include/ -> QuickSearchDefaults.php (source)

   1  <?php
   2  if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
   3  /*********************************************************************************
   4   * SugarCRM is a customer relationship management program developed by
   5   * SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
   6   * 
   7   * This program is free software; you can redistribute it and/or modify it under
   8   * the terms of the GNU General Public License version 3 as published by the
   9   * Free Software Foundation with the addition of the following permission added
  10   * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
  11   * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
  12   * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  13   * 
  14   * This program is distributed in the hope that it will be useful, but WITHOUT
  15   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  17   * details.
  18   * 
  19   * You should have received a copy of the GNU General Public License along with
  20   * this program; if not, see http://www.gnu.org/licenses or write to the Free
  21   * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  22   * 02110-1301 USA.
  23   * 
  24   * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
  25   * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
  26   * 
  27   * The interactive user interfaces in modified source and object code versions
  28   * of this program must display Appropriate Legal Notices, as required under
  29   * Section 5 of the GNU General Public License version 3.
  30   * 
  31   * In accordance with Section 7(b) of the GNU General Public License version 3,
  32   * these Appropriate Legal Notices must retain the display of the "Powered by
  33   * SugarCRM" logo. If the display of the logo is not reasonably feasible for
  34   * technical reasons, the Appropriate Legal Notices must display the words
  35   * "Powered by SugarCRM".
  36   ********************************************************************************/
  37  
  38  /**
  39   * QuickSearchDefaults class, outputs default values for setting up quicksearch
  40   *
  41   * @copyright  2004-2007 SugarCRM Inc.
  42   * @license    http://www.sugarcrm.com/crm/products/sugar-professional-eula.html  SugarCRM Professional End User License
  43   * @since      Class available since Release 4.0
  44   */
  45  
  46  class QuickSearchDefaults {
  47  
  48      var $form_name = 'EditView';
  49      
  50  	function setFormName($name = 'EditView') {
  51          $this->form_name = $name;
  52      }
  53      
  54      function getQSParent($parent = 'Accounts') {
  55          global $app_strings;
  56  
  57          $qsParent = array(
  58                      'form' => $this->form_name,
  59                      'method' => 'query',
  60                      'modules' => array($parent),
  61                      'group' => 'or',
  62                      'field_list' => array('name', 'id'),
  63                      'populate_list' => array('parent_name', 'parent_id'),
  64                      'required_list' => array('parent_id'),
  65                      'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
  66                      'order' => 'name',
  67                      'limit' => '30',
  68                      'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
  69                      );
  70  
  71          return $qsParent;
  72      }
  73  
  74      function getQSAccount($nameKey, $idKey, $billingKey = null, $shippingKey = null, $additionalFields = null) {
  75  
  76          global $app_strings;
  77  
  78  
  79          $field_list = array('name', 'id');
  80          $populate_list = array($nameKey, $idKey);
  81          if($billingKey != null) {
  82              $field_list = array_merge($field_list, array('billing_address_street', 'billing_address_city',
  83                                                             'billing_address_state', 'billing_address_postalcode', 'billing_address_country'));
  84  
  85              $populate_list = array_merge($populate_list, array($billingKey . "_address_street", $billingKey . "_address_city",
  86                                                                  $billingKey . "_address_state", $billingKey . "_address_postalcode", $billingKey . "_address_country"));
  87          } //if
  88  
  89          if($shippingKey != null) {
  90              $field_list = array_merge($field_list, array('shipping_address_street', 'shipping_address_city',
  91                                                             'shipping_address_state', 'shipping_address_postalcode', 'shipping_address_country'));
  92  
  93              $populate_list = array_merge($populate_list, array($shippingKey . "_address_street", $shippingKey . "_address_city",
  94                                                                  $shippingKey . "_address_state", $shippingKey . "_address_postalcode", $shippingKey . "_address_country"));
  95          }
  96  
  97          if(!empty($additionalFields) && is_array($additionalFields)) {
  98             $field_list = array_merge($field_list, array_keys($additionalFields));
  99             $populate_list = array_merge($populate_list, array_values($additionalFields));
 100          }
 101  
 102          $qsParent = array(
 103                      'form' => $this->form_name,
 104                      'method' => 'query',
 105                      'modules' => array('Accounts'),
 106                      'group' => 'or',
 107                      'field_list' => $field_list,
 108                      'populate_list' => $populate_list,
 109                      'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
 110                      'required_list' => array($idKey),
 111                      'order' => 'name',
 112                      'limit' => '30',
 113                      'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
 114                      );
 115  
 116          return $qsParent;
 117      }
 118  
 119      /**
 120       * getQSContact
 121       * This is a customized method to handle returning in JSON notation the QuickSearch formats
 122       * for searching the Contacts module for a contact name.  The method takes into account
 123       * the locale settings (s = salutation, f = first name, l = last name) that are permissible.
 124       * It should be noted though that any other characters present in the formatting will render
 125       * this widget non-functional.
 126       * @return The JSON format of a QuickSearch definition for the Contacts module
 127       */
 128      function getQSContact($name, $idName) {
 129          global $app_strings, $locale;
 130  
 131          $qsContact = array('form' => $this->form_name,
 132                             'method'=>'get_contact_array',
 133                             'modules'=>array('Contacts'),
 134                             'field_list' => array('salutation', 'first_name', 'last_name', 'id'),
 135                             'populate_list' => array($name, $idName, $idName, $idName),
 136                             'required_list' => array($idName),
 137                             'group' => 'or',
 138                             'conditions' => array(
 139                                                   array('name'=>'first_name', 'op'=>'like_custom','end'=>'%','value'=>''),
 140                                                   array('name'=>'last_name', 'op'=>'like_custom','end'=>'%','value'=>'')
 141                                             ),
 142                             'order'=>'last_name',
 143                             'limit'=>'30',
 144                             'no_match_text'=> $app_strings['ERR_SQS_NO_MATCH']);
 145          return $qsContact;
 146      }
 147  
 148      function getQSUser($p_name = 'assigned_user_name', $p_id ='assigned_user_id') {
 149          global $app_strings;
 150  
 151          $qsUser = array('form' => $this->form_name,
 152                          'method' => 'get_user_array', // special method
 153                          'field_list' => array('user_name', 'id'),
 154                          'populate_list' => array($p_name, $p_id),
 155                          'required_list' => array($p_id),
 156                          'conditions' => array(array('name'=>'user_name','op'=>'like_custom','end'=>'%','value'=>'')),
 157                          'limit' => '30','no_match_text' => $app_strings['ERR_SQS_NO_MATCH']);
 158          return $qsUser;
 159      }
 160  
 161      function getQSCampaigns() {
 162          global $app_strings;
 163  
 164          $qsCampaign = array('form' => $this->form_name,
 165                              'method' => 'query',
 166                              'modules'=> array('Campaigns'),
 167                              'group' => 'or',
 168                              'field_list' => array('name', 'id'),
 169                              'populate_list' => array('campaign_name', 'campaign_id'),
 170                              'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
 171                              'required_list' => array('campaign_id'),
 172                              'order' => 'name',
 173                              'limit' => '30',
 174                              'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']);
 175          return $qsCampaign;
 176      }
 177  
 178  
 179  
 180  
 181  
 182  
 183  
 184  
 185  
 186  
 187  
 188  
 189  
 190  
 191  
 192  
 193  
 194  
 195  
 196  
 197      // BEGIN QuickSearch functions for 4.5.x backwards compatibility support
 198      function getQSScripts() {
 199          global $sugar_version, $sugar_config, $theme;
 200          $qsScripts = '<script type="text/javascript" src="' . getJSPath('include/JSON.js') .'"></script>
 201          <script type="text/javascript">sqsWaitGif = "' . SugarThemeRegistry::current()->getImageURL('sqsWait.gif') . '";</script>
 202          <script type="text/javascript" src="'. getJSPath('include/javascript/quicksearch.js') . '"></script>';
 203          return $qsScripts;
 204      }
 205  
 206  	function getQSScriptsNoServer() {
 207          return $this->getQSScripts();
 208      }
 209  
 210  	function getQSScriptsJSONAlreadyDefined() {
 211          global $sugar_version, $sugar_config, $theme;
 212          $qsScriptsJSONAlreadyDefined = '<script type="text/javascript">sqsWaitGif = "' . SugarThemeRegistry::current()->getImageURL('sqsWait.gif') . '";</script><script type="text/javascript" src="' . getJSPath('include/javascript/quicksearch.js') . '"></script>';
 213          return $qsScriptsJSONAlreadyDefined;
 214      }
 215      // END QuickSearch functions for 4.5.x backwards compatibility support
 216  }
 217  
 218  ?>


Generé en: Thu Mar 4 09:44:50 2010 | Cross-referenced par PHPXref 0.7