fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17154] booking: more on delegate


From: sigurdne
Subject: [Fmsystem-commits] [17154] booking: more on delegate
Date: Sun, 15 Oct 2017 10:36:13 -0400 (EDT)

Revision: 17154
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17154
Author:   sigurdne
Date:     2017-10-15 10:36:12 -0400 (Sun, 15 Oct 2017)
Log Message:
-----------
booking: more on delegate

Modified Paths:
--------------
    trunk/booking/inc/class.sodelegate.inc.php
    trunk/booking/setup/phpgw_no.lang
    trunk/booking/templates/base/delegate_edit.xsl
    trunk/bookingfrontend/templates/base/delegate.xsl
    trunk/bookingfrontend/templates/base/delegate_edit.xsl

Modified: trunk/booking/inc/class.sodelegate.inc.php
===================================================================
--- trunk/booking/inc/class.sodelegate.inc.php  2017-10-14 21:17:41 UTC (rev 
17153)
+++ trunk/booking/inc/class.sodelegate.inc.php  2017-10-15 14:36:12 UTC (rev 
17154)
@@ -28,24 +28,6 @@
                        $this->account = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
-               function get_metainfo( $id )
-               {
-                       $this->db->limit_query("SELECT bb_delegate.first_name 
|| ' ' || last_name AS name"
-                               . " bb_organization.name AS organization, 
bb_organization.district,"
-                               . " bb_organization.city, 
bb_delegate.description"
-                               . " FROM bb_delegate, bb_organization AS 
bb_organization"
-                               . " WHERE 
bb_delegate.organization_id=bb_organization.id AND bb_delegate.id=" . 
intval($id), 0, __LINE__, __FILE__, 1);
-                       if (!$this->db->next_record())
-                       {
-                               return False;
-                       }
-                       return array('name' => $this->db->f('name', false),
-                               'organization' => $this->db->f('organization', 
false),
-                               'district' => $this->db->f('district', false),
-                               'city' => $this->db->f('city', false),
-                               'description' => $this->db->f('description', 
false));
-               }
-
                protected function preValidate( &$entity )
                {
                        $id = (int) $entity['id'];
@@ -78,8 +60,30 @@
                                        $errors['ssn'] = 
lang(strtr($e->getMessage(), array('%field%' => 'ssn')));
                                }
 
+                               $hash = sha1($entity['ssn']);
+                               $ssn =  '{SHA1}' . base64_encode($hash);
+
+                               $cnt = 0;
+                               if(empty($entity['id']))
+                               {
+                                       $sql = "SELECT count(id) AS cnt FROM 
bb_delegate WHERE ssn = '{$ssn}' AND organization_id = " . (int) 
$entity['organization_id'];
+                               }
+                               else
+                               {
+                                       $id = (int) $entity['id'];
+                                       $sql = "SELECT count(id) AS cnt FROM 
bb_delegate WHERE id != {$id} AND ssn = '{$ssn}' AND organization_id = " . 
(int) $entity['organization_id'];
+                               }
+                               $this->db->query($sql, __LINE__, __FILE__);
+                               $this->db->next_record();
+                               $cnt = $this->db->f('cnt');
+                               if($cnt > 0)
+                               {
+                                       $errors['ssn'] = lang('duplicate ssn');
+                               }
+
                                return;
                        }
+
                        $algo = $m[1];
                        $hash = $m[2];
 

Modified: trunk/booking/setup/phpgw_no.lang
===================================================================
--- trunk/booking/setup/phpgw_no.lang   2017-10-14 21:17:41 UTC (rev 17153)
+++ trunk/booking/setup/phpgw_no.lang   2017-10-15 14:36:12 UTC (rev 17154)
@@ -715,4 +715,5 @@
 please enter a delegate        booking no      Angi navn på delegert til
 please enter an email  booking no      Angi en epost
 ssn is invalid booking no      Fødselsnummeret er ikke gyldig
-edit delegate  booking no      Endre delegert til
\ No newline at end of file
+edit delegate  booking no      Endre delegert til
+duplicate ssn  booking no      Duplikat av f.nr for samme organisasjon
\ No newline at end of file

Modified: trunk/booking/templates/base/delegate_edit.xsl
===================================================================
--- trunk/booking/templates/base/delegate_edit.xsl      2017-10-14 21:17:41 UTC 
(rev 17153)
+++ trunk/booking/templates/base/delegate_edit.xsl      2017-10-15 14:36:12 UTC 
(rev 17154)
@@ -20,7 +20,7 @@
                                        </div>
                                        <div class="pure-control-group">
                                                <label for="name">
-                                                       <xsl:value-of 
select="php:function('lang', 'delegate')" />
+                                                       <xsl:value-of 
select="php:function('lang', 'name')" />
                                                </label>
                                                <input id="name" name="name" 
type="text" value="{delegate/name}" >
                                                        <xsl:attribute 
name="data-validation">

Modified: trunk/bookingfrontend/templates/base/delegate.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/delegate.xsl   2017-10-14 21:17:41 UTC 
(rev 17153)
+++ trunk/bookingfrontend/templates/base/delegate.xsl   2017-10-15 14:36:12 UTC 
(rev 17154)
@@ -28,7 +28,7 @@
 
                <dl class="proplist">
                        <dt>
-                               <xsl:value-of select="php:function('lang', 
'delegate')" />
+                               <xsl:value-of select="php:function('lang', 
'name')" />
                        </dt>
                        <dd>
                                <xsl:value-of select="delegate/name"/>

Modified: trunk/bookingfrontend/templates/base/delegate_edit.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/delegate_edit.xsl      2017-10-14 
21:17:41 UTC (rev 17153)
+++ trunk/bookingfrontend/templates/base/delegate_edit.xsl      2017-10-15 
14:36:12 UTC (rev 17154)
@@ -28,7 +28,7 @@
                                        <dl class="form-col">
                                                <dt>
                                                        <label for="field_name">
-                                                               <xsl:value-of 
select="php:function('lang', 'delegate')" />
+                                                               <xsl:value-of 
select="php:function('lang', 'name')" />
                                                        </label>
                                                </dt>
                                                <dd>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]