Completed
Push — v3.0 ( 3d1631...29f961 )
by Samir
22:25
created
web_interface/astpp/application/modules/invoices/controllers/invoices.php 1 patch
Braces   +100 added lines, -95 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
         $this->load->library('fpdf');
38 38
         $this->load->library('pdf');
39 39
 
40
-        if ($this->session->userdata('user_login') == FALSE)
41
-            redirect(base_url() . '/astpp/login');
40
+        if ($this->session->userdata('user_login') == FALSE) {
41
+                    redirect(base_url() . '/astpp/login');
42
+        }
42 43
     }
43 44
 
44 45
 
@@ -66,7 +67,7 @@  discard block
 block discarded – undo
66 67
          $result_query = $this->invoices_model->get_invoice_list(true,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
67 68
       if($logintype == -1){
68 69
          $currency_id = Common_model::$global_config['system_config']['base_currency'];
69
-      }else{
70
+      } else{
70 71
 	  $accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $login_info["currency_id"]);
71 72
          $currency_id = $accountdata["currency_id"];
72 73
       }
@@ -85,7 +86,7 @@  discard block
 block discarded – undo
85 86
           $duedate = strtotime($value['due_date']);
86 87
           if($value['type'] == 'I'){
87 88
           $due_date =date("Y-m-d",$duedate);
88
-          }else{
89
+          } else{
89 90
           $due_date='';
90 91
           }
91 92
           $outstanding = $value['amount'];
@@ -97,7 +98,7 @@  discard block
 block discarded – undo
97 98
             //echo '<pre>'; print_r($invoice_total_query); 
98 99
             if($value['type'] == 'I'){
99 100
             $outstanding -= $this->common->currency_decimal($invoice_total_query[0]['credit']);
100
-            }else{
101
+            } else{
101 102
             $outstanding='';
102 103
             }
103 104
             $last_payment_date = $invoice_total_query[0]['created_date'];
@@ -105,10 +106,10 @@  discard block
 block discarded – undo
105 106
             if($last_payment_date ){
106 107
             $payment_date=strtotime( $last_payment_date);
107 108
             $payment_last=date("Y-m-d",$payment_date);
108
-            }else{
109
+            } else{
109 110
              $payment_last='';
110 111
             }
111
-         }else{
112
+         } else{
112 113
           $payment_last='';
113 114
           }
114 115
             
@@ -119,7 +120,7 @@  discard block
 block discarded – undo
119 120
           $id=$accountinfo['id'];
120 121
           if($accountinfo['type'] == 1){
121 122
           $query ="select sum(amount) as grand_total from invoices where reseller_id='$id'";
122
-          }else{
123
+          } else{
123 124
           $query ="select sum(amount) as grand_total from invoices where reseller_id='0'";
124 125
           }
125 126
           $ext_query=$this->db->query($query);
@@ -132,7 +133,7 @@  discard block
 block discarded – undo
132 133
           
133 134
           if($accountinfo['type'] == 1){
134 135
           $invoice_query ="select sum(credit) as grand_credit from invoice_details where reseller_id='$id'";
135
-          }else{
136
+          } else{
136 137
           $invoice_query ="select sum(credit) as grand_credit from invoice_details where reseller_id='0'";
137 138
           }
138 139
           $credit_query=$this->db->query($invoice_query);
@@ -147,28 +148,28 @@  discard block
 block discarded – undo
147 148
 		if($value['confirm'] ==0){
148 149
 			if($value['generate_type'] ==1){
149 150
 		              $payment = '<a href="'. base_url() .'invoices/invoice_manually_edit/' . $value['id'] . '" class="btn btn-royelblue btn-sm"  title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a>';
150
-			}else{
151
+			} else{
151 152
 		              $payment = '<a href="'. base_url() .'invoices/invoice_automatically_edit/' . $value['id'] . '" class="btn btn-royelblue btn-sm"  title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a>';
152 153
 			}
153 154
   		        $id=$value['id'];       
154 155
 		        $delete_button="<a onclick='invoice_delete($id)' class='btn btn-royelblue btn-sm'  title='Delete' ><i class='fa fa-trash fa-fw'></i></a>&nbsp";
155 156
 
156
-		}else{
157
+		} else{
157 158
             	     if($outstanding > 0){
158 159
 		        $payment = '<a style="padding: 0 8px;" href="'. base_url() .'invoices/invoice_summary/' . $value['id'] . '" class="btn btn-warning"  title="Payment">Unpaid</i></a>';
159
-            	     }else{
160
+            	     } else{
160 161
 		        $payment = '<button style="padding: 0 17px;" type="button"  class="btn btn-success">Paid</button>';
161 162
             	     }
162 163
 	             $delete_button="&nbsp";
163 164
   	       }		
164
-             }else{
165
+             } else{
165 166
                $payment = '';
166 167
            }
167 168
            $account_arr = $this->db_model->getSelect('first_name,number,last_name','accounts', array('id'=>$value['accountid']));
168 169
            $account_array = $account_arr->result_array();
169 170
             if($value['generate_type'] == 1){
170 171
 		$invoice_type='Manually';
171
-	   }else{
172
+	   } else{
172 173
 		$invoice_type='Automatically';
173 174
 	   }    
174 175
 	   if($value['deleted'] == 1){
@@ -184,8 +185,7 @@  discard block
 block discarded – undo
184 185
 	   }
185 186
 		if($value['type'] == 'R'){
186 187
 		$icon = '<div class="flx_font flx_magenta">R</div>';
187
-		}
188
-		else
188
+		} else
189 189
 		{		
190 190
 			$icon = '<div class="flx_font flx_drk_pink">I</div>';
191 191
 			
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		if($value['item_type'] == 'TAX'){
238 238
 			$data['total_tax_dis'][$taxi]=$value['debit'];
239 239
 			$taxi++;
240
-		}else{
240
+		} else{
241 241
 		     if($i >= 5){
242 242
 	   		     $data['row_count']=$i+1;
243 243
 		     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         if($system_config["paypal_mode"]==0){
287 287
             $data["paypal_url"] = $system_config["paypal_url"];
288 288
             $data["paypal_email_id"] = $system_config["paypal_id"];
289
-        }else{
289
+        } else{
290 290
             $data["paypal_url"] = $system_config["paypal_sandbox_url"];
291 291
             $data["paypal_email_id"] = $system_config["paypal_sandbox_id"];
292 292
          }
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
         $data["to_currency"] = Common_model::$global_config['system_config']['base_currency'];
298 298
 	if($account_data['type'] == -1){
299 299
 		$data["to_currency"] = $data["to_currency"];
300
-	}elseif($account_data['type'] == 1){
300
+	} elseif($account_data['type'] == 1){
301 301
 		$accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
302 302
 		$data["to_currency"] = $accountdata["currency_id"];
303
-	}else{
303
+	} else{
304 304
 		$accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
305 305
 		$data["to_currency"] = $accountdata["currency_id"];
306 306
 	} 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	$data['notify_url'] = base_url() . "invoices/invoice_list_get_data";
324 324
 	if($account_data['type'] =='1'){
325 325
 		$data['response_url'] = base_url() . "invoices/invoice_list_responce/";
326
-	}else{
326
+	} else{
327 327
 		$data['response_url'] = base_url() . "user/user_list_responce/";
328 328
 	}
329 329
 	$data['sucess_url'] = base_url() . "invoices/invoice_list_sucess";
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		if($value['item_type'] == 'TAX'){
354 354
 			$data['total_tax_dis'][$taxi]=$value['debit'];
355 355
 			$taxi++;
356
-		}else{
356
+		} else{
357 357
 		   if($value['generate_type'] == 1){
358 358
 		     if($i >= 5){
359 359
 	   		     $data['row_count']=$i+1;
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         if($system_config["paypal_mode"]==0){
421 421
             $data["paypal_url"] = $system_config["paypal_url"];
422 422
             $data["paypal_email_id"] = $system_config["paypal_id"];
423
-        }else{
423
+        } else{
424 424
             $data["paypal_url"] = $system_config["paypal_sandbox_url"];
425 425
             $data["paypal_email_id"] = $system_config["paypal_sandbox_id"];
426 426
          }
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
 	if($account_data['type'] == -1){
434 434
 	  $accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
435 435
           $data["to_currency"] = $accountdata["currency_id"];
436
-	}elseif($account_data['type'] == 1){
436
+	} elseif($account_data['type'] == 1){
437 437
 		$accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
438 438
 		$data["to_currency"] = $accountdata["currency_id"];
439
-	}else{
439
+	} else{
440 440
 		$accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
441 441
 		$data["to_currency"] = $accountdata["currency_id"];
442 442
 	} 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	$data['notify_url'] = base_url() . "invoices/invoice_list_get_data";
459 459
 	if($account_data['type'] =='1'){
460 460
 		$data['response_url'] = base_url() . "invoices/invoice_list_responce/";
461
-	}else{
461
+	} else{
462 462
 		$data['response_url'] = base_url() . "user/user_list_responce/";
463 463
 	}
464 464
 	$data['sucess_url'] = base_url() . "invoices/invoice_list_sucess";
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	$response_arr=$_POST;
470 470
 	if(isset($response_arr['save'])){
471 471
 	   $confirm=0;
472
-	}else{
472
+	} else{
473 473
 	   $confirm=1;
474 474
 	}
475 475
 	$where=array('invoiceid'=>$response_arr['invoiceid'],'generate_type'=>1);
@@ -537,11 +537,11 @@  discard block
 block discarded – undo
537 537
 		$account_data = $account_data->result_array();
538 538
 		if($account_data[0]['posttoexternal'] == 1){
539 539
 			$bal_data=$account_data[0]['balance']-$this->common_model->add_calculate_currency($response_arr['total_val_final'],"","",true,false);
540
-		}else{
540
+		} else{
541 541
 			$bal_data=$account_data[0]['balance']-$this->common_model->add_calculate_currency($response_arr['total_val_final'],"","",true,false);
542 542
 			if($response_arr['reseller_id'] == 0){
543 543
 				$payment=1;
544
-			}else{
544
+			} else{
545 545
 				$payment=$response_arr['reseller_id'];
546 546
 			}
547 547
 		        $invoice_prefix = $this->common->get_field_name('invoice_prefix', 'invoices', $response_arr['invoiceid']);
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	$response_arr=$_POST;
583 583
 	if(isset($response_arr['save'])){
584 584
 	   $confirm=0;
585
-	}else{
585
+	} else{
586 586
 	   $confirm=1;
587 587
 	}
588 588
 	foreach($response_arr['auto_invoice_date'] as $key=>$val){
@@ -678,14 +678,14 @@  discard block
 block discarded – undo
678 678
 		$invoice_conf =  array();
679 679
 		if($accountdata['reseller_id'] == 0){
680 680
 			$where = array("accountid"=> 1);
681
-		}else{
681
+		} else{
682 682
 			$where = array("accountid"=> $accountdata['reseller_id']);    
683 683
 		}
684 684
 		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
685 685
 		if($query->num_rows >0){
686 686
 			$invoice_conf = $query->result_array();
687 687
 			$invoice_conf = $invoice_conf[0];
688
-		}else{
688
+		} else{
689 689
 			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
690 690
 			$invoice_conf = $query->result_array();
691 691
 			$invoice_conf = $invoice_conf[0];            
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
         if($system_config["paypal_mode"]==0){
737 737
             $data["paypal_url"] = $system_config["paypal_url"];
738 738
             $data["paypal_email_id"] = $system_config["paypal_id"];
739
-        }else{
739
+        } else{
740 740
             $data["paypal_url"] = $system_config["paypal_sandbox_url"];
741 741
             $data["paypal_email_id"] = $system_config["paypal_sandbox_id"];
742 742
          }
@@ -748,10 +748,10 @@  discard block
 block discarded – undo
748 748
       if($account_data['type'] == -1){
749 749
 	  $accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
750 750
           $data["to_currency"] = $accountdata["currency_id"];
751
-      }elseif($account_data['type'] == 1){
751
+      } elseif($account_data['type'] == 1){
752 752
 	  $accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
753 753
           $data["to_currency"] = $accountdata["currency_id"];
754
-      }else{
754
+      } else{
755 755
 	  $accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $account_data["currency_id"]);
756 756
           $data["to_currency"] = $accountdata["currency_id"];
757 757
       }
@@ -775,13 +775,13 @@  discard block
 block discarded – undo
775 775
         	$data['notify_url'] = base_url() . "invoices/invoice_list_get_data/";
776 776
         	if($account_data['type'] =='1'){
777 777
         	$data['response_url'] = base_url() . "invoices/invoice_list_responce/";
778
-        	}else{
778
+        	} else{
779 779
         	$data['response_url'] = base_url() . "user/user_list_responce/";
780 780
         	}
781 781
         	$data['sucess_url'] = base_url() . "invoices/invoice_list_sucess/";
782 782
       	}
783 783
       	
784
-      	}else{
784
+      	} else{
785 785
       	
786 786
       	redirect(base_url() . 'dashboard/');
787 787
       	}
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
           $data = array('status' => '0');
845 845
           $this->db->update("invoices", $data);
846 846
          // echo $this->db->last_query(); exit;
847
-          }else{
847
+          } else{
848 848
           $this->db->where("id", $invoice_id);        
849 849
           $data = array('status' => '2');
850 850
           $this->db->update("invoices", $data);
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 );        // echo '<pre>'; print_r( $tax_array); exit;
892 892
        	 $this->db->insert("invoice_details",$tax_array);
893 893
          
894
-         }else{
894
+         } else{
895 895
          
896 896
         //  echo 'else'; exit;
897 897
          $actual_amount=$debit-$amount;
@@ -899,11 +899,11 @@  discard block
 block discarded – undo
899 899
        
900 900
 	         $this->db->insert("invoice_details",$tax_array);
901 901
          }
902
-	 }else{
902
+	 } else{
903 903
 	  if($logintype = 0){
904 904
           $this->session->set_flashdata('astpp_notification', 'Invoice payment amount should be higher then the invoice amount.');
905 905
           redirect(base_url().'user/user_invoice_payment/'.$invoice_id);
906
-          }else{
906
+          } else{
907 907
           $this->session->set_flashdata('astpp_notification', 'Invoice payment amount should be higher then the invoice amount.');
908 908
           redirect(base_url().'invoices/invoice_summary/'.$invoice_id);
909 909
           }
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
          if($reseller_debit > 0){
918 918
 	 $this->accounts_model->update_balance($amount,$response_arr["custom"], "debit");
919 919
 	 $this->accounts_model->update_balance($amount,$reseller_debit, "debit");
920
-	 }else{
920
+	 } else{
921 921
 	 $this->accounts_model->update_balance($amount,$response_arr["custom"], "debit");
922 922
 	 }
923 923
 	 $account_data['accountid']=$account_data['id'];
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 	 if($logintype = '1'){
926 926
          $this->session->set_flashdata('astpp_errormsg', 'Invoice payment done successfully!');
927 927
        redirect(base_url() . 'invoices/invoice_list/');
928
-       }else{
928
+       } else{
929 929
         $this->session->set_flashdata('astpp_errormsg', 'Invoice payment done successfully!');
930 930
        redirect(base_url() . 'user/user_invoices_list/');
931 931
        }
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
           $data = array('status' => '0');
967 967
           $this->db->update("invoices", $data);
968 968
          // echo $this->db->last_query(); exit;
969
-          }else{
969
+          } else{
970 970
           $this->db->where("id", $invoice_id);        
971 971
           $data = array('status' => '2');
972 972
           $this->db->update("invoices", $data);
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
         $this->db->insert("invoice_details",$tax_array);
986 986
      
987 987
       
988
-         }else{
988
+         } else{
989 989
          
990 990
           $this->session->set_flashdata('astpp_notification', 'Invoice payment amount should be higher then the invoice amount.');
991 991
           redirect(base_url().'invoices/invoice_summary/'.$invoice_id);
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
             if($last_payment_date ){
1134 1134
             $payment_date=strtotime( $last_payment_date);
1135 1135
             $payment_last=date("d/m/Y",$payment_date);
1136
-            }else{
1136
+            } else{
1137 1137
              $payment_last='';
1138 1138
             }
1139 1139
          
@@ -1166,10 +1166,10 @@  discard block
 block discarded – undo
1166 1166
 	    if($value['type'] == 'R'){
1167 1167
 		$payment ='';	
1168 1168
 		$outstanding=0;	
1169
-	    }else{
1169
+	    } else{
1170 1170
 		    if($outstanding > 0){
1171 1171
 		      $payment = '<a style="padding: 0 8px;" href="'. base_url() .'invoices/invoice_summary/' . $value['id'] . '" class="btn btn-warning"  title="Payment">Unpaid</i></a>';
1172
-		    }else{
1172
+		    } else{
1173 1173
 		      $payment = ' <button style="padding: 0 8px;" type="button"  class="btn btn-success">Paid</button>';
1174 1174
 		    }
1175 1175
             }
@@ -1178,14 +1178,13 @@  discard block
 block discarded – undo
1178 1178
            $account_array = $account_arr->result_array();
1179 1179
            if($value['generate_type'] == 1){
1180 1180
 		$invoice_type='Manually';
1181
-	   }else{
1181
+	   } else{
1182 1182
 		$invoice_type='Automatically';
1183 1183
 	   }
1184 1184
 	   
1185 1185
 	   if($value['type'] == 'R'){
1186 1186
 		$icon = '<div class="flx_font flx_magenta">R</div>';
1187
-		}
1188
-		else
1187
+		} else
1189 1188
 		{		
1190 1189
 			$icon = '<div class="flx_font flx_drk_pink">I</div>';
1191 1190
 			
@@ -1242,7 +1241,7 @@  discard block
 block discarded – undo
1242 1241
             if($last_payment_date ){
1243 1242
             $payment_date=strtotime( $last_payment_date);
1244 1243
             $payment_last=date("d/m/Y",$payment_date);
1245
-            }else{
1244
+            } else{
1246 1245
              $payment_last='';
1247 1246
             }
1248 1247
          
@@ -1275,7 +1274,7 @@  discard block
 block discarded – undo
1275 1274
          $download='<a href="'. base_url() .'/user/user_invoice_download/' . $value['id'].'/00'.$value['invoice_prefix'].$value['invoiceid'].'" class="btn btn-royelblue btn-sm"  title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a>&nbsp';
1276 1275
          if($outstanding > 0){
1277 1276
          $payment = ' <a style="padding: 0 8px;" href="'. base_url() .'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning"  title="Payment">Unpaid</a>';
1278
-}else{
1277
+} else{
1279 1278
 
1280 1279
 $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>';
1281 1280
 }          $account_arr = $this->db_model->getSelect('first_name,number,last_name','accounts', array('id'=>$value['accountid']));
@@ -1382,7 +1381,7 @@  discard block
 block discarded – undo
1382 1381
       if($type=='R'){
1383 1382
 	       $this->receipt_download($invoiceid);
1384 1383
       }
1385
-     }else{
1384
+     } else{
1386 1385
       redirect(base_url() . 'invoices/invoice_list/');
1387 1386
      }
1388 1387
     }
@@ -1408,7 +1407,7 @@  discard block
 block discarded – undo
1408 1407
  	     	 if( $to_date > $feture_date){
1409 1408
  	     	 $this->session->set_flashdata('astpp_notification', 'To date should not be greater than current date.');  
1410 1409
 	         redirect(base_url()."invoices/invoice_list/");
1411
- 	     	 }else{
1410
+ 	     	 } else{
1412 1411
 	         $todate=$data['todate'].' '.'23:59:59';
1413 1412
 	         $from_date=$data['fromdate'].' '.'00:00:01';
1414 1413
 	         $accountid=$data['accountid'];
@@ -1423,14 +1422,14 @@  discard block
 block discarded – undo
1423 1422
 		$invoice_conf =  array();
1424 1423
 		if($accountdata['reseller_id'] == 0){
1425 1424
  			$where = array("accountid"=> 1);
1426
-		}else{
1425
+		} else{
1427 1426
 			$where = array("accountid"=> $accountdata['reseller_id']);    
1428 1427
 		}
1429 1428
 		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1430 1429
 		if($query->num_rows >0){
1431 1430
 			$invoice_conf = $query->result_array();
1432 1431
 			$invoice_conf = $invoice_conf[0];
1433
-		}else{
1432
+		} else{
1434 1433
 			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
1435 1434
 			$invoice_conf = $query->result_array();
1436 1435
 			$invoice_conf = $invoice_conf[0];            
@@ -1438,18 +1437,18 @@  discard block
 block discarded – undo
1438 1437
 		$last_invoice_ID = $this->get_invoice_date("invoiceid");
1439 1438
 		if($last_invoice_ID && $last_invoice_ID > 0){
1440 1439
 			$last_invoice_ID = ($last_invoice_ID+1);
1441
-		}else{
1440
+		} else{
1442 1441
 			$last_invoice_ID = $invoice_conf['invoice_start_from'];
1443 1442
 		}
1444 1443
 		$last_invoice_ID =str_pad($last_invoice_ID,(strlen($last_invoice_ID)+4),'0',STR_PAD_LEFT);
1445 1444
 		if($accountdata['posttoexternal'] == 1){
1446 1445
        		    $balance = ($accountdata['credit_limit']-$accountdata['balance']);
1447
-		}else{
1446
+		} else{
1448 1447
        		    $balance = $accountdata['balance'];
1449 1448
 		}
1450 1449
 		if($accountdata['invoice_interval'] > 0){
1451 1450
 			$due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$accountdata['invoice_interval']." days"));
1452
-		}else{
1451
+		} else{
1453 1452
 			$due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +7 days"));
1454 1453
 		}	
1455 1454
 		$invoice_data = array("accountid"=>$accountdata['id'],"invoice_prefix" =>$invoice_conf['invoice_prefix'],"invoiceid"=>$last_invoice_ID,"reseller_id"=>   
@@ -1471,8 +1470,7 @@  discard block
 block discarded – undo
1471 1470
 	         redirect(base_url()."invoices/invoice_list/");
1472 1471
 	     }
1473 1472
 	    
1474
-	}
1475
-	else
1473
+	} else
1476 1474
 	{
1477 1475
 	   $this->session->set_flashdata('astpp_notification', 'Permission Denied.');
1478 1476
 	   redirect(base_url()."invoices/invoice_list/");
@@ -1482,7 +1480,7 @@  discard block
 block discarded – undo
1482 1480
 	if($accountid){
1483 1481
 	        $where = array('type'=>"I","accountid"=>$accountid);
1484 1482
         $query = $this->db_model->select($select, "invoices", $where,"to_date","DESC","1","0");
1485
-	}else{
1483
+	} else{
1486 1484
 		 $where = array('type'=>"I");
1487 1485
         $query = $this->db_model->select($select, "invoices", $where,"id","DESC","1","0");
1488 1486
 	}
@@ -1547,10 +1545,10 @@  discard block
 block discarded – undo
1547 1545
       if($login_info['type'] == -1){
1548 1546
 	  $data["to_currency"] = Common_model::$global_config['system_config']['base_currency'];
1549 1547
           $currency = $data["to_currency"];
1550
-      }elseif($login_info['type'] == 1){
1548
+      } elseif($login_info['type'] == 1){
1551 1549
 	  $accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $login_info["currency_id"]);
1552 1550
           $currency = $accountdata["currency_id"];
1553
-      }else{
1551
+      } else{
1554 1552
 	  $accountdata["currency_id"] = $this->common->get_field_name('currency', 'currency', $login_info["currency_id"]);
1555 1553
           $currency = $accountdata["currency_id"];
1556 1554
       }
@@ -1580,13 +1578,13 @@  discard block
 block discarded – undo
1580 1578
 			  $data['description']=$value['description'];
1581 1579
 			  if($value['item_type'] == 'Refill'){
1582 1580
 				  $data['debit']=$value['credit'];
1583
-			  }else{
1581
+			  } else{
1584 1582
 				  $data['debit']=$value['debit'];
1585 1583
 			  }	   
1586 1584
 			  $created_date=$value['created_date'];
1587 1585
 			  $invoicedata['invoiceid']=$value['invoiceid'];
1588 1586
 		  }
1589
-          }else{
1587
+          } else{
1590 1588
 		$query="select item_type,description,created_date,invoiceid,debit,credit from invoice_details where invoiceid = ".$invoiceid." And item_type='SUBCHRG' Group By item_type"; 	
1591 1589
 		$invoice_total_query=$this->db->query($query);
1592 1590
 		if($invoice_total_query ->num_rows() > 0) {
@@ -1596,7 +1594,7 @@  discard block
 block discarded – undo
1596 1594
 			  $data['description']=$value['description'];
1597 1595
 			  if($value['item_type'] == 'Refill'){
1598 1596
 				  $data['debit']=$value['credit'];
1599
-			  }else{
1597
+			  } else{
1600 1598
 				  $data['debit']=$value['debit'];
1601 1599
 			  }	   
1602 1600
 			  $created_date=$value['created_date'];
@@ -1606,15 +1604,16 @@  discard block
 block discarded – undo
1606 1604
 	  }
1607 1605
           $data['accountinfo'] = $accountdata;
1608 1606
          //Get invoice header information
1609
-        if($accountdata['reseller_id']=='0')
1610
-	      $accountid = '1';
1611
-        else
1612
-            $accountid = $accountdata['reseller_id'];
1607
+        if($accountdata['reseller_id']=='0') {
1608
+        	      $accountid = '1';
1609
+        } else {
1610
+                    $accountid = $accountdata['reseller_id'];
1611
+        }
1613 1612
             $invoiceconf  = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid));
1614 1613
             $invoiceconf = $invoiceconf->result_array();
1615 1614
             if(!empty($invoiceconf)){
1616 1615
                 $data['invoiceconf'] = $invoiceconf[0];
1617
-            }else{
1616
+            } else{
1618 1617
             $invoiceconf  = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> "1"));
1619 1618
             $invoiceconf = $invoiceconf->result_array();
1620 1619
             $data['invoiceconf'] = $invoiceconf[0];
@@ -1625,20 +1624,26 @@  discard block
 block discarded – undo
1625 1624
       // echo '<pre>'; print_r($accountdata); exit;
1626 1625
         //FOR the Customer Address
1627 1626
         $customer_address="<div style='font-size:12px;' >";
1628
-        if ( $accountdata['company_name'] != "")
1629
-            $customer_address .= $accountdata['company_name'] . "<br/>";
1630
-        if ( $accountdata['address_1'] != "")
1631
-            $customer_address .= $accountdata['address_1'] . "," .$accountdata['address_2'] .",". "<br/>";
1632
-        if ( $accountdata['city'] != "")
1633
-            $customer_address .= $accountdata['city'] . "<br/>";
1634
-        if ( $accountdata['province'] != "")
1635
-            $customer_address .= $accountdata['province']."<br/>";
1636
-        if ( $accountdata['country_id'] != "")
1637
-            $customer_address .= $this->common->get_field_name('country', 'countrycode', $accountdata['country_id'])."<br/>";            
1638
-        if ( $accountdata['postal_code'] != "")
1639
-            $customer_address .= "Pincode - " . $accountdata['postal_code'] . "<br/>";
1640
-        else
1641
-            $customer_address .= "\n";
1627
+        if ( $accountdata['company_name'] != "") {
1628
+                    $customer_address .= $accountdata['company_name'] . "<br/>";
1629
+        }
1630
+        if ( $accountdata['address_1'] != "") {
1631
+                    $customer_address .= $accountdata['address_1'] . "," .$accountdata['address_2'] .",". "<br/>";
1632
+        }
1633
+        if ( $accountdata['city'] != "") {
1634
+                    $customer_address .= $accountdata['city'] . "<br/>";
1635
+        }
1636
+        if ( $accountdata['province'] != "") {
1637
+                    $customer_address .= $accountdata['province']."<br/>";
1638
+        }
1639
+        if ( $accountdata['country_id'] != "") {
1640
+                    $customer_address .= $this->common->get_field_name('country', 'countrycode', $accountdata['country_id'])."<br/>";
1641
+        }
1642
+        if ( $accountdata['postal_code'] != "") {
1643
+                    $customer_address .= "Pincode - " . $accountdata['postal_code'] . "<br/>";
1644
+        } else {
1645
+                    $customer_address .= "\n";
1646
+        }
1642 1647
            // $customer_address .= "Date of Invoice: " .date('d/m/Y', strtotime($invoicedata['invoice_date']))."<br/>";
1643 1648
 $customer_address .= "</div>";
1644 1649
 
@@ -1652,7 +1657,7 @@  discard block
 block discarded – undo
1652 1657
         if($logo != ''){
1653 1658
         $src=$path;
1654 1659
         $logo = "<img style='height:50px; width:180px; margin-left:70px;' alt='logo' src='".$src."'>";
1655
-        }else{
1660
+        } else{
1656 1661
         $path = getcwd()."/assets/images/logo.png";
1657 1662
         $src=$path;
1658 1663
         $logo = "<img style='height:50px; width:180px; margin-left:70px;' alt='logo' src='".$src."'>";
@@ -1709,12 +1714,12 @@  discard block
 block discarded – undo
1709 1714
 		if($logo != ''){
1710 1715
 			$src=$path;
1711 1716
 			$logo = "<img style='height:50px; width:180px; margin-left:70px;' alt='logo' src='".$src."'>";
1712
-		}else{
1717
+		} else{
1713 1718
 			$path = base_url()."/assets/images/logo.png";
1714 1719
 			$src=$path;
1715 1720
 			$logo = "<img style='height:50px; width:180px; margin-left:70px;' alt='logo' src='".$src."'>";
1716 1721
 		}
1717
-	}else{
1722
+	} else{
1718 1723
 		$dir_path= base_url()."/upload/logo.png";
1719 1724
 		$src=$dir_path;
1720 1725
 		$logo = "<img style='height:50px; width:180px; margin-left:70px;' alt='logo' src='".$src."'>";
@@ -1748,8 +1753,7 @@  discard block
 block discarded – undo
1748 1753
         if($to_currency->num_rows() > 0){
1749 1754
             $to_currency_arr = $to_currency->result_array();
1750 1755
             $to_currency = $to_currency_arr[0]["currencyrate"];
1751
-        }
1752
-        else{
1756
+        } else{
1753 1757
             $to_currency= $from_currency;
1754 1758
         }
1755 1759
 
@@ -1768,8 +1772,9 @@  discard block
 block discarded – undo
1768 1772
     function date_diff_custom($end='2020-06-09 10:30:00', $out_in_array=false){
1769 1773
         $intervalo = date_diff(date_create(), date_create($end));
1770 1774
         $out = $intervalo->format("Years:%Y,Months:%M,Days:%d,Hours:%H,Minutes:%i,Seconds:%s");
1771
-        if(!$out_in_array)
1772
-            return $out;
1775
+        if(!$out_in_array) {
1776
+                    return $out;
1777
+        }
1773 1778
         $a_out = array();
1774 1779
         array_walk(explode(',',$out),
1775 1780
         function($val,$key) use(&$a_out){
@@ -1828,7 +1833,7 @@  discard block
 block discarded – undo
1828 1833
                     $tax_value=$tax_value[0];
1829 1834
                  if($tax_value["taxes_priority"] == ""){
1830 1835
                      $tax_priority = $tax_value["taxes_priority"];
1831
-                 }else if($tax_value["taxes_priority"] > $tax_priority){
1836
+                 } else if($tax_value["taxes_priority"] > $tax_priority){
1832 1837
                      $query = $this->db_model->getSelect("SUM(value) as total", "invoices_total", array("invoiceid"=> $invoiceid));
1833 1838
                      $query =  $query->result_array();
1834 1839
                      $sub_total = $query["0"]["total"];
Please login to merge, or discard this patch.
astpp/application/modules/invoices/libraries/invoices_form.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
24
+if ( ! defined('BASEPATH')) {
25
+	exit('No direct script access allowed');
26
+}
25 27
 class invoices_form{
26 28
      function __construct($library_name = '') {
27 29
         $this->CI = & get_instance();
@@ -127,7 +129,7 @@  discard block
 block discarded – undo
127 129
      if(!empty($invoiceconf)){
128 130
 	if($invoiceconf['logo'] != ''){
129 131
 	     $logo=$invoiceconf['file'];
130
-	}else{
132
+	} else{
131 133
 	     $logo=$invoiceconf['logo'];
132 134
 	}
133 135
      $accountid=$invoiceconf['accountid'];  
@@ -135,13 +137,13 @@  discard block
 block discarded – undo
135 137
              $file_name= base_url()."upload/$logo";
136 138
              $image_path= array('Existing Image', 'IMAGE', array('type'=>'image','name' => 'image' ,'style'=>'width:100%;margin-top:20px;','src'=> $file_name), '', 'tOOL TIP', '');
137 139
               $delete_logo=array('Delete logo', 'DEL_BUTTON', array('value'=>'ankit','style'=>'margin-top:20px;','name' => 'button','id'=>'logo_delete','size' => '20', 'class' => "btn btn-line-parrot"), '', 'tOOL TIP', 'Please Enter account number');
138
-             }else{
140
+             } else{
139 141
               $image_path= array('Existing Image', 'HIDDEN', array('type'=>'','name' => '' ,'style'=>'width:250px;'), '', 'tOOL TIP', '');
140 142
               $delete_logo= array('Delete logo', 'HIDDEN', array('value'=>'ankit','style'=>'margin-top:0px;','name' => 'button','id'=>'logo_delete','size' => '20', 'maxlength' => '100', 'class' => "btn btn-line-parrot"), '', 'tOOL TIP', 'Please Enter account number');
141 143
              // $image_path=array();
142 144
              }
143 145
              
144
-             }else{
146
+             } else{
145 147
              $logo = '';
146 148
              $file_name = '';
147 149
              $accountid=0;
Please login to merge, or discard this patch.
astpp/application/modules/invoices/views/view_invoice_payment.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	    	 	</th>
231 231
 	    	 	<td align="right">
232 232
 	    	 	<!--0-->
233
-	    	 	<b><?php if($paypal){ echo   $this->common->currency_decimal($this->common_model->calculate_currency($paypal));  }else { echo $this->common->currency_decimal($this->common_model->calculate_currency($amount_visible)); ;}?> <?php  echo $to_currency;  ?></b>
233
+	    	 	<b><?php if($paypal){ echo   $this->common->currency_decimal($this->common_model->calculate_currency($paypal));  } else { echo $this->common->currency_decimal($this->common_model->calculate_currency($amount_visible)); ;}?> <?php  echo $to_currency;  ?></b>
234 234
 	    	 	</td>
235 235
 	    	 	
236 236
 	    	 	
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		
252 252
 		<tr style="">
253 253
 		 <td><b >Outstanding Amount :</b></td>
254
-	<td><span class="pull-right" style="color:#3278b6"><b><?php if($debit == ''){ echo  $this->common->currency_decimal($outstanding); ?> <?php  echo $to_currency; }else {  echo $this->common->currency_decimal($outstanding); ?> <?php  echo $to_currency; } ?></b> </span></td>
254
+	<td><span class="pull-right" style="color:#3278b6"><b><?php if($debit == ''){ echo  $this->common->currency_decimal($outstanding); ?> <?php  echo $to_currency; } else {  echo $this->common->currency_decimal($outstanding); ?> <?php  echo $to_currency; } ?></b> </span></td>
255 255
 		 <input type="hidden" name="total_amount" id="total_amount" class="article" value="<?php echo  $this->common->currency_decimal($amount); ?>" >
256 256
 	 </tr> 
257 257
 </table>
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		</td>
299 299
 	     </tr>
300 300
 	</table>
301
-<?php }elseif($logintype == 1){?>
301
+<?php } elseif($logintype == 1){?>
302 302
 	  <table class="invoice_table1  pull-right">
303 303
 	    <tr style="border-bottom:2px solid #dfdfe1; color:#474747;"><th colspan="2">Payment Amount :</th></tr>
304 304
 	      <tr>
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	     </tr>
321 321
 	</table>
322 322
 
323
-<?php }else{ ?>
323
+<?php } else{ ?>
324 324
 	<table class="invoice_table1  pull-right">
325 325
   	  <tr style="border-bottom:2px solid #dfdfe1; color:#474747;"><th colspan="2">Payment Amount :</th></tr>
326 326
   	    <tr>
Please login to merge, or discard this patch.
application/modules/invoices/views/view_invoice_edit_automatically.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@
 block discarded – undo
242 242
 for($i=1;$i<=$row_count;$i++){
243 243
 if($get_data['invoice_amount_'.$i] > 0){
244 244
 $invoice_amt=$this->common->currency_decimal($this->common_model->calculate_currency($get_data['invoice_amount_'.$i]));
245
-}else{
245
+} else{
246 246
 $invoice_amt='';
247 247
 }
248 248
 ?>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/invoices/models/invoices_model.php 1 patch
Braces   +11 added lines, -15 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
 	    $this->db->where_in('accountid',$acc_arr);
51 51
 	    if($flag){
52 52
 	      $this->db->select('*');
53
-	    }
54
-	    else{
53
+	    } else{
55 54
 	      $this->db->select('count(id) as count');
56 55
 	    }
57 56
 	    if($flag){
@@ -63,21 +62,20 @@  discard block
 block discarded – undo
63 62
  	    //echo $this->db->last_query();exit;    
64 63
 	    if($flag){
65 64
 	      return $result;
66
-	    }else{
65
+	    } else{
67 66
 	      $result=$result->result_array();
68 67
 	      return $result[0]['count'];
69 68
 	    }
70
-	  }else{
69
+	  } else{
71 70
           if($flag){
72 71
 	      $query=(object)array('num_rows'=>0);
73
-	  }
74
-	  else{
72
+	  } else{
75 73
 	      $query=0;
76 74
 	  }
77 75
  	  
78 76
 	  return $query;
79 77
         }
80
-    }else{
78
+    } else{
81 79
           
82 80
          if($result->num_rows() >0){
83 81
 /****
@@ -93,8 +91,7 @@  discard block
 block discarded – undo
93 91
          
94 92
          if($flag){
95 93
 	  $this->db->select('*');
96
-         }
97
-         else{
94
+         } else{
98 95
           $this->db->select('count(id) as count');
99 96
          }
100 97
          if($flag){
@@ -107,18 +104,17 @@  discard block
 block discarded – undo
107 104
 	      if($flag){
108 105
 	        
109 106
 		return $result;
110
-	      }else{
107
+	      } else{
111 108
 		$result=$result->result_array();
112 109
 		
113 110
 		return $result[0]['count'];
114 111
 	      }
115
-         }else{
112
+         } else{
116 113
 	      if($flag){
117 114
 	          
118 115
 		  $query=(object)array('num_rows'=>0);
119 116
 		 // echo '<pre>'; print_r($query); 	
120
-	      }
121
-	      else{
117
+	      } else{
122 118
 		  $query=0;
123 119
 	      }
124 120
 	return $query;
@@ -193,7 +189,7 @@  discard block
 block discarded – undo
193 189
         if ($logintype == 1 || $logintype == 5) {
194 190
           
195 191
 		$where = array("accountid" => $this->session->userdata["accountinfo"]['id']);
196
-        }else{
192
+        } else{
197 193
        		 $where=array('id'=> $accountid);
198 194
 	}      
199 195
         $query = $this->db_model->getSelect("*","invoice_conf",$where);
@@ -213,7 +209,7 @@  discard block
 block discarded – undo
213 209
 		unset($post_array['accountid']);
214 210
 		unset($post_array['logo_main']);
215 211
 		$this->db->update('invoice_conf',$post_array);
216
-	}else{
212
+	} else{
217 213
 		unset($post_array['logo_main']);
218 214
 		$logintype = $this->session->userdata('logintype');
219 215
 		if ($logintype == 1 || $logintype == 5) {
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/opensips/controllers/opensips.php 1 patch
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
         $db_config = Common_model::$global_config['system_config'];
34 34
         $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
35 35
         $this->opensips_db = $this->load->database($opensipdsn, true);
36
-        if ($this->session->userdata('user_login') == FALSE)
37
-            redirect(base_url() . '/astpp/login');
36
+        if ($this->session->userdata('user_login') == FALSE) {
37
+                    redirect(base_url() . '/astpp/login');
38
+        }
38 39
     }
39 40
 
40 41
     function opensips_add() {
@@ -92,7 +93,7 @@  discard block
 block discarded – undo
92 93
                         $this->opensips_model->edit_opensipsdevices($add_array, $add_array['id']);
93 94
                         echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!"));
94 95
                         exit;
95
-                }else{
96
+                } else{
96 97
                        echo json_encode($auth_flag);
97 98
                        exit;
98 99
                 }
@@ -109,7 +110,7 @@  discard block
 block discarded – undo
109 110
                         $this->opensips_model->add_opensipsdevices($add_array);
110 111
                         echo json_encode(array("SUCCESS"=> "OpenSips added successfully!"));
111 112
                         exit;
112
-                }else{
113
+                } else{
113 114
                        echo json_encode($auth_flag);
114 115
                         exit;
115 116
                 }
@@ -131,10 +132,10 @@  discard block
 block discarded – undo
131 132
                 $auth_flag = $auth_flag->num_rows();
132 133
                 if($auth_flag == 0){
133 134
                     return "TRUE";
134
-                }else{
135
+                } else{
135 136
                     return array("username_error"=>"Duplicate Email Address Found Email Must Be Unique.");
136 137
                 }
137
-        }else{
138
+        } else{
138 139
           return array("username_error"=>"User name is required field.");
139 140
         }
140 141
         return "0";
@@ -155,13 +156,13 @@  discard block
 block discarded – undo
155 156
                 echo json_encode(array("SUCCESS"=> "Opensips Updated Successfully!"));
156 157
                 exit;
157 158
             }
158
-        }else{
159
+        } else{
159 160
 	      $data['page_title'] = 'Add Opensips';
160 161
 	      if ($this->form_validation->run() == FALSE) {
161 162
                 $data['validation_errors'] = validation_errors();
162 163
                 echo $data['validation_errors'];
163 164
                 exit;
164
-            }else{
165
+            } else{
165 166
 		$this->opensips_model->add_opensipsdevices($array_add);
166 167
                 echo json_encode(array("SUCCESS"=> "Opensips Added Successfully!"));
167 168
                 exit;
@@ -184,13 +185,13 @@  discard block
 block discarded – undo
184 185
                 echo json_encode(array("SUCCESS"=> "OpenSips Updated Successfully!"));
185 186
                 exit;
186 187
             }
187
-        }else{
188
+        } else{
188 189
               $data['page_title'] = 'Add Opensips';
189 190
 	      if ($this->form_validation->run() == FALSE) {
190 191
                 $data['validation_errors'] = validation_errors();
191 192
                 echo $data['validation_errors'];
192 193
                 exit;
193
-             }else{
194
+             } else{
194 195
 		$this->opensips_model->add_opensipsdevices($add_array);
195 196
                 echo json_encode(array("SUCCESS"=> "OpenSips Added Successfully!"));
196 197
                 exit;
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/opensips/models/opensips_model.php 1 patch
Braces   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $this->opensips_db->limit($limit,$start);
39 39
             if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
40 40
 		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
41
-	    }else{
41
+	    } else{
42 42
             $this->opensips_db->order_by('username','asc');
43 43
 	    }
44 44
             $query = $this->opensips_db->get("subscriber");
@@ -62,8 +62,9 @@  discard block
 block discarded – undo
62 62
                                             OR  effective_caller_id_number like '%$instant_search%'
63 63
                                                 )"
64 64
                                            :null;
65
-        if(!empty($like_str))
66
-        $this->opensips_db->where($like_str);
65
+        if(!empty($like_str)) {
66
+                $this->opensips_db->where($like_str);
67
+        }
67 68
         $this->opensips_db->where($where);
68 69
         if ($flag) {
69 70
 	      $this->opensips_db->limit($limit,$start);            
@@ -72,15 +73,13 @@  discard block
 block discarded – undo
72 73
         if($result->num_rows() > 0){
73 74
 	  if($flag){
74 75
 	    return $result;
75
-	  }
76
-	  else{
76
+	  } else{
77 77
 	    return $result->num_rows();
78 78
 	  }
79
-        }else{
79
+        } else{
80 80
          if($flag){
81 81
 	      $result=(object)array('num_rows'=>0);
82
-	  }
83
-	  else{
82
+	  } else{
84 83
 	      $result=0;
85 84
 	  }
86 85
 	  return $result;
@@ -93,7 +92,7 @@  discard block
 block discarded – undo
93 92
             $this->opensips_db->limit( $limit,$start);
94 93
             if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
95 94
 		$this->opensips_db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
96
-	    }else{
95
+	    } else{
97 96
             $this->opensips_db->order_by('setid','asc');
98 97
 	    }
99 98
             $query = $this->opensips_db->get("dispatcher");
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/controllers/ipmap.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@  discard block
 block discarded – undo
31 31
         $this->load->library("ipmap_form");
32 32
         $this->load->library('astpp/form');
33 33
         $this->load->model('ipmap_model');
34
-        if ($this->session->userdata('user_login') == FALSE)
35
-            redirect(base_url() . '/astpp/login');
34
+        if ($this->session->userdata('user_login') == FALSE) {
35
+                    redirect(base_url() . '/astpp/login');
36
+        }
36 37
          }
37 38
     function ipmap_add() {
38 39
         $data['username'] = $this->session->userdata('user_name');
@@ -66,8 +67,7 @@  discard block
 block discarded – undo
66 67
         $ip = $add_array['ip'];
67 68
         if (strpos($ip,'/') !== false) {
68 69
            $add_array['ip']=$add_array['ip'];
69
-        }
70
-        else{
70
+        } else{
71 71
            $add_array['ip']=$add_array['ip'].'/32';
72 72
         }
73 73
         $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
    	$accountdata=$this->session->userdata['accountinfo'];
127 127
         if($accountdata['type'] == '0'){
128 128
         redirect(base_url() . 'user/user_ipmap_detail/');
129
-        }else{
129
+        } else{
130 130
         redirect(base_url() . 'ipmap/ipmap_detail/');
131 131
         }
132 132
         /*********************************************************************/
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
          $ret_url,
191 191
          
192 192
           ));
193
-         }else{
193
+         } else{
194 194
          $ret_url = '<a href="'. base_url() .'ipmap/ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'. base_url() .'ipmap/ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
195 195
          $account_name =$this->common->build_concat_string("first_name,last_name,number", "accounts",$value['accountid']);
196 196
          $json_data['rows'][] = array('cell' => array(
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/libraries/ipmap_form.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 # You should have received a copy of the GNU Affero General Public License
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23
-if (!defined('BASEPATH'))
24
-    exit('No direct script access allowed');
23
+if (!defined('BASEPATH')) {
24
+    exit('No direct script access allowed');
25
+}
25 26
 
26 27
 class Ipmap_form {
27 28
       	function __construct($library_name = '') {
@@ -42,7 +43,7 @@  discard block
 block discarded – undo
42 43
        if($account_type == '0' || $logintype == '0'){
43 44
         $account=null;
44 45
         $form['forms'] = array(base_url() . 'user/user_ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
45
-       }else{
46
+       } else{
46 47
        $account=array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0","status" => "0"));
47 48
         $form['forms'] = array(base_url() . 'ipmap/ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form'));
48 49
        }
@@ -79,7 +80,7 @@  discard block
 block discarded – undo
79 80
    	    *****************************************/
80 81
      if($account_data =='0'){
81 82
            $account=null;
82
-        }else{
83
+        } else{
83 84
          $account=array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"0", "deleted" => "0"));
84 85
         }
85 86
         /***************************************************************************************/
@@ -127,7 +128,7 @@  discard block
 block discarded – undo
127 128
             array("Action", "205", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'),
128 129
                     "DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single")))
129 130
                 ));
130
-            }else{
131
+            } else{
131 132
            $grid_field_arr = json_encode(array(
132 133
            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "","","","false","center"),
133 134
 		   array("Account", "200", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"),
Please login to merge, or discard this patch.