public function testSaveAndMark_deleted() { error_reporting(E_ERROR | E_PARSE); $aosQuotes = new AOS_Quotes(); $aosQuotes->name = 'test'; $aosQuotes->total_amt = 100; $aosQuotes->total_amt_usdollar = 100; $aosQuotes->save(); //test for record ID to verify that record is saved $this->assertTrue(isset($aosQuotes->id)); $this->assertEquals(36, strlen($aosQuotes->id)); //mark the record as deleted and verify that this record cannot be retrieved anymore. $aosQuotes->mark_deleted($aosQuotes->id); $result = $aosQuotes->retrieve($aosQuotes->id); $this->assertEquals(null, $result); }
public function testmark_lines_deleted() { $aosProductsQuotes = new AOS_Products_Quotes(); //create parent bean $aosQuote = new AOS_Quotes(); $aosQuote->id = 1; //get the linked beans and get record count before deletion $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); $expected = count($product_quote_lines); $product_quote_lines = null; $aosProductsQuotes->mark_lines_deleted($aosQuote); unset($aosQuote); //get the linked beans and get record count after deletion $aosQuote = new AOS_Quotes(); $aosQuote->id = 1; $product_quote_lines = $aosQuote->get_linked_beans('aos_products_quotes', $aosQuote->object_name); $actual = count($product_quote_lines); $this->assertLessThan($expected, $actual); }
* * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with this program; if not, see http://www.gnu.org/licenses * or write to the Free Software Foundation,Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA * * @author SalesAgility <*****@*****.**> */ if (!ACLController::checkAccess('AOS_Contracts', 'edit', true)) { ACLController::displayNoAccess(); die; } require_once 'modules/AOS_Quotes/AOS_Quotes.php'; require_once 'modules/AOS_Contracts/AOS_Contracts.php'; //Setting values in Quotes $quote = new AOS_Quotes(); $quote->retrieve($_REQUEST['record']); //Setting Contract Values $contract = new AOS_Contracts(); $contract->name = $quote->name; $contract->assigned_user_id = $quote->assigned_user_id; $contract->total_contract_value = format_number($quote->total_amount); $contract->contract_account_id = $quote->billing_account_id; $contract->contact_id = $quote->billing_contact_id; $contract->opportunity_id = $quote->opportunity_id; $contract->total_amt = $quote->total_amt; $contract->subtotal_amount = $quote->subtotal_amount; $contract->discount_amount = $quote->discount_amount; $contract->tax_amount = $quote->tax_amount; $contract->shipping_amount = $quote->shipping_amount; $contract->shipping_tax = $quote->shipping_tax;
<?php if (!isset($_REQUEST['record']) || empty($_REQUEST['record'])) { die('Error retrieving record. This record may be deleted or you may not be authorized to view it.'); } require_once 'modules/AOS_Quotes/AOS_Quotes.php'; require_once 'modules/AOS_Quotes/TemplateParser.php'; require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php'; global $current_user; $quote = new AOS_Quotes(); $quote->retrieve($_REQUEST['record']); $lineItems = array(); $sql = "SELECT id, product_id FROM aos_products_quotes WHERE parent_type = 'AOS_Quotes' AND parent_id = '" . $this->bean->id . "' AND deleted = 0"; $res = $quote->db->query($sql); while ($row = $quote->db->fetchByAssoc($res)) { $lineItems[$row['id']] = $row['product_id']; } $template = new AOS_PDF_Templates(); $template->retrieve($quote->template_ddown_c); $object_arr = array(); $object_arr['AOS_Quotes'] = $quote->id; $search = array('@<script[^>]*?>.*?</script>@si', '@<[\\/\\!]*?[^<>]*?>@si', '@([\\r\\n])[\\s]+@', '@&(quot|#34);@i', '@&(amp|#38);@i', '@&(lt|#60);@i', '@&(gt|#62);@i', '@&(nbsp|#160);@i', '@&(iexcl|#161);@i', '@&(cent|#162);@i', '@&(pound|#163);@i', '@&(copy|#169);@i', '@&#(\\d+);@e', '@<address[^>]*?>@si'); $replace = array('', '', '\\1', '"', '&', '<', '>', ' ', chr(161), chr(162), chr(163), chr(169), 'chr(\\1)', '<br>'); $text = preg_replace($search, $replace, $template->description); $text = str_replace("\$subtotal_amount", "\$aos_quotes_subtotal_amount", $text); $text = str_replace("\$tax_amount", "\$aos_quotes_tax_amount", $text); $text = str_replace("\$shipping_amount", "\$aos_quotes_shipping_amount", $text); $text = str_replace("\$total_amount", "\$aos_quotes_total_amount", $text); //Converting Text $parts = explode('$aos_products_quotes_name', $text); $text = $parts[0];
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with this program; if not, see http://www.gnu.org/licenses * or write to the Free Software Foundation,Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA * * @author SalesAgility <*****@*****.**> */ if (!ACLController::checkAccess('Opportunities', 'edit', true)) { ACLController::displayNoAccess(); die; } global $app_list_strings; require_once 'modules/AOS_Quotes/AOS_Quotes.php'; require_once 'modules/Opportunities/Opportunity.php'; //Setting values in Quotes $quote = new AOS_Quotes(); $quote->retrieve($_REQUEST['record']); //Setting Opportunity Values $opportunity = new Opportunity(); $opportunity->name = $quote->name; $opportunity->assigned_user_id = $quote->assigned_user_id; $opportunity->amount = $quote->total_amount; $opportunity->account_id = $quote->billing_account_id; $opportunity->currency_id = $quote->currency_id; $opportunity->sales_stage = 'Proposal/Price Quote'; $opportunity->probability = $app_list_strings['sales_probability_dom']['Proposal/Price Quote']; $opportunity->lead_source = 'Self Generated'; $opportunity->date_closed = $quote->expiration; $opportunity->save(); //Setting opportunity quote relationship $quote->load_relationship('opportunities');