示例#1
0
    /**
     * Deletes an associated ShipmentAsTo
     * @param Shipment $objShipment
     * @return void
     */
    public function DeleteAssociatedShipmentAsTo(Shipment $objShipment)
    {
        if (is_null($this->intCompanyId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateShipmentAsTo on this unsaved Company.');
        }
        if (is_null($objShipment->ShipmentId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateShipmentAsTo on this Company with an unsaved Shipment.');
        }
        // Get the Database Object for this Class
        $objDatabase = Company::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`shipment`
				WHERE
					`shipment_id` = ' . $objDatabase->SqlVariable($objShipment->ShipmentId) . ' AND
					`to_company_id` = ' . $objDatabase->SqlVariable($this->intCompanyId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objShipment->Journal('DELETE');
        }
    }
    /**
     * Deletes an associated ShipmentAsModifiedBy
     * @param Shipment $objShipment
     * @return void
     */
    public function DeleteAssociatedShipmentAsModifiedBy(Shipment $objShipment)
    {
        if (is_null($this->intUserAccountId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateShipmentAsModifiedBy on this unsaved UserAccount.');
        }
        if (is_null($objShipment->ShipmentId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateShipmentAsModifiedBy on this UserAccount with an unsaved Shipment.');
        }
        // Get the Database Object for this Class
        $objDatabase = UserAccount::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`shipment`
				WHERE
					`shipment_id` = ' . $objDatabase->SqlVariable($objShipment->ShipmentId) . ' AND
					`modified_by` = ' . $objDatabase->SqlVariable($this->intUserAccountId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objShipment->Journal('DELETE');
        }
    }