Code Duplication    Length = 11-20 lines in 3 locations

includes/librairies/eav/attributes_set.class.php 1 location

@@ 142-154 (lines=13) @@
139
		}
140
141
		if(($pageAction != '') && (($pageAction == 'edit') || ($pageAction == 'editandcontinue') || ($pageAction == 'delete'))){
142
			if(current_user_can('wpshop_edit_attribute_set')){
143
				$attribute_set_parameter['last_update_date'] = date('Y-m-d H:i:s');
144
				if($pageAction == 'delete'){
145
					if(current_user_can('wpshop_delete_attribute_set'))
146
						$attribute_set_parameter['status'] = 'deleted';
147
					else
148
						$actionResult = 'userNotAllowedForActionDelete';
149
				}
150
				$actionResult = wpshop_database::update($attribute_set_parameter, $id, self::getDbTable());
151
			}
152
			else{
153
				$actionResult = 'userNotAllowedForActionEdit';
154
			}
155
156
			/** Address display managment **/
157
				if ( !empty($id) ) {

includes/librairies/eav/attributes.class.php 1 location

@@ 313-323 (lines=11) @@
310
				$attribute = self::getElement($id, "'valid', 'moderated', 'notused', 'deleted'", 'id');
311
				$attribute_code = $attribute->code;
312
			}
313
			if (!in_array($attribute_code, $attribute_undeletable)) {
314
				if(current_user_can('wpshop_delete_attributes')){
315
					$attribute_parameter['last_update_date'] = current_time('mysql', 0);
316
					$attribute_parameter['status'] = 'deleted';
317
					$actionResult = wpshop_database::update($attribute_parameter, $id, self::getDbTable());
318
				}
319
				else
320
					$actionResult = 'userNotAllowedForActionDelete';
321
			}
322
			else
323
				$actionResult = 'unDeletableAtribute';
324
		}
325
		elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){
326
			if(current_user_can('wpshop_add_attributes')){

includes/librairies/eav/attributes_unit.class.php 1 location

@@ 174-193 (lines=20) @@
171
		$pageAction = isset($_REQUEST[self::getDbTable() . '_action']) ? wpshop_tools::varSanitizer($_REQUEST[self::getDbTable() . '_action']) : '';
172
		$id = isset($attribute_group_parameter['id']) ? sanitize_key($attribute_group_parameter['id']) : '';
173
		if(($pageAction != '') && (($pageAction == 'edit') || ($pageAction == 'editandcontinue'))){
174
			if(current_user_can('wpshop_edit_attributes'))
175
			{
176
				$attribute_group_parameter['last_update_date'] = date('Y-m-d H:i:s');
177
				if($pageAction == 'delete')
178
				{
179
					if(current_user_can('wpshop_delete_attributes'))
180
					{
181
						$attribute_group_parameter['status'] = 'deleted';
182
					}
183
					else
184
					{
185
						$actionResult = 'userNotAllowedForActionDelete';
186
					}
187
				}
188
				$actionResult = wpshop_database::update($attribute_group_parameter, $id, self::getDbTable());
189
			}
190
			else
191
			{
192
				$actionResult = 'userNotAllowedForActionEdit';
193
			}
194
		}
195
		elseif(($pageAction != '') && (($pageAction == 'delete'))){
196
			if(current_user_can('wpshop_delete_attributes'))