Esempio n. 1
0
 function save($check_notify = FALSE)
 {
     global $sugar_config;
     if (empty($this->id) || $this->new_with_id) {
         if (isset($_POST['group_id'])) {
             unset($_POST['group_id']);
         }
         if (isset($_POST['product_id'])) {
             unset($_POST['product_id']);
         }
         if (isset($_POST['service_id'])) {
             unset($_POST['service_id']);
         }
         if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
             $this->number = $this->db->getOne("SELECT MAX(CAST(number as INT))+1 FROM aos_quotes");
         } else {
             $this->number = $this->db->getOne("SELECT MAX(CAST(number as UNSIGNED))+1 FROM aos_quotes");
         }
         if ($this->number < $sugar_config['aos']['quotes']['initialNumber']) {
             $this->number = $sugar_config['aos']['quotes']['initialNumber'];
         }
     }
     require_once 'modules/AOS_Products_Quotes/AOS_Utils.php';
     perform_aos_save($this);
     parent::save($check_notify);
     require_once 'modules/AOS_Line_Item_Groups/AOS_Line_Item_Groups.php';
     $productQuoteGroup = new AOS_Line_Item_Groups();
     $productQuoteGroup->save_groups($_POST, $this, 'group_');
 }
Esempio n. 2
0
 function save($check_notify = FALSE)
 {
     // If new or duplicate entry, get a quote number otherwise already set.
     $this->number = empty($this->id) ? $this->db->getOne("SELECT count(id)+1 FROM aos_quotes") : $this->number;
     parent::save($check_notify);
     if (isset($_POST['product_id']) && !empty($_POST['product_id'])) {
         $this->saveListItems();
     }
 }