The followings are the available columns in table 'commissioning_body':
Inheritance: extends BaseActiveRecordVersioned
Ejemplo n.º 1
0
 /**
  * Search the local authorities and return both their address and the address of their social security department
  *
  * @param $term
  */
 public function actionAutoComplete($term)
 {
     $crit = new \CDbCriteria();
     // NOTE: have commented out the address eager loading here due to column ambiguity issues with the relation definitions.
     // need to investigate if this can be solved with the cunning use of scopes on the Contact model or not.
     $crit->with = array('contact' => array('alias' => 'service_contact'), 'commissioning_body', 'commissioning_body.contact', 'type' => array('alias' => 'service_type'), 'commissioning_body.type' => array('alias' => 'body_type'));
     $crit->compare('LOWER(t.name)', strtolower($term), true);
     $crit->compare('LOWER(commissioning_body.name)', strtolower($term), true, 'OR');
     $crit->addColumnCondition(array('service_type.shortname' => 'SSD'));
     $crit->addColumnCondition(array('body_type.shortname' => 'LA'));
     $crit->order = 'commissioning_body.name, t.name';
     $results = array();
     $found_bodies = array();
     foreach (\CommissioningBodyService::model()->findAll($crit) as $cbs) {
         $body = $cbs->commissioning_body;
         $found_bodies[] = $body->id;
         $results[] = array('id' => 'service' . $cbs->id, 'value' => $cbs->name . " ({$body->name})", 'service' => array('id' => $cbs->id, 'name' => $cbs->name, 'address' => $cbs->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $cbs->contact->primary_phone), 'body' => array('id' => $body->id, 'name' => $body->name, 'address' => $body->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $body->contact->primary_phone));
     }
     $body_crit = new \CDbCriteria();
     $body_crit->with = array('type', 'contact', 'contact.correspondAddress');
     $body_crit->compare('LOWER(t.name)', strtolower($term), true);
     $body_crit->addNotInCondition('t.id', $found_bodies);
     $body_crit->addColumnCondition(array('type.shortname' => 'LA'));
     foreach (\CommissioningBody::model()->findAll($body_crit) as $body) {
         $results[] = array('id' => 'body' . $body->id, 'value' => $body->name, 'body' => array('id' => $body->id, 'name' => $body->name, 'address' => $body->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $body->contact->primary_phone));
     }
     echo json_encode($results);
 }
Ejemplo n.º 2
0
 public function actionVerifyDeleteCommissioningBodyTypes()
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('commissioning_body_type_id', @$_POST['commissioning_body_type']);
     foreach (CommissioningBody::model()->findAll($criteria) as $cb) {
         if (!$cb->canDelete()) {
             echo "0";
             return;
         }
     }
     echo "1";
 }
<div class="box admin">
	<h2><?php 
echo $cbs->id ? 'Edit' : 'Add';
?>
 commissioning body service</h2>
	<?php 
echo $this->renderPartial('//admin/_form_errors', array('errors' => $errors));
?>
	<?php 
$form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'adminform', 'enableAjaxValidation' => false, 'focus' => '#username', 'layoutColumns' => array('label' => 2, 'field' => 5)));
$criteria = new CDbCriteria();
$criteria->order = 't.name asc';
if ($commissioning_bt) {
    $criteria->addColumnCondition(array('commissioning_body_type_id' => $commissioning_bt->id));
}
echo $form->dropDownList($cbs, 'commissioning_body_id', CHtml::listData(CommissioningBody::model()->findAll($criteria), 'id', 'name'), array('style' => 'margin-bottom:6px;'));
if ($commissioning_bst) {
    ?>
		<div id="div_CommissioningBodyService_commissioning_body_service_type_id" class="row field-row">
			<div class="large-2 column">
				<label for="div_CommissioningBodyService_commissioning_body_service_type_id">Service type:</label>
			</div>
			<div class="large-5 column end">
				<?php 
    echo $form->hiddenInput($cbs, 'commissioning_body_service_type_id', $commissioning_bst->id);
    echo $commissioning_bst->name;
    ?>
			</div>
		</div>
	<?php 
} else {
Ejemplo n.º 4
0
<div class="box admin">
	<h2>Commissioning bodies</h2>
	<form id="admin_commissioning_bodies">
		<table class="grid">
			<thead>
				<tr>
					<th><input type="checkbox" id="checkall" class="commissioning_body" /></th>
					<th>Code</th>
					<th>Name</th>
					<th>Type</th>
					<th>Address</th>
				</tr>
			</thead>
			<tbody>
				<?php 
foreach (CommissioningBody::model()->findAll(array('order' => 'name asc')) as $i => $cb) {
    ?>
					<tr class="clickable" data-id="<?php 
    echo $cb->id;
    ?>
" data-uri="admin/editCommissioningBody?commissioning_body_id=<?php 
    echo $cb->id;
    ?>
">
						<td><input type="checkbox" name="commissioning_body[]" value="<?php 
    echo $cb->id;
    ?>
" class="wards" /></td>
						<td><?php 
    echo $cb->code;
    ?>
Ejemplo n.º 5
0
 /**
  * Imports the 'CcgAssignment' file.
  * 
  * @param array $data
  *
  * @throws Exception If Failed to save commissioning body assignment
  */
 private function importCcgAssignment(array $data)
 {
     $practice = Practice::model()->findByAttributes(array('code' => $data['practice_code']));
     $ccg = CommissioningBody::model()->findByAttributes(array('code' => $data['ccg_code'], 'commissioning_body_type_id' => $this->cbtId));
     if (!$practice || !$ccg) {
         return;
     }
     $found = false;
     foreach ($practice->commissioningbodyassigments as $assignment) {
         if ($assignment->commissioning_body_id == $ccg->id) {
             $found = true;
         } else {
             if ($assignment->commissioning_body->commissioning_body_type_id == $this->cbtId) {
                 if ($assignment->delete() && $this->audit !== 'false') {
                     Audit::add('ProcessHscicDataCommand', 'Assignment Deleted');
                 }
             }
         }
     }
     if (!$found) {
         $assignment = new CommissioningBodyPracticeAssignment();
         $assignment->commissioning_body_id = $ccg->id;
         $assignment->practice_id = $practice->id;
         if (!$assignment->save()) {
             throw new Exception('Failed to save commissioning body assignment: ' . print_r($assignment->errors, true));
         }
         if ($this->audit !== 'false') {
             Audit::add('ProcessHscicDataCommand', 'Assignment Saved');
         }
     }
 }