[ghelda-devel] [19] Update the Childhood plugin. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/ghelda-devel Archives
]
Revision: 19
Author: odyx
Date: 2009-04-02 12:35:06 +0200 (Thu, 02 Apr 2009)
Log Message:
-----------
Update the Childhood plugin. It now works. ;)
Modified Paths:
--------------
trunk/plugins/Childhood/config.php
trunk/plugins/Childhood/config_core.php
trunk/plugins/Childhood.php
Modified: trunk/plugins/Childhood/config.php
===================================================================
--- trunk/plugins/Childhood/config.php 2009-04-02 09:14:49 UTC (rev 18)
+++ trunk/plugins/Childhood/config.php 2009-04-02 10:35:06 UTC (rev 19)
@@ -19,12 +19,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-$conf['select']['list'][] = 'Name';
-$conf['select']['list'][] = 'Surname';
+$conf['select']['list'][] = 'name';
+$conf['select']['list'][] = 'surname';
-$conf['select']['orderby'][] = 'Name';
-$conf['select']['orderby'][] = 'Surname';
+$conf['select']['orderby'][] = 'name';
+$conf['select']['orderby'][] = 'surname';
-$conf['select']['format'] = '<Name> <Surname>';
+$conf['select']['format'] = '<name> <surname>';
-?>
\ No newline at end of file
+?>
Modified: trunk/plugins/Childhood/config_core.php
===================================================================
--- trunk/plugins/Childhood/config_core.php 2009-04-02 09:14:49 UTC (rev 18)
+++ trunk/plugins/Childhood/config_core.php 2009-04-02 10:35:06 UTC (rev 19)
@@ -22,4 +22,4 @@
// Needed.
$conf['select']['list'][] = G_DB_PEOPLE_ID;
-?>
\ No newline at end of file
+?>
Modified: trunk/plugins/Childhood.php
===================================================================
--- trunk/plugins/Childhood.php 2009-04-02 09:14:49 UTC (rev 18)
+++ trunk/plugins/Childhood.php 2009-04-02 10:35:06 UTC (rev 19)
@@ -62,26 +62,24 @@
trigger_error(T_('The first parent should exist to set the second (they have been swapped).'),G_E_DISPLAY);
}
- // If both parents are the same
- if( $people_id2 == $people_id1 ) {
+ // If both parents are the same and not empty
+ if( $people_id1 == $people_id2 && $people_id1 != G_PEOPLE_ID_NEW ) {
$people_id2 = G_PEOPLE_ID_NEW;
trigger_error(T_('Both parents have to be different.'),G_E_DISPLAY);
}
-
- if( $people_id1 != G_ADDRESS_ID_NEW ) {
- $query = sprintf("UPDATE `%s` SET `%s` = '%s', `%s` = '%s' WHERE `%s` = '%s' LIMIT 1",
- $this->authH->storage_options['table'],
- G_CHILDHOOD_OF_ONE,
- $people_id1,
- G_CHILDHOOD_OF_TWO,
- $people_id2,
- G_DB_PEOPLE_ID,
- $id_people);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $childhood = array(G_CHILDHOOD_OF_ONE => $people_id1, G_CHILDHOOD_OF_TWO => $people_id2);
- }
+ // Actually commit the parents
+ $query = sprintf("UPDATE `%s` SET `%s` = '%s', `%s` = '%s' WHERE `%s` = '%s' LIMIT 1",
+ $this->authH->storage_options['table'],
+ G_CHILDHOOD_OF_ONE,
+ $people_id1,
+ G_CHILDHOOD_OF_TWO,
+ $people_id2,
+ G_DB_PEOPLE_ID,
+ $id_people);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $childhood = array(G_CHILDHOOD_OF_ONE => $people_id1, G_CHILDHOOD_OF_TWO => $people_id2);
}
if( !isset($childhood) ) {
@@ -99,13 +97,12 @@
// Get the fields
$fields = $this->configH[$this->name]['select']['list'];
-
// Format them
- $fields = implode($fields,'`,`');
+ $fields = implode('`,`',$fields);
// Get the ordering ones and format them
$fields_OrderBy = $this->configH[$this->name]['select']['orderby'];
- $fields_OrderBy = implode($fields_OrderBy,'`,`');
+ $fields_OrderBy = implode('`,`',$fields_OrderBy);
$query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` <> '%s' ORDER BY `%s` ASC",
$fields, // List of fields
@@ -163,4 +160,4 @@
return $to_return;
}
}
-?>
\ No newline at end of file
+?>