Jump to content

Anton Qcl

Members
  • Posts

    70
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Anton Qcl

  1. Change this row: Options Indexes FollowSymLinks MultiViews to Options Indexes +FollowSymLinks MultiViews
  2. Ok... Install $this->Record->query(" CREATE TABLE IF NOT EXISTS `vs_credit_invoices` ( `creation_date` datetime NOT NULL, `id` int(11) NOT NULL, `client_id` int(11) NOT NULL, `status` enum('NEW','DONE') NOT NULL DEFAULT 'NEW', PRIMARY KEY (`id`), KEY `i_status` (`status`) ) " ); public function createAdditionalTables() { $this->Record->query(" CREATE TABLE IF NOT EXISTS `vs_credit_invoice_lines` ( `id` int(11) NOT NULL, `invoice_id` int(11) NOT NULL, `service_id` int(11) NOT NULL, `amount` float(12,4) NOT NULL DEFAULT '0.0000', PRIMARY KEY (`id`), KEY `i_invoice_id` (`invoice_id`) ) " ); } public function modifyExistedTables() { $this->Record->query(" ALTER TABLE `invoices` CHANGE `status` `status` ENUM('active','draft','void','expect_additions') DEFAULT 'active' NOT NULL " ); public function createAdditionalTriggers() { $this->Record->query(" DROP TRIGGER IF EXISTS `tbi_invoice_lines` " ); $this->Record->query(" CREATE TRIGGER `tbi_invoice_lines` BEFORE INSERT ON `invoice_lines` FOR EACH ROW BEGIN IF (NEW.`description` LIKE '{{NOT_TRIGGERED}}%') THEN SET NEW.`description` = REPLACE(NEW.`description`, '{{NOT_TRIGGERED}}', ''); ELSE SET @credit_fl = ( SELECT mrm.`value` FROM `services` s JOIN `module_row_meta` mrm ON ( mrm.`module_row_id`=s.`module_row_id` AND mrm.`key`='credit_fl' ) WHERE s.`id`=NEW.`service_id` ); IF (@credit_fl = 'yes' ) THEN UPDATE `invoices` SET `status`='expect_additions' WHERE `id`=NEW.`invoice_id`; UPDATE `invoice_delivery` SET `date_sent`='2001-01-01 00:00:00' WHERE `invoice_id`=NEW.`invoice_id`; INSERT INTO `vs_credit_invoices` SELECT NOW(), NEW.`invoice_id`, s.`client_id`, 'NEW' FROM `services` s WHERE s.`id`=NEW.`service_id`; SET @new_line_id = ( SELECT `AUTO_INCREMENT` AS 'ai' FROM information_schema.`TABLES` WHERE `table_schema`=(SELECT DATABASE()) AND `table_name`='invoice_lines' ); INSERT INTO `vs_credit_invoice_lines` VALUES ( @new_line_id , NEW.`invoice_id`, NEW.`service_id`, NEW.`amount` ); END IF; END IF; END; " ); } } I also tried without this part. Result was same: UPDATE `invoices` SET `status`='expect_additions' WHERE `id`=NEW.`invoice_id`; UPDATE `invoice_delivery` SET `date_sent`='2001-01-01 00:00:00' WHERE `invoice_id`=NEW.`invoice_id`; Main function for fill invoices: private function fillCreditInvoices() { $invoices = $this->getCreditInvoices(); foreach ($invoices as $invoice) { $count_lines = $this->getCountInvoiceLines($invoice->id); foreach ($invoice->invoice_lines as $line) { $service = $this->Services->get($line->service_id); $fields = $this->formatServiceFields($service->fields); $credit = $this->Voipswitch->getVsCredit($fields->vs_id); $account_state = $this->Voipswitch->getVsAccountData($fields->vs_id)->account_state; $balance = $credit-$account_state; if ($balance <= 0) { if ($line->amount == 0) { $this->deleteInvoiceLine($line->id); if ($count_lines == 1) { $this->deleteInvoice($invoice->id); } } } else { $invoice->data = $this->Invoices->get($invoice->id); $vars = array( 'client_id' => $invoice->data->client_id, 'currency' => $invoice->data->currency, 'lines' => array( array( 'service_id' => $line->service_id, 'description' => $this->getInvoiceDescription($fields->vs_id), 'qty' => 1, 'amount' => $balance, 'tax' => true ) ) ); if ($line->amount == 0) { $vars['lines'][0]['id'] = $line->id; $vars['lines'][0]['description'] = $this->getInvoiceDescription($fields->vs_id, "no"); } $this->Invoices->edit($invoice->id, $vars); $this->Voipswitch->makePayment($fields->vs_id, $balance, 1, "Credit restored from Portal"); } } $this->activateInvoice($invoice->id); $this->markInvoiceAsProcessed($invoice->id); } } Function for get invoices: private function getCreditInvoices() { $query = " SELECT ci.* FROM `vs_credit_invoices` ci WHERE ci.`status`='NEW' "; $result = $this->Record->query($query); $invoices = $result->fetchAll(); foreach ($invoices as &$invoice) { $query = " SELECT cil.* FROM `vs_credit_invoice_lines` cil WHERE cil.`invoice_id`=? "; $result = $this->Record->query($query, $invoice->id); $invoice_lines = $result->fetchAll(); $invoice->invoice_lines = $invoice_lines; } return $invoices; }
  3. Is option "+followsymlinks" enabled in apache for your site?
  4. Id of existed invoice. Entering "20" works fully correct - tax added. Entering "$invoice->id" result in that the tax is not added. I changed the code in such a way that the client_id was taken directly from the invoice but it doesn't help: $invoice->data = $this->Invoices->get($invoice->id); $vars = array( 'client_id' => $invoice->data->client_id, 'currency' => $invoice->data->currency, 'lines' => array( array( 'service_id' => $line->service_id, 'description' => $this->getInvoiceDescription($fields->vs_id), 'qty' => 1, 'amount' => $balance, 'tax' => true ) ) ); What exactly do I need to show?
  5. . Thank you, it is my fault. I'm trying to use next code in my custom plugin: $vars = array( 'client_id' => $invoice->client_id, 'currency' => $this->Invoices->get($invoice->id)->currency, 'lines' => array( array( 'service_id' => $line->service_id, 'description' => $this->getInvoiceDescription($fields->vs_id), 'qty' => 1, 'amount' => $balance, 'tax' => true ) ) ); $this->Invoices->edit($invoice->id, $vars); ... but it doen't work - line add but tax doesn't add. If I am changing this row: $this->Invoices->edit($invoice->id, $vars); to $this->Invoices->edit(20, $vars); ...then it works correct. Do you have any idea how to fix it?
  6. Version: 3.0.5 Action: Try to use function "Invoices-edit" to add new invoice line with tax. The following query add new invoice line. New line should has tax but doesn't has. https://my.blesta.site/api/Invoices/edit.json?invoice_id=20&vars[client_id]=7&vars[lines][0][service_id]=39&vars[lines][0][description]=test&vars[lines][0][qty]=1&vars[lines][0][amount]=2&vars[lines][0][service_id]=39&tax=true"
  7. Yes, that's what happens. But in this case, the event "renewService" will never happen. Why is there method in a module that handles the event, if it can't ever come?
  8. Hello, If invoices is creating before few days of Renew Date, then Renew Date is moving. And event "Service Renew" is never coming. Is it normal?
  9. Hm, the problem has gone on version 3.0.4.
  10. That is cookie's bug. If I chosen Add-On and didn't buy it this then I can't change Add-On or buy any service (even service doesn't have Add-On) without chosen Add-On. For example: Package: Foo, Bar. Add-On's from package Foo: Fooaddon1, Fooaddon2. 1. I go to Portal and choose package Foo with Add-On Fooaddon1. 2. I close browser. 3. I open browser and go to Portal. 4. I choose package Bar and press "Continue". 5. I receive Add-On Fooaddon1.
  11. Version: 3.0.4 URL: plugin/order/main/configure/services?q_item=0 Last action: button "Continue" pressed. Problem: I'm trying to buy some product with plugin "Portal". I have few add-on packages - for example: "foo", "bar", "foobar". Package "foo" first in list. I'm trying to choose package "foobar" but function getClientAddField still receivng data in object "$package" from package "foo". Example: Code of getClientAddFields: public function getClientAddFields($package, $vars=null) { var_dump($package); } (I've chosen "foobar") Received data:object(stdClass)#242 (18) { ["id"]=> string(1) "3" ["id_format"]=> string(5) "{num}" ["id_value"]=> string(1) "3" ["module_id"]=> string(2) "12" ["name"]=> string(13) "foo" ["description"]=> string(0) "" ["description_html"]=> string(8) " " ["qty"]=> NULL ["module_row"]=> string(1) "3" ["module_group"]=> NULL ["taxable"]=> string(1) "1" ["status"]=> string(6) "active" ["company_id"]=> string(1) "1" ["id_code"]=> string(1) "3" ["email_content"]=> array(1) { [0]=> object(stdClass)#243 (3) { ["lang"]=> string(5) "en_us" ["html"]=> string(8) " " ["text"]=> string(0) "" } } ["pricing"]=> array(1) { [0]=> object(stdClass)#114 (7) { ["id"]=> string(1) "3" ["term"]=> string(1) "0" ["period"]=> string(7) "onetime" ["price"]=> string(7) "10.0000" ["setup_fee"]=> string(6) "0.0000" ["cancel_fee"]=> string(6) "0.0000" ["currency"]=> string(3) "CAD" } } ["meta"]=> object(stdClass)#240 (0) { } ["groups"]=> array(1) { [0]=> object(stdClass)#239 (3) { ["id"]=> string(1) "2" ["name"]=> string(4) "DIDs" ["type"]=> string(5) "addon" } } }
  12. Does anyone have any ideas? Maybe I have to show other functions from my code?
  13. Thank you. It works with standart Blesta's libraries: $(this).blestaSetHeadTag( "script", { type:"text/javascript", src: "/app/views/admin/default/javascript/date.min.js" } ); $(this).blestaSetHeadTag( "script", { type:"text/javascript", src: "/app/views/admin/default/javascript/jquery.datePicker.min.js" } ); But it doesn't work with jquery.js and jquery-ui.js. I think this is occurs because another version of jquery-libraries is already included on this page. May be at first I have to exclude them? If it right, how can I do that?
  14. Version: 3.0.3 URL: /admin/clients/servicetab/40/59/tabCalls/ Action: Changing from any other tabs Problem: When I'm changing tab inclusion of library jquery-ui doesn't occur. If I reload this page, library's inclusion occur correct. Error: Unhandled Error: '$(".custom_date").datepicker' is not a function My code: <div class="pad"> <ul class="highlight"> <li class="custom_date-wrapper"> <label for="id_date_start">Date Start: </label> <input type="text" name="date_start" id="id_date_start" class="custom_date" value="<?php if ($params->period == "CUSTOM") { echo $params->date_start; } ?>" > </input> </li> <li class="custom_date-wrapper"> <label for="id_date_end">Date End: </label> <input type="text" name="date_end" id="id_date_end" class="custom_date" value="<?php if ($params->period == "CUSTOM") { echo $params->date_end; } ?>" > </input> </li> </ul> </div> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $.noConflict(); jQuery(document).ready(function($) { $(".custom_date").datepicker({ dateFormat: "yy-mm-dd" }); });
  15. Version: 3.0.3 URL: /admin/clients/addservice/40/2/6/?parent_service_id=59 Action: Press button "Add Service" Problem: When I trying to apply coupon to addon-package based on service with my custom module I'm getting next error. Error: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '=' for column 'used_qty' at row 1 on line 124 in /var/www/my.blesta.site/public_html/lib/model.php Printing Stack Trace: #0 /var/www/my.blesta.site/lib/model.php(124): PDOStatement->execute(Array) #1 /var/www/my.blesta.site/public_html/components/record/record.php(232): Model->query('UPDATE `coupons...', Array) #2 /var/www/my.blesta.site/public_html/app/models/services.php(810): Record->update('coupons') #3 /var/www/my.blesta.site/public_html/app/controllers/admin_clients.php(3930): Services->add(Array, Array, true) #4 /var/www/my.blesta.site/public_html/app/controllers/admin_clients.php(3843): AdminClients->createService(Array, Array) #5 /var/www/my.blesta.site/public_html/app/controllers/admin_clients.php(3407): AdminClients->processServiceStep('confirm', Object(stdClass), Object(stdClass), Object(stdClass)) #6 /var/www/portal.myglt.net/public_html/lib/dispatcher.php(111): AdminClients->addService() #7 /var/www/portal.myglt.net/public_html/index.php(21): Dispatcher::dispatch('/admin/clients/...') #8 {main} Code of my function "getAdminAddFields": public function getAdminAddFields($package, $vars=null) { Loader::loadHelpers($this, array("Html")); $row = $this->getModuleRow($package->module_row); $fields = new ModuleFields(); /* Logic to getting array $numbers */ $number = $fields->label("Number", "number"); $number->attach( $fields->fieldSelect( 'number', $numbers, $this->Html->ifSet($vars->did_id), array( 'id' => "number" ) ) ); $fields->setField($number); //Trying to force set qty /*$qty = $fields->fieldHidden( "qty", 1, array( 'id' => "did_qty", ) ); $fields->setField($qty);*/ return $fields; } PS Service is added despite on error.
  16. Hello, Please add currency "CAD" in the Bluepay gateway. File: /public_html/components/gateways/merchant/blue_pay/blue_pay.php String(84-86): public function getCurrencies() { return array("USD"); } Necessary code: public function getCurrencies() { return array("USD", "CAD"); }
  17. I am creating field for show and edit module-meta-settings in manage.pdt. Full test code is in my first post. I expect that when I press button "Save" on /admin/settings/company/modules/manage/3/ data will be saved in table "modue_meta". This data will be displayed to user(administrator) when he will be on url /admin/settings/company/modules/manage/3/ again. This doesn't happens because the /var/www/my.blesta.site/public_html/app/controllers/admin_company_modules.php receive empty array "POST"($this->post) but have to receive array "POST"($this->post) with data from my form.
  18. Thank you for answer but no, I don't want add row. Method addModuleRow() work correct in my modules. I wish to add setting which will be act for entire module, not for one row.
  19. Hello, I have a problem with save field of my module settings. Version: 3.0.2 URL: /admin/settings/company/modules/manage/3/ Action: Press button "Save" in my custom module. Code of my "manageModule" method: public function manageModule($module, array &$vars) { $this->view = new View("manage", "default"); $this->view->base_uri = $this->base_uri; $this->view->setDefaultView("components" . DS . "modules" . DS . "vs_manager" . DS); Loader::loadHelpers($this, array("Form", "Html", "Widget")); $this->view->set("module", $module); return $this->view->fetch(); } Code of my manage.pdt: <?php $this->Widget->clear(); ?> <?php $this->Widget->create($this->_("AdminCompanyModules.manage.boxtitle_manage", true, $this->Html->_($module->name, true))); ?> <?php $this->Form->create(); ?> <div class="title_row first"> <div class="pad"> <?php $this->Form->label("Settings", "my_settings"); ?> <?php $this->Form->fieldText("settings", $this->Html->ifSet($module->meta->settings), array('id'=>"my_settings")); ?> </div> <div class="button_row"> <a href="#" class="btn_right submit">Save</a> </div> </div> <?php $this->Form->end(); ?> <?php $this->Widget->end();?> I've expected that data will be saved but I've got next error:
×
×
  • Create New...