@@ -137,8 +137,12 @@ discard block |
||
| 137 | 137 | $validator->isNumeric($array_var['pic_id'], 'Fejl i billedid', 'allow_empty'); |
| 138 | 138 | $validator->isNumeric($array_var['weight'], 'Fejl i vægt - skal være et helt tal', 'allow_empty'); |
| 139 | 139 | |
| 140 | - if (isset($array_var['price'])) $validator->isNumeric($array_var['price'], 'Fejl i pris', 'allow_empty'); |
|
| 141 | - if (isset($array_var['before_price'])) $validator->isNumeric($array_var['before_price'], 'Fejl i førpris', 'allow_empty'); |
|
| 140 | + if (isset($array_var['price'])) { |
|
| 141 | + $validator->isNumeric($array_var['price'], 'Fejl i pris', 'allow_empty'); |
|
| 142 | + } |
|
| 143 | + if (isset($array_var['before_price'])) { |
|
| 144 | + $validator->isNumeric($array_var['before_price'], 'Fejl i førpris', 'allow_empty'); |
|
| 145 | + } |
|
| 142 | 146 | |
| 143 | 147 | if ($this->product->error->isError()) { |
| 144 | 148 | return false; |
@@ -236,11 +240,17 @@ discard block |
||
| 236 | 240 | $do_update = 1; |
| 237 | 241 | $sql = ''; |
| 238 | 242 | // we make sure that unit is set to a valid unit. |
| 239 | - if (empty($array_var['unit'])) $array_var['unit'] = 1; |
|
| 243 | + if (empty($array_var['unit'])) { |
|
| 244 | + $array_var['unit'] = 1; |
|
| 245 | + } |
|
| 240 | 246 | $sql .= "unit = ".intval($array_var['unit']).", "; |
| 241 | 247 | |
| 242 | - if (!isset($array_var['name'])) $array_var['name'] = ''; |
|
| 243 | - if (!isset($array_var['description'])) $array_var['description'] = ''; |
|
| 248 | + if (!isset($array_var['name'])) { |
|
| 249 | + $array_var['name'] = ''; |
|
| 250 | + } |
|
| 251 | + if (!isset($array_var['description'])) { |
|
| 252 | + $array_var['description'] = ''; |
|
| 253 | + } |
|
| 244 | 254 | |
| 245 | 255 | foreach ($this->fields as $field) { |
| 246 | 256 | if (!array_key_exists($field, $array_var)) { |
@@ -72,7 +72,9 @@ discard block |
||
| 72 | 72 | $query = $this->variation->getTable()->createQuery(); |
| 73 | 73 | |
| 74 | 74 | $select = get_class($this->variation).'.*, detail.*, a1.*, a1_attribute.*, a1_attribute_group.*'; |
| 75 | - if (count($this->groups) == 2) $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*'; |
|
| 75 | + if (count($this->groups) == 2) { |
|
| 76 | + $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*'; |
|
| 77 | + } |
|
| 76 | 78 | $query = $query->select($select) |
| 77 | 79 | ->leftJoin(get_class($this->variation).'.detail detail') |
| 78 | 80 | ->innerJoin(get_class($this->variation).'.attribute1 a1 WITH a1.attribute_number = 1') |
@@ -184,7 +186,9 @@ discard block |
||
| 184 | 186 | $query = $this->variation->getTable()->createQuery(); |
| 185 | 187 | |
| 186 | 188 | $select = get_class($this->variation).'.*, detail.*, a1.*, a1_attribute.*, a1_attribute_group.*'; |
| 187 | - if (count($this->groups) == 2) $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*'; |
|
| 189 | + if (count($this->groups) == 2) { |
|
| 190 | + $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*'; |
|
| 191 | + } |
|
| 188 | 192 | |
| 189 | 193 | $query = $query->select($select) |
| 190 | 194 | ->leftJoin(get_class($this->variation).'.detail detail') |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | try { |
| 49 | 49 | $attribute->save(); |
| 50 | 50 | return new k_SeeOther($this->url()); |
| 51 | - } |
|
| 52 | - catch (Doctrine_Validator_Exception $e) { |
|
| 51 | + } catch (Doctrine_Validator_Exception $e) { |
|
| 53 | 52 | $this->attribute = $attribute; |
| 54 | 53 | $this->getError()->attachErrorStack($attribute->getErrorStack()); |
| 55 | 54 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | return 'Intraface_modules_product_Controller_AttributeGroups'; |
| 22 | 22 | } elseif ($name == 'batchedit') { |
| 23 | 23 | return 'Intraface_modules_product_Controller_BatchEdit'; |
| 24 | - } elseif ($name == 'batchprice') { |
|
| 24 | + } elseif ($name == 'batchprice') { |
|
| 25 | 25 | return 'Intraface_modules_product_Controller_BatchPriceChanger'; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -90,15 +90,31 @@ discard block |
||
| 90 | 90 | $product->getDetails()->Translation['da']->name = $_POST['name']; |
| 91 | 91 | $product->getDetails()->Translation['da']->description = $_POST['description']; |
| 92 | 92 | $product->getDetails()->price = new Ilib_Variable_Float($_POST['price'], 'da_dk'); |
| 93 | - if (isset($_POST['before_price'])) $product->getDetails()->before_price = new Ilib_Variable_Float($_POST['before_price'], 'da_dk'); |
|
| 94 | - if (isset($_POST['weight'])) $product->getDetails()->weight = new Ilib_Variable_Float($_POST['weight'], 'da_dk'); |
|
| 95 | - if (isset($_POST['unit'])) $product->getDetails()->unit = $_POST['unit']; |
|
| 96 | - if (isset($_POST['vat'])) $product->getDetails()->vat = $_POST['vat']; |
|
| 97 | - if (isset($_POST['do_show'])) $product->do_show = $_POST['do_show']; |
|
| 98 | - if (isset($_POST['state_account_id'])) $product->getDetails()->state_account_id = (int)$_POST['state_account_id']; |
|
| 99 | - |
|
| 100 | - if (isset($_POST['has_variation'])) $product->has_variation = $_POST['has_variation']; |
|
| 101 | - if (isset($_POST['stock'])) $product->stock = $_POST['stock']; |
|
| 93 | + if (isset($_POST['before_price'])) { |
|
| 94 | + $product->getDetails()->before_price = new Ilib_Variable_Float($_POST['before_price'], 'da_dk'); |
|
| 95 | + } |
|
| 96 | + if (isset($_POST['weight'])) { |
|
| 97 | + $product->getDetails()->weight = new Ilib_Variable_Float($_POST['weight'], 'da_dk'); |
|
| 98 | + } |
|
| 99 | + if (isset($_POST['unit'])) { |
|
| 100 | + $product->getDetails()->unit = $_POST['unit']; |
|
| 101 | + } |
|
| 102 | + if (isset($_POST['vat'])) { |
|
| 103 | + $product->getDetails()->vat = $_POST['vat']; |
|
| 104 | + } |
|
| 105 | + if (isset($_POST['do_show'])) { |
|
| 106 | + $product->do_show = $_POST['do_show']; |
|
| 107 | + } |
|
| 108 | + if (isset($_POST['state_account_id'])) { |
|
| 109 | + $product->getDetails()->state_account_id = (int)$_POST['state_account_id']; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + if (isset($_POST['has_variation'])) { |
|
| 113 | + $product->has_variation = $_POST['has_variation']; |
|
| 114 | + } |
|
| 115 | + if (isset($_POST['stock'])) { |
|
| 116 | + $product->stock = $_POST['stock']; |
|
| 117 | + } |
|
| 102 | 118 | |
| 103 | 119 | try { |
| 104 | 120 | $product->save(); |
@@ -48,7 +48,9 @@ |
||
| 48 | 48 | |
| 49 | 49 | $existing_groups = array(); |
| 50 | 50 | $new_groups = array(); |
| 51 | - foreach ($product->getAttributeGroups() AS $group) $existing_groups[] = $group['id']; |
|
| 51 | + foreach ($product->getAttributeGroups() AS $group) { |
|
| 52 | + $existing_groups[] = $group['id']; |
|
| 53 | + } |
|
| 52 | 54 | |
| 53 | 55 | if (count($existing_groups) > 0) {
|
| 54 | 56 | try {
|
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | } else { |
| 106 | 106 | return array(); |
| 107 | 107 | } |
| 108 | - } elseif (is_int($product_id)) { |
|
| 108 | + } elseif (is_int($product_id)) { |
|
| 109 | 109 | if (intval($product_id) == 0) { |
| 110 | 110 | return array(); |
| 111 | 111 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | if (substr($url, 0, 7) != 'http://' && substr($url, 0, 8) != 'https://') { |
| 40 | 40 | $form_action = ''; |
| 41 | - } else { |
|
| 41 | + } else { |
|
| 42 | 42 | $form_action = $url; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -92,8 +92,7 @@ discard block |
||
| 92 | 92 | if ($action['action'] == 'add') { |
| 93 | 93 | if (isset($action['start_date']) && $action['start_date'] != '' && isset($action['end_date']) && $action['end_date'] != '') { |
| 94 | 94 | $description = date('d-m-Y', strtotime($action['start_date'])).' - '.date('d-m-Y', strtotime($action['end_date'])); |
| 95 | - } |
|
| 96 | - else { |
|
| 95 | + } else { |
|
| 97 | 96 | $description = ''; |
| 98 | 97 | } |
| 99 | 98 | |
@@ -101,8 +100,7 @@ discard block |
||
| 101 | 100 | 'product_id' => $action['product_id'], |
| 102 | 101 | 'description' => $description, |
| 103 | 102 | 'quantity' => (int)$action['month']); |
| 104 | - } |
|
| 105 | - elseif (($action['action'] == 'terminate' || $action['action'] == 'delete') |
|
| 103 | + } elseif (($action['action'] == 'terminate' || $action['action'] == 'delete') |
|
| 106 | 104 | && isset($action['product_id']) && $action['product_id'] != 0 |
| 107 | 105 | && isset($action['product_detail_id']) && $action['product_detail_id'] != 0) { |
| 108 | 106 | // we only substract the price id we are able to find a product detail. |
@@ -179,16 +177,14 @@ discard block |
||
| 179 | 177 | } |
| 180 | 178 | } |
| 181 | 179 | |
| 182 | - } |
|
| 183 | - elseif ($action['action'] == 'terminate') { |
|
| 180 | + } elseif ($action['action'] == 'terminate') { |
|
| 184 | 181 | $manager = new Intraface_modules_modulepackage_Manager($intranet, (int)$action['intranet_module_package_id']); |
| 185 | 182 | if (!$manager->terminate()) { |
| 186 | 183 | throw new Exception('There was an error terminating the intranet module package '.$action['intranet_module_package_id']); |
| 187 | 184 | $this->error->set("an error appeared when removing your old modulepackage. we have been noticed."); |
| 188 | 185 | |
| 189 | 186 | } |
| 190 | - } |
|
| 191 | - elseif ($action['action'] == 'delete') { |
|
| 187 | + } elseif ($action['action'] == 'delete') { |
|
| 192 | 188 | $manager = new Intraface_modules_modulepackage_Manager($intranet, (int)$action['intranet_module_package_id']); |
| 193 | 189 | if (!$manager->delete()) { |
| 194 | 190 | throw new Exception('There was an error deleting the intranet module package '.$action['intranet_module_package_id']); |
@@ -199,8 +195,7 @@ discard block |
||
| 199 | 195 | |
| 200 | 196 | if ($this->error->isError()) { |
| 201 | 197 | return false; |
| 202 | - } |
|
| 203 | - else { |
|
| 198 | + } else { |
|
| 204 | 199 | return true; |
| 205 | 200 | } |
| 206 | 201 | } |
@@ -24,7 +24,9 @@ discard block |
||
| 24 | 24 | $this->cmspage->kernel->useModule('filemanager');
|
| 25 | 25 | $this->value['picture'] = array(); |
| 26 | 26 | |
| 27 | - if ($this->value['pic_id'] == 0) return; |
|
| 27 | + if ($this->value['pic_id'] == 0) { |
|
| 28 | + return; |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | 31 | |
| 30 | 32 | $filemanager = new FileHandler($this->cmspage->kernel, $this->value['pic_id']); |
@@ -32,8 +34,7 @@ discard block |
||
| 32 | 34 | if ($filemanager->get('id') > 0) {
|
| 33 | 35 | if ($size == 'original') {
|
| 34 | 36 | $this->value['picture'] = $filemanager->get(); |
| 35 | - } |
|
| 36 | - else {
|
|
| 37 | + } else {
|
|
| 37 | 38 | $filemanager->createInstance($size); |
| 38 | 39 | $this->value['picture'] = $filemanager->instance->get(); |
| 39 | 40 | |
@@ -43,7 +44,9 @@ discard block |
||
| 43 | 44 | |
| 44 | 45 | function validate_section(& $var) {
|
| 45 | 46 | $validator = new Intraface_Validator($this->error); |
| 46 | - if (!empty($var['pic_id'])) $validator->isNumeric($var['pic_id'], 'error in pic_id', 'allow_empty'); |
|
| 47 | + if (!empty($var['pic_id'])) { |
|
| 48 | + $validator->isNumeric($var['pic_id'], 'error in pic_id', 'allow_empty'); |
|
| 49 | + } |
|
| 47 | 50 | |
| 48 | 51 | if ($this->error->isError()) {
|
| 49 | 52 | return 0; |
@@ -91,7 +94,9 @@ discard block |
||
| 91 | 94 | $var['pic_id'] = $this->parameter->get('pic_id');
|
| 92 | 95 | } |
| 93 | 96 | */ |
| 94 | - if (!empty($var['pic_id'])) $this->addParameter('pic_id', $var['pic_id']);
|
|
| 97 | + if (!empty($var['pic_id'])) { |
|
| 98 | + $this->addParameter('pic_id', $var['pic_id']); |
|
| 99 | + } |
|
| 95 | 100 | return 1; |
| 96 | 101 | |
| 97 | 102 | } |