api/model/fulfillment.model.php
/** --------------------------------
     *  ADD A NEW OBJECT TO THE DATABASE
     *  --------------------------------
     */
ADD A NEW OBJECT TO THE DATABASE
ADD A NEW OBJECT TO THE DATABASE
public function add_row($o = null)
    {
        if($o instanceof Fulfillment)
        {
            $db_columns =  $o->serialize_object();
            $db_columns[self::TABLE_PREFIX . 'tmodified'] = current_timestamp();
            $db_columns[self::TABLE_PREFIX . 'tcreate'] = current_timestamp();
            if(!isset($db_columns[self::TABLE_PREFIX . 'id'])) $db_columns[self::TABLE_PREFIX . 'id'] = $this->id;
        } else {
            throw new Exception('Not a valid ' . self::TABLE_NAME .' object!' . print_r($o,true));
        }
        if(isset($db_columns[self::TABLE_PREFIX . 'id'])) unset($db_columns[self::TABLE_PREFIX . 'id']);
        try {
            $insert_id = $this->db_create(self::TABLE_NAME,$db_columns);
            $this->set_id($insert_id);
            return $insert_id;
        } catch(Exception $e) {
            log_error('Error'. $e->getCode() .': '. $e->getMessage());
        }
        return false;
    }
public function add_row ( $ o = null ) { if ( $ o instanceof Fulfillment ) { $ db_columns = $ o -> serialize_object ( ) ; $ db_columns [ self :: TABLE_PREFIX . 'tmodified' ] = current_timestamp ( ) ; $ db_columns [ self :: TABLE_PREFIX . 'tcreate' ] = current_timestamp ( ) ; if ( ! isset ( $ db_columns [ self :: TABLE_PREFIX . 'id' ] ) ) $ db_columns [ self :: TABLE_PREFIX . 'id' ] = $ this -> id ; } else { throw new Exception ( 'Not a valid ' . self :: TABLE_NAME . ' object!' . print_r ( $ o , true ) ) ; } if ( isset ( $ db_columns [ self :: TABLE_PREFIX . 'id' ] ) ) unset ( $ db_columns [ self :: TABLE_PREFIX . 'id' ] ) ; try { $ insert_id = $ this -> db_create ( self :: TABLE_NAME , $ db_columns ) ; $ this -> set_id ( $ insert_id ) ; return $ insert_id ; } catch ( Exception $ e ) { log_error ( 'Error' . $ e -> getCode ( ) . ': ' . $ e -> getMessage ( ) ) ; } return false ; }
ADD A NEW OBJECT TO THE DATABASE
ADD A NEW OBJECT TO THE DATABASE
/**
         *  $order should be a order object being passed
         */