@@ 325-342 (lines=18) @@ | ||
322 | else |
|
323 | $actionResult = 'unDeletableAtribute'; |
|
324 | } |
|
325 | elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){ |
|
326 | if(current_user_can('wpshop_add_attributes')){ |
|
327 | $attribute_parameter['creation_date'] = current_time('mysql', 0); |
|
328 | if(trim($attribute_parameter['code']) == ''){ |
|
329 | $attribute_parameter['code'] = $attribute_parameter['frontend_label']; |
|
330 | } |
|
331 | $attribute_parameter['code'] = wpshop_tools::slugify(str_replace("\'", "_", str_replace('\"', "_", $attribute_parameter['code'])), array('noAccent', 'noSpaces', 'lowerCase', 'noPunctuation')); |
|
332 | $code_exists = self::getElement($attribute_parameter['code'], "'valid', 'moderated', 'deleted'", 'code'); |
|
333 | if((is_object($code_exists) || is_array($code_exists)) && (count($code_exists) > 0)){ |
|
334 | $attribute_parameter['code'] = $attribute_parameter['code'] . '_' . (count($code_exists) + rand()); |
|
335 | } |
|
336 | $actionResult = wpshop_database::save($attribute_parameter, self::getDbTable()); |
|
337 | $id = $wpdb->insert_id; |
|
338 | } |
|
339 | else{ |
|
340 | $actionResult = 'userNotAllowedForActionAdd'; |
|
341 | } |
|
342 | } |
|
343 | ||
344 | /* When an action is launched and there is a result message */ |
|
345 | /************ CHANGE THE FIELD NAME TO TAKE TO DISPLAY *************/ |
@@ 207-224 (lines=18) @@ | ||
204 | $actionResult = 'userNotAllowedForActionDelete'; |
|
205 | } |
|
206 | } |
|
207 | elseif(($pageAction != '') && (($pageAction == 'save') || ($pageAction == 'saveandcontinue') || ($pageAction == 'add'))){ |
|
208 | if(current_user_can('wpshop_add_attributes')){ |
|
209 | $attribute_group_parameter['creation_date'] = date('Y-m-d H:i:s'); |
|
210 | if(trim($attribute_group_parameter['code']) == ''){ |
|
211 | $attribute_group_parameter['code'] = $attribute_group_parameter['frontend_label']; |
|
212 | } |
|
213 | $attribute_group_parameter['code'] = wpshop_tools::slugify(str_replace("\'", "_", str_replace('\"', "_", $attribute_group_parameter['code'])), array('noAccent', 'noSpaces', 'lowerCase', 'noPunctuation')); |
|
214 | $code_exists = self::getElement($attribute_group_parameter['code'], "'valid', 'moderated', 'deleted'", 'code'); |
|
215 | if((is_object($code_exists) || is_array($code_exists)) && (count($code_exists) > 0)){ |
|
216 | $attribute_group_parameter['code'] = $attribute_group_parameter['code'] . '_' . (count($code_exists) + 1); |
|
217 | } |
|
218 | $actionResult = wpshop_database::save($attribute_group_parameter, self::getDbTable()); |
|
219 | $id = $wpdb->insert_id; |
|
220 | } |
|
221 | else{ |
|
222 | $actionResult = 'userNotAllowedForActionAdd'; |
|
223 | } |
|
224 | } |
|
225 | ||
226 | ||
227 | /* When an action is launched and there is a result message */ |