Jump to content
X2Community Forums

Recommended Posts

X2 Version: 1.6.1

 

Modified - AdminController.php and DefaultController.php based on admin posts following 1.6.1 release

 

Unable to Create New Campaign (griping about a lauchDate field)

 

Error as follows:

 

 

CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'launchDate' doesn't have a default value. The SQL statement executed was: INSERT INTO `x2_campaigns` (`active`, `complete`, `assignedTo`, `content`, `description`, `listId`, `name`, `subject`, `type`, `createdBy`, `createDate`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)

C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\db\CDbCommand.php(354)

 

342 return $n;

343 }

344 catch(Exception $e)

345 {

346 if($this->_connection->enableProfiling)

347 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');

348 $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;

349 $message = $e->getMessage();

350 Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',

351 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');

352 if(YII_DEBUG)

353 $message .= '. The SQL statement executed was: '.$this->getText().$par;

354 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',

355 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);

356 }

357 }

358

359 /**

360 * Executes the SQL statement and returns query result.

361 * This method is for executing an SQL query that returns result set.

362 * @param array $params input parameters (name=>value) for the SQL execution. This is an alternative

363 * to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing

364 * them in this way can improve the performance. Note that if you pass parameters in this way,

365 * you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.

366 * binding methods and the input parameters this way can improve the performance.

 

Stack Trace

#0

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\db\ar\CActiveRecord.php(1014): CDbCommand->execute()

#1

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\db\ar\CActiveRecord.php(787): CActiveRecord->insert(null)

#2

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\protected\controllers\x2base.php(539): CActiveRecord->save()

 

534 * If creation is successful, the browser will be redirected to the 'view' page.

535 */

536 public function create($model, $oldAttributes, $api) {

537 $name=$this->modelClass;

538 $model->createDate=time();

539 if($model->save()) {

540 if(!($model instanceof Actions)) {

541 $fields=Fields::model()->findAllByAttributes(array('modelName'=>$name,'type'=>'link'));

542 foreach($fields as $field) {

543 $fieldName=$field->fieldName;

544 if(isset($model->$fieldName) && is_numeric($model->$fieldName)) {

#3

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\protected\modules\marketing\controllers\DefaultController.php(112): x2base->create(Campaign, array("active" => 1, "complete" => 0, "id" => null, "masterId" => null, ...), 0)

 

107 $model=new Campaign;

108 if(isset($_POST['Campaign'])) {

109 $oldAttributes = $model->attributes;

110 $model->setX2Fields($_POST['Campaign']);

111 $model->createdBy = Yii::app()->user->getName();

112 parent::create($model, $oldAttributes,0);

113 }

114 $this->render('create',array(

115 'model'=>$model,

116 ));

117 }

#4

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\actions\CInlineAction.php(50): DefaultController->actionCreate()

#5

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\CController.php(309): CInlineAction->runWithParams(array())

#6

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\filters\CFilterChain.php(134): CController->runAction(CInlineAction)

#7

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\protected\controllers\x2base.php(1215): CFilterChain->run()

 

1210 $this->portlets = ProfileChild::getWidgets();

1211 // foreach($widgets as $key=>$value) {

1212 // $options = ProfileChild::parseWidget($value,$key);

1213 // $this->portlets[$key] = $options;

1214 // }

1215 $filterChain->run();

1216 }

1217

1218

1219 function getRealIp() {

1220 if (!empty($_SERVER['HTTP_CLIENT_IP']))

#8

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\filters\CInlineFilter.php(59): x2base->filterSetPortlets(CFilterChain)

#9

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter(CFilterChain)

#10

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\filters\CFilter.php(41): CFilterChain->run()

#11

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\CController.php(1146): CFilter->filter(CFilterChain)

#12

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(CFilterChain)

#13

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter(CFilterChain)

#14

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\CController.php(292): CFilterChain->run()

#15

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\CController.php(266): CController->runActionWithFilters(CInlineAction, array("accessControl", "setPortlets"))

#16

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\CWebApplication.php(276): CController->run("create")

#17

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\web\CWebApplication.php(135): CWebApplication->runController("marketing/default/create")

#18

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\framework\base\CApplication.php(162): CWebApplication->processRequest()

#19

+

[/center] C:\inetpub\wwwroot\SwingtimeGolfCRM\index.php(63): CApplication->run()

Link to post
Share on other sites

I think the easiest fix for this would be to go into your MySQL database, and alter the launchDate field in x2_campaigns to have a default value of 0. It seems you have some different database settings from us, as this doesn't usually produce an error but I think it would resolve it on your system.

 

Let me know if there are any more issues.

 

Jake

Link to post
Share on other sites

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...