Commits

Jesse Terry committed 3bc0a6c

More tweaks for the client type-in lookups

Comments (0)

Files changed (7)

application/modules_core/client_center/controllers/admin.php

 
 			$this->load->model('clients/mdl_clients');
 
-			$data = array(
-				'clients'	=>	$this->mdl_clients->get()
-			);
-
-			$this->load->view('admin_form', $data);
+			$this->load->view('admin_form');
 
 		}
 

application/modules_core/invoice_search/views/search.php

-<?php $this->load->view('dashboard/header'); ?>
-
-<?php $this->load->view('dashboard/jquery_date_picker'); ?>
+<?php $this->load->view('dashboard/header', array('header_insert'=>array('dashboard/jquery_date_picker', 'invoices/jquery_client_ac'))); ?>
 
 <div class="grid_10" id="content_wrapper">
 

application/modules_core/invoices/controllers/invoices.php

 			$this->load->helper('text');
 
 			$data = array(
-				'clients'			=>	$this->mdl_clients->get_active(),
 				'invoice_groups'	=>	$this->mdl_invoice_groups->get()
 			);
 
 			'invoice_items'     =>  $this->mdl_invoices->get_invoice_items($invoice->invoice_id),
 			'invoice_tax_rates' =>  $this->mdl_invoices->get_invoice_tax_rates($invoice->invoice_id),
 			'tags'              =>  $this->mdl_invoices->get_invoice_tags($invoice->invoice_id),
-			'clients'			=>	$this->mdl_clients->get_active($client_params),
 			'tax_rates'			=>	$this->mdl_tax_rates->get(),
 			'invoice_statuses'	=>	$this->mdl_invoice_statuses->get(),
 			'tab_index'			=>	$tab_index,
 		$this->load->model('invoices/mdl_invoice_groups');
 
 		$data = array(
-			'clients'			=>	$this->mdl_clients->get(),
 			'invoice_groups'	=>	$this->mdl_invoice_groups->get()
 		);
 

application/modules_core/payments/controllers/client_credits.php

 				$this->mdl_client_credits->set_date();
 
 			}
-			
-			$data = array(
-				'clients'	=>	$this->mdl_clients->get()
-			);
 
-			$this->load->view('client_credit_form', $data);
+			$this->load->view('client_credit_form');
 
 		}
 

application/modules_core/payments/models/mdl_client_credits.php

 
 	public function validate() {
 
+		$this->form_validation->set_rules('client_id_autocomplete_label');
 		$this->form_validation->set_rules('client_credit_client_id', $this->lang->line('client'), 'required');
 		$this->form_validation->set_rules('client_credit_date', $this->lang->line('date'), 'required');
 		$this->form_validation->set_rules('client_credit_amount', $this->lang->line('amount'), 'required');
 	public function db_array() {
 
 		$db_array = parent::db_array();
+
+		unset($db_array['client_id_autocomplete_label']);
+
 		$db_array['client_credit_date'] = strtotime(standardize_date($db_array['client_credit_date']));
 		$db_array['client_credit_amount'] = standardize_number($db_array['client_credit_amount']);
 
 
 		}
 
+		$this->form_values['client_id_autocomplete_label'] = $this->form_values['client_name'];
+
 	}
 
 	public function set_date() {

application/modules_core/payments/views/client_credit_form.php

-<?php $this->load->view('dashboard/header'); ?>
-
-<?php $this->load->view('dashboard/jquery_date_picker'); ?>
+<?php $this->load->view('dashboard/header', array('header_insert'=>array('invoices/jquery_client_ac', 'dashboard/jquery_date_picker'))); ?>
 
 <div class="grid_10" id="content_wrapper">
 
 			<dl>
 				<dt><label>* <?php echo $this->lang->line('client'); ?>: </label></dt>
 				<dd>
-					<select name="client_credit_client_id" id="client_credit_client_id">
-						<option value=""></option>
-						<?php foreach ($clients as $client) { ?>
-						<option value="<?php echo $client->client_id; ?>" <?php if ($this->mdl_client_credits->form_value('client_credit_client_id') == $client->client_id) { ?>selected="selected"<?php } ?>><?php echo $client->client_name; ?></option>
-						<?php } ?>
-					</select>
+					<input type="text" id="client_id_autocomplete_label" name="client_id_autocomplete_label" value="<?php echo $this->mdl_client_credits->form_value('client_id_autocomplete_label'); ?>" />
+					<input type="hidden" id="client_id_autocomplete_hidden" name="client_credit_client_id" value="<?php echo $this->mdl_client_credits->form_value('client_credit_client_id'); ?>"/>
 				</dd>
 			</dl>
 

application/modules_core/reports/controllers/client_statement.php

 
 		$this->load->model('clients/mdl_clients');
 
-		$client_params = array(
-			'select' => 'mcb_clients.*'
-		);
-
 		$data = array(
-			'output_types' => array('pdf', 'view'),
-			'clients' => $this->mdl_clients->get($client_params)
+			'output_types' => array('pdf', 'view')
 		);
 
 		$this->load->view('client_statement', $data);