fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7789]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7789]
Date: Tue, 04 Oct 2011 06:11:45 +0000

Revision: 7789
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7789
Author:   erikhl
Date:     2011-10-04 06:11:43 +0000 (Tue, 04 Oct 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendar/inc/class.soactivity.inc.php
    trunk/activitycalendar/inc/class.soarena.inc.php
    trunk/activitycalendar/inc/class.socontactperson.inc.php
    trunk/activitycalendar/inc/class.soorganization.inc.php
    trunk/activitycalendar/inc/class.uiactivities.inc.php
    trunk/activitycalendar/inc/model/class.activity.inc.php
    trunk/activitycalendar/setup/setup.inc.php
    trunk/activitycalendar/setup/tables_update.inc.php
    trunk/activitycalendar/templates/base/activity.php
    trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
    trunk/activitycalendarfrontend/setup/setup.inc.php

Modified: trunk/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soactivity.inc.php 2011-10-03 12:46:33 UTC 
(rev 7788)
+++ trunk/activitycalendar/inc/class.soactivity.inc.php 2011-10-04 06:11:43 UTC 
(rev 7789)
@@ -198,6 +198,8 @@
                        $columns[] = 'activity.contact_person_2_zip';
                        $columns[] = 'activity.special_adaptation';
                        $columns[] = 'activity.secret';
+                       $columns[] = 'activity.frontend';
+                       $columns[] = 'activity.new_org';                        
                        
                        $cols = implode(',',$columns);
                }
@@ -268,7 +270,9 @@
                        'contact_person_2 = '          . 
$this->marshal($activity->get_contact_person_2(), 'int'),
                        'contact_person_2_address = '          . 
$this->marshal($activity->get_contact_person_2_address(), 'string'),
                        'contact_person_2_zip = '          . 
$this->marshal($activity->get_contact_person_2_zip(), 'string'),
-                       'special_adaptation = '                 
.($activity->get_special_adaptation() ? "true" : "false")
+                       'special_adaptation = '                 
.($activity->get_special_adaptation() ? "true" : "false"),
+                       'frontend = '                   
.($activity->get_frontend() ? "true" : "false"),
+                       'new_org = '                    
.($activity->get_new_org() ? "true" : "false")
                );
                
                //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
@@ -374,6 +378,8 @@
                        
$activity->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
                        
$activity->set_contact_person_2_address($this->unmarshal($this->db->f('contact_person_2_address'),
 'string'));
                        
$activity->set_contact_person_2_zip($this->unmarshal($this->db->f('contact_person_2_zip'),
 'string'));
+                       
$activity->set_frontend($this->unmarshal($this->db->f('frontend', 'bool')));
+                       
$activity->set_new_org($this->unmarshal($this->db->f('new_org', 'bool')));
                        
                        if($activity->get_group_id() && 
$activity->get_group_id() > 0)
                        {

Modified: trunk/activitycalendar/inc/class.soarena.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soarena.inc.php    2011-10-03 12:46:33 UTC 
(rev 7788)
+++ trunk/activitycalendar/inc/class.soarena.inc.php    2011-10-04 06:11:43 UTC 
(rev 7789)
@@ -187,7 +187,7 @@
        function get_buildings()
        {
                $buildings = array();
-       $q_buildings="SELECT id, name FROM bb_building WHERE active=1 ORDER BY 
id";
+       $q_buildings="SELECT id, name FROM bb_building WHERE active=1 ORDER BY 
name ASC";
        //var_dump($q_buildings);
                $this->db->query($q_buildings, __LINE__, __FILE__);
                while($this->db->next_record()){

Modified: trunk/activitycalendar/inc/class.socontactperson.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.socontactperson.inc.php    2011-10-03 
12:46:33 UTC (rev 7788)
+++ trunk/activitycalendar/inc/class.socontactperson.inc.php    2011-10-04 
06:11:43 UTC (rev 7789)
@@ -208,6 +208,20 @@
                return $result;
        }
        
+       function get_org_contact_name_local($id)
+       {
+               $result = "Ingen";
+       if(isset($id)){
+               $q1="SELECT name, phone, email FROM activity_contact_person 
WHERE id={$id}";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $result = $this->db->f('name') . "<br/>" . 
$this->db->f('phone') . "<br/>" . $this->db->f('email');
+                       }
+       }
+               return $result;
+       }
+       
+       
        function get_mailaddress_for_group_contact($contact_person_id)
        {
                if($contact_person_id){

Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php     2011-10-03 
12:46:33 UTC (rev 7788)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php     2011-10-04 
06:11:43 UTC (rev 7789)
@@ -42,10 +42,19 @@
                //Add columns to this array to include them in the query
                $columns = array();
 
-               if($sort_field != null) {
+               if($sort_field != null && !$return_count) {
+                       if($sort_field == 'identifier')
+                       {
+                               $sort_field = 'org.id';
+                       }
                        $dir = $ascending ? 'ASC' : 'DESC';
-                       $order = "ORDER BY id $dir";
+                       $order = "ORDER BY $sort_field $dir";
                }
+               else if(!$return_count)
+               {
+                       $dir = $ascending ? 'ASC' : 'DESC';
+                       $order = "ORDER BY org.id $dir";
+               }
                if($search_for)
                {
                        $query = $this->marshal($search_for,'string');
@@ -192,6 +201,20 @@
                return $result;
        }
        
+       function get_organization_name_local($org_id)
+       {
+               $result = "Ingen";
+       if(isset($org_id)){
+               $q1="SELECT name FROM activity_organization WHERE id={$org_id}";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $result = $this->db->f('name');
+                       }
+       }
+               
+               return $result;
+       }
+       
        function get_contacts($organization_id)
        {
                $contacts = array();
@@ -235,6 +258,19 @@
                return $desc;
        }
        
+       function get_description_local($organization_id)
+       {
+       if(isset($organization_id)){
+               $q1="SELECT description FROM activity_organization WHERE 
id={$organization_id}";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $desc = $this->db->f('description');
+                       }
+       }
+               return $desc;
+       }
+       
+       
        function get_district_from_name($name)
        {
                $this->db->query("SELECT part_of_town_id FROM fm_part_of_town 
where name like UPPER('%{$name}%') ", __LINE__, __FILE__);

Modified: trunk/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-10-03 
12:46:33 UTC (rev 7788)
+++ trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-10-04 
06:11:43 UTC (rev 7789)
@@ -97,6 +97,7 @@
                $activity_id = (int)phpgw::get_var('id');
                $so_activity = activitycalendar_soactivity::get_instance();
                $so_arena = activitycalendar_soarena::get_instance();
+               $so_org = activitycalendar_soorganization::get_instance();
                //var_dump($activity_id);
                
                $categories = $so_activity->get_categories();
@@ -123,11 +124,18 @@
                }
                else if(isset($o_id) && $o_id > 0)
                {
-                       $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
-                       $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
+                       $persons = $so_org->get_contacts($o_id);
+                       $desc = $so_org->get_description($o_id);
                }
                $arenas = $so_arena->get(null, null, null, null, null, null, 
null);
-               $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, null, null, 
null, null, null);
+               if($activity->get_new_org())
+               {
+                       $org_name = 
$so_org->get_organization_name_local($activity->get_organization_id());
+               }
+               else
+               {
+                       $organizations = $so_org->get(null, null, null, null, 
null, null, null);
+               }
                $groups = activitycalendar_sogroup::get_instance()->get(null, 
null, null, null, null, null, null);
 
                if(isset($_POST['save_activity'])) // The user has pressed the 
save button
@@ -197,6 +205,7 @@
                        (
                                'activity'      => $activity,
                                'organizations' => $organizations,
+                               'org_name' => $org_name,
                                'groups' => $groups,
                                'arenas' => $arenas,
                                'buildings' => $buildings,

Modified: trunk/activitycalendar/inc/model/class.activity.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.activity.inc.php     2011-10-03 
12:46:33 UTC (rev 7788)
+++ trunk/activitycalendar/inc/model/class.activity.inc.php     2011-10-04 
06:11:43 UTC (rev 7789)
@@ -30,6 +30,8 @@
                protected $special_adaptation;
                protected $secret;
                protected $internal_arena;
+               protected $frontend;
+               protected $new_org;
                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -213,6 +215,20 @@
                
                public function get_internal_arena() { return 
$this->internal_arena; }
                
+               public function set_frontend(bool $frontend)
+               {
+                       $this->frontend = (bool)$frontend;
+               }
+               
+               public function get_frontend() { return $this->frontend; }
+               
+               public function set_new_org(bool $new_org)
+               {
+                       $this->new_org = (bool)$new_org;
+               }
+               
+               public function get_new_org() { return $this->new_org; }
+               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 
@@ -232,9 +248,20 @@
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        if(isset($this->organization_id) && 
$this->get_organization_id() > 0)
                        {
-                               $contact_1 = 
activitycalendar_socontactperson::get_instance()->get_org_contact_name($this->get_contact_person_1());
-                               $contact_2 = 
activitycalendar_socontactperson::get_instance()->get_org_contact_name($this->get_contact_person_2());
-                               $desc = 
activitycalendar_soorganization::get_instance()->get_description($this->get_organization_id());
+                               if($this->get_new_org())
+                               {
+                                       $org_name = 
activitycalendar_soorganization::get_instance()->get_organization_name_local($this->get_organization_id());
+                                       $contact_1 = 
activitycalendar_socontactperson::get_instance()->get_org_contact_name_local($this->get_contact_person_1());
+                                       $contact_2 = 
activitycalendar_socontactperson::get_instance()->get_org_contact_name_local($this->get_contact_person_2());
+                                       $desc = 
activitycalendar_soorganization::get_instance()->get_description_local($this->get_organization_id());
+                               }
+                               else
+                               {
+                                       $org_name = 
activitycalendar_soorganization::get_instance()->get_organization_name($this->get_organization_id());
+                                       $contact_1 = 
activitycalendar_socontactperson::get_instance()->get_org_contact_name($this->get_contact_person_1());
+                                       $contact_2 = 
activitycalendar_socontactperson::get_instance()->get_org_contact_name($this->get_contact_person_2());
+                                       $desc = 
activitycalendar_soorganization::get_instance()->get_description($this->get_organization_id());
+                               }
                        }
                        else if(isset($this->group_id) && $this->get_group_id() 
> 0)
                        {
@@ -256,10 +283,11 @@
                        {
                                $arena_name = 
activitycalendar_soarena::get_instance()->get_arena_name($this->get_arena());
                        }
+                       
                        return array(
                                'id' => $this->get_id(),
                                'title' => $this->get_title(),
-                               'organization_id' => 
activitycalendar_soorganization::get_instance()->get_organization_name($this->get_organization_id()),
+                               'organization_id' => $org_name,
                                'group_id' => 
activitycalendar_sogroup::get_instance()->get_group_name($this->get_group_id()),
                                'district' => 
activitycalendar_soactivity::get_instance()->get_district_name($this->get_district()),
                                'office' => 
activitycalendar_soactivity::get_instance()->get_office_name($this->get_office()),
@@ -271,7 +299,8 @@
                                'contact_person_1' => $contact_1,
                                'contact_person_2' => $contact_2,
                                'special_adaptation' => 
$this->get_special_adaptation(),
-                               'last_change_date' => 
$this->get_last_change_date()!=NULL?date($date_format, 
$this->get_last_change_date()):''
+                               'last_change_date' => 
$this->get_last_change_date()!=NULL?date($date_format, 
$this->get_last_change_date()):'',
+                               'frontend' => $this->get_frontend()
                        );
                }
        }

Modified: trunk/activitycalendar/setup/setup.inc.php
===================================================================
--- trunk/activitycalendar/setup/setup.inc.php  2011-10-03 12:46:33 UTC (rev 
7788)
+++ trunk/activitycalendar/setup/setup.inc.php  2011-10-04 06:11:43 UTC (rev 
7789)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['activitycalendar']['name'] = 'activitycalendar';
-       $setup_info['activitycalendar']['version'] = '0.1.5';
+       $setup_info['activitycalendar']['version'] = '0.1.7';
        $setup_info['activitycalendar']['app_order'] = 60;
        $setup_info['activitycalendar']['enable'] = 1;
        $setup_info['activitycalendar']['app_group']    = 'office';

Modified: trunk/activitycalendar/setup/tables_update.inc.php
===================================================================
--- trunk/activitycalendar/setup/tables_update.inc.php  2011-10-03 12:46:33 UTC 
(rev 7788)
+++ trunk/activitycalendar/setup/tables_update.inc.php  2011-10-04 06:11:43 UTC 
(rev 7789)
@@ -131,4 +131,29 @@
                $GLOBALS['setup_info']['activitycalendar']['currentver'] = 
'0.1.5';
                return $GLOBALS['setup_info']['activitycalendar']['currentver'];
        }
+       
+       $test[] = '0.1.5';
+       function activitycalendar_upgrade0_1_5()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('activity_activity','frontend',array(
+                       'type' => 'bool',
+                       'default' => 'false'
+               ));
+               
+               $GLOBALS['setup_info']['activitycalendar']['currentver'] = 
'0.1.6';
+               return $GLOBALS['setup_info']['activitycalendar']['currentver'];
+       }
+       
+       $test[] = '0.1.6';
+       function activitycalendar_upgrade0_1_6()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('activity_activity','new_org',array(
+                       'type' => 'bool',
+                       'default' => 'false',
+               ));
+               
+               $GLOBALS['setup_info']['activitycalendar']['currentver'] = 
'0.1.7';
+               return $GLOBALS['setup_info']['activitycalendar']['currentver'];
+       }
+       
 ?>

Modified: trunk/activitycalendar/templates/base/activity.php
===================================================================
--- trunk/activitycalendar/templates/base/activity.php  2011-10-03 12:46:33 UTC 
(rev 7788)
+++ trunk/activitycalendar/templates/base/activity.php  2011-10-04 06:11:43 UTC 
(rev 7789)
@@ -75,17 +75,24 @@
                                        $current_organization_id = 
$activity->get_organization_id();
                                        if ($editable)
                                        {
+                                               if($activity->get_new_org())
+                                               {
+                                                       echo $org_name;
+                                               }
+                                               else
+                                               {
                                                ?>
                                                <select name="organization_id" 
id="organization_id" onchange="javascript:get_available_groups();">
                                                        <option value="">Ingen 
organisasjon valgt</option>
                                                        <?php
-                                                       foreach($organizations 
as $organization)
-                                                       {
-                                                               echo "<option 
".($current_organization_id == $organization->get_id() ? 'selected="selected"' 
: "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
-                                                       }
-                                                       ?>
+                                                               
foreach($organizations as $organization)
+                                                               {
+                                                                       echo 
"<option ".($current_organization_id == $organization->get_id() ? 
'selected="selected"' : "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
+                                                               }
+                                                               ?>
                                                </select>
                                                <?php
+                                               }
                                        ?>
                                        <?php
                                        }

Modified: trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-10-03 
12:46:33 UTC (rev 7788)
+++ trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-10-04 
06:11:43 UTC (rev 7789)
@@ -82,8 +82,8 @@
                        $offices = $so_activity->select_district_list();
                        $districts = $so_activity->get_districts();
                        $buildings = $so_arena->get_buildings();
-                       $arenas = $so_arena->get(null, null, null, null, null, 
null, null);
-                       $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, null, null, 
null, null, null);
+                       $arenas = $so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
+                       $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, 'org.name', 
true, null, null, null);
                        $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, null);
                        
                        // Retrieve the activity object or create a new one
@@ -123,6 +123,7 @@
                        {
                                if($o_id == "new_org")
                                {
+                                       $activity->set_new_org(true);
                                        //add new organization to internal 
activitycalendar organization register
                                        $org_info['name'] = 
phpgw::get_var('orgname');
                                        $org_info['orgnr'] = 
phpgw::get_var('orgno');
@@ -210,6 +211,7 @@
                                        $activity->set_organization_id($o_id);
                                        $activity->set_group_id($g_id);
                                        
$activity->set_arena(phpgw::get_var('arena_id'));
+                                       
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
                                        $district_array = 
phpgw::get_var('district');
                                        $activity->set_district(implode(",", 
$district_array));
                                        
$activity->set_office(phpgw::get_var('office'));
@@ -230,6 +232,7 @@
                                        
$activity->set_time(phpgw::get_var('time'));
                                        
$activity->set_contact_persons($persons);
                                        
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
+                                       $activity->set_frontend(true);
                                        
 //                                     var_dump("storing"); 
                                        

Modified: trunk/activitycalendarfrontend/setup/setup.inc.php
===================================================================
--- trunk/activitycalendarfrontend/setup/setup.inc.php  2011-10-03 12:46:33 UTC 
(rev 7788)
+++ trunk/activitycalendarfrontend/setup/setup.inc.php  2011-10-04 06:11:43 UTC 
(rev 7789)
@@ -31,7 +31,7 @@
        
        $setup_info['activitycalendarfrontend']['depends'][] = array(
                'appname' => 'activitycalendar',
-               'versions' => Array('0.1.3','0.1.4','0.1.5')
+               'versions' => Array('0.1.3','0.1.4','0.1.5','0.1.6','0.1.7')
        );
 
        /* The hooks this app includes, needed for hooks registration */




reply via email to

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