Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Commit

Permalink
OES-144
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Larka committed Mar 14, 2013
1 parent 3f782f5 commit 42d48df
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 26 deletions.
11 changes: 10 additions & 1 deletion inc/lib_form_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

include_once APPROOT.'inc/lib_form.inc';

function endswith($string, $test) {
$strlen = strlen($string);
$testlen = strlen($test);
if ($testlen > $strlen) return false;
return substr_compare($string, $test, -$testlen) === 0;
}

function compartmentalize_view_form($entity_form ) {

$normalFields =array();
Expand All @@ -12,7 +19,9 @@ function compartmentalize_view_form($entity_form ) {

if( $entity_form[$fieldName]['type'] != 'submit' ){
$field_number = $entity_form[$fieldName]['field_number'] % 100 ;
if( $field_number == 1 || $field_number == 61 || $field_number == 62 || $field_number == 70 || $field_number == 71 ){

if(endswith($fieldName,"_record_number") || 'date_of_entry'==$fieldName || 'entered_by'==$fieldName ||'date_updated'==$fieldName || 'updated_by'==$fieldName){
//if( $field_number == 1 || $field_number == 61 || $field_number == 62 || $field_number == 70 || $field_number == 71 ){
$systemFields[$fieldName] = $field;
} else if ($field_number == 66){
$supportingDocFields[$fieldName] = $field;
Expand Down
49 changes: 25 additions & 24 deletions mod/person/personModule.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ public function act_delete_biographic()

$this->biographics = Browse::getBiographyListArray($_POST['biographics']);
}


function act_new_biography()
{
Expand All @@ -366,7 +367,7 @@ function act_new_biography()
include_once APPROOT.'inc/lib_uuid.inc';
include_once APPROOT.'inc/lib_form.inc';

$biography_form = biographic_form('new');
$this->biography_form = biographic_form('new');

$this->pid = (isset($_GET['pid']) && $_GET['pid'] != null) ? $_GET['pid'] : $_SESSION['person']['pid'];
if($this->pid != null){
Expand All @@ -378,32 +379,32 @@ function act_new_biography()

if(isset($_POST['save'])){
$this->pid = $_SESSION['person']['pid'];
$status = shn_form_validate($biography_form);
$status = shn_form_validate($this->biography_form);
if($status){
if($_POST['biographic_details_record_number'] == ''){
$_POST['biographic_details_record_number'] = shn_create_uuid('biography');
}
$_GET['pid'] = $_SESSION['person']['pid'];
$biography = new BiographicDetail();
$biography->LoadfromRecordNumber($_POST['biographic_details_record_number']);
$biography->biographic_details_record_number = $_POST['biographic_details_record_number'];
form_objects($biography_form, $biography);
$biography->person = $_SESSION['person']['pid'];
if($biography->related_person == '') $biography->related_person = null;
$biography->SaveAll();
$this->biography = new BiographicDetail();
$this->biography->LoadfromRecordNumber($_POST['biographic_details_record_number']);
$this->biography->biographic_details_record_number = $_POST['biographic_details_record_number'];
form_objects($this->biography_form, $this->biography);
$this->biography->person = $_SESSION['person']['pid'];
if($this->biography->related_person == '') $this->biography->related_person = null;
$this->biography->SaveAll();

$_GET['pid'] = null;

$_GET['bid'] = $_POST['biographic_details_record_number'];
$this->biography_list($_SESSION['person']['pid']);
$_SESSION['pid'] = $_SESSION['person']['pid'];

set_redirect_header('person','biography_list',null,array('biography_id'=>$biography->biographic_details_record_number,'type'=>'bd'));
set_redirect_header('person','biography_list',null,array('biography_id'=>$this->biography->biographic_details_record_number,'type'=>'bd'));
}
}
else{
$biography_form['related_person']['extra_opts']['readonly'] = true;
$this->biography_form = $biography_form;
$this->biography_form['related_person']['extra_opts']['readonly'] = true;
//$this->biography_form = $biography_form;
}
}

Expand All @@ -412,7 +413,7 @@ function act_edit_biography()
include_once APPROOT.'inc/lib_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc';

$biography_form = biographic_form('edit');
$this->biography_form = biographic_form('edit');

$this->pid = (isset($_GET['pid']) && $_GET['pid'] != null) ? $_GET['pid'] : $_SESSION['pid'];
if($this->pid != null){
Expand All @@ -424,33 +425,33 @@ function act_edit_biography()

if(isset($_GET['biography_id'])){
set_url_args('biography_id',$this->biographic_details->biographic_details_record_number);
popuate_formArray($biography_form,$this->biographic_details);
$this->biography_form = $biography_form;
popuate_formArray($this->biography_form,$this->biographic_details);
$this->biography_form = $this->biography_form;
}

if(isset($_POST['save'])){
$this->pid = $_SESSION['person']['pid'];
$status = shn_form_validate($biography_form);
$status = shn_form_validate($this->biography_form);
if($status){
if($_POST['biographic_details_record_number'] == ''){
$_POST['biographic_details_record_number'] = shn_create_uuid('biography');
}
$_GET['pid'] = $_SESSION['person']['pid'];
$biography = new BiographicDetail();
$biography->LoadfromRecordNumber($_POST['biographic_details_record_number']);
$biography->biographic_details_record_number = $_POST['biographic_details_record_number'];
form_objects($biography_form, $biography);
$biography->person = $_SESSION['person']['pid'];
if($biography->related_person == '') $biography->related_person = null;
$biography->SaveAll();
$this->biography = new BiographicDetail();
$this->biography->LoadfromRecordNumber($_POST['biographic_details_record_number']);
$this->biography->biographic_details_record_number = $_POST['biographic_details_record_number'];
form_objects($this->biography_form, $this->biography);
$this->biography->person = $_SESSION['person']['pid'];
if($this->biography->related_person == '') $this->biography->related_person = null;
$this->biography->SaveAll();

$_GET['pid'] = null;
$_GET['bid'] = $_POST['biographic_details_record_number'];

$this->biography_list($_SESSION['person']['pid']);
$_SESSION['pid'] = $_SESSION['person']['pid'];

set_redirect_header('person','biography_list',null,array('biography_id'=>$biography->biographic_details_record_number,'type'=>'bd'));
set_redirect_header('person','biography_list',null,array('biography_id'=>$this->biography->biographic_details_record_number,'type'=>'bd'));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion www/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.2
version=1.3

0 comments on commit 42d48df

Please sign in to comment.