Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Error : Bad quota id with this survey id when creating a quota

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
4 months 2 weeks ago #253173 by blocka
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.48+231205
Own server or LimeSurvey hosting: Own
Survey theme/template: N/A
==================
When I try to add a quota to a survey, I get the error "Bad quota id with this survey id" .. I see this is triggered in Quotas.php:
Code:
    /**
     * Check validity of a quotaid against a survey id
     * @param integer $iSurveyId
     * @param integer $quotaid
     * throw Exception
     * @return void
     */
    private function checkValidQuotaId($surveyId, $quotaId)
    {
        $model = Quota::model()->find(
            "id = :quotaid AND sid = :surveyid",
            [':quotaid' => $quotaId, ':surveyid' => $surveyId]
        );
        if (empty($model)) {
            throw new CHttpException(403, gT("Bad quota id with this survey id."));
        }
    }

But I'm not understanding why this error would occur?

Steps to recreate error:
  1. I create the the initial quota okay.
  2. I then click "Add answer".
  3. I select a Question and click Next
  4. I select an Answer and click Next
  5. The error Bad quota id with this survey id is displayed...

Please Log in to join the conversation.

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
4 months 2 weeks ago #253175 by blocka
As an update to this, I noted that if I go to line 313 of /application/controllers/admin/Quotas.php/Quotas.php and comment out ...

$this->checkValidQuotaId($surveyId, $quota_id);

as shown below, the error does not occur. Note sure what else I'm breaking by commenting out this line though....

Code:
    public function insertquotaanswer(int $iSurveyId)
    {
        $this->requirePostRequest();
 
        $iSurveyId = sanitize_int($iSurveyId);
        $qid = Yii::app()->request->getPost('quota_qid');
        $quota_id = Yii::app()->request->getPost('quota_id');
        $this->checkPermissions($iSurveyId, 'update');
        //$this->checkValidQuotaId($surveyId, $quota_id);

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 2 weeks ago #253298 by DenisChenu

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose