131 lines
3.2 KiB
PHP
131 lines
3.2 KiB
PHP
<?php
|
|
class Shipment extends AppModel {
|
|
|
|
var $name = 'Shipment';
|
|
/* var $validate = array(
|
|
'freight_forwarder_id' => array('numeric'),
|
|
'airway_bill' => array('notempty')
|
|
); */
|
|
|
|
var $recursive = 1;
|
|
|
|
//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'
|
|
),
|
|
'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'
|
|
)
|
|
|
|
|
|
);
|
|
|
|
var $hasMany = array(
|
|
'Box' => array(
|
|
'className' => 'Box',
|
|
'foreignKey' => 'shipment_id',
|
|
'dependent' => false,
|
|
'conditions' => '',
|
|
'fields' => '',
|
|
'order' => '',
|
|
'limit' => '',
|
|
'offset' => '',
|
|
'exclusive' => '',
|
|
'finderQuery' => '',
|
|
'counterQuery' => ''
|
|
),
|
|
'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;
|
|
|
|
}*/
|
|
|
|
|
|
}
|
|
?>
|