本文整理汇总了PHP中Location::LoadByShortDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::LoadByShortDescription方法的具体用法?PHP Location::LoadByShortDescription怎么用?PHP Location::LoadByShortDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::LoadByShortDescription方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: btnSave_Click
protected function btnSave_Click($strFormId, $strControlId, $strParameter)
{
if ($objLocation = Location::LoadByShortDescription($this->txtShortDescription->Text)) {
$this->txtShortDescription->Warning = 'This Location Name is already in use. Please try another.';
} else {
try {
$this->UpdateLocationFields();
$this->objLocation->Save();
$this->RedirectToListPage();
} catch (QExtendedOptimisticLockingException $objExc) {
$this->btnCancel->Warning = sprintf('This location has been updated by another user. You must <a href="location_edit.php?intLocationId=%s">Refresh</a> to edit this location.', $this->objLocation->LocationId);
}
}
}
示例2: sprintf
require_once '../includes/prepend.inc.php';
QApplication::Authenticate();
$objDatabase = Location::GetDatabase();
// Load the Location Object by location_id=6
$objLocation = Location::Load(6);
// If the location exist or already updated
if ($objLocation && $objLocation->ShortDescription != 'Archived') {
$objDatabase->NonQuery("SET FOREIGN_KEY_CHECKS = 0;");
// Update location_id=6 to 'Archived'
$strQuery = sprintf("UPDATE `location`\n SET `short_description`='Archived', `created_by`=NULL, `modified_by`=NULL, `creation_date`=NULL, `modified_date`=NULL, `long_description`=NULL\n WHERE `location_id`='6';");
$objDatabase->NonQuery($strQuery);
// Save existing location with new location_id
$strQuery = sprintf("INSERT INTO `location` VALUES\n (NULL, '{$objLocation->ShortDescription}', '{$objLocation->LongDescription}', '{$objLocation->CreatedBy}', '" . $objLocation->CreationDate->PHPDate('Y-m-d H:i:s') . "', '{$objLocation->ModifiedBy}', '{$objLocation->ModifiedDate}');");
// Save and reload old location
$objDatabase->NonQuery($strQuery);
$objNewLocation = Location::LoadByShortDescription($objLocation->ShortDescription);
// Get new location_id
$objNewLocationId = $objNewLocation->LocationId;
// Update all foreign keys and links
// Added `modified_date`=`modified_date` to avoid the attribute "ON UPDATE CURRENT_TIMESTAMP"
$strQuery = sprintf("UPDATE `asset`\n SET `location_id`='%s', `modified_date`=`modified_date`\n WHERE `location_id`='6';", $objNewLocationId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("UPDATE `audit_scan`\n SET `location_id`='%s'\n WHERE `location_id`='6';", $objNewLocationId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("UPDATE `inventory_location`\n SET `location_id`='%s', `modified_date`=`modified_date`\n WHERE `location_id`='6';", $objNewLocationId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("UPDATE `asset_transaction`\n SET `source_location_id`='%s', `modified_date`=`modified_date`\n WHERE `source_location_id`='6';", $objNewLocationId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("UPDATE `asset_transaction`\n SET `destination_location_id`='%s', `modified_date`=`modified_date`\n WHERE `destination_location_id`='6';", $objNewLocationId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("UPDATE `inventory_transaction`\n SET `source_location_id`='%s', `modified_date`=`modified_date`\n WHERE `source_location_id`='6';", $objNewLocationId);
示例3: Transaction
if (QApplication::$TracmorSettings->StrictCheckinPolicy == '1' && $objUserAccount->UserAccountId != QApplication::$objUserAccount->UserAccountId) {
$blnError = true;
$strWarning .= $strAssetCode . " - That asset was not checked out by the current user.<br />";
} else {
$arrCheckedAssetCode[] = $strAssetCode;
}
}
if (!$blnError && $objNewAsset instanceof Asset) {
$objAssetArray[] = $objNewAsset;
}
} else {
$strWarning .= "Please enter an asset tag.<br />";
}
}
if (!$blnError) {
$objDestinationLocation = Location::LoadByShortDescription($_POST['destination_location']);
if (!$objDestinationLocation) {
$blnError = true;
$strWarning .= $_POST['destination_location'] . " - Destination Location does not exist.<br />";
} else {
$intDestinationLocationId = $objDestinationLocation->LocationId;
// There is a 1 to Many relationship between Transaction and AssetTransaction so each Transaction can have many AssetTransactions.
$objTransaction = new Transaction();
$objTransaction->EntityQtypeId = EntityQtype::Asset;
$objTransaction->TransactionTypeId = 2;
// Check in
$objTransaction->Save();
foreach ($objAssetArray as $objAsset) {
$objAssetTransaction = new AssetTransaction();
$objAssetTransaction->AssetId = $objAsset->AssetId;
$objAssetTransaction->TransactionId = $objTransaction->TransactionId;
示例4: elseif
} elseif ($objNewAsset->LinkedFlag) {
$blnError = true;
$strWarning .= $strAssetCode . " - That asset is locked to a parent asset.";
} elseif (!($objNewAsset->LocationId == 5 || $objNewAsset->LocationId == 2)) {
$blnError = true;
$strWarning .= $strAssetCode . " - That asset has already been received.<br />";
} elseif (!($objPendingReceipt = AssetTransaction::PendingReceipt($objNewAsset->AssetId))) {
$blnError = true;
$strWarning .= $strAssetCode . " - That asset must be in a pending receipt.<br />";
} elseif ($objNewAsset->CheckedOutFlag) {
$blnError = true;
$strWarning .= $strAssetCode . " - That asset is checked out.<br />";
} elseif ($objNewAsset->ReservedFlag) {
$blnError = true;
$strWarning .= $strAssetCode . " - That asset is reserved.<br />";
} elseif (!($objDestinationLocation = Location::LoadByShortDescription($strLocation))) {
$blnError = true;
$strWarning .= $strLocation . " - Destination Location does not exist.<br />";
} else {
if (!array_key_exists($objNewAsset->AssetId, $arrLocation)) {
$arrLocation[$objNewAsset->AssetId] = $objDestinationLocation;
$arrCheckedAssetCodeLocation[] = $strAssetCodeLocation;
} else {
$blnError = true;
$strWarning .= $strAssetCode . " - That is a duplicate asset tag.<br />";
}
}
if (!$blnError && $objNewAsset instanceof Asset) {
$objAssetArray[] = $objNewAsset;
$arrPendingReceiptId[] = $objPendingReceipt->Transaction->Receipt->ReceiptId;
$objAssetTransactionArray[$objNewAsset->AssetId] = $objPendingReceipt;