Example #1
0
 /**
  * (non-PHPdoc)
  * @see Tinebase_Controller_Record_Abstract::_inspectCreate()
  */
 protected function _inspectCreate(Tinebase_Record_Interface $_record)
 {
     $_record->__set('order_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('order_nr'));
     if (!$_record->__get('payment_method_id')) {
         $_record->__set('payment_method_id', Billing_Controller_PaymentMethod::getInstance()->getDefaultPaymentMethod()->getId());
     }
 }
Example #2
0
 /**
  * (non-PHPdoc)
  * @see Tinebase_Controller_Record_Abstract::_inspectCreate()
  */
 protected function _inspectCreate(Tinebase_Record_Interface $_record)
 {
     // check whether the article nr is set? -> then do not overwrite: maybe from export...
     if (!$_record->__get('article_nr')) {
         $_record->__set('article_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('article_nr'));
     }
     if (!$_record->__get('price2_vat_id')) {
         $vat0 = Billing_Controller_Vat::getInstance()->getByName(0);
         $_record->__set('price2_vat_id', $vat0->getId());
     }
 }
Example #3
0
 protected function _inspectCreate($_record)
 {
     if (!$_record->__get('booking_nr')) {
         $_record->__set('booking_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('booking_nr'));
     }
     $receipt = $_record->getForeignRecordBreakNull('receipt_id', Billing_Controller_Receipt::getInstance());
     $order = $_record->getForeignRecordBreakNull('order_id', Billing_Controller_Order::getInstance());
     if ($order) {
         $_record->__set('erp_context_id', $order->__get('erp_context_id'));
     }
     if ($_record->__get('booking_date')) {
         if (!$_record->__get('booking_receipt_date')) {
             $_record->__set('booking_receipt_date', $_record->__get('booking_date'));
         }
     }
 }
Example #4
0
 /**
  * (non-PHPdoc)
  * @see Tinebase_Controller_Record_Abstract::_inspectCreate()
  */
 protected function _inspectCreate(Tinebase_Record_Interface $_record)
 {
     $type = $_record->__get('type');
     switch ($type) {
         case SPQUERY:
             $_record->__set('supply_request_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('supply_request_nr'));
             break;
         case SPOFFER:
             $_record->__set('supply_offer_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('supply_offer_nr'));
             break;
         case SPORDER:
             $_record->__set('supply_order_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('supply_order_nr'));
             break;
         case SPINVOICE:
             $_record->__set('supply_inc_inv_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('supply_inc_inv_nr'));
             break;
     }
 }
Example #5
0
 /**
  * (non-PHPdoc)
  * @see Tinebase_Controller_Record_Abstract::_inspectCreate()
  */
 protected function _inspectCreate(Tinebase_Record_Interface $_record)
 {
     $_record->__set('job_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('job_nr'));
 }
Example #6
0
 /**
  * (non-PHPdoc)
  * @see Tinebase_Controller_Record_Abstract::_inspectCreate()
  */
 protected function _inspectCreate(Tinebase_Record_Interface $_record)
 {
     $orderId = $_record->getForeignId('order_id');
     $order = Billing_Controller_Order::getInstance()->get($orderId);
     $debitor = $order->__get('debitor_id');
     $aContact = $debitor->__get('contact_id');
     $contactId = $aContact['id'];
     $contact = Addressbook_Controller_Contact::getInstance()->get($contactId);
     $_record->__set('erp_context_id', $order->__get('erp_context_id'));
     $params = array('contact' => $contact, 'debitor' => $debitor, 'order' => $order);
     // calculates numbers according to receipt type -> defined in number_base
     $type = $_record->__get('type');
     switch ($type) {
         case Billing_Model_Receipt::TYPE_CALCULATION:
             $_record->__set('calc_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('calc_nr', null, $params));
             break;
         case Billing_Model_Receipt::TYPE_BID:
             $_record->__set('bid_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('bid_nr', null, $params));
             break;
         case Billing_Model_Receipt::TYPE_CONFIRM:
             $_record->__set('confirm_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('confirm_nr', null, $params));
             break;
         case Billing_Model_Receipt::TYPE_SHIPPING:
             $_record->__set('ship_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('ship_nr', null, $params));
             break;
         case Billing_Model_Receipt::TYPE_INVOICE:
             $_record->__set('invoice_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('invoice_nr', null, $params));
             break;
         case Billing_Model_Receipt::TYPE_CREDIT:
             $_record->__set('credit_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('invoice_nr', null, $params));
             // TODO HH: make configurable -> some orgas might use own number area for credit
             // others: the same for invoice and credit
             //$_record->__set('credit_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('credit_nr', null, $params));
             break;
         case Billing_Model_Receipt::TYPE_MONITION:
             $_record->__set('monition_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('monition_nr', null, $params));
             break;
     }
 }
Example #7
0
 /**
  * (non-PHPdoc)
  * @see Tinebase_Controller_Record_Abstract::_inspectCreate()
  */
 protected function _inspectCreate(Tinebase_Record_Interface $_record)
 {
     $order = $_record->getForeignRecord('order_id', Billing_Controller_Order::getInstance());
     $_record->__set('erp_context_id', $order->__get('erp_context_id'));
     $_record->__set('op_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('op_nr'));
 }
 protected function _inspectCreate($_record)
 {
     if (!$_record->__get('booking_template_nr')) {
         $_record->__set('booking_template_nr', Tinebase_NumberBase_Controller::getInstance()->getNextNumber('booking_template_nr'));
     }
 }