cmc-sales/app/models/shipment.php

133 lines
3.2 KiB
PHP
Raw Normal View History

<?php
class Shipment extends AppModel {
var $name = 'Shipment';
2011-04-28 20:07:30 -07:00
/* var $validate = array(
'freight_forwarder_id' => array('numeric'),
'airway_bill' => array('notempty')
2011-04-28 20:07:30 -07:00
); */
var $recursive = 1;
var $order = 'Shipment.created DESC';
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'FreightForwarder' => array(
'className' => 'FreightForwarder',
'foreignKey' => 'freight_forwarder_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'FreightService' => array(
'className' => 'FreightService',
'foreignKey' => 'freight_service_id'
2011-04-28 00:41:36 -07:00
),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => array('User.type' => 'user')
),
'Customer' => array(
'className' => 'Customer',
'foreignKey' => 'customer_id'
),
'Address' => array(
'className' => 'Address',
'foreignKey' => 'address_id'
)
2011-04-28 00:41:36 -07:00
);
var $hasMany = array(
'Box' => array(
'className' => 'Box',
'foreignKey' => 'shipment_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
2011-05-03 18:49:07 -07:00
),
'ShipmentInvoice' => array(
'className' => 'ShipmentInvoice',
'foreignKey' => 'shipment_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
var $hasAndBelongsToMany = array(
'Job' => array(
'className' => 'Job',
'joinTable' => 'shipments_jobs',
'foreignKey' => 'shipment_id',
'associationForeignKey' => 'job_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),
'Principle' => array(
'className' => 'Principle',
'joinTable' => 'shipments_principles',
'foreignKey' => 'shipment_id',
'associationForeignKey' => 'principle_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),
'PurchaseOrder' => array(
'className' => 'PurchaseOrder',
'joinTable' => 'shipments_purchase_orders',
'foreignKey' => 'shipment_id',
'associationForeignKey' => 'purchase_order_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
/*function beforeSave() {
$thisID = $this->data['Shipment']['id'];
$this->Box->deleteAll(array('Box.shipment_id'=>$thisID));
return true;
}*/
}
?>