NotEqual() public static method

public static NotEqual ( QQNode $objQueryNode, $mixValue )
$objQueryNode QQNode
Example #1
0
 public function testOrderByCondition()
 {
     $objItems = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQ::NotEqual(QQN::Person()->LastName, 'Smith'), QQN::Person()->FirstName)));
     $this->assertEqual($objItems[0]->FirstName . " " . $objItems[0]->LastName, "Alex Smith");
     $this->assertEqual($objItems[1]->FirstName . " " . $objItems[1]->LastName, "Jennifer Smith");
     $this->assertEqual($objItems[2]->FirstName . " " . $objItems[2]->LastName, "Wendy Smith");
     $this->assertEqual($objItems[3]->FirstName . " " . $objItems[3]->LastName, "Ben Robinson");
 }
Example #2
0
 public static function GenerateStewardship()
 {
     $dttDate = new QDateTime('2004-01-05');
     print 'Generating Stewardship... ';
     $objFundArray = StewardshipFund::QueryArray(QQ::NotEqual(QQN::StewardshipFund()->Id, 1));
     while ($dttDate->IsEarlierThan(QDateTime::Now())) {
         print $strDate = '[' . $dttDate->ToString('YYYY-MMM-DD') . ']';
         $intCheckCount = rand(10, 55);
         $arrStack = array();
         for ($i = 0; $i < floor(($intCheckCount - 1) / 25) + 1; $i++) {
             $arrStack[] = null;
         }
         $objBatch = StewardshipBatch::Create(self::GenerateFromArray(self::$StewardshipUserArray), $arrStack, self::GenerateFromArray(array('Weekend T/O', 'Weekend Giving', 'Tithes and Offerings', 'Tithes & Offerings', null)), $dttDate, $dttDate);
         $intStackCount = $objBatch->CountStewardshipStacks();
         $dttStart = new QDateTime($dttDate);
         $dttStart->SetTime(8, 0, 0);
         $dttEnd = new QDateTime($dttDate);
         $dttEnd->SetTime(16, 0, 0);
         for ($i = 0; $i < $intStackCount; $i++) {
             if ($i == $intStackCount - 1) {
                 if ($intCheckCount % 25 == 0) {
                     $intChecksInStackCount = 25;
                 } else {
                     $intChecksInStackCount = $intCheckCount % 25;
                 }
             } else {
                 $intChecksInStackCount = 25;
             }
             $objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($objBatch->Id, $i + 1);
             for ($j = 0; $j < $intChecksInStackCount; $j++) {
                 $objHousehold = self::GenerateFromArray(self::$HouseholdArray);
                 $objHouseholdParticipant = self::GenerateFromArray($objHousehold->GetHouseholdParticipationArray());
                 $mixAmountArray = array();
                 if (rand(0, 50)) {
                     $mixAmountArray[] = array(1, rand(1000, 150000) / 100);
                 } else {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 if (!rand(0, 20)) {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 $objContribution = StewardshipContribution::Create($objBatch->CreatedByLogin, $objHouseholdParticipant->Person, $objStack, StewardshipContributionType::Check, rand(1000, 9999), $mixAmountArray, self::GenerateDateTime($dttStart, $dttEnd), null, null, null, false);
                 if (rand(0, 5)) {
                     $objContribution->SaveImageFile(__DEVTOOLS_CLI__ . '/datagen_file_assets/check.tif');
                 }
             }
             $objStack->RefreshActualTotalAmount();
         }
         if ($intCheckCount != $objBatch->CountStewardshipContributions()) {
             print "\r\n" . 'MISCOUNT: ' . $objBatch->Id . "\r\n";
         }
         $objBatch->RefreshActualTotalAmount();
         $dttDate->Day += 7;
         print str_repeat(chr(8) . ' ' . chr(8), strlen($strDate));
     }
     print "Done.\r\n";
 }
Example #3
0
 public function dtgComments_Bind()
 {
     // Only bind comments about this person
     $objCondition = QQ::Equal(QQN::Comment()->PersonId, $this->objPerson->Id);
     // Do NOT allow viewing of Confidential notes if the Login isn't allowed to see them
     if (!QApplication::$Login->IsPermissionAllowed(PermissionType::AccessConfidentialNotes)) {
         $objCondition = QQ::AndCondition($objCondition, QQ::NotEqual(QQN::Comment()->CommentPrivacyTypeId, CommentPrivacyType::Confidential));
     }
     // Perform the Bind
     $this->dtgComments->MetaDataBinder($objCondition);
 }
Example #4
0
 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');
             }
         }
     } 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);
     }
 }
Example #5
0
 protected function dtgInventoryTransaction_Bind()
 {
     $this->ctlInventoryEdit->dtgInventoryTransaction->TotalItemCount = InventoryTransaction::CountShipmentReceiptByInventoryModelId($this->ctlInventoryEdit->objInventoryModel->InventoryModelId, false);
     if ($this->ctlInventoryEdit->dtgInventoryTransaction->TotalItemCount === 0) {
         $this->ctlInventoryEdit->dtgInventoryTransaction->ShowHeader = false;
     } else {
         $this->ctlInventoryEdit->dtgInventoryTransaction->ShowHeader = true;
     }
     $objClauses = array();
     if ($objClause = $this->ctlInventoryEdit->dtgInventoryTransaction->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->ctlInventoryEdit->dtgInventoryTransaction->LimitClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = QQ::Expand(QQN::InventoryTransaction()->Transaction->TransactionType)) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = QQ::Expand(QQN::InventoryTransaction()->SourceLocation)) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = QQ::Expand(QQN::InventoryTransaction()->DestinationLocation)) {
         array_push($objClauses, $objClause);
     }
     $objCondition = QQ::AndCondition(QQ::Equal(QQN::InventoryTransaction()->InventoryLocation->InventoryModelId, $this->ctlInventoryEdit->objInventoryModel->InventoryModelId), QQ::NotEqual(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 6), QQ::NotEqual(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 7));
     $this->ctlInventoryEdit->dtgInventoryTransaction->DataSource = InventoryTransaction::QueryArray($objCondition, $objClauses);
 }
Example #6
0
//////////////////////
$objForumArray = Forum::LoadAll();
$objForumTopicArray = array();
while (QDataGen::DisplayWhileTask('Generating Forum Topics', GENERATE_FORUM_TOPICS)) {
    $objForum = QDataGen::GenerateFromArray($objForumArray);
    $strName = QDataGen::GenerateTitle(4, 12);
    $strFirstMessageText = QDataGen::GenerateContent(rand(1, 5));
    $objPerson = Person::Load(rand(1, $intMaxPersonId));
    $dttDateTime = QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
    $objTopic = $objForum->PostTopic($strName, $strFirstMessageText, $objPerson, $dttDateTime);
    $objForumTopicArray[] = $objTopic;
}
//////////////////////
// Qcodo Package Manager
//////////////////////
$objPackageCategories = PackageCategory::QueryArray(QQ::NotEqual(QQN::PackageCategory()->Token, 'issues'));
while (QDataGen::DisplayWhileTask('Generating QPM Packages...', GENERATE_QPM)) {
    $objPackage = new Package();
    $objPackage->PackageCategory = QDataGen::GenerateFromArray($objPackageCategories);
    $objPackage->Name = QDataGen::GenerateTitle(1, 3);
    $objPackage->Token = Package::SanitizeForToken($objPackage->Name);
    while (Package::LoadByToken($objPackage->Token)) {
        $objPackage->Name = QDataGen::GenerateTitle(1, 3);
        $objPackage->Token = Package::SanitizeForToken($objPackage->Name);
    }
    $objPackage->Description = QDataGen::GenerateContent(rand(1, 3), 20, 80);
    $objPackage->Save();
    $objPackage->CreateTopicAndTopicLink(Person::Load(rand(1, $intMaxPersonId)));
    $intContributionCount = rand(1, 10);
    for ($intContribution = 0; $intContribution < $intContributionCount; $intContribution++) {
        while (PackageContribution::LoadByPackageIdPersonId($objPackage->Id, $objPerson->Id)) {
Example #7
0
 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);
     }
 }
Example #8
0
 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     // Do not allow empty/whitespace for role name
     if (!trim($this->txtShortDescription->Text)) {
         $blnError = true;
         $this->txtShortDescription->Warning = QApplication::Translate('You must enter a Role Name.');
     }
     // Role Duplicate checks
     if ($this->blnEditMode) {
         $objRoleDuplicate = Role::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::Role()->ShortDescription, trim($this->txtShortDescription->Text)), QQ::NotEqual(QQN::Role()->RoleId, $this->objRole->RoleId)));
     } else {
         $objRoleDuplicate = Role::QuerySingle(QQ::Equal(QQN::Role()->ShortDescription, trim($this->txtShortDescription->Text)));
     }
     if ($objRoleDuplicate) {
         $blnError = true;
         $this->txtShortDescription->Warning = QApplication::Translate('That Role Name is already in use.');
     }
     if (!$blnError) {
         try {
             // Get an instance of the database
             $objDatabase = QApplication::$Database[1];
             // Begin a MySQL Transaction to be either committed or rolled back
             $objDatabase->TransactionBegin();
             // Update the role fields
             $this->UpdateRoleFields();
             // Save the role
             $this->objRole->Save();
             // Update the authorizations for this role
             // This must be done after saving the Role. If it is new, we need a RoleId first.
             $this->UpdateAuthorizations();
             // Update the Role Field Authorization for this role
             $this->UpdateFieldLevelAuthorizations();
             // Update the Role Transaction Level Authorization for this role
             $this->UpdateTransactionLevelAuthorizations();
             // Commit the transaction to the database
             $objDatabase->TransactionCommit();
             QApplication::Redirect('role_list.php');
         } catch (QExtendedOptimisticLockingException $objExc) {
             // Roll back the transaction from the database
             $objDatabase->TransactionRollback();
             $this->btnCancel->Warning = sprintf('This role has been updated by another user. You must <a href="role_edit.php?intRoleId=%s">Refresh</a> to edit this role.', $this->objRole->RoleId);
         }
     }
 }
 } catch (Exception $objEx) {
     if (strstr($objEx->getMessage(), 'Duplicate')) {
         $arrDuplicateTexts = NarroText::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroText()->TextValue, $objText->TextValue), QQ::NotEqual(QQN::NarroText()->TextId, $objText->TextId)));
         error_log(sprintf('Found duplicates for "%s": %d', $objText->TextValue, count($arrDuplicateTexts)));
         foreach ($arrDuplicateTexts as $objDuplicateText) {
             if ($objText->TextValue !== $objDuplicateText->TextValue) {
                 continue;
             }
             foreach (NarroTextComment::LoadArrayByTextId($objDuplicateText->TextId) as $objTextComment) {
                 error_log('Moving text comment');
                 $objTextComment->TextId = $objText->TextId;
                 $objTextComment->Save();
             }
             foreach (NarroSuggestion::LoadArrayByTextId($objDuplicateText->TextId) as $objSuggestion) {
                 error_log('Moving text from suggestion');
                 $arrDuplicateSuggestions = NarroSuggestion::QueryArray(QQ::AndCondition(QQ::NotEqual(QQN::NarroSuggestion()->SuggestionId, $objSuggestion->SuggestionId), QQ::Equal(QQN::NarroSuggestion()->SuggestionValue, $objSuggestion->SuggestionValue), QQ::Equal(QQN::NarroSuggestion()->TextId, $objText->TextId), QQ::Equal(QQN::NarroSuggestion()->LanguageId, $objSuggestion->LanguageId)));
                 if (count($arrDuplicateSuggestions)) {
                     error_log(sprintf('Found duplicates for "%s": %d', $objSuggestion->SuggestionValue, count($arrDuplicateSuggestions)));
                     foreach ($arrDuplicateSuggestions as $objDuplicateSuggestion) {
                         if ($objSuggestion->SuggestionValue !== $objDuplicateSuggestion->SuggestionValue) {
                             continue;
                         }
                         foreach (NarroSuggestionComment::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionComment) {
                             error_log('Moving suggestion comment');
                             $objSuggestionComment->SuggestionId = $objSuggestion->SuggestionId;
                             $objSuggestionComment->Save();
                         }
                         foreach (NarroSuggestionVote::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionVote) {
                             error_log('Moving suggestion vote');
                             $objSuggestionVote->SuggestionId = $objSuggestion->SuggestionId;
                             $objSuggestionVote->Save();
Example #10
0
 public static function CountAllActive()
 {
     return parent::QueryCount(QQ::AndCondition(QQ::NotEqual(QQN::NarroLanguage()->LanguageCode, NarroLanguage::SOURCE_LANGUAGE_CODE), QQ::Equal(QQN::NarroLanguage()->Active, 1)));
 }
Example #11
0
	</ul>
	<h2>Select all People, Ordered by Last Name then First Name, Limited to the first 4 results</h2>
	<p><em>Combining QQ::OrderBy and QQ::LimitInfo</em></p>
	<ul>
<?php 
$objPersonArray = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::LimitInfo(4)));
foreach ($objPersonArray as $objPerson) {
    _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false);
}
?>
	</ul>
	<h2>Select all People, those with last name Smith first, then ordered by First Name</h2>
	<p><em>Using a QQ::Condition as an ORDER BY clause</em></p>
	<ul>
<?php 
$objPersonArray = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQ::NotEqual(QQN::Person()->LastName, 'Smith'), QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {
    _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false);
}
?>
	</ul>
	<h2>Select all Projects and the Count of Team Members (if applicable)</h2>
	<p><em>GROUP BY in action</em></p>
	<ul>
<?php 
$objProjectArray = Project::QueryArray(QQ::All(), QQ::Clause(QQ::GroupBy(QQN::Project()->Id), QQ::Count(QQN::Project()->PersonAsTeamMember->PersonId, 'team_member_count')));
foreach ($objProjectArray as $objProject) {
    _p('<li>' . $objProject->Name . ' (' . $objProject->GetVirtualAttribute('team_member_count') . ' team members)' . '</li>', false);
}
?>
	</ul>
Example #12
0
 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     if ($this->txtPassword->Text != $this->txtPasswordConfirm->Text) {
         $blnError = true;
         $this->txtPassword->Warning = "The passwords do not match, please re-enter.";
         $this->txtPassword->Text = "";
         $this->txtPasswordConfirm->Text = "";
     } else {
         if (!($this->blnEditMode && $this->txtPassword->Text == '') && strlen($this->txtPassword->Text) < 8) {
             $blnError = true;
             $this->txtPassword->Warning = "Password must be at least 8 characters.";
         }
     }
     // Check for a valid email address
     if (!filter_var($this->txtEmailAddress->Text, FILTER_VALIDATE_EMAIL)) {
         $blnError = true;
         $this->txtEmailAddress->Warning = 'Please enter a valid email address';
     }
     // Do not allow duplicate email addresses
     $objUserAccountDupe = UserAccount::LoadByEmailAddress($this->txtEmailAddress->Text);
     if ($this->blnEditMode && $objUserAccountDupe && $objUserAccountDupe->UserAccountId != $this->objUserAccount->UserAccountId || !$this->blnEditMode && $objUserAccountDupe) {
         $blnError = true;
         $this->txtEmailAddress->Warning = 'A user account with that email address already exists.';
     }
     $intUserLimit = is_numeric(QApplication::$TracmorSettings->UserLimit) ? QApplication::$TracmorSettings->UserLimit : 99999;
     // Do not allow creation of a new active user if user limit will be exceeded
     if (!$this->blnEditMode && $this->chkActiveFlag->Checked) {
         if (UserAccount::CountActive() >= $intUserLimit) {
             $blnError = true;
             $this->chkActiveFlag->Warning = "You have exceeded your user limit.";
         }
     }
     // Do not allow activation of a disabled user if the user limit will be exceeded
     if ($this->blnEditMode && $this->chkActiveFlag->Checked && !$this->objUserAccount->ActiveFlag) {
         if (UserAccount::CountActive() >= $intUserLimit) {
             $blnError = true;
             $this->chkActiveFlag->Warning = "You have exceeded your user limit.";
         }
     }
     // Do not allow duplicate usernames
     if ($this->blnEditMode) {
         $objUserAccountDuplicate = UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text), QQ::NotEqual(QQN::UserAccount()->UserAccountId, $this->objUserAccount->UserAccountId)));
     } else {
         $objUserAccountDuplicate = UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text));
     }
     if ($objUserAccountDuplicate) {
         $blnError = true;
         $this->btnCancel->Warning = 'A user account already exists with that username. Please choose another.';
     }
     // Do not allow deactivation of owner account
     $this->objOwnerAccount = UserAccount::LoadOwner();
     if ($this->blnEditMode && $this->objOwnerAccount && $this->objOwnerAccount->UserAccountId == $this->objUserAccount->UserAccountId && !$this->chkActiveFlag->Checked) {
         $blnError = true;
         $this->btnCancel->Warning = 'This user cannot be deactivated because they are the account owner.';
     }
     if (!$blnError) {
         try {
             $this->UpdateUserAccountFields();
             $this->objUserAccount->Save();
             QApplication::Redirect('user_account_list.php');
         } catch (QExtendedOptimisticLockingException $objExc) {
             $this->btnCancel->Warning = sprintf('This user account has been updated by another user. You must <a href="user_account_edit.php?intUserAccountId=%s">Refresh</a> to edit this user account.', $this->objUserAccount->UserAccountId);
         }
     }
 }
Example #13
0
 public function dtgPeople_Bind()
 {
     $objConditions = QQ::NotEqual(QQN::Person()->Id, $this->objPerson->Id);
     $objClauses = array();
     if ($strName = trim($this->txtName->Text)) {
         Person::PrepareQqForSearch($strName, $objConditions, $objClauses);
     }
     if ($strName = trim($this->txtFirstName->Text)) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->FirstName, $strName . '%'));
     }
     if ($strName = trim($this->txtLastName->Text)) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->LastName, $strName . '%'));
     }
     if ($strName = trim($this->txtCity->Text)) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryCityText, $strName . '%'));
     }
     if ($strName = trim($this->txtEmail->Text)) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryEmail->Address, $strName . '%'));
     }
     if ($strName = trim($this->txtPhone->Text)) {
         $objClauses[] = QQ::Distinct();
         $objConditions = QQ::AndCondition($objConditions, QQ::OrCondition(QQ::Like(QQN::Person()->Phone->Number, $strName . '%'), QQ::Like(QQN::Person()->HouseholdParticipation->Household->Address->Phone->Number, $strName . '%')));
     }
     if (!is_null($strValue = $this->lstGender->SelectedValue)) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->Gender, $strValue));
     }
     if (!is_null($strValue = $this->lstMemberStatus->SelectedValue)) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->MembershipStatusTypeId, $strValue));
     }
     $this->dtgPeople->MetaDataBinder($objConditions, $objClauses);
 }
Example #14
0
 /**
  * This returns all Module objects except for the Home module
  * It is intended to use for the role_edit page because the home module always grants full authorization
  *
  * @return Array Module Objects
  */
 public static function LoadAllButHome()
 {
     $objModuleArray = Module::QueryArray(QQ::NotEqual(QQN::Module()->ModuleId, 1));
     return $objModuleArray;
 }
Example #15
0
 public function dtgIssues_Bind()
 {
     $objCondition = QQ::All();
     if (trim($this->txtSummary->Text)) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::Issue()->Title, '%' . trim($this->txtSummary->Text) . '%'));
     }
     if ($intValue = $this->lstCategory->SelectedValue) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::Issue()->IssueFieldValue->IssueFieldId, $this->objIssueFieldForCategory->Id), QQ::Equal(QQN::Issue()->IssueFieldValue->IssueFieldOptionId, $intValue));
     }
     if ($intValue = $this->lstStatus->SelectedValue) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::Issue()->IssueStatusTypeId, $intValue));
     }
     if ($intValue = $this->lstPriority->SelectedValue) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::Issue()->IssuePriorityTypeId, $intValue));
     }
     if (trim($this->txtPostedBy->Text)) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::Issue()->PostedByPerson->DisplayName, trim($this->txtPostedBy->Text) . '%'));
     }
     if (trim($this->txtAssignedTo->Text)) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::Issue()->AssignedToPerson->DisplayName, trim($this->txtAssignedTo->Text) . '%'));
     }
     if (!$this->chkIncludeClosed->Checked) {
         $objCondition = QQ::AndCondition($objCondition, QQ::NotEqual(QQN::Issue()->IssueStatusTypeId, IssueStatusType::Closed));
     }
     $this->dtgIssues->TotalItemCount = Issue::QueryCount($objCondition);
     $objClauses = array();
     if ($objClause = $this->dtgIssues->LimitClause) {
         $objClauses[] = $objClause;
     }
     if ($objClause = $this->dtgIssues->OrderByClause) {
         $objClauses[] = $objClause;
     }
     $this->dtgIssues->DataSource = Issue::QueryArray($objCondition, $objClauses);
 }
 public function dtgFile_SetConditions()
 {
     if ($this->txtSearch->Text == '') {
         $objCommonCondition = QQ::AndCondition(QQ::Equal(QQN::NarroFileProgress()->File->Active, 1), QQ::Equal(QQN::NarroFileProgress()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroFileProgress()->File->ProjectId, $this->objProject->ProjectId));
     } else {
         $objCommonCondition = QQ::AndCondition(QQ::Equal(QQN::NarroFileProgress()->File->Active, 1), QQ::Equal(QQN::NarroFileProgress()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroFileProgress()->File->ProjectId, $this->objProject->ProjectId), QQ::Like(QQN::NarroFileProgress()->File->FileName, sprintf('%%%s%%', $this->txtSearch->Text)));
     }
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if (!$this->chkShowHierarchy->Checked) {
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = $objCommonCondition;
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     } elseif ($this->objParentFile) {
         $objParentCondition = QQ::Equal(QQN::NarroFileProgress()->File->ParentId, $this->objParentFile->FileId);
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition);
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     } else {
         $objParentCondition = QQ::IsNull(QQN::NarroFileProgress()->File->ParentId);
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition);
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     }
     $this->MarkAsModified();
 }
Example #17
0
 public function __construct($strDate, $objParentObject, NarroProject $objProject = null, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     $this->strTemplate = dirname(__FILE__) . '/' . __CLASS__ . '.tpl.php';
     $this->blnAutoRenderChildren = true;
     // Tabs
     $this->tabTop = new QTabs($this);
     $pnlTranslators = new NarroUserDataGrid($this->tabTop);
     $pnlTranslators->CssClass = 'datagrid';
     $colUsername = $pnlTranslators->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Translations'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlTranslators->SortColumnIndex = 1;
     $pnlTranslators->ShowHeader = false;
     $pnlTranslators->SortDirection = 1;
     $pnlTranslators->AddColumn($colCnt);
     $pnlTranslators->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroSuggestionAsUser->Created, $strDate), QQ::Equal(QQN::NarroUser()->NarroSuggestionAsUser->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID), $objProject ? QQ::Equal(QQN::NarroUser()->NarroSuggestionAsUser->Text->NarroContextAsText->ProjectId, $objProject->ProjectId) : QQ::All());
     $pnlTranslators->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroSuggestionAsUser->SuggestionId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $pnlReviewers = new NarroUserDataGrid($this->tabTop);
     $pnlReviewers->CssClass = 'datagrid';
     $colUsername = $pnlReviewers->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Reviewers'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlReviewers->SortColumnIndex = 1;
     $pnlReviewers->ShowHeader = false;
     $pnlReviewers->SortDirection = 1;
     $pnlReviewers->AddColumn($colCnt);
     $pnlReviewers->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroContextInfoAsValidatorUser->Modified, $strDate), QQ::Equal(QQN::NarroUser()->NarroContextInfoAsValidatorUser->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID), $objProject ? QQ::Equal(QQN::NarroUser()->NarroContextInfoAsValidatorUser->Context->ProjectId, $objProject->ProjectId) : QQ::All());
     $pnlReviewers->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroContextInfoAsValidatorUser->ValidSuggestionId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $pnlVoters = new NarroUserDataGrid($this->tabTop);
     $pnlVoters->CssClass = 'datagrid';
     $colUsername = $pnlVoters->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Reviewers'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlVoters->SortColumnIndex = 1;
     $pnlVoters->ShowHeader = false;
     $pnlVoters->SortDirection = 1;
     $pnlVoters->AddColumn($colCnt);
     $pnlVoters->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroSuggestionVoteAsUser->Created, $strDate), QQ::Equal(QQN::NarroUser()->NarroSuggestionVoteAsUser->Suggestion->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID), $objProject ? QQ::Equal(QQN::NarroUser()->NarroSuggestionVoteAsUser->Suggestion->Text->NarroContextAsText->ProjectId, $objProject->ProjectId) : QQ::All());
     $pnlVoters->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroSuggestionVoteAsUser->SuggestionId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $pnlComments = new NarroUserDataGrid($this->tabTop);
     $pnlComments->CssClass = 'datagrid';
     $colUsername = $pnlComments->MetaAddColumn(QQN::NarroUser()->Username);
     $colUsername->HtmlEntities = false;
     $colUsername->Html = '<?=NarroLink::UserProfile($_ITEM->UserId, $_ITEM->Username)?>';
     $colCnt = new QDataGridColumn(t('Reviewers'));
     $colCnt->Html = '<?=$_ITEM->GetVirtualAttribute("suggestion_cnt")?>';
     $pnlComments->SortColumnIndex = 1;
     $pnlComments->ShowHeader = false;
     $pnlComments->SortDirection = 1;
     $pnlComments->AddColumn($colCnt);
     $pnlComments->AdditionalConditions = QQ::AndCondition(QQ::GreaterOrEqual(QQN::NarroUser()->NarroTextCommentAsUser->Created, $strDate), QQ::Equal(QQN::NarroUser()->NarroTextCommentAsUser->LanguageId, QApplication::GetLanguageId()), QQ::NotEqual(QQN::NarroUser()->UserId, NarroUser::ANONYMOUS_USER_ID));
     $pnlComments->AdditionalClauses = array(QQ::Count(QQN::NarroUser()->NarroTextCommentAsUser->TextCommentId, 'suggestion_cnt'), QQ::GroupBy(QQN::NarroUser()->UserId));
     $this->tabTop->Headers = array(t('Translators'), t('Reviewers'), t('Voters'), t('Comments'));
 }
Example #18
0
 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     try {
         $blnError = false;
         if (trim($this->txtShortDescription->Text) == "") {
             $this->txtShortDescription->Warning = 'Short description is required';
             $blnError = true;
         }
         if (!$this->blnEditMode) {
             if ($this->txtAddressShortDescription->Text) {
                 if (!$this->txtAddress1->Text) {
                     $this->txtAddress1->Warning = 'Address is a required field.';
                     $blnError = true;
                 }
                 if (!$this->txtCity->Text) {
                     $this->txtCity->Warning = 'City is a required field.';
                     $blnError = true;
                 }
                 if (!$this->txtPostalCode->Text) {
                     $this->txtPostalCode->Warning = 'Postal Code is a required field.';
                     $blnError = true;
                 }
                 if (!$this->lstCountry->SelectedValue) {
                     $this->lstCountry->Warning = 'Country is a required field.';
                     $blnError = true;
                 }
             } elseif ($this->txtAddress1->Text || $this->txtAddress2->Text || $this->txtCity->Text || $this->lstStateProvince->SelectedValue || $this->txtPostalCode->Text || $this->lstCountry->SelectedValue) {
                 $this->txtAddressShortDescription->Warning = 'Address Name is a required field.';
                 return;
             }
         }
         if ($blnError) {
             return;
         }
         // Do not allow duplicate Company names
         if ($this->blnEditMode) {
             $objCompanyDuplicate = Company::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::Company()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::Company()->CompanyId, $this->objCompany->CompanyId)));
         } else {
             $objCompanyDuplicate = Company::QuerySingle(QQ::Equal(QQN::Company()->ShortDescription, $this->txtShortDescription->Text));
         }
         if ($objCompanyDuplicate) {
             $blnError = true;
             $this->txtShortDescription->Warning = 'A company with that name already exists. Please try another';
             return;
         }
         $this->UpdateCompanyFields();
         $this->objCompany->Save();
         // Assign input values to custom fields
         if ($this->arrCustomFields) {
             // Save the values from all of the custom field controls to save the asset
             CustomField::SaveControls($this->objCompany->objCustomFieldArray, $this->blnEditMode, $this->arrCustomFields, $this->objCompany->CompanyId, 7);
         }
         $this->SaveNewAddress();
         if ($this->blnEditMode) {
             //$this->SetupCompany();
             $this->UpdateCompanyLabels();
             $this->DisplayLabels();
         } elseif (!$this->blnEditMode) {
             QApplication::Redirect('company_edit.php?intCompanyId=' . $this->objCompany->CompanyId);
         }
     } catch (QExtendedOptimisticLockingException $objExc) {
         $this->btnCancel->Warning = sprintf('This company has been updated by another user. You must <a href="company_edit.php?intCompanyId=%s">Refresh</a> to edit this company.', $this->objCompany->CompanyId);
     }
 }
 /**
  * Count InventoryTransactions
  * by InventoryModelId Index(es), but only those transactions that are Shipments or Receipts
  * @param integer $intAssetId
  * @param boolean $blnInclude - include only shipments and receipts or all other transactions
  * @return int
  */
 public static function CountShipmentReceiptByInventoryModelId($intInventoryModelId, $blnInclude = true)
 {
     // Call AssetTransaction::QueryCount to perform the CountByAssetId query
     if ($blnInclude) {
         $arrToReturn = InventoryTransaction::QueryCount(QQ::AndCondition(QQ::Equal(QQN::InventoryTransaction()->InventoryLocation->InventoryModelId, $intInventoryModelId), QQ::OrCondition(QQ::Equal(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 6), QQ::Equal(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 7))));
     } else {
         $arrToReturn = InventoryTransaction::QueryCount(QQ::AndCondition(QQ::Equal(QQN::InventoryTransaction()->InventoryLocation->InventoryModelId, $intInventoryModelId), QQ::NotEqual(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 6), QQ::NotEqual(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 7)));
     }
     return $arrToReturn;
 }
Example #20
0
 /**
  * Count AssetTransactions (excluding transactions for linked assets)
  * by TransactionId Index(es)
  * @param integer $intTransactionId
  * @return int
  */
 public static function CountByTransactionIdLinkedFlag($intTransactionId)
 {
     // Call AssetTransaction::QueryCount to perform the CountByTransactionId query
     return AssetTransaction::QueryCount(QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->TransactionId, $intTransactionId), QQ::NotEqual(QQN::AssetTransaction()->Asset->LinkedFlag, true)));
 }
Example #21
0
 protected function dtgAssetTransaction_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->ctlAssetEdit->dtgAssetTransaction->TotalItemCount = AssetTransaction::CountShipmentReceiptByAssetId($this->ctlAssetEdit->objAsset->AssetId, false);
     if ($this->ctlAssetEdit->dtgAssetTransaction->TotalItemCount === 0) {
         $this->ctlAssetEdit->dtgAssetTransaction->ShowHeader = false;
     } else {
         $this->ctlAssetEdit->dtgAssetTransaction->ShowHeader = true;
     }
     $objClauses = array();
     if ($objClause = $this->ctlAssetEdit->dtgAssetTransaction->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->ctlAssetEdit->dtgAssetTransaction->LimitClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = QQ::Expand(QQN::AssetTransaction()->Transaction->TransactionType)) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation)) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = QQ::Expand(QQN::AssetTransaction()->DestinationLocation)) {
         array_push($objClauses, $objClause);
     }
     $objCondition = QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $this->ctlAssetEdit->objAsset->AssetId), QQ::NotEqual(QQN::AssetTransaction()->Transaction->TransactionTypeId, 6), QQ::NotEqual(QQN::AssetTransaction()->Transaction->TransactionTypeId, 7));
     $this->ctlAssetEdit->dtgAssetTransaction->DataSource = AssetTransaction::QueryArray($objCondition, $objClauses);
 }
Example #22
0
 private function GetAssetsData()
 {
     $objClauses = array();
     array_push($objClauses, QQ::OrderBy(QQN::Myassets()->Title));
     if ($objClause = $this->dtrAssets->LimitClause) {
         array_push($objClauses, $this->dtrAssets->LimitClause);
     }
     if ($this->txtSearchAssets->Text != '') {
         $condition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Myassets()->Title, '%' . $this->txtSearchAssets->Text . '%'), QQ::Like(QQN::Myassets()->Author, '%' . $this->txtSearchAssets->Text . '%'), QQ::Like(QQN::Myassets()->Artist, '%' . $this->txtSearchAssets->Text . '%'), QQ::Like(QQN::Myassets()->Actor, '%' . $this->txtSearchAssets->Text . '%'), QQ::Like(QQN::Myassets()->Director, '%' . $this->txtSearchAssets->Text . '%'), QQ::Like(QQN::Myassets()->Publisher, '%' . $this->txtSearchAssets->Text . '%'), QQ::Like(QQN::Myassets()->Label, '%' . $this->txtSearchAssets->Text . '%'), QQ::Like(QQN::Myassets()->Isbn, '%' . $this->txtSearchAssets->Text . '%')), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User']));
     } else {
         $condition = QQ::AndCondition(QQ::NotEqual(QQN::Myassets()->Asin, ''), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User']));
     }
     $arrResult = Myassets::QueryArray($condition, $objClauses);
     $this->dtrAssets->TotalItemCount = Myassets::QueryCount($condition);
     $this->dtrAssets->DataSource = $arrResult;
 }
 protected function btnSave_Click()
 {
     $blnError = false;
     // Do not allow duplicate depreciation class names
     if ($this->blnEditMode) {
         $objDepreciationClassDuplicate = DepreciationClass::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::DepreciationClass()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::DepreciationClass()->DepreciationClassId, $this->objDepreciationClass->DepreciationClassId)));
     } else {
         $objDepreciationClassDuplicate = DepreciationClass::QuerySingle(QQ::Equal(QQN::DepreciationClass()->ShortDescription, $this->txtShortDescription->Text));
     }
     if ($objDepreciationClassDuplicate) {
         $blnError = true;
         $this->txtShortDescription->Warning = 'This Depreciation Class Name is already in use. Please try another.';
         $this->txtShortDescription->Focus();
     }
     // Enforce positive integer for Life
     if (!preg_match("/^\\d+\$/", $this->txtLife->Text)) {
         $this->btnCancel->Warning = 'Life must be a positive whole number';
         $blnError = true;
     }
     if (!$blnError) {
         $this->UpdateDepreciationClassFields();
         $this->objDepreciationClass->Save();
         QApplication::Redirect('depreciation.php');
     }
 }
Example #24
0
 protected function dtgAudit_Bind()
 {
     if ($this->rblDiscrepancy->SelectedValue == 'discrepancies') {
         $objConditions = QQ::AndCondition(QQ::Equal(QQN::AuditScan()->AuditId, $_GET['intAuditId']), QQ::NotEqual(QQN::AuditScan()->Count, QQN::AuditScan()->SystemCount));
     } else {
         $objConditions = QQ::Equal(QQN::AuditScan()->AuditId, $_GET['intAuditId']);
     }
     $objAuditScanArray = AuditScan::QueryArray($objConditions, QQ::Clause(QQ::Expand(QQN::AuditScan()->Location), $this->dtgAudit->OrderByClause));
     if ($objAuditScanArray) {
         foreach ($objAuditScanArray as $objAuditScan) {
             $objAuditScan->InventoryModel = InventoryModel::QuerySingle(QQ::Equal(QQN::InventoryModel()->InventoryModelId, $objAuditScan->EntityId), QQ::Clause(QQ::Expand(QQN::InventoryModel()->InventoryModelCode)));
         }
     }
     if (count($objAuditScanArray) == 0) {
         $this->dtgAudit->ShowHeader = false;
     } else {
         $this->dtgAudit->ShowHeader = true;
     }
     $this->dtgAudit->DataSource = $objAuditScanArray;
 }
Example #25
0
 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     // Do not allow duplicate Location names
     if ($this->blnEditMode) {
         $objLocationDuplicate = Location::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::Location()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::Location()->LocationId, $this->objLocation->LocationId)));
     } else {
         $objLocationDuplicate = Location::QuerySingle(QQ::Equal(QQN::Location()->ShortDescription, $this->txtShortDescription->Text));
     }
     if ($objLocationDuplicate) {
         $blnError = true;
         $this->txtShortDescription->Warning = 'This Location Name is already in use. Please try another.';
         $this->txtShortDescription->Focus();
     }
     // Check if there is any inventory at this location
     $objInventoryLocation = InventoryLocation::QuerySingle(QQ::Equal(QQN::InventoryLocation()->LocationId, $this->objLocation->LocationId), QQ::Clause(QQ::Sum(QQN::InventoryLocation()->Quantity, 'QuantityTotal')));
     $intInventoryAtLocation = $objInventoryLocation->GetVirtualAttribute('QuantityTotal');
     // Don't allow disabling of locations with assets or inventory quantities
     if ($this->blnEditMode && $this->objLocation->EnabledFlag && !$this->chkEnabled->Checked && (Asset::CountByLocationId($this->objLocation->LocationId) > 0 || $intInventoryAtLocation > 0)) {
         $blnError = true;
         $this->chkEnabled->Warning = 'Location must be empty before disabling.';
         $this->chkEnabled->Focus();
     }
     if (!$blnError) {
         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);
         }
     }
 }
Example #26
0
 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     if ($this->txtPassword->Text != $this->txtPasswordConfirm->Text) {
         $blnError = true;
         $this->txtPassword->Warning = "The passwords do not match, please re-enter.";
         $this->txtPassword->Text = "";
         $this->txtPasswordConfirm->Text = "";
     }
     $intUserLimit = is_numeric(QApplication::$TracmorSettings->UserLimit) ? QApplication::$TracmorSettings->UserLimit : 99999;
     // Do not allow creation of a new active user if user limit will be exceeded
     if (!$this->blnEditMode && $this->chkActiveFlag->Checked) {
         if (UserAccount::CountActive() >= $intUserLimit) {
             $blnError = true;
             $this->chkActiveFlag->Warning = "You have exceeded your user limit.";
         }
     }
     // Do not allow activation of a disabled user if the user limit will be exceeded
     if ($this->blnEditMode && $this->chkActiveFlag->Checked && !$this->objUserAccount->ActiveFlag) {
         if (UserAccount::CountActive() >= $intUserLimit) {
             $blnError = true;
             $this->chkActiveFlag->Warning = "You have exceeded your user limit.";
         }
     }
     // Do not allow duplicate usernames
     if ($this->blnEditMode) {
         $objUserAccountDuplicate = UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text), QQ::NotEqual(QQN::UserAccount()->UserAccountId, $this->objUserAccount->UserAccountId)));
     } else {
         $objUserAccountDuplicate = UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text));
     }
     if ($objUserAccountDuplicate) {
         $blnError = true;
         $this->btnCancel->Warning = 'A user account already exists with that username. Please choose another.';
     }
     if (!$blnError) {
         try {
             $this->UpdateUserAccountFields();
             $this->objUserAccount->Save();
             QApplication::Redirect('user_account_list.php');
         } catch (QExtendedOptimisticLockingException $objExc) {
             $this->btnCancel->Warning = sprintf('This user account has been updated by another user. You must <a href="user_account_edit.php?intUserAccountId=%s">Refresh</a> to edit this user account.', $this->objUserAccount->UserAccountId);
         }
     }
 }
Example #27
0
 public static function _(QQNode $objQueryNode, $strSymbol, $mixValue, $mixValueTwo = null)
 {
     try {
         switch (strtolower(trim($strSymbol))) {
             case '=':
                 return QQ::Equal($objQueryNode, $mixValue);
             case '!=':
                 return QQ::NotEqual($objQueryNode, $mixValue);
             case '>':
                 return QQ::GreaterThan($objQueryNode, $mixValue);
             case '<':
                 return QQ::LessThan($objQueryNode, $mixValue);
             case '>=':
                 return QQ::GreaterOrEqual($objQueryNode, $mixValue);
             case '<=':
                 return QQ::LessOrEqual($objQueryNode, $mixValue);
             case 'in':
                 return QQ::In($objQueryNode, $mixValue);
             case 'not in':
                 return QQ::NotIn($objQueryNode, $mixValue);
             case 'like':
                 return QQ::Like($objQueryNode, $mixValue);
             case 'not like':
                 return QQ::NotLike($objQueryNode, $mixValue);
             case 'is null':
                 return QQ::IsNull($objQueryNode, $mixValue);
             case 'is not null':
                 return QQ::IsNotNull($objQueryNode, $mixValue);
             case 'between':
                 return QQ::Between($objQueryNode, $mixValue, $mixValueTwo);
             case 'not between':
                 return QQ::NotBetween($objQueryNode, $mixValue, $mixValueTwo);
             default:
                 throw new QCallerException('Unknown Query Comparison Operation: ' . $strSymbol, 0);
         }
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
 protected function GetFilterConditions()
 {
     // Exclude inventory locations with zero qty
     $arrConditions = array(QQ::NotEqual(QQN::InventoryLocation()->Quantity, 0));
     // Inventory Model
     if (strlen($this->txtInventoryModel->Text) > 0) {
         array_push($arrConditions, QQ::Like(QQN::InventoryLocation()->InventoryModel->ShortDescription, '%' . $this->txtInventoryModel->Text . '%'));
     }
     // Inventory Code
     if (strlen($this->txtInventoryCode->Text) > 0) {
         array_push($arrConditions, QQ::Like(QQN::InventoryLocation()->InventoryModel->InventoryModelCode, '%' . $this->txtInventoryCode->Text . '%'));
     }
     // Category
     if ($this->lstCategory->SelectedValue) {
         array_push($arrConditions, QQ::Equal(QQN::InventoryLocation()->InventoryModel->CategoryId, $this->lstCategory->SelectedValue));
     }
     // Manufacturer
     if ($this->lstManufacturer->SelectedValue) {
         array_push($arrConditions, QQ::Equal(QQN::InventoryLocation()->InventoryModel->ManufacturerId, $this->lstManufacturer->SelectedValue));
     }
     // Location
     if (strlen($this->txtLocation->Text) > 0) {
         array_push($arrConditions, QQ::Like(QQN::InventoryLocation()->Location->ShortDescription, sprintf($this->lstLocationFilterTypes->SelectedValue, $this->txtLocation->Text)));
     }
     return $arrConditions;
 }
Example #29
0
 public function btnAddAsset_Click($strFormId, $strControlId, $strParameter)
 {
     if ($this->rblAssetType->SelectedValue == 'new') {
         $blnError = false;
         // Do not allow creation of an asset if asset limit will be exceeded
         $intAssetLimit = is_numeric(QApplication::$TracmorSettings->AssetLimit) ? QApplication::$TracmorSettings->AssetLimit : false;
         if ($intAssetLimit && Asset::CountActive() >= $intAssetLimit) {
             $blnError = true;
             $this->txtNewAssetCode->Warning = "Your asset limit has been reached.";
         }
         // Assign an empty string to the asset code for now (NULL won't work to render properly in the datagrid
         if ($this->chkAutoGenerateAssetCode->Checked == true) {
             $strAssetCode = '';
         } else {
             $strAssetCode = $this->txtNewAssetCode->Text;
             if (!$strAssetCode) {
                 $blnError = true;
                 $this->txtNewAssetCode->Warning = 'You must enter an asset tag.';
             }
         }
         // Generate an error if that asset code already exists
         if ($objDuplicate = Asset::LoadByAssetCode($strAssetCode)) {
             $blnError = true;
             $this->txtNewAssetCode->Warning = 'That asset tag already exists. Choose another.';
         } elseif (!$this->lstAssetModel->SelectedValue) {
             $blnError = true;
             $this->txtNewAssetCode->Warning = 'You must select one model.';
         }
         if (!$blnError) {
             $objNewAsset = new Asset();
             $objNewAsset->AssetModelId = $this->lstAssetModel->SelectedValue;
             $objNewAsset->LocationId = 5;
             // To Be Received
             $objNewAsset->AssetCode = $strAssetCode;
             // Set the AssetId to 0. This is so that it can be assigned to an AssetTransaction object without being saved to the db
             // We don't want to save this until btnSave_Click, because we don't want to create new assets that could get orphaned
             $objNewAsset->AssetId = 0;
             // This can be combined with the code below it
             $this->txtNewAssetCode->Text = null;
             $this->txtNewAssetCode->Enabled = true;
             $this->chkAutoGenerateAssetCode->Checked = false;
             $this->lstAssetModel->SelectedValue = null;
             $objNewAssetTransaction = new AssetTransaction();
             // The source location can either be 'Shipped'(2) or 'To Be Received'(5)
             $objNewAssetTransaction->SourceLocationId = $objNewAsset->LocationId;
             // $objNewAssetTransaction->AssetId = $objNewAsset->AssetId;
             $objNewAssetTransaction->Asset = $objNewAsset;
             $this->objAssetTransactionArray[] = $objNewAssetTransaction;
             // Set this boolean to true so that the datagrid updates
             $this->blnModifyAssets = true;
         }
     } elseif ($this->rblAssetType->SelectedValue == 'existing') {
         $strAssetCode = $this->txtNewAssetCode->Text;
         $blnDuplicate = false;
         $blnError = false;
         if ($strAssetCode) {
             // Begin error checking
             if ($this->objAssetTransactionArray) {
                 foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                     if ($objAssetTransaction && $objAssetTransaction->Asset->AssetCode == $strAssetCode) {
                         $blnError = true;
                         $this->txtNewAssetCode->Warning = "That asset has already been added.";
                     }
                 }
             }
             if (!$blnError) {
                 $objNewAsset = Asset::LoadByAssetCode($this->txtNewAssetCode->Text);
                 if (!$objNewAsset instanceof Asset) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset tag does not exist.";
                 } elseif ($objNewAsset->LinkedFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is locked to a parent asset.";
                 } elseif ($objNewAsset->ArchivedFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is archived.";
                 } elseif ($objNewAsset->CheckedOutFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is checked out.";
                 } elseif ($objNewAsset->ReservedFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is reserved.";
                 } elseif (!($objNewAsset->LocationId == 5 || $objNewAsset->LocationId == 2)) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset has already been received.";
                 } elseif (!QApplication::AuthorizeEntityBoolean($objNewAsset, 2)) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "You do not have authorization to perform a transaction on this asset.";
                 } elseif ($objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objNewAsset->AssetId)) {
                     $strAssetCodeArray = array();
                     $objCheckedLinkedAssetArray = array();
                     foreach ($objLinkedAssetArray as $objLinkedAsset) {
                         if (!QApplication::AuthorizeEntityBoolean($objLinkedAsset, 2)) {
                             $blnError = true;
                             $this->txtNewAssetCode->Warning = sprintf("You do not have authorization to perform a transaction on locked asset %s.", $objLinkedAsset->AssetCode);
                             break;
                         } else {
                             $objCheckedLinkedAssetArray[] = $objLinkedAsset;
                             $strAssetCodeArray[] = $objLinkedAsset->AssetCode;
                         }
                         if (!$blnError) {
                             $this->txtNewAssetCode->Warning = sprintf("The following asset(s) have been added to the transaction because they are locked to asset (%s):<br />%s", $objNewAsset->AssetCode, implode('<br />', $strAssetCodeArray));
                         }
                     }
                     if (!$blnError) {
                         foreach ($objCheckedLinkedAssetArray as $objCheckedLinkedAsset) {
                             $objNewAssetTransaction = new AssetTransaction();
                             // We can assign the AssetId for existing assets because they have already been saved to the db
                             $objNewAssetTransaction->AssetId = $objCheckedLinkedAsset->AssetId;
                             // The source location can either be 'Shipped'(2) or 'To Be Received'(5)
                             $objNewAssetTransaction->SourceLocationId = $objCheckedLinkedAsset->LocationId;
                             $this->objAssetTransactionArray[] = $objNewAssetTransaction;
                         }
                     }
                 }
                 if (!$blnError) {
                     // Check that the asset isn't already in another pending receipt
                     $arrPendingReceipts = AssetTransaction::QueryArray(QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $objNewAsset->AssetId), QQ::In(QQN::AssetTransaction()->SourceLocationId, array(5, 2)), QQ::IsNull(QQN::AssetTransaction()->DestinationLocationId), QQ::NotEqual(QQN::AssetTransaction()->TransactionId, $this->objReceipt->TransactionId)));
                     if (!$blnError && count($arrPendingReceipts) != 0) {
                         $blnError = true;
                         $this->txtNewAssetCode->Warning = 'That asset is already pending receipt.';
                     } elseif (!$blnError && ($objPendingShipment = AssetTransaction::PendingShipment($objNewAsset->AssetId))) {
                         $blnError = true;
                         $this->txtNewAssetCode->Warning = 'That asset is in a pending shipment.';
                     }
                 }
                 // Create a new, but incomplete AssetTransaction
                 if (!$blnError) {
                     $this->txtNewAssetCode->Text = null;
                     $this->txtNewAssetCode->Enabled = true;
                     $this->chkAutoGenerateAssetCode->Checked = false;
                     $this->lstAssetModel->SelectedValue = null;
                     $objNewAssetTransaction = new AssetTransaction();
                     // We can assign the AssetId for existing assets because they have already been saved to the db
                     $objNewAssetTransaction->AssetId = $objNewAsset->AssetId;
                     // The source location can either be 'Shipped'(2) or 'To Be Received'(5)
                     $objNewAssetTransaction->SourceLocationId = $objNewAsset->LocationId;
                     $this->objAssetTransactionArray[] = $objNewAssetTransaction;
                     // Set this boolean to true so that the datagrid updates
                     $this->blnModifyAssets = true;
                 }
             }
         }
     }
     $this->dtgAssetTransact->Refresh();
     $this->txtNewAssetCode->Focus();
 }
 protected function dtrText_Conditions($blnReset = false)
 {
     $this->arrConditions = array(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroContextInfo()->Context->Active, true), QQ::Equal(QQN::NarroContextInfo()->Context->File->Active, true)));
     if ($blnReset) {
         $this->intMaxRowCount = 0;
     }
     $this->arrClauses = array(QQ::Expand(QQN::NarroContextInfo()->Context), QQ::Expand(QQN::NarroContextInfo()->Context->Text), QQ::Expand(QQN::NarroContextInfo()->Context->File), QQ::Expand(QQN::NarroContextInfo()->Context->Project), QQ::Expand(QQN::NarroContextInfo()->ValidSuggestion));
     if ($this->lstProject->SelectedValue > 0) {
         $this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $this->lstProject->SelectedValue);
     }
     switch ($this->lstFilter->SelectedValue) {
         case self::SHOW_NOT_TRANSLATED:
             $this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, false);
             break;
         case self::SHOW_NOT_APPROVED:
             $this->arrConditions[] = QQ::AndCondition(QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, true));
             break;
         case self::SHOW_APPROVED:
             $this->arrConditions[] = QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId);
             break;
         case self::SHOW_APPROVED_AND_NOT_APPROVED:
             $this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, true);
             break;
         case self::SHOW_NOT_APPROVED_AND_NOT_TRANSLATED:
             $this->arrConditions[] = QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId);
             break;
         case self::SHOW_NOT_APPROVED_AND_WITHOUT_VOTES:
             $this->arrConditions[] = QQ::Equal(QQ::SubSql('SELECT COUNT(*) FROM narro_suggestion_vote, narro_suggestion WHERE narro_suggestion_vote.suggestion_id=narro_suggestion.suggestion_id AND narro_suggestion.text_id={1}', QQN::NarroContextInfo()->Context->TextId), 0);
             break;
         case self::SHOW_NOT_APPROVED_AND_WITH_VOTES:
             $this->arrConditions[] = QQ::NotEqual(QQ::SubSql('SELECT COUNT(*) FROM narro_suggestion_vote, narro_suggestion WHERE narro_suggestion_vote.suggestion_id=narro_suggestion.suggestion_id AND narro_suggestion.text_id={1}', QQN::NarroContextInfo()->Context->TextId), 0);
             break;
         case self::SHOW_IDENTICAL_APPROVED:
             $this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
             $this->arrClauses[] = QQ::Distinct();
             $this->arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->Text->TextValueMd5, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValueMd5), QQ::Equal(QQN::NarroContextInfo()->ValidSuggestionId, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionId), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QQN::NarroContextInfo()->LanguageId));
             break;
         case self::SHOW_IDENTICAL:
             $this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
             $this->arrClauses[] = QQ::Distinct();
             $this->arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->Text->TextValueMd5, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValueMd5), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QQN::NarroContextInfo()->LanguageId));
             break;
         case self::SHOW_ALL:
         default:
     }
     if ($this->txtFile->Text != t('all files') && $this->txtFile->Text != '') {
         if (preg_match("/^'.+'\$/", $this->txtFile->Text)) {
             $this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->File->FilePath, substr($this->txtFile->Text, 1, -1));
         } elseif (preg_match('/^".+"$/', $this->txtFile->Text)) {
             $this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->File->FilePath, substr($this->txtFile->Text, 1, -1));
         } else {
             $this->arrConditions[] = QQ::Like(QQN::NarroContextInfo()->Context->File->FilePath, '%' . $this->txtFile->Text . '%');
         }
     }
     if ($this->txtSearch->Text) {
         if (preg_match("/^'.+'\$/", $this->txtSearch->Text)) {
             $strLikeSearch = substr($this->txtSearch->Text, 1, -1);
         } elseif (preg_match('/^".+"$/', $this->txtSearch->Text)) {
             $strLikeSearch = substr($this->txtSearch->Text, 1, -1);
         } else {
             $strLikeSearch = '%' . $this->txtSearch->Text . '%';
         }
         switch ($this->lstSearchIn->SelectedValue) {
             case self::SEARCH_IN_TEXTS:
                 $this->arrConditions[] = QQ::Like(QQN::NarroContextInfo()->Context->Text->TextValue, $strLikeSearch);
                 break;
             case self::SEARCH_IN_TRANSLATIONS:
                 $this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
                 $this->arrConditions[] = QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValue, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId()));
                 break;
             case self::SEARCH_IN_AUTHORS:
                 $this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
                 $this->arrConditions[] = QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->User->RealName, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId()));
                 break;
             case self::SEARCH_IN_CONTEXTS:
                 $this->arrConditions[] = QQ::OrCondition(QQ::Like(QQN::NarroContextInfo()->Context->Context, $strLikeSearch), QQ::Like(QQN::NarroContextInfo()->Context->Comment, $strLikeSearch));
                 break;
             case self::SEARCH_IN_ALL:
             default:
                 $this->arrClauses[] = QQ::Distinct();
                 $this->arrConditions[] = QQ::OrCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->TextValue, $strLikeSearch), QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValue, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId())), QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->User->RealName, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId())), QQ::Like(QQN::NarroContextInfo()->Context->Context, $strLikeSearch), QQ::Like(QQN::NarroContextInfo()->Context->Comment, $strLikeSearch));
         }
     }
     switch ($this->lstSort->SelectedValue) {
         case self::SORT_TEXT:
             $this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Context->Text->TextValue, $this->lstSortDir->SelectedValue);
             break;
         case self::SORT_TEXT_LENGTH:
             $this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Context->Text->TextWordCount, $this->lstSortDir->SelectedValue);
             break;
         case self::SORT_TRANSLATION:
             $this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->ValidSuggestion->SuggestionValue, $this->lstSortDir->SelectedValue);
             break;
         case self::SORT_TRANSLATION_DATE:
             $this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Modified, $this->lstSortDir->SelectedValue);
             break;
     }
 }