Code Duplication    Length = 29-29 lines in 2 locations

web_interface/astpp/application/modules/accounts/models/accounts_model.php 2 locations

@@ 154-182 (lines=29) @@
151
152
				$this->db_model->build_search('reseller_list_search');
153
				$query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
154
				if ($query_pricelist->num_rows > 0) {
155
					$description = '';
156
					if ($update_array['balance']['operator'] == '2') {
157
						$description .="Reseller update set balance by admin";
158
					}
159
					if ($update_array['balance']['operator'] == '3') {
160
						$description .="Reseller update increase balance by admin";
161
					}
162
					if ($update_array['balance']['operator'] == '4') {
163
						$description .="Reseller update descrise balance by admin";
164
					}
165
					foreach ($query_pricelist->result_array() as $key => $reseller_payment) {
166
						if (!empty($reseller_payment['reseller_id']) && $reseller_payment['reseller_id'] != '') {
167
							$payment_by = $reseller_payment['reseller_id'];
168
						} else {
169
							$payment_by = '-1';
170
						}
171
						$insert_arr = array("accountid" => $reseller_payment['id'],
172
							"credit" => $update_array['balance']['balance'],
173
							'payment_mode' => 0,
174
							'type' => "SYSTEM",
175
							"notes" => $description,
176
							"payment_date" => $date,
177
							'payment_by' => $payment_by,
178
							'reseller_id' => $reseller_payment['reseller_id'],
179
						);
180
						$this->db->insert("payments", $insert_arr);
181
					}
182
				}
183
			}
184
		}
185
@@ 218-246 (lines=29) @@
215
216
			$this->db_model->build_search('customer_list_search');
217
			$query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
218
			if ($query_pricelist->num_rows > 0) {
219
				$description = '';
220
				if ($update_array['balance']['operator'] == '2') {
221
					$description .="Customer update set balance by admin";
222
				}
223
				if ($update_array['balance']['operator'] == '3') {
224
					$description .="Customer update increase balance by admin";
225
				}
226
				if ($update_array['balance']['operator'] == '4') {
227
					$description .="Customer update descrise balance by admin";
228
				}
229
				foreach ($query_pricelist->result_array() as $key => $customer_payment) {
230
					if (!empty($customer_payment['reseller_id']) && $customer_payment['reseller_id'] != '0') {
231
						$payment_by = $customer_payment['reseller_id'];
232
					} else {
233
						$payment_by = '-1';
234
					}
235
					$insert_arr = array("accountid" => $customer_payment['id'],
236
						"credit" => $update_array['balance']['balance'],
237
						'payment_mode' => 0,
238
						'type' => "SYSTEM",
239
						"notes" => $description,
240
						"payment_date" => $date,
241
						'payment_by' => $payment_by,
242
						'reseller_id' => $customer_payment['reseller_id'],
243
					);
244
					$this->db->insert("payments", $insert_arr);
245
				}
246
			}
247
		}
248
		return true;
249
	}