Jump to content

Error With Adding Coupon To Cutom Add-On


Anton Qcl

Recommended Posts

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.

Link to comment
Share on other sites

Yeah, I think we'll need more information to help you debug. The used_qty is set to coupons.used_qty+1 when the service is added, so I'm not sure how it could have the value "=". You can try to dump the $vars data before the service is created to see if something is amiss.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...