Author: sevein
Date: Fri Nov 27 19:09:11 2009
New Revision: 3980

Log:
Simple checks for mandatory fields, ICA-ISAAR

Modified:
   trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php   
(contents, props changed)
   trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php

Modified: trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php    Fri Nov 
27 18:49:53 2009        (r3979)
+++ trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php    Fri Nov 
27 19:09:11 2009        (r3980)
@@ -33,6 +33,23 @@
     // run the core actor show action commands
     parent::execute($request);
 
-    // add ISAAR specific commands
+    $validatorSchema = new sfValidatorSchema;
+    $validatorSchema->authorizedFormOfName = new 
sfValidatorString(array('required' => true), array('required' => 'Authorized 
form of name'));
+    $validatorSchema->datesOfExistence = new 
sfValidatorString(array('required' => true), array('required' => 'Dates of 
existence'));
+    $validatorSchema->descriptionIdentifier = new 
sfValidatorString(array('required' => true), array('required' => 'Authority 
record identifier'));
+    $validatorSchema->entityType = new sfValidatorString(array('required' => 
true), array('required' => 'Type of entity'));
+
+    try
+    {
+      $validatorSchema->clean(array(
+        'authorizedFormOfName' => $this->actor->authorizedFormOfName,
+        'datesOfExistence' => $this->actor->datesOfExistence,
+        'descriptionIdentifier' => $this->actor->descriptionIdentifier,
+        'entityType' => $this->actor->entityType));
+    }
+    catch (sfValidatorErrorSchema $e)
+    {
+      $this->errorSchema = $e;
+    }
   }
 }

Modified: trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php       Fri Nov 
27 18:49:53 2009        (r3979)
+++ trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php       Fri Nov 
27 19:09:11 2009        (r3980)
@@ -7,6 +7,20 @@
   <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 
'actor'), render_title($actor), array('module' => 'actor', 'action' => 'edit', 
'id' => $actor->id), array('title' => __('Edit authority record'))) ?>
   </td></tr>
 
+<?php if (isset($errorSchema)): ?>
+<tr>
+  <td colspan="2">
+    <div class="messages error">
+      <ul>
+        <?php foreach ($errorSchema as $error): ?>
+          <li><?php echo $error ?></li>
+        <?php endforeach; ?>
+      </ul>
+    </div>
+  </td>
+</tr>
+<?php endif; ?>
+
 <?php if ($actor->getEntityTypeId()): ?>
   <tr><th><?php echo __('type of entity') ?></th><td>
   <?php echo $actor->getEntityType()->getName(array('cultureFallback' => 
true)) ?>

--

You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.


Reply via email to