當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CustomField::QuerySingle方法代碼示例

本文整理匯總了PHP中CustomField::QuerySingle方法的典型用法代碼示例。如果您正苦於以下問題:PHP CustomField::QuerySingle方法的具體用法?PHP CustomField::QuerySingle怎麽用?PHP CustomField::QuerySingle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CustomField的用法示例。


在下文中一共展示了CustomField::QuerySingle方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: LoadByCustomFieldId

 /**
  * Load a single CustomField object,
  * by CustomFieldId Index(es)
  * @param integer $intCustomFieldId
  * @return CustomField
  */
 public static function LoadByCustomFieldId($intCustomFieldId)
 {
     return CustomField::QuerySingle(QQ::Equal(QQN::CustomField()->CustomFieldId, $intCustomFieldId));
 }
開發者ID:heshuai64,項目名稱:einv2,代碼行數:10,代碼來源:CustomFieldGen.class.php

示例2: btnSave_Click

 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     try {
         $arrRestrictedFields = array('asset code', 'asset tag', 'model', 'category', 'manufacturer', 'location', 'assets', 'name', 'asset model code', 'model number', 'inventory code', 'quantity', 'company name', 'city', 'state/province', 'country', 'title', 'company', 'email', 'address', 'shipment number', 'ship date', 'ship to company', 'ship to contact', 'ship to address', 'scheduled by', 'status', 'tracking', 'receipt number', 'receive from company', 'receive from contact', 'description', 'account', 'courier', 'account number', 'field name', 'type', 'enabled', 'required', 'role', 'username', 'user role', 'active', 'admin');
         $blnError = false;
         /*if ($this->chkRequiredFlag->Checked) {
         			if ($this->lstCustomFieldQtype->SelectedValue != 2 && $this->txtDefaultValue->Text == '') {
         				$blnError = true;
         				$this->btnCancel->Warning = 'A custom field must have a default value if it is required.';
         			}
         		}*/
         if (count($this->chkEntityQtype->SelectedItems) == 0) {
             $blnError = true;
             $this->btnCancel->Warning = 'You must select at least one field in the Apply To list box.';
         }
         if (in_array(strtolower($this->txtShortDescription->Text), $arrRestrictedFields, false)) {
             $blnError = true;
             $this->btnCancel->Warning = sprintf("'%s' is a Tracmor restricted word. Please choose another name for this custom field", $this->txtShortDescription->Text);
         }
         if (in_array('1', $this->chkEntityQtype->SelectedValues) && $this->rblAllAssetModels->SelectedValue == 2 && count($this->arrAssetModels) == 0) {
             $blnError = true;
             $this->btnCancel->Warning = 'You must apply at least one Model.';
         }
         if ($this->blnEditMode) {
             $objCustomFieldDuplicate = CustomField::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::CustomField()->CustomFieldId, $this->objCustomField->CustomFieldId)));
         } else {
             $objCustomFieldDuplicate = CustomField::QuerySingle(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text));
         }
         if ($objCustomFieldDuplicate) {
             $blnError = true;
             $this->btnCancel->Warning = 'A custom field already exists with that name. Please choose another.';
         }
         if (!$blnError) {
             $this->UpdateCustomFieldFields();
             $this->objCustomField->Save();
             // If this field is a required field
             if ($this->objCustomField->RequiredFlag) {
                 $blnDefaultIsNone = false;
                 // If this custom field is a text or textarea,
                 if ($this->lstCustomFieldQtype->SelectedValue != 2) {
                     if ($this->txtDefaultValue->Text != null) {
                         // Assign the existing DefaultCustomFieldValue
                         if ($this->blnEditMode && $this->objCustomField->DefaultCustomFieldValueId) {
                             $objCustomFieldValue = CustomFieldValue::Load($this->objCustomField->DefaultCustomFieldValueId);
                         } else {
                             $objCustomFieldValue = new CustomFieldValue();
                             $objCustomFieldValue->CustomFieldId = $this->objCustomField->CustomFieldId;
                         }
                         // Save the new CustomFieldValue
                         $objCustomFieldValue->ShortDescription = $this->txtDefaultValue->Text;
                         $objCustomFieldValue->Save();
                         // Set the DefaultCustomFieldValueId of the custom field
                         $this->objCustomField->DefaultCustomFieldValueId = $objCustomFieldValue->CustomFieldValueId;
                     } else {
                         $this->objCustomField->DefaultCustomFieldValueId = null;
                         $blnDefaultIsNone = true;
                     }
                 } elseif ($this->lstCustomFieldQtype->SelectedValue == 2) {
                     $this->objCustomField->DefaultCustomFieldValueId = $this->lstDefaultValue->SelectedValue;
                     if ($this->lstDefaultValue->SelectedValue == null) {
                         $blnDefaultIsNone = true;
                     }
                 }
                 // Save the custom field
                 $this->objCustomField->Save();
                 // Update the EntityQtypeCustomFields if they have changed (or if it is a new custom field
                 $this->UpdateEntityQtypeCustomFields();
                 // Update all of the CustomFieldSelections and values for the EntityQtypes
                 if (!$blnDefaultIsNone) {
                     $this->objCustomField->UpdateRequiredFieldSelections();
                     // impove logic for asset customfields
                     if ($this->blnAssetEntityType && $this->rblAllAssetModels->SelectedValue == 2) {
                         // define assets to set default value
                         $chosenAssetModels = array();
                         foreach ($this->arrAssetModels as $chosenAssetModel) {
                             $assetsToFill = Asset::LoadArrayByAssetModelId($chosenAssetModel->AssetModelId);
                             if (count($assetsToFill > 0)) {
                                 foreach ($assetsToFill as $assetToFill) {
                                     array_push($chosenAssetModels, $assetToFill->AssetId);
                                 }
                             }
                         }
                         $chosenAssetModels = implode(",", $chosenAssetModels);
                         if ($chosenAssetModels) {
                             $objDatabase = CustomField::GetDatabase();
                             $strQuery = sprintf("UPDATE `asset_custom_field_helper` SET `cfv_%s`= NULL WHERE `asset_id` NOT IN({$chosenAssetModels});", $this->objCustomField->CustomFieldId);
                             $objDatabase->NonQuery($strQuery);
                         }
                     }
                 }
             } else {
                 $this->objCustomField->DefaultCustomFieldValueId = null;
                 $this->objCustomField->Save();
                 $this->UpdateEntityQtypeCustomFields();
             }
             // If it is a new select Custom Field, then stay to add options
             if (!$this->blnEditMode && $this->objCustomField->CustomFieldQtypeId == 2) {
                 QApplication::Redirect('custom_field_edit.php?intCustomFieldId=' . $this->objCustomField->CustomFieldId);
             } else {
                 QApplication::Redirect('custom_field_list.php');
//.........這裏部分代碼省略.........
開發者ID:proxymoron,項目名稱:tracmor,代碼行數:101,代碼來源:custom_field_edit.php

示例3: LoadByCustomFieldId

 /**
  * Load a single CustomField object,
  * by CustomFieldId Index(es)
  * @param integer $intCustomFieldId
  * @return CustomField
  */
 public static function LoadByCustomFieldId($intCustomFieldId, $objOptionalClauses = null)
 {
     return CustomField::QuerySingle(QQ::Equal(QQN::CustomField()->CustomFieldId, $intCustomFieldId), $objOptionalClauses);
 }
開發者ID:proxymoron,項目名稱:tracmor,代碼行數:10,代碼來源:CustomFieldGen.class.php

示例4: btnSave_Click

 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     try {
         $arrRestrictedFields = array('asset code', 'model', 'category', 'manufacturer', 'location', 'assets', 'name', 'asset model code', 'inventory code', 'quantity', 'company name', 'city', 'state/province', 'country', 'title', 'company', 'email', 'address', 'shipment number', 'ship date', 'ship to company', 'ship to contact', 'ship to address', 'scheduled by', 'status', 'tracking', 'receipt number', 'receive from company', 'receive from contact', 'description', 'account', 'courier', 'account number', 'field name', 'type', 'enabled', 'required', 'role', 'username', 'user role', 'active', 'admin');
         $blnError = false;
         if ($this->chkRequiredFlag->Checked) {
             if ($this->lstCustomFieldQtype->SelectedValue != 2 && $this->txtDefaultValue->Text == '') {
                 $blnError = true;
                 $this->btnCancel->Warning = 'A custom field must have a default value if it is required.';
             }
         }
         if (count($this->lstEntityQtype->SelectedItems) == 0) {
             $blnError = true;
             $this->btnCancel->Warning = 'You must select at least one field in the Apply To list box.';
         }
         if (in_array(strtolower($this->txtShortDescription->Text), $arrRestrictedFields, false)) {
             $blnError = true;
             $this->btnCancel->Warning = sprintf("'%s' is a Tracmor restricted word. Please choose another name for this custom field", $this->txtShortDescription->Text);
         }
         if ($this->blnEditMode) {
             $objCustomFieldDuplicate = CustomField::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::CustomField()->CustomFieldId, $this->objCustomField->CustomFieldId)));
         } else {
             $objCustomFieldDuplicate = CustomField::QuerySingle(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text));
         }
         if ($objCustomFieldDuplicate) {
             $blnError = true;
             $this->btnCancel->Warning = 'A custom field already exists with that name. Please choose another.';
         }
         if (!$blnError) {
             $this->UpdateCustomFieldFields();
             $this->objCustomField->Save();
             // If this field is a required field
             if ($this->objCustomField->RequiredFlag) {
                 // If this custom field is a text or textarea,
                 if ($this->lstCustomFieldQtype->SelectedValue != 2) {
                     // Assign the existing DefaultCustomFieldValue
                     if ($this->blnEditMode && $this->objCustomField->DefaultCustomFieldValueId) {
                         $objCustomFieldValue = CustomFieldValue::Load($this->objCustomField->DefaultCustomFieldValueId);
                     } else {
                         $objCustomFieldValue = new CustomFieldValue();
                         $objCustomFieldValue->CustomFieldId = $this->objCustomField->CustomFieldId;
                     }
                     // Save the new CustomFieldValue
                     $objCustomFieldValue->ShortDescription = $this->txtDefaultValue->Text;
                     $objCustomFieldValue->Save();
                     // Set the DefaultCustomFieldValueId of the custom field
                     $this->objCustomField->DefaultCustomFieldValueId = $objCustomFieldValue->CustomFieldValueId;
                 } elseif ($this->lstCustomFieldQtype->SelectedValue == 2) {
                     $this->objCustomField->DefaultCustomFieldValueId = $this->lstDefaultValue->SelectedValue;
                 }
                 // Save the custom field
                 $this->objCustomField->Save();
                 // Update the EntityQtypeCustomFields if they have changed (or if it is a new custom field
                 $this->UpdateEntityQtypeCustomFields();
                 // Update all of the CustomFieldSelections and values for the EntityQtypes
                 $this->objCustomField->UpdateRequiredFieldSelections();
             } else {
                 $this->objCustomField->DefaultCustomFieldValueId = null;
                 $this->objCustomField->Save();
                 $this->UpdateEntityQtypeCustomFields();
             }
             // If it is a new select Custom Field, then stay to add options
             if (!$this->blnEditMode && $this->objCustomField->CustomFieldQtypeId == 2) {
                 QApplication::Redirect('custom_field_edit.php?intCustomFieldId=' . $this->objCustomField->CustomFieldId);
             } else {
                 QApplication::Redirect('custom_field_list.php');
             }
         }
     } catch (QExtendedOptimisticLockingException $objExc) {
         $this->btnCancel->Warning = sprintf('This custom field has been updated by another user. You must <a href="custom_field_edit.php?intCustomFieldId=%s">Refresh</a> to edit this custom field.', $this->objCustomField->CustomFieldId);
     }
 }
開發者ID:heshuai64,項目名稱:einv2,代碼行數:72,代碼來源:custom_field_edit.php


注:本文中的CustomField::QuerySingle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。