Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into task/zoho-L41-T206…
Browse files Browse the repository at this point in the history
…-refactor-controller-assessments

# Conflicts:
#	application/config/version.php
#	application/helpers/update/updatedb_helper.php
  • Loading branch information
Trischi80 committed Jan 14, 2021
2 parents 3050fbb + bb7b80f commit 58806ca
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 22 deletions.
4 changes: 2 additions & 2 deletions application/config/version.php
Expand Up @@ -11,10 +11,10 @@
* See COPYRIGHT.php for copyright notices and details.
*/

$config['versionnumber'] = '4.4.0-RC2';
$config['versionnumber'] = '4.4.0-RC3';
$config['dbversionnumber'] = 436;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
$config['assetsversionnumber'] = '30179';
$config['assetsversionnumber'] = '30180';
return $config;
4 changes: 2 additions & 2 deletions application/controllers/admin/globalsettings.php
Expand Up @@ -279,15 +279,15 @@ private function _saveSettings()
SettingGlobal::setSetting('emailmethod', strip_tags(Yii::app()->getRequest()->getPost('emailmethod')));
SettingGlobal::setSetting('emailsmtphost', strip_tags(returnGlobal('emailsmtphost')));
if (returnGlobal('emailsmtppassword') != 'somepassword') {
SettingGlobal::setSetting('emailsmtppassword', LSActiveRecord::encryptSingle(strip_tags(returnGlobal('emailsmtppassword'))));
SettingGlobal::setSetting('emailsmtppassword', LSActiveRecord::encryptSingle(returnGlobal('emailsmtppassword')));
}
SettingGlobal::setSetting('bounceaccounthost', strip_tags(returnGlobal('bounceaccounthost')));
SettingGlobal::setSetting('bounceaccounttype', Yii::app()->request->getPost('bounceaccounttype', 'off'));
SettingGlobal::setSetting('bounceencryption', Yii::app()->request->getPost('bounceencryption', 'off'));
SettingGlobal::setSetting('bounceaccountuser', strip_tags(returnGlobal('bounceaccountuser')));

if (returnGlobal('bounceaccountpass') != 'enteredpassword') {
SettingGlobal::setSetting('bounceaccountpass', LSActiveRecord::encryptSingle(strip_tags(returnGlobal('bounceaccountpass'))));
SettingGlobal::setSetting('bounceaccountpass', LSActiveRecord::encryptSingle(returnGlobal('bounceaccountpass')));
}

SettingGlobal::setSetting('emailsmtpssl', sanitize_paranoid_string(Yii::app()->request->getPost('emailsmtpssl', '')));
Expand Down
4 changes: 3 additions & 1 deletion application/controllers/admin/tokens.php
Expand Up @@ -2437,7 +2437,9 @@ public function bouncesettings($iSurveyId)
if (Yii::app()->request->getPost('bounceprocessing') == 'L') {
$fieldvalue['bounceaccountencryption'] = Yii::app()->request->getPost('bounceaccountencryption');
$fieldvalue['bounceaccountuser'] = Yii::app()->request->getPost('bounceaccountuser');
$fieldvalue['bounceaccountpass'] = LSActiveRecord::encryptSingle(Yii::app()->request->getPost('bounceaccountpass'));
if (Yii::app()->request->getPost('bounceaccountpass')!='somepassword'){
$fieldvalue['bounceaccountpass'] = LSActiveRecord::encryptSingle(Yii::app()->request->getPost('bounceaccountpass'));
}
$fieldvalue['bounceaccounttype'] = Yii::app()->request->getPost('bounceaccounttype');
$fieldvalue['bounceaccounthost'] = Yii::app()->request->getPost('bounceaccounthost');
}
Expand Down
Expand Up @@ -22,7 +22,7 @@
</button>
</span>
<?php else :?>
<a class="btn btn-default" href='<?php echo Yii::App()->createUrl("questionAdministration/view/surveyid/".$oSurvey->sid);
<a class="btn btn-default" href='<?php echo Yii::App()->createUrl("questionAdministration/create/surveyid/".$oSurvey->sid);
?>' role="button">
<span class="icon-add"></span>
<?php eT("Add new question"); ?>
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/questionHelper.php
Expand Up @@ -1043,7 +1043,7 @@ public static function getAttributesDefinitions()
'options'=>array(0=>gT('No'), 1=>gT('Yes')),
'default'=>0,
"help"=>gT('Add a button to reset the slider. If you choose an start value, it reset at start value, else empty the answer.'),
"caption"=>gT('Allow reset the slider')
"caption"=>gT('Allow slider reset')
);

self::$attributes["slider_showminmax"] = array(
Expand Down
25 changes: 18 additions & 7 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -2854,8 +2854,10 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)

if($iOldDBVersion < 412) {
$oTransaction = $oDB->beginTransaction();
$aGroups = array_keys(SurveysGroups::model()->findAll(array('index'=>'gsid')));
$aGroupSettings = array_keys(SurveysGroupsettings::model()->findAll(array('index'=>'gsid')));
$sSurveyGroupQuery = "SELECT gsid from {{surveys_groups}} order by gsid";
$aGroups = $oDB->createCommand($sSurveyGroupQuery)->queryColumn();
$sSurveyGroupSettingsQuery = "SELECT gsid from {{surveys_groupsettings}} order by gsid";
$aGroupSettings = $oDB->createCommand($sSurveyGroupSettingsQuery)->queryColumn();
foreach ($aGroups as $group){
if (!array_key_exists($group, $aGroupSettings)){
$settings = new SurveysGroupsettings;
Expand Down Expand Up @@ -2909,11 +2911,11 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)

// encrypt bounceaccountpass value in db
alterColumn('{{surveys}}','bounceaccountpass',"text",true,'NULL');
$aSurveys = Survey::model()->findAll();
foreach($aSurveys as $oSurvey){
if (!empty($oSurvey->bounceaccountpass)){
$oSurvey->bounceaccountpass = LSActiveRecord::encryptSingle($oSurvey->bounceaccountpass);
$oSurvey->save();
$sSurveyQuery = "SELECT * from {{surveys}} order by sid";
$aSurveys = $oDB->createCommand($sSurveyQuery)->queryAll();
foreach ( $aSurveys as $aSurvey ) {
if (!empty($aSurvey['bounceaccountpass'])){
$oDB->createCommand()->update('{{surveys}}',['bounceaccountpass'=>LSActiveRecord::encryptSingle($aSurvey->bounceaccountpass)],"sid=".$aSurvey[sid]);
}
}

Expand Down Expand Up @@ -3459,6 +3461,15 @@ function ($v) {
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 435), "stg_name='DBVersion'");
$oTransaction->commit();
}

if ($iOldDBVersion < 436) {
$oTransaction = $oDB->beginTransaction();
$oDB->createCommand()->update('{{boxes}}', array('url' => 'themeOptions'), "url='admin/themeoptions'");
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 436), "stg_name='DBVersion'");
$oTransaction->commit();
}


if($iOldDBVersion < 436){
$oTransaction = $oDB->beginTransaction();
//refactore controller assessment (surveymenu_entry link changes to new controller rout)
Expand Down
7 changes: 4 additions & 3 deletions application/models/Permission.php
Expand Up @@ -487,7 +487,7 @@ public function copySurveyPermissions($iSurveyIDSource, $iSurveyIDTarget)
* @param string $sEntityName string The entity name
* @param $sPermission string Name of the permission
* @param $sCRUD string The permission detail you want to check on: 'create','read','update','delete','import' or 'export'
* @param $iUserID integer User ID - if not given the one of the current user is used
* @param $iUserID integer User ID - if not given the one of the current user is used, 0 is used for role permission (not related to user)
* @return bool True if user has the permission
*/
public function hasPermission($iEntityID, $sEntityName, $sPermission, $sCRUD = 'read', $iUserID = null, $iPermissionRoleId = null)
Expand Down Expand Up @@ -539,7 +539,7 @@ public function hasPermission($iEntityID, $sEntityName, $sPermission, $sCRUD = '

/* Always return true if you are the owner : this can be done in core plugin ? */
// TODO: give the rights to owner adding line in permissions table, so it will return true with the normal way
if ($iUserID == $this->getEntityOwnerId($iEntityID, $sEntityName) && $sEntityName != 'role') {
if ($iUserID === $this->getEntityOwnerId($iEntityID, $sEntityName)) {
return true;
}

Expand Down Expand Up @@ -701,6 +701,7 @@ public function hasSurveysInGroupPermission($iSurveyGroupId, $sPermission, $sCRU
*/
public function hasRolePermission($iRoleId, $sPermission, $sCRUD = 'read')
{
/* Get permission foor user id = 0 */
return $this->hasPermission($iRoleId, 'role', $sPermission, $sCRUD, 0);
}

Expand Down Expand Up @@ -764,7 +765,7 @@ public static function getUserRole($iUserID)
protected function getEntityOwnerId($iEntityID, $sEntityName)
{
/* know invalid entity */
if (in_array($sEntityName, array('global','template'))) {
if (in_array($sEntityName, array('global','template','role',))) {
return null;
}
/* allow to get it dynamically from any model */
Expand Down
6 changes: 5 additions & 1 deletion application/models/SurveysGroups.php
Expand Up @@ -11,7 +11,7 @@
* @property integer $sortorder
* @property integer $owner_id
* @property integer $parent_id
* @property boolean $alwaysavailable
* @property boolean|integer $alwaysavailable
* @property string $created
* @property string $modified
* @property integer $created_by
Expand All @@ -20,6 +20,10 @@
*/
class SurveysGroups extends LSActiveRecord
{

/* @var boolean|integer alwaysavailable : set default, and set for old DB , usage of integer for DB compatibility */
public $alwaysavailable = 0;

/**
* @return string the associated database table name
*/
Expand Down
4 changes: 2 additions & 2 deletions application/models/Token.php
Expand Up @@ -405,8 +405,8 @@ public function rules()
array('usesleft', 'numerical', 'integerOnly'=>true, 'allowEmpty'=>true, 'min'=>-2147483647, 'max'=>2147483647),
array('mpid', 'numerical', 'integerOnly'=>true, 'allowEmpty'=>true),
array('blacklisted', 'in', 'range'=>array('Y', 'N'), 'allowEmpty'=>true),
array('validfrom', 'date','format'=>['yyyy-M-d H:m:s','yyyy-M-d H:m'],'allowEmpty'=>true),
array('validuntil','date','format'=>['yyyy-M-d H:m:s','yyyy-M-d H:m'],'allowEmpty'=>true),
array('validfrom', 'date','format'=>['yyyy-M-d H:m:s.???','yyyy-M-d H:m:s','yyyy-M-d H:m'],'allowEmpty'=>true),
array('validuntil','date','format'=>['yyyy-M-d H:m:s.???','yyyy-M-d H:m:s','yyyy-M-d H:m'],'allowEmpty'=>true),
array('emailstatus', 'default', 'value' => 'OK'),
);
foreach (decodeTokenAttributes($this->survey->attributedescriptions) as $key => $info) {
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/bounce.php
Expand Up @@ -84,7 +84,7 @@
</label>

<div class="default controls">
<input autocomplete="off" size="50" type="password" value="<?php echo $settings['bounceaccountpass'];?>" name="bounceaccountpass" id="bounceaccountpass" />
<input autocomplete="off" size="50" type="password" value="somepassword" name="bounceaccountpass" id="bounceaccountpass" />
</div>
</div>

Expand Down
Expand Up @@ -736,7 +736,7 @@
</options>
<default>0</default>
<help>Add a button to reset the slider. If you choose an start value, it reset at start value, else empty the answer.</help>
<caption>Allow reset the slider</caption>
<caption>Allow slider reset</caption>
<i18n></i18n>
<readonly></readonly>
<readonly_when_active></readonly_when_active>
Expand Down
9 changes: 9 additions & 0 deletions docs/release_notes.txt
Expand Up @@ -34,6 +34,15 @@ Thank you to everyone who helped with this new release!

CHANGE LOG
------------------------------------------------------
Changes from 4.4.0-RC2 (build 210104) to 4.4.0-RC3 (build 210112) January 11, 2021
-Fixed issue: Database error when username or user full name too long (Carsten Schmitz)
-Fixed issue: Database error when survey title too long (Carsten Schmitz)
-Fixed issue #15611: No HTML wrapper in public stats (#1696) (Gabriel Jenik)
#Updated translation: Romanian by c_schmitz, filipguttman, enedelcu, cdorin
#Updated translation: Portuguese (Portugal) by samarta
#Updated translation: Japanese by nomoto


Changes from 4.4.0-RC1 (build 201223) to 4.4.0-RC2 (build 210104) January 4, 2021
+New feature #16779: Keep graph on same statistics PDF page if possible (GabrielJenik)
-Fixed issue #16932: When creating a survey with the default demo contents, the process halts (GabrielJenik)
Expand Down

0 comments on commit 58806ca

Please sign in to comment.