Browse files

OES-144

  • Loading branch information...
1 parent 3f782f5 commit 42d48df712f0b132b598d6208b916c93eb547cf1 @denis-larka denis-larka committed Mar 14, 2013
Showing with 36 additions and 26 deletions.
  1. +10 −1 inc/lib_form_util.inc
  2. +25 −24 mod/person/personModule.class.php
  3. +1 −1 www/VERSION
View
11 inc/lib_form_util.inc
@@ -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();
@@ -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;
View
49 mod/person/personModule.class.php
@@ -357,6 +357,7 @@ public function act_delete_biographic()
$this->biographics = Browse::getBiographyListArray($_POST['biographics']);
}
+
function act_new_biography()
{
@@ -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){
@@ -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;
}
}
@@ -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){
@@ -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'));
}
}
}
View
2 www/VERSION
@@ -1 +1 @@
-version=1.2
+version=1.3

0 comments on commit 42d48df

Please sign in to comment.