/** * Function searches the records in the module, if parentId & parentModule * is given then searches only those records related to them. * @param <String> $searchValue - Search value * @param <Integer> $parentId - parent recordId * @param <String> $parentModule - parent module name * @return <Array of Vtiger_Record_Model> */ public function searchRecord($searchValue, $parentId = false, $parentModule = false, $relatedModule = false) { if (!empty($searchValue) && empty($parentId) && empty($parentModule) && in_array($relatedModule, getInventoryModules())) { $matchingRecords = Products_Record_Model::getSearchResult($searchValue, $this->getName()); } else { return parent::searchRecord($searchValue); } return $matchingRecords; }
public function process(Vtiger_Request $request) { ${"GLOBALS"}["pwqcmepsgy"] = "adb"; $adwshrlpqh = "products"; ${${"GLOBALS"}["pwqcmepsgy"]} = \PearDatabase::getInstance(); ${$adwshrlpqh} = Products_Record_Model::getSearchResult($request->get("query"), "Products"); $acypysvneb = "services"; ${$acypysvneb} = Services_Record_Model::getSearchResult($request->get("query"), "Services"); ${${"GLOBALS"}["vocxjbdqjl"]} = array(); ${"GLOBALS"}["hhfjmudmehbv"] = "services"; foreach (${${"GLOBALS"}["egjkkwquu"]}["Products"] as ${${"GLOBALS"}["rywkvygs"]}) { $lwwocgvf = "return"; ${$lwwocgvf}["results"][] = array("group" => "Products", "text" => $result->get("label"), "id" => $result->getId()); } foreach (${${"GLOBALS"}["hhfjmudmehbv"]}["Services"] as ${${"GLOBALS"}["rywkvygs"]}) { ${${"GLOBALS"}["vocxjbdqjl"]}["results"][] = array("group" => "Services", "text" => $result->get("label"), "id" => $result->getId()); } echo json_encode(${${"GLOBALS"}["vocxjbdqjl"]}); exit; }
function content_5678d07645c92($_smarty_tpl) { $_smarty_tpl->tpl_vars["deleted"] = new Smarty_variable("deleted" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["hdnProductId"] = new Smarty_variable("hdnProductId" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["productName"] = new Smarty_variable("productName" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["comment"] = new Smarty_variable("comment" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["productDescription"] = new Smarty_variable("productDescription" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["qtyInStock"] = new Smarty_variable("qtyInStock" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["qty"] = new Smarty_variable("qty" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["listPrice"] = new Smarty_variable("listPrice" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["productTotal"] = new Smarty_variable("productTotal" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["subproduct_ids"] = new Smarty_variable("subproduct_ids" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["subprod_names"] = new Smarty_variable("subprod_names" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["entityIdentifier"] = new Smarty_variable("entityType" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["entityType"] = new Smarty_variable($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['entityIdentifier']->value], null, 0); $_smarty_tpl->tpl_vars["discount_type"] = new Smarty_variable("discount_type" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["discount_percent"] = new Smarty_variable("discount_percent" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["checked_discount_percent"] = new Smarty_variable("checked_discount_percent" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["style_discount_percent"] = new Smarty_variable("style_discount_percent" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["discount_amount"] = new Smarty_variable("discount_amount" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["checked_discount_amount"] = new Smarty_variable("checked_discount_amount" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["style_discount_amount"] = new Smarty_variable("style_discount_amount" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["checked_discount_zero"] = new Smarty_variable("checked_discount_zero" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["discountTotal"] = new Smarty_variable("discountTotal" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["totalAfterDiscount"] = new Smarty_variable("totalAfterDiscount" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["taxTotal"] = new Smarty_variable("taxTotal" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["netPrice"] = new Smarty_variable("netPrice" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["FINAL"] = new Smarty_variable($_smarty_tpl->tpl_vars['RELATED_PRODUCTS']->value[1]['final_details'], null, 0); $_smarty_tpl->tpl_vars["productDeleted"] = new Smarty_variable("productDeleted" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["productId"] = new Smarty_variable($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['hdnProductId']->value], null, 0); $_smarty_tpl->tpl_vars["listPriceValues"] = new Smarty_variable(Products_Record_Model::getListPriceValues($_smarty_tpl->tpl_vars['productId']->value), null, 0); ?> <td><i class="icon-trash deleteRow cursorPointer" title="<?php echo vtranslate('LBL_DELETE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> "></i> <a><img src="<?php echo vimage_path('drag.png'); ?> " border="0" title="<?php echo vtranslate('LBL_DRAG', $_smarty_tpl->tpl_vars['MODULE']->value); ?> "/></a><input type="hidden" class="rowNumber" value="<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " /></td><td><!-- Product Re-Ordering Feature Code Addition Starts --><input type="hidden" name="hidtax_row_no<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " id="hidtax_row_no<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['tax_row_no']->value; ?> "/><!-- Product Re-Ordering Feature Code Addition ends --><div><input type="text" id="<?php echo $_smarty_tpl->tpl_vars['productName']->value; ?> " name="<?php echo $_smarty_tpl->tpl_vars['productName']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productName']->value]; ?> " class="productName <?php if ($_smarty_tpl->tpl_vars['row_no']->value != 0) { ?> autoComplete <?php } ?> " placeholder="<?php echo vtranslate('LBL_TYPE_SEARCH', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-validation-engine="validate[required]" <?php if (!empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productName']->value])) { ?> disabled="disabled" <?php } ?> /><input type="hidden" id="<?php echo $_smarty_tpl->tpl_vars['hdnProductId']->value; ?> " name="<?php echo $_smarty_tpl->tpl_vars['hdnProductId']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['hdnProductId']->value]; ?> " class="selectedModuleId"/><input type="hidden" id="lineItemType<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " name="lineItemType<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['entityType']->value; ?> " class="lineItemType"/><?php if ($_smarty_tpl->tpl_vars['row_no']->value == 0) { ?> <img class="lineItemPopup cursorPointer alignMiddle" data-popup="ServicesPopup" title="<?php echo vtranslate('Services', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-module-name="Services" data-field-name="serviceid" src="<?php echo vimage_path('Services.png'); ?> "/><img class="lineItemPopup cursorPointer alignMiddle" data-popup="ProductsPopup" title="<?php echo vtranslate('Products', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-module-name="Products" data-field-name="productid" src="<?php echo vimage_path('Products.png'); ?> "/> <i class="icon-remove-sign clearLineItem cursorPointer" title="<?php echo vtranslate('LBL_CLEAR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="vertical-align:middle"></i><?php } else { if (!$_smarty_tpl->tpl_vars['RECORD_ID']->value) { if ($_smarty_tpl->tpl_vars['entityType']->value == 'Services' && !$_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productDeleted']->value] || $_smarty_tpl->tpl_vars['PRODUCT_ACTIVE']->value != 'true') { ?> <img class="lineItemPopup cursorPointer alignMiddle" data-popup="ServicesPopup" data-module-name="Services" title="<?php echo vtranslate('Services', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-field-name="serviceid" src="<?php echo vimage_path('Services.png'); ?> "/> <i class="icon-remove-sign clearLineItem cursorPointer" title="<?php echo vtranslate('LBL_CLEAR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="vertical-align:middle"></i><?php } elseif (!$_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productDeleted']->value]) { ?> <img class="lineItemPopup cursorPointer alignMiddle" data-popup="ProductsPopup" data-module-name="Products" title="<?php echo vtranslate('Products', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-field-name="productid" src="<?php echo vimage_path('Products.png'); ?> "/> <i class="icon-remove-sign clearLineItem cursorPointer" title="<?php echo vtranslate('LBL_CLEAR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="vertical-align:middle"></i><?php } } else { if ($_smarty_tpl->tpl_vars['entityType']->value == 'Services' && !$_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productDeleted']->value]) { ?> <img class="<?php if ($_smarty_tpl->tpl_vars['SERVICE_ACTIVE']->value) { ?> lineItemPopup<?php } ?> cursorPointer alignMiddle" data-popup="ServicesPopup" data-module-name="Services" title="<?php echo vtranslate('Services', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-field-name="serviceid" src="<?php echo vimage_path('Services.png'); ?> "/> <i class="icon-remove-sign <?php if ($_smarty_tpl->tpl_vars['SERVICE_ACTIVE']->value) { ?> clearLineItem<?php } ?> cursorPointer" title="<?php echo vtranslate('LBL_CLEAR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="vertical-align:middle"></i><?php } elseif (!$_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productDeleted']->value]) { ?> <img class="<?php if ($_smarty_tpl->tpl_vars['PRODUCT_ACTIVE']->value) { ?> lineItemPopup<?php } ?> cursorPointer alignMiddle" data-popup="ProductsPopup" data-module-name="Products" title="<?php echo vtranslate('Products', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-field-name="productid" src="<?php echo vimage_path('Products.png'); ?> "/> <i class="icon-remove-sign <?php if ($_smarty_tpl->tpl_vars['PRODUCT_ACTIVE']->value) { ?> clearLineItem<?php } ?> cursorPointer" title="<?php echo vtranslate('LBL_CLEAR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="vertical-align:middle"></i><?php } } } ?> </div><input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['subproduct_ids']->value]; ?> " id="<?php echo $_smarty_tpl->tpl_vars['subproduct_ids']->value; ?> " name="<?php echo $_smarty_tpl->tpl_vars['subproduct_ids']->value; ?> " class="subProductIds" /><div id="<?php echo $_smarty_tpl->tpl_vars['subprod_names']->value; ?> " name="<?php echo $_smarty_tpl->tpl_vars['subprod_names']->value; ?> " class="subInformation"><span class="subProductsContainer"><?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['subprod_names']->value]; ?> </span></div><?php if ($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productDeleted']->value]) { ?> <div class="row-fluid deletedItem redColor"><?php if (empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productName']->value])) { echo vtranslate('LBL_THIS_LINE_ITEM_IS_DELETED_FROM_THE_SYSTEM_PLEASE_REMOVE_THIS_LINE_ITEM', $_smarty_tpl->tpl_vars['MODULE']->value); } else { echo vtranslate('LBL_THIS', $_smarty_tpl->tpl_vars['MODULE']->value); ?> <?php echo $_smarty_tpl->tpl_vars['entityType']->value; ?> <?php echo vtranslate('LBL_IS_DELETED_FROM_THE_SYSTEM_PLEASE_REMOVE_OR_REPLACE_THIS_ITEM', $_smarty_tpl->tpl_vars['MODULE']->value); } ?> </div><?php } else { ?> <div><br><textarea id="<?php echo $_smarty_tpl->tpl_vars['comment']->value; ?> " name="<?php echo $_smarty_tpl->tpl_vars['comment']->value; ?> " class="lineItemCommentBox"><?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['comment']->value]; ?> </textarea><?php } ?> </td><td><input id="<?php echo $_smarty_tpl->tpl_vars['qty']->value; ?> " name="<?php echo $_smarty_tpl->tpl_vars['qty']->value; ?> " type="text" class="qty smallInputBox" data-validation-engine="validate[required,funcCall[Vtiger_OrMoreZero_Validator_Js.invokeValidation]]" value="<?php if (!empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['qty']->value]) || $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['qty']->value] === '0') { echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['qty']->value]; } else { ?> 1<?php } ?> "/><?php if ($_smarty_tpl->tpl_vars['MODULE']->value != 'PurchaseOrder') { ?> <br><span class="stockAlert redColor <?php if ($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['qty']->value] <= $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['qtyInStock']->value]) { ?> hide<?php } ?> " ><?php echo vtranslate('LBL_STOCK_NOT_ENOUGH', $_smarty_tpl->tpl_vars['MODULE']->value); ?> <br><?php echo vtranslate('LBL_MAX_QTY_SELECT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> <span class="maxQuantity"><?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['qtyInStock']->value]; ?> </span></span><?php } ?> </td><td><div><input id="<?php echo $_smarty_tpl->tpl_vars['listPrice']->value; ?> " name="<?php echo $_smarty_tpl->tpl_vars['listPrice']->value; ?> " value="<?php if (!empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['listPrice']->value])) { echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['listPrice']->value]; } else { ?> 0<?php } ?> " type="text" data-validation-engine="validate[required,funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" class="listPrice smallInputBox" list-info='<?php if (!empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['listPrice']->value])) { echo Zend_Json::encode($_smarty_tpl->tpl_vars['listPriceValues']->value); } ?> '/> <?php $_smarty_tpl->tpl_vars['PRICEBOOK_MODULE_MODEL'] = new Smarty_variable(Vtiger_Module_Model::getInstance('PriceBooks'), null, 0); if ($_smarty_tpl->tpl_vars['PRICEBOOK_MODULE_MODEL']->value->isPermitted('DetailView')) { ?> <img src="<?php echo vimage_path('PriceBooks.png'); ?> " class="cursorPointer alignMiddle priceBookPopup" data-popup="Popup" data-module-name="PriceBooks" title="<?php echo vtranslate('PriceBooks', $_smarty_tpl->tpl_vars['MODULE']->value); ?> "/><?php } ?> </div><div><span>(-) <b><a href="javascript:void(0)" class="individualDiscount"><?php echo vtranslate('LBL_DISCOUNT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a> : </b></span></div><div class="discountUI validCheck hide" id="discount_div<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> "><?php $_smarty_tpl->tpl_vars["DISCOUNT_TYPE"] = new Smarty_variable("zero", null, 0); if (!empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['discount_type']->value])) { $_smarty_tpl->tpl_vars["DISCOUNT_TYPE"] = new Smarty_variable($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['discount_type']->value], null, 0); } ?> <input type="hidden" id="discount_type<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " name="discount_type<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['DISCOUNT_TYPE']->value; ?> " class="discount_type" /><table width="100%" border="0" cellpadding="5" cellspacing="0" class="table table-nobordered popupTable"><tr><!-- TODO : CLEAN : should not append product total it should added in the js because product total can change at any point of time --><th id="discount_div_title<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " nowrap><b><?php echo vtranslate('LBL_SET_DISCOUNT_FOR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> : <?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productTotal']->value]; ?> </b></th><th><button type="button" class="close closeDiv">x</button></th></tr><!-- TODO : discount price and amount are hide by default we need to check id they are already selected if so we should not hide them --><tr><td><input type="radio" name="discount<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " <?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['checked_discount_zero']->value]; ?> <?php if (empty($_smarty_tpl->tpl_vars['data']->value)) { ?> checked<?php } ?> class="discounts" data-discount-type="zero" /> <?php echo vtranslate('LBL_ZERO_DISCOUNT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </td><td><!-- Make the discount value as zero --><input type="hidden" class="discountVal" value="0" /></td></tr><tr><td><input type="radio" name="discount<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " <?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['checked_discount_percent']->value]; ?> class="discounts" data-discount-type="percentage" /> %<?php echo vtranslate('LBL_OF_PRICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </td><td><span class="pull-right"> %</span><input type="text" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" id="discount_percentage<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " name="discount_percentage<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['discount_percent']->value]; ?> " class="discount_percentage smallInputBox pull-right discountVal <?php if (empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['checked_discount_percent']->value])) { ?> hide<?php } ?> " /></td></tr><tr><td class="LineItemDirectPriceReduction"><input type="radio" name="discount<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " <?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['checked_discount_amount']->value]; ?> class="discounts" data-discount-type="amount" /> <?php echo vtranslate('LBL_DIRECT_PRICE_REDUCTION', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </td><td><input type="text" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" id="discount_amount<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " name="discount_amount<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['discount_amount']->value]; ?> " class="smallInputBox pull-right discount_amount discountVal <?php if (empty($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['checked_discount_amount']->value])) { ?> hide<?php } ?> "/></td></tr></table><div class="modal-footer lineItemPopupModalFooter modal-footer-padding"><div class=" pull-right cancelLinkContainer"><a class="cancelLink" type="reset" data-dismiss="modal"><?php echo vtranslate('LBL_CANCEL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></div><button class="btn btn-success discountSave" type="button" name="lineItemActionSave"><strong><?php echo vtranslate('LBL_SAVE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></div></div><div><b><?php echo vtranslate('LBL_TOTAL_AFTER_DISCOUNT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> :</b></div><div class="individualTaxContainer <?php if ($_smarty_tpl->tpl_vars['IS_GROUP_TAX_TYPE']->value) { ?> hide<?php } ?> ">(+) <b><a href="javascript:void(0)" class="individualTax"><?php echo vtranslate('LBL_TAX', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a> : </b></div><span class="taxDivContainer"><div class="taxUI hide" id="tax_div<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> "><!-- we will form the table with all taxes --><table width="100%" border="0" cellpadding="5" cellspacing="0" class="table table-nobordered popupTable" id="tax_table<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> "><tr><th id="tax_div_title<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " nowrap align="left" ><b><?php echo vtranslate('LBL_SET_TAX_FOR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> : <?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['totalAfterDiscount']->value]; ?> </b></th><th colspan="2"><button type="button" class="close closeDiv">x</button></th></tr><?php $_smarty_tpl->tpl_vars['tax_data'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['tax_data']->_loop = false; $_smarty_tpl->tpl_vars['tax_row_no'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['data']->value['taxes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['tax_data']->key => $_smarty_tpl->tpl_vars['tax_data']->value) { $_smarty_tpl->tpl_vars['tax_data']->_loop = true; $_smarty_tpl->tpl_vars['tax_row_no']->value = $_smarty_tpl->tpl_vars['tax_data']->key; $_smarty_tpl->tpl_vars["taxname"] = new Smarty_variable($_smarty_tpl->tpl_vars['tax_data']->value['taxname'] . "_percentage" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["tax_id_name"] = new Smarty_variable("hidden_tax" . $_smarty_tpl->tpl_vars['tax_row_no']->value + (1 . "_percentage") . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["taxlabel"] = new Smarty_variable($_smarty_tpl->tpl_vars['tax_data']->value['taxlabel'] . "_percentage" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); $_smarty_tpl->tpl_vars["popup_tax_rowname"] = new Smarty_variable("popup_tax_row" . $_smarty_tpl->tpl_vars['row_no']->value, null, 0); ?> <tr><td><input type="text" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" name="<?php echo $_smarty_tpl->tpl_vars['taxname']->value; ?> " id="<?php echo $_smarty_tpl->tpl_vars['taxname']->value; ?> " value="<?php echo $_smarty_tpl->tpl_vars['tax_data']->value['percentage']; ?> " class="smallInputBox taxPercentage" /> %</td><td><div class="textOverflowEllipsis"><?php echo $_smarty_tpl->tpl_vars['tax_data']->value['taxlabel']; ?> </div></td><td><input type="text" name="<?php echo $_smarty_tpl->tpl_vars['popup_tax_rowname']->value; ?> " class="cursorPointer smallInputBox taxTotal" value="<?php echo $_smarty_tpl->tpl_vars['tax_data']->value['amount']; ?> " readonly /></td></tr><?php } ?> </table><div class="modal-footer lineItemPopupModalFooter modal-footer-padding"><div class=" pull-right cancelLinkContainer"><a class="cancelLink" type="reset" data-dismiss="modal"><?php echo vtranslate('LBL_CANCEL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></div><button class="btn btn-success taxSave" type="button" name="lineItemActionSave"><strong><?php echo vtranslate('LBL_SAVE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></div></div></span></td><td><div id="productTotal<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " align="right" class="productTotal"><?php if ($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productTotal']->value]) { echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productTotal']->value]; } else { ?> 0<?php } ?> </div><div id="discountTotal<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " align="right" class="discountTotal"><?php if ($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['discountTotal']->value]) { echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['discountTotal']->value]; } else { ?> 0<?php } ?> </div><div id="totalAfterDiscount<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " align="right" class="totalAfterDiscount"><?php if ($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['totalAfterDiscount']->value]) { echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['totalAfterDiscount']->value]; } else { ?> 0<?php } ?> </div><div id="taxTotal<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " align="right" class="productTaxTotal <?php if ($_smarty_tpl->tpl_vars['IS_GROUP_TAX_TYPE']->value) { ?> hide<?php } ?> "><?php if ($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['taxTotal']->value]) { echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['taxTotal']->value]; } else { ?> 0<?php } ?> </div></td><td><span id="netPrice<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " class="pull-right netPrice"><?php if ($_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['netPrice']->value]) { echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['netPrice']->value]; } else { ?> 0<?php } ?> </span></td><?php }
public function process(Vtiger_Request $request) { $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $record = $request->get('record'); $sourceRecord = $request->get('sourceRecord'); $sourceModule = $request->get('sourceModule'); if (!empty($record) && $request->get('isDuplicate') == true) { $recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName); $currencyInfo = $recordModel->getCurrencyInfo(); $taxes = $recordModel->getProductTaxes(); $relatedProducts = $recordModel->getProducts(); $viewer->assign('MODE', ''); //While Duplicating record, If the related record is deleted then we are removing related record info in record model $mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels(); foreach ($mandatoryFieldModels as $fieldModel) { if ($fieldModel->isReferenceField()) { $fieldName = $fieldModel->get('name'); if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) { $recordModel->set($fieldName, ''); } } } } elseif (!empty($record)) { $recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName); $currencyInfo = $recordModel->getCurrencyInfo(); $taxes = $recordModel->getProductTaxes(); $relatedProducts = $recordModel->getProducts(); $viewer->assign('RECORD_ID', $record); $viewer->assign('MODE', 'edit'); } elseif ($request->get('salesorder_id') || $request->get('quote_id')) { if ($request->get('salesorder_id')) { $referenceId = $request->get('salesorder_id'); } else { $referenceId = $request->get('quote_id'); } $parentRecordModel = Inventory_Record_Model::getInstanceById($referenceId); $currencyInfo = $parentRecordModel->getCurrencyInfo(); $taxes = $parentRecordModel->getProductTaxes(); $relatedProducts = $parentRecordModel->getProducts(); $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName); $recordModel->setRecordFieldValues($parentRecordModel); } else { $taxes = Inventory_Module_Model::getAllProductTaxes(); $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName); $viewer->assign('MODE', ''); //The creation of Inventory record from action and Related list of product/service detailview the product/service details will calculated by following code if ($request->get('product_id') || $sourceModule === 'Products') { if ($sourceRecord) { $productRecordModel = Products_Record_Model::getInstanceById($sourceRecord); } else { $productRecordModel = Products_Record_Model::getInstanceById($request->get('product_id')); } $relatedProducts = $productRecordModel->getDetailsForInventoryModule($recordModel); } elseif ($request->get('service_id') || $sourceModule === 'Services') { if ($sourceRecord) { $serviceRecordModel = Services_Record_Model::getInstanceById($sourceRecord); } else { $serviceRecordModel = Services_Record_Model::getInstanceById($request->get('service_id')); } $relatedProducts = $serviceRecordModel->getDetailsForInventoryModule($recordModel); } elseif ($sourceRecord && ($sourceModule === 'Accounts' || $sourceModule === 'Contacts' || $sourceModule === 'Potentials' || $sourceModule === 'Vendors' && $moduleName === 'PurchaseOrder')) { $parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule); $recordModel->setParentRecordData($parentRecordModel); } } $moduleModel = $recordModel->getModule(); $fieldList = $moduleModel->getFields(); $requestFieldList = array_intersect_key($request->getAll(), $fieldList); //get the inventory terms and conditions $inventoryRecordModel = Inventory_Record_Model::getCleanInstance($moduleName); $termsAndConditions = $inventoryRecordModel->getInventoryTermsandConditions(); foreach ($requestFieldList as $fieldName => $fieldValue) { $fieldModel = $fieldList[$fieldName]; if ($fieldModel->isEditable()) { $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue)); } } $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT); $viewer->assign('VIEW_MODE', "fullForm"); $isRelationOperation = $request->get('relationOperation'); //if it is relation edit $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation); if ($isRelationOperation) { $viewer->assign('SOURCE_MODULE', $sourceModule); $viewer->assign('SOURCE_RECORD', $sourceRecord); } if (!empty($record) && $request->get('isDuplicate') == true) { $viewer->assign('IS_DUPLICATE', true); } else { $viewer->assign('IS_DUPLICATE', false); } $currencies = Inventory_Module_Model::getAllCurrencies(); $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName); $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource)); $mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName); $viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField)); $viewer->assign('RECORD', $recordModel); $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance); $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure()); $viewer->assign('MODULE', $moduleName); $viewer->assign('BLOCK_LIST', $moduleModel->getBlocks()); $viewer->assign('CURRENTDATE', date('Y-n-j')); $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel()); $viewer->assign('RELATED_PRODUCTS', $relatedProducts); $viewer->assign('TAXES', $taxes); $viewer->assign('CURRENCINFO', $currencyInfo); $viewer->assign('CURRENCIES', $currencies); $viewer->assign('TERMSANDCONDITIONS', $termsAndConditions); $productModuleModel = Vtiger_Module_Model::getInstance('Products'); $viewer->assign('PRODUCT_ACTIVE', $productModuleModel->isActive()); $serviceModuleModel = Vtiger_Module_Model::getInstance('Services'); $viewer->assign('SERVICE_ACTIVE', $serviceModuleModel->isActive()); $viewer->assign('APIADDRESS', Settings_ApiAddress_Module_Model::getInstance('Settings:ApiAddress')->getConfig(false)); $viewer->view('EditView.tpl', 'Inventory'); }
public function process(Vtiger_Request $request) { $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $record = $request->get('record'); $sourceRecord = $request->get('sourceRecord'); $sourceModule = $request->get('sourceModule'); if (!empty($record) && $request->get('isDuplicate') == true) { $recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName); $currencyInfo = $recordModel->getCurrencyInfo(); $taxes = $recordModel->getProductTaxes(); $shippingTaxes = $recordModel->getShippingTaxes(); $relatedProducts = $recordModel->getProducts(); $viewer->assign('MODE', ''); //While Duplicating record, If the related record is deleted then we are removing related record info in record model $mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels(); foreach ($mandatoryFieldModels as $fieldModel) { if ($fieldModel->isReferenceField()) { $fieldName = $fieldModel->get('name'); if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) { $recordModel->set($fieldName, ''); } } } } elseif (!empty($record)) { $recordModel = Inventory_Record_Model::getInstanceById($record, $moduleName); $currencyInfo = $recordModel->getCurrencyInfo(); $taxes = $recordModel->getProductTaxes(); $shippingTaxes = $recordModel->getShippingTaxes(); $relatedProducts = $recordModel->getProducts(); $viewer->assign('RECORD_ID', $record); $viewer->assign('MODE', 'edit'); // SalesPlatform.ru begin Relation between Invoice & Consignment } elseif ($request->get('salesorder_id') || $request->get('quote_id') || $request->get('invoice_id')) { //} elseif ($request->get('salesorder_id') || $request->get('quote_id') || $request->get('invoice_id')) { // SalesPlatform.ru end if ($request->get('salesorder_id')) { $referenceId = $request->get('salesorder_id'); // SalesPlatform.ru begin Relation between Invoice & Consignment } elseif ($request->get('invoice_id')) { $referenceId = $request->get('invoice_id'); // SalesPlatform.ru end } else { $referenceId = $request->get('quote_id'); } $parentRecordModel = Inventory_Record_Model::getInstanceById($referenceId); $currencyInfo = $parentRecordModel->getCurrencyInfo(); $taxes = $parentRecordModel->getProductTaxes(); $shippingTaxes = $parentRecordModel->getShippingTaxes(); $relatedProducts = $parentRecordModel->getProducts(); $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName); $recordModel->setRecordFieldValues($parentRecordModel); /** EventHandler START */ $recordModel = EventHandler_Module_Model::do_filter('vtiger.filter.' . strtolower($moduleName) . '.convert', $recordModel, $parentRecordModel); /** EventHandler ENDE */ } else { $taxes = Inventory_Module_Model::getAllProductTaxes(); $shippingTaxes = Inventory_Module_Model::getAllShippingTaxes(); $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName); $viewer->assign('MODE', ''); //The creation of Inventory record from action and Related list of product/service detailview the product/service details will calculated by following code if ($request->get('product_id') || $sourceModule === 'Products') { if ($sourceRecord) { $productRecordModel = Products_Record_Model::getInstanceById($sourceRecord); } else { $productRecordModel = Products_Record_Model::getInstanceById($request->get('product_id')); } $relatedProducts = $productRecordModel->getDetailsForInventoryModule($recordModel); } elseif ($request->get('service_id') || $sourceModule === 'Services') { if ($sourceRecord) { $serviceRecordModel = Services_Record_Model::getInstanceById($sourceRecord); } else { $serviceRecordModel = Services_Record_Model::getInstanceById($request->get('service_id')); } $relatedProducts = $serviceRecordModel->getDetailsForInventoryModule($recordModel); } elseif ($sourceRecord && ($sourceModule === 'Accounts' || $sourceModule === 'Contacts' || $sourceModule === 'Potentials' || $sourceModule === 'Vendors' && $moduleName === 'PurchaseOrder')) { $parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule); $recordModel->setParentRecordData($parentRecordModel); } } $moduleModel = $recordModel->getModule(); $fieldList = $moduleModel->getFields(); $requestFieldList = array_intersect_key($request->getAll(), $fieldList); //get the inventory terms and conditions $inventoryRecordModel = Inventory_Record_Model::getCleanInstance($moduleName); $termsAndConditions = $inventoryRecordModel->getInventoryTermsandConditions(); foreach ($requestFieldList as $fieldName => $fieldValue) { $fieldModel = $fieldList[$fieldName]; if ($fieldModel->isEditable()) { $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue)); } } // SalesPlatform.ru begin Set default invoice status for SalesOrder if ($moduleName == "SalesOrder") { if (empty($record)) { $recordModel->set("invoicestatus", "AutoCreated"); } else { $checkbox = $recordModel->get("enable_recurring"); if ($checkbox != 1) { $recordModel->set("invoicestatus", "AutoCreated"); } } } // SalesPlatform.ru end // SalesPlatform.ru begin Unifying method for EditView preparing $recordModel = prepareEditView($recordModel, $_REQUEST, $viewer); // SalesPlatform.ru end $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT); // SalesPlatform.ru begin Field Validation Information $tabid = getTabid($moduleName); $validationData = getDBValidationData($recordModel->get('tab_name'), $tabid); $validationArray = split_validationdataArray($validationData); $viewer->assign("VALIDATION_DATA_FIELDNAME", $validationArray['fieldname']); $viewer->assign("VALIDATION_DATA_FIELDDATATYPE", $validationArray['datatype']); $viewer->assign("VALIDATION_DATA_FIELDLABEL", $validationArray['fieldlabel']); $viewer->assign('ID', $record); // SalesPlatform.ru end $viewer->assign('VIEW_MODE', "fullForm"); $isRelationOperation = $request->get('relationOperation'); //if it is relation edit //SalesPlatform.ru begin add relation create for Act from Invoice $isFromInvoiceCreate = $request->get('convertFromInvoice'); $viewer->assign('IS_FROM_INVOICE_CREATE', $isFromInvoiceCreate); //SalesPlatform.ru end $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation); //SalesPlatform.ru begin add relation create for Act from Invoice if ($isRelationOperation || $isFromInvoiceCreate) { //if($isRelationOperation) //SalesPlatform.ru end $viewer->assign('SOURCE_MODULE', $sourceModule); $viewer->assign('SOURCE_RECORD', $sourceRecord); } if (!empty($record) && $request->get('isDuplicate') == true) { $viewer->assign('IS_DUPLICATE', true); } else { $viewer->assign('IS_DUPLICATE', false); } $currencies = Inventory_Module_Model::getAllCurrencies(); $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName); $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource)); $viewer->assign('RECORD', $recordModel); $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance); $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure()); $viewer->assign('MODULE', $moduleName); $viewer->assign('CURRENTDATE', date('Y-n-j')); $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel()); $viewer->assign('RELATED_PRODUCTS', $relatedProducts); $viewer->assign('SHIPPING_TAXES', $shippingTaxes); $viewer->assign('TAXES', $taxes); $viewer->assign('CURRENCINFO', $currencyInfo); $viewer->assign('CURRENCIES', $currencies); $viewer->assign('TERMSANDCONDITIONS', $termsAndConditions); $productModuleModel = Vtiger_Module_Model::getInstance('Products'); $viewer->assign('PRODUCT_ACTIVE', $productModuleModel->isActive()); $serviceModuleModel = Vtiger_Module_Model::getInstance('Services'); $viewer->assign('SERVICE_ACTIVE', $serviceModuleModel->isActive()); $viewer->view('EditView.tpl', 'Inventory'); }