本文整理汇总了PHP中Shipment::hasCompany方法的典型用法代码示例。如果您正苦于以下问题:PHP Shipment::hasCompany方法的具体用法?PHP Shipment::hasCompany怎么用?PHP Shipment::hasCompany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shipment
的用法示例。
在下文中一共展示了Shipment::hasCompany方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: btnMassDelete_Click
protected function btnMassDelete_Click($strFormId, $strControlId, $strParameter)
{
$items = $this->dtgCompany->getSelected('CompanyId');
// Show confirm "Are you sure you want to {delete/edit} these objects?"
if (count($items) > 0) {
$this->lblMassActionError->Text = "";
if (!$this->dlgMassDelete->Display) {
$arrToBeSkipped = array();
foreach ($items as $item) {
// Check if any Shipments or Receipts include selected contact
if (Shipment::hasCompany($item)) {
// append $item to be skipped
$arrToBeSkipped[] = $item;
} else {
$this->arrToDelete[] = $item;
}
}
if (count($arrToBeSkipped) > 0) {
if (count($arrToBeSkipped) == 1) {
$toBe = 'is';
$ending1 = 'y';
$ending2 = '';
} else {
$toBe = 'are';
$ending1 = 'ies';
$ending2 = 's';
}
// Show dialog box "There are {number} {entity_type}s that are not able to be deleted. Would you like to continue the deletion process, skipping these items?"
$this->dlgMassDelete->Text = sprintf("There %s %s compan%s that %s not able to be deleted.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t Would you like to continue the deletion process,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t skipping these item%s?<br />", $toBe, count($arrToBeSkipped), $ending1, $toBe, $ending2);
$this->dlgMassDelete->ShowDialogBox();
} else {
if (count($this->arrToDelete) > 0) {
try {
// Get an instance of the database
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
foreach ($this->arrToDelete as $intCompanyId) {
Company::Load($intCompanyId)->Delete();
}
$objDatabase->TransactionCommit();
$this->arrToDelete = array();
QApplication::Redirect('');
} catch (QMySqliDatabaseException $objExc) {
$objDatabase->TransactionRollback();
throw new QDatabaseException();
}
}
}
// print_r(get_class_methods(get_class($this->dlgDelete)));exit;//$this->dlgDelete->ShowDialogBox() ;
}
} else {
$this->lblMassActionError->Text = "You haven't chosen any Company to Delete";
}
}