コード例 #1
0
ファイル: Contact.class.php プロジェクト: proxymoron/tracmor
    /**
     * Load an array of Contact objects
     * by FirstName, LastName, or Company ShortDescription
     * using the contact_custom_field_helper table
     *
     * @param string $strFirstName
     * @param string $strLastName
     * @param string $strCompany
     * @param string $strDateModified
     * @param string $strDateModifiedFirst
     * @param string $strDateModifiedLast
     * @param string $strOrderBy
     * @param string $strLimit
     * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
     * @return Contact[]
     */
    public static function LoadArrayBySearchHelper($strFirstName = null, $strLastName = null, $strCompany = null, $arrCustomFields = null, $strDateModified = null, $strDateModifiedFirst = null, $strDateModifiedLast = null, $blnAttachment = null, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        Contact::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup QueryExpansion
        $objQueryExpansion = new QQueryExpansion();
        if ($objExpansionMap) {
            try {
                Contact::ExpandQuery('contact', null, $objExpansionMap, $objQueryExpansion);
            } catch (QCallerException $objExc) {
                $objExc->IncrementOffset();
                throw $objExc;
            }
        }
        $arrSearchSql = Contact::GenerateSearchSql($strFirstName, $strLastName, $strCompany, $arrCustomFields, $strDateModified, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment);
        $arrAttachmentSql = Attachment::GenerateSql(EntityQtype::Contact);
        $arrCustomFieldSql = CustomField::GenerateHelperSql(EntityQtype::Contact);
        $strQuery = sprintf('
				SELECT
					%s
					`contact`.`contact_id` AS `contact_id`,
					`contact`.`address_id` AS `address_id`,
					`contact`.`company_id` AS `company_id`,
					`contact`.`first_name` AS `first_name`,
					`contact`.`last_name` AS `last_name`,
					`contact`.`title` AS `title`,
					`contact`.`email` AS `email`,
					`contact`.`phone_office` AS `phone_office`,
					`contact`.`phone_home` AS `phone_home`,
					`contact`.`phone_mobile` AS `phone_mobile`,
					`contact`.`fax` AS `fax`,
					`contact`.`description` AS `description`,
					`contact`.`created_by` AS `created_by`,
					`contact`.`creation_date` AS `creation_date`,
					`contact`.`modified_by` AS `modified_by`,
					`contact`.`modified_date` AS `modified_date`
					%s
					%s
					%s
				FROM
					`contact` AS `contact`
					%s
					%s
					%s
				WHERE
				1=1
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
			', $strLimitPrefix, $objQueryExpansion->GetSelectSql(",\n\t\t\t\t\t", ",\n\t\t\t\t\t"), $arrCustomFieldSql['strSelect'], $arrAttachmentSql['strSelect'], $objQueryExpansion->GetFromSql("", "\n\t\t\t\t\t"), $arrCustomFieldSql['strFrom'], $arrAttachmentSql['strFrom'], $arrSearchSql['strFirstNameSql'], $arrSearchSql['strLastNameSql'], $arrSearchSql['strCompanySql'], $arrSearchSql['strCustomFieldsSql'], $arrSearchSql['strDateModifiedSql'], $arrSearchSql['strAttachmentSql'], $arrSearchSql['strAuthorizationSql'], $arrAttachmentSql['strGroupBy'], $strOrderBy, $strLimitSuffix);
        //echo($strQuery); exit;
        $objDbResult = $objDatabase->Query($strQuery);
        return Contact::InstantiateDbResult($objDbResult);
    }
コード例 #2
0
    /**
     * Load an array of InventoryModel objects
     * by search parameters using the helper table
     *
     * @param string $strInventoryModelCode
     * @param int $intLocationId
     * @param int $intInventoryModelId
     * @param int $intCategoryId
     * @param int $intManufacturerId
     * @param string $strShortDescription
     * @param array $arrCustomFields
     * @param string $strDateModified
     * @param string $strDateModifiedFirst
     * @param string $strDateModifiedLast
     * @param bool $blnAttachment
     * @param string $strOrderBy
     * @param string $strLimit
     * @param array $objExpansionMap
     * @return InventoryModel[]
     */
    public static function LoadArrayBySearchHelper($strInventoryModelCode = null, $intLocationId = null, $intInventoryModelId = null, $intCategoryId = null, $intManufacturerId = null, $strShortDescription = null, $arrCustomFields = null, $strDateModified = null, $strDateModifiedFirst = null, $strDateModifiedLast = null, $blnAttachment = null, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        InventoryModel::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup QueryExpansion
        $objQueryExpansion = new QQueryExpansion();
        if ($objExpansionMap) {
            try {
                InventoryModel::ExpandQuery('inventory_model', null, $objExpansionMap, $objQueryExpansion);
            } catch (QCallerException $objExc) {
                $objExc->IncrementOffset();
                throw $objExc;
            }
        }
        $arrSearchSql = InventoryModel::GenerateSearchSql($strInventoryModelCode, $intLocationId, $intInventoryModelId, $intCategoryId, $intManufacturerId, $strShortDescription, $arrCustomFields, $strDateModified, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment);
        $arrCustomFieldSql = CustomField::GenerateHelperSql(EntityQtype::Inventory);
        $arrAttachmentSql = Attachment::GenerateSql(EntityQtype::Inventory);
        $strQuery = sprintf('
				SELECT
					%s
					SUM( `inventory_location` . `quantity` ) AS `inventory_model_quantity`,
					`inventory_model`.`inventory_model_id` AS `inventory_model_id`,
					`inventory_model`.`category_id` AS `category_id`,
					`inventory_model`.`manufacturer_id` AS `manufacturer_id`,
					`inventory_model`.`inventory_model_code` AS `inventory_model_code`,
					`inventory_model`.`short_description` AS `short_description`,
					`inventory_model`.`long_description` AS `long_description`,
					`inventory_model`.`image_path` AS `image_path`,
					`inventory_model`.`price` AS `price`,
					`inventory_model`.`created_by` AS `created_by`,
					`inventory_model`.`creation_date` AS `creation_date`,
					`inventory_model`.`modified_by` AS `modified_by`,
					`inventory_model`.`modified_date` AS `modified_date`
					%s
					%s
					%s
				FROM
					`inventory_model` AS `inventory_model`
					LEFT JOIN `inventory_location` AS `inventory_location` ON `inventory_model` . `inventory_model_id` = `inventory_location` . `inventory_model_id`
					%s
					%s
					%s
				WHERE
				1=1
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
			', $strLimitPrefix, $objQueryExpansion->GetSelectSql(",\n\t\t\t\t\t", ",\n\t\t\t\t\t"), $arrCustomFieldSql['strSelect'], $arrAttachmentSql['strSelect'], $objQueryExpansion->GetFromSql("", "\n\t\t\t\t\t"), $arrCustomFieldSql['strFrom'], $arrAttachmentSql['strFrom'], $arrSearchSql['strInventoryModelCodeSql'], $arrSearchSql['strLocationSql'], $arrSearchSql['strInventoryModelSql'], $arrSearchSql['strCategorySql'], $arrSearchSql['strManufacturerSql'], $arrSearchSql['strShortDescriptionSql'], $arrSearchSql['strCustomFieldsSql'], $arrSearchSql['strDateModifiedSql'], $arrSearchSql['strAttachmentSql'], $arrSearchSql['strAuthorizationSql'], $arrAttachmentSql['strGroupBy'], $strOrderBy, $strLimitSuffix);
        $objDbResult = $objDatabase->Query($strQuery);
        return InventoryModel::InstantiateDbResult($objDbResult);
    }
コード例 #3
0
ファイル: Asset.class.php プロジェクト: proxymoron/tracmor
    /**
     * Load an array of Asset objects
     * by search parameters using the helper table
     *
     * @param string $strAssetCode
     * @param int $intLocationId
     * @param int $intAssetModelId
     * @param int $intCategoryId
     * @param int $intManufacturerId
     * @param bool $blnOffsite
     * @param string $strAssetModelCode
     * @param integer $intReservedBy
     * @param integer $intCheckedOutBy
     * @param string $strShortDescription
     * @param array $arrCustomFields
     * @param string $strDateModified
     * @param string $strDateModifiedFirst
     * @param string $strDateModifiedLast
     * @param bool $blnAttachment
     * @param string $strOrderBy
     * @param string $strLimit
     * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
     * @return Asset[]
     */
    public static function LoadArrayBySearchHelper($strAssetCode = null, $intLocationId = null, $intAssetModelId = null, $intCategoryId = null, $intManufacturerId = null, $blnOffsite = false, $strAssetModelCode = null, $intReservedBy = null, $intCheckedOutBy = null, $strShortDescription = null, $arrCustomFields = null, $strDateModified = null, $strModifiedCreated, $strDateModifiedFirst = null, $strDateModifiedLast = null, $blnAttachment = null, $strOrderBy = null, $strLimit = null, $objExpansionMap = null, $blnIncludeTBR = false, $blnIncludeShipped = false, $blnArchived = false, $intCheckedOutToUser = null, $intCheckedOutToContact = null, $blnChekcedOutPastDue = false, $intAssetId = null)
    {
        Asset::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup QueryExpansion
        $objQueryExpansion = new QQueryExpansion();
        if ($objExpansionMap) {
            try {
                Asset::ExpandQuery('asset', null, $objExpansionMap, $objQueryExpansion);
            } catch (QCallerException $objExc) {
                $objExc->IncrementOffset();
                throw $objExc;
            }
        }
        $arrSearchSql = Asset::GenerateSearchSql($strAssetCode, $intLocationId, $intAssetModelId, $intCategoryId, $intManufacturerId, $blnOffsite, $strAssetModelCode, $intReservedBy, $intCheckedOutBy, $strShortDescription, $arrCustomFields, $strDateModified, $strModifiedCreated, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment, $blnIncludeTBR, $blnIncludeShipped, $blnArchived, $intCheckedOutToUser, $intCheckedOutToContact, $blnChekcedOutPastDue, $intAssetId);
        $arrCustomFieldSql = CustomField::GenerateHelperSql(EntityQtype::Asset);
        $arrAttachmentSql = Attachment::GenerateSql(EntityQtype::Asset);
        $strQuery = sprintf('
				SELECT
					%s
					`asset`.`asset_id` AS `asset_id`,
					`asset`.`asset_model_id` AS `asset_model_id`,
					`asset`.`location_id` AS `location_id`,
					`asset`.`asset_code` AS `asset_code`,
					`asset`.`parent_asset_id` AS `parent_asset_id`,
					`asset`.`image_path` AS `image_path`,
					`asset`.`checked_out_flag` AS `checked_out_flag`,
					`asset`.`reserved_flag` AS `reserved_flag`,
					`asset`.`archived_flag` AS `archived_flag`,
					`asset`.`created_by` AS `created_by`,
					`asset`.`creation_date` AS `creation_date`,
					`asset`.`modified_by` AS `modified_by`,
					`asset`.`modified_date` AS `modified_date`,
					`asset`.`depreciation_flag` AS `depreciation_flag`,
					`asset`.`purchase_date` AS `purchase_date`,
					`asset`.`purchase_cost` AS `purchase_cost`
					%s
					%s
					%s
				FROM
					`asset` AS `asset`
					%s
					%s
					%s
				WHERE
				1=1
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
			', $strLimitPrefix, $objQueryExpansion->GetSelectSql(",\n\t\t\t\t\t", ",\n\t\t\t\t\t"), $arrCustomFieldSql['strSelect'], $arrAttachmentSql['strSelect'], $objQueryExpansion->GetFromSql("", "\n\t\t\t\t\t"), $arrCustomFieldSql['strFrom'], $arrAttachmentSql['strFrom'], $arrSearchSql['strAssetCodeSql'], $arrSearchSql['strLocationSql'], $arrSearchSql['strAssetModelSql'], $arrSearchSql['strCategorySql'], $arrSearchSql['strManufacturerSql'], $arrSearchSql['strOffsiteSql'], $arrSearchSql['strAssetModelCodeSql'], $arrSearchSql['strReservedBySql'], $arrSearchSql['strCheckedOutBySql'], $arrSearchSql['strCheckedOutToUserSql'], $arrSearchSql['strCheckedOutToContactSql'], $arrSearchSql['strCheckedOutPastDueSql'], $arrSearchSql['strAssetIdSql'], $arrSearchSql['strArchivedSql'], $arrSearchSql['strIncludeTBRSql'], $arrSearchSql['strIncludeShippedSql'], $arrSearchSql['strShortDescriptionSql'], $arrSearchSql['strCustomFieldsSql'], $arrSearchSql['strDateModifiedSql'], $arrSearchSql['strAttachmentSql'], $arrSearchSql['strAuthorizationSql'], $arrAttachmentSql['strGroupBy'], $strOrderBy, $strLimitSuffix);
        $objDbResult = $objDatabase->Query($strQuery);
        return Asset::InstantiateDbResult($objDbResult);
    }
コード例 #4
0
ファイル: Shipment.class.php プロジェクト: brustj/tracmor
    /**
     * Load an array of Shipment objects
     * by To Company, To Contact, From Company, From Contact, Shipment Number, Asset Code, Inventory Code, Tracking Number, or Status
     * using the shipment_custom_field_helper table
     *
     * @param string $strToCompany
     * @param string $strToContact
     * @param string $strFromCompany
     * @param string $strFromContact
     * @param string $strShipmentNumber
     * @param string $strAssetCode
     * @param string $strInventoryModelCode
     * @param int $intStatus
     * @param string $strTrackingNumber
     * @param int $intCourierId
     * @param string $strNote
     * @param string $strDateModified
     * @param string $strDateModifiedFirst
     * @param string $strDateModifiedLast
     * @param string $strOrderBy
     * @param string $strLimit
     * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
     * @return Shipment[]
     */
    public static function LoadArrayBySearchHelper($strToCompany = null, $strToContact = null, $strFromCompany = null, $strFromContact = null, $strShipmentNumber = null, $strAssetCode = null, $strInventoryModelCode = null, $intStatus = null, $strTrackingNumber = null, $intCourierId = null, $strNote = null, $strShipmentDate = null, $arrCustomFields = null, $strDateModified = null, $strDateModifiedFirst = null, $strDateModifiedLast = null, $blnAttachment = null, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        Shipment::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup QueryExpansion
        $objQueryExpansion = new QQueryExpansion();
        if ($objExpansionMap) {
            try {
                Shipment::ExpandQuery('shipment', null, $objExpansionMap, $objQueryExpansion);
            } catch (QCallerException $objExc) {
                $objExc->IncrementOffset();
                throw $objExc;
            }
        }
        $arrSearchSql = Shipment::GenerateSearchSql($strToCompany, $strToContact, $strFromCompany, $strFromContact, $strShipmentNumber, $strAssetCode, $strInventoryModelCode, $intStatus, $strTrackingNumber, $intCourierId, $strNote, $strShipmentDate, $arrCustomFields, $strDateModified, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment);
        $arrAttachmentSql = Attachment::GenerateSql(EntityQtype::Shipment);
        $arrCustomFieldSql = CustomField::GenerateHelperSql(EntityQtype::Shipment);
        $strQuery = sprintf('
				SELECT
					%s
					DISTINCT
					`shipment`.`shipment_id` AS `shipment_id`,
					`shipment`.`shipment_number` AS `shipment_number`,
					`shipment`.`to_contact_id` AS `to_contact_id`,
					`shipment`.`from_company_id` AS `from_company_id`,
					`shipment`.`from_contact_id` AS `from_contact_id`,
					`shipment`.`transaction_id` AS `transaction_id`,
					`shipment`.`ship_date` AS `ship_date`,
					`shipment`.`from_address_id` AS `from_address_id`,
					`shipment`.`to_company_id` AS `to_company_id`,
					`shipment`.`to_address_id` AS `to_address_id`,
					`shipment`.`courier_id` AS `courier_id`,
					`shipment`.`shipped_flag` AS `shipped_flag`,
					`shipment`.`tracking_number` AS `tracking_number`,
					`shipment`.`created_by` AS `created_by`,
					`shipment`.`creation_date` AS `creation_date`,
					`shipment`.`modified_by` AS `modified_by`,
					`shipment`.`modified_date` AS `modified_date`
					%s
					%s
					%s
				FROM
					`shipment` AS `shipment`
					%s
					%s
					%s
					%s
					%s
				WHERE
				1=1
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
			', $strLimitPrefix, $objQueryExpansion->GetSelectSql(",\n\t\t\t\t\t", ",\n\t\t\t\t\t"), $arrCustomFieldSql['strSelect'], $arrAttachmentSql['strSelect'], $objQueryExpansion->GetFromSql("", "\n\t\t\t\t\t"), $arrCustomFieldSql['strFrom'], $arrAttachmentSql['strFrom'], $arrSearchSql['strAssetCodeFromSql'], $arrSearchSql['strInventoryModelCodeFromSql'], $arrSearchSql['strToCompanySql'], $arrSearchSql['strToContactSql'], $arrSearchSql['strFromCompanySql'], $arrSearchSql['strFromContactSql'], $arrSearchSql['strShipmentNumberSql'], $arrSearchSql['strAssetCodeSql'], $arrSearchSql['strInventoryModelCodeSql'], $arrSearchSql['strStatusSql'], $arrSearchSql['strTrackingNumberSql'], $arrSearchSql['strCourierSql'], $arrSearchSql['strNoteSql'], $arrSearchSql['strShipmentDateSql'], $arrSearchSql['strCustomFieldsSql'], $arrSearchSql['strDateModifiedSql'], $arrSearchSql['strAttachmentSql'], $arrSearchSql['strAuthorizationSql'], $arrAttachmentSql['strGroupBy'], $strOrderBy, $strLimitSuffix);
        $objDbResult = $objDatabase->Query($strQuery);
        return Shipment::InstantiateDbResult($objDbResult);
    }
コード例 #5
0
ファイル: Company.class.php プロジェクト: heshuai64/einv2
    /**
     * Load an array of Company objects
     * by ShortDescription, City, StateProvince, or Country
     *
     * @param string $strShortDescription
     * @param string $strCity
     * @param integer $intStateProvinceId
     * @param integer $intCountryId
     * @param string $strDateModified
     * @param string $strDateModifiedFirst
     * @param string $strDateModifiedLast
     * @param string $strOrderBy
     * @param string $strLimit
     * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
     * @return Company[]
     */
    public static function LoadArrayBySearch($strShortDescription = null, $strCity = null, $intStateProvinceId = null, $intCountryId = null, $arrCustomFields = null, $strDateModified = null, $strDateModifiedFirst = null, $strDateModifiedLast = null, $blnAttachment = null, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        Company::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup QueryExpansion
        $objQueryExpansion = new QQueryExpansion();
        if ($objExpansionMap) {
            try {
                Company::ExpandQuery('company', null, $objExpansionMap, $objQueryExpansion);
            } catch (QCallerException $objExc) {
                $objExc->IncrementOffset();
                throw $objExc;
            }
        }
        // Generate an array of SQL strings to be used in the search query
        $arrSearchSql = Company::GenerateSearchSql($strShortDescription, $strCity, $intStateProvinceId, $intCountryId, $arrCustomFields, $strDateModified, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment);
        $arrAttachmentSql = Attachment::GenerateSql(EntityQtype::Company);
        $arrCustomFieldSql = CustomField::GenerateSql(EntityQtype::Company);
        $strQuery = sprintf('
				SELECT
					%s
					`company`.`company_id` AS `company_id`,
					`company`.`address_id` AS `address_id`,
					`company`.`short_description` AS `short_description`,
					`company`.`website` AS `website`,
					`company`.`telephone` AS `telephone`,
					`company`.`fax` AS `fax`,
					`company`.`email` AS `email`,
					`company`.`long_description` AS `long_description`,
					`company`.`created_by` AS `created_by`,
					`company`.`creation_date` AS `creation_date`,
					`company`.`modified_by` AS `modified_by`,
					`company`.`modified_date` AS `modified_date`
					%s
					%s
					%s
				FROM
					`company` AS `company`
					%s
					%s
					%s
				WHERE
				1=1
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
				%s
			', $strLimitPrefix, $objQueryExpansion->GetSelectSql(",\n\t\t\t\t\t", ",\n\t\t\t\t\t"), $arrCustomFieldSql['strSelect'], $arrAttachmentSql['strSelect'], $objQueryExpansion->GetFromSql("", "\n\t\t\t\t\t"), $arrCustomFieldSql['strFrom'], $arrAttachmentSql['strFrom'], $arrSearchSql['strShortDescriptionSql'], $arrSearchSql['strCitySql'], $arrSearchSql['strStateProvinceSql'], $arrSearchSql['strCountrySql'], $arrSearchSql['strCustomFieldsSql'], $arrSearchSql['strDateModifiedSql'], $arrSearchSql['strAttachmentSql'], $arrSearchSql['strAuthorizationSql'], $arrAttachmentSql['strGroupBy'], $strOrderBy, $strLimitSuffix);
        $objDbResult = $objDatabase->Query($strQuery);
        return Company::InstantiateDbResult($objDbResult);
    }