fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15421] rental: more on application


From: sigurdne
Subject: [Fmsystem-commits] [15421] rental: more on application
Date: Thu, 4 Aug 2016 13:53:26 +0000 (UTC)

Revision: 15421
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15421
Author:   sigurdne
Date:     2016-08-04 13:53:25 +0000 (Thu, 04 Aug 2016)
Log Message:
-----------
rental: more on application

Modified Paths:
--------------
    trunk/rental/inc/class.uiapplication.inc.php
    trunk/rental/inc/model/class.application.inc.php
    trunk/rental/templates/base/application.xsl

Modified: trunk/rental/inc/class.uiapplication.inc.php
===================================================================
--- trunk/rental/inc/class.uiapplication.inc.php        2016-08-04 13:52:33 UTC 
(rev 15420)
+++ trunk/rental/inc/class.uiapplication.inc.php        2016-08-04 13:53:25 UTC 
(rev 15421)
@@ -28,6 +28,7 @@
         */
        phpgw::import_class('rental.uicommon');
        phpgw::import_class('rental.soapplication');
+       phpgw::import_class('phpgwapi.datetime');
 
        include_class('rental', 'application', 'inc/model/');
 
@@ -239,7 +240,6 @@
                                phpgw::no_access();
                        }
 
-                       $responsibility_id = 
phpgw::get_var('responsibility_id');
                        $application_id = phpgw::get_var('id', 'int');
 
                        if (!empty($values['application_id']))
@@ -247,18 +247,25 @@
                                $application_id = $values['application_id'];
                        }
 
-                       if (!empty($application_id))
+                       if ($application_id)
                        {
                                $application = 
rental_application::get($application_id);
                        }
                        else
                        {
-                               $title = phpgw::get_var('application_title');
+                               if (!empty($values['application']))
+                               {
+                                       $application = $values['application'];
+                               }
+                               else
+                               {
+                                       $title = 
phpgw::get_var('application_title');
+                                       $application = new rental_application();
+                                       $application->set_title($title);
+       //                              
$application->set_responsibility_id($responsibility_id);
+       //                              $application->set_price_type_id(1); // 
defaults to year
 
-                               $application = new rental_application();
-                               $application->set_title($title);
-//                             
$application->set_responsibility_id($responsibility_id);
-//                             $application->set_price_type_id(1); // defaults 
to year
+                               }
                        }
 
                        //              $responsibility_title = 
($application->get_responsibility_title()) ? 
$application->get_responsibility_title() : 
rental_socontract::get_instance()->get_responsibility_title($responsibility_id);
@@ -317,8 +324,8 @@
                                ),
                                'district_list' => array('options' => 
$bocommon->select_district_list('', $application->get_district_id())),
                                'composite_type_list' => array('options' => 
$bocommon->select_list($application->get_composite_type(), $composite_type)),
-                               'value_date_start' => 
$GLOBALS['phpgw']->common->show_date($application->get_start_date(), 
$this->dateFormat),
-                               'value_date_end' => 
$GLOBALS['phpgw']->common->show_date($application->get_end_date(), 
$this->dateFormat),
+                               'value_date_start' => 
$GLOBALS['phpgw']->common->show_date($application->get_date_start(), 
$this->dateFormat),
+                               'value_date_end' => 
$GLOBALS['phpgw']->common->show_date($application->get_date_end(), 
$this->dateFormat),
                                'value_cleaning' => 
$application->get_cleaning(),
                                'payment_method_list' => array('options' => 
$bocommon->select_list($application->get_payment_method(), $payment_method)),
                                'value_application_id' => 
$application->get_id(),
@@ -367,47 +374,75 @@
                        _debug_array($_POST);
                        $application_id = phpgw::get_var('id', 'int');
 
-                       if (!empty($application_id))
+                       if ($application_id)
                        {
                                $application = 
rental_application::get($application_id);
                        }
                        else
                        {
-                               $title = phpgw::get_var('application_title');
-                               $responsibility_id = 
phpgw::get_var('responsibility_id');
                                $application = new rental_application();
-                               $application->set_title($title);
-                               
$application->set_responsibility_id($responsibility_id);
-                               $application->set_price_type_id(1); // defaults 
to year
                        }
 
+                       $application->set_ecodimb(phpgw::get_var('ecodimb', 
'int'));
+                       
$application->set_district_id(phpgw::get_var('district_id', 'int'));
+                       
$application->set_composite_type(phpgw::get_var('composite_type_id', 'int'));
+                       $date_start = 
phpgwapi_datetime::date_to_timestamp(phpgw::get_var('date_start', 'string'));
+                       $application->set_date_start($date_start);
+                       $date_end = 
phpgwapi_datetime::date_to_timestamp(phpgw::get_var('date_end', 'string'));
+                       $application->set_date_start($date_end);
+
+                       $application->set_cleaning(phpgw::get_var('cleaning', 
'bool'));
+                       
$application->set_payment_method(phpgw::get_var('payment_method', 'int'));
+                       
$application->set_identifier(phpgw::get_var('identifier'));
+                       
$application->set_firstname(phpgw::get_var('firstname'));
+                       $application->set_lastname(phpgw::get_var('lastname'));
                        $application->set_title(phpgw::get_var('title'));
-                       
$application->set_agresso_id(phpgw::get_var('agresso_id'));
-                       $application->set_is_area(phpgw::get_var('is_area') == 
'true' ? true : false);
-                       
$application->set_is_inactive(phpgw::get_var('is_inactive') == 'on' ? true : 
false);
-                       
$application->set_is_adjustable(phpgw::get_var('is_adjustable') == 'on' ? true 
: false);
-                       $application->set_standard(phpgw::get_var('standard') 
== 'on' ? true : false);
-                       $application->set_price(phpgw::get_var('price'));
-                       
$application->set_price_type_id(phpgw::get_var('price_type_id', 'int'));
-                       if ($application->get_agresso_id() == null)
+                       
$application->set_company_name(phpgw::get_var('company_name'));
+                       
$application->set_department(phpgw::get_var('department'));
+                       $application->set_address1(phpgw::get_var('address1'));
+                       $application->set_address2(phpgw::get_var('address2'));
+                       
$application->set_postal_code(phpgw::get_var('postal_code'));
+                       $application->set_place(phpgw::get_var('place'));
+                       
$application->set_account_number(phpgw::get_var('account_number'));
+                       $application->set_phone(phpgw::get_var('phone'));
+                       $application->set_email(phpgw::get_var('email'));
+                       
$application->set_unit_leader(phpgw::get_var('unit_leader'));
+                       $application->set_comment(phpgw::get_var('comment'));
+                       
$application->set_assign_date_start(phpgw::get_var('assign_date_start'));
+                       
$application->set_assign_date_end(phpgw::get_var('assign_date_end'));
+                       $application->set_status(phpgw::get_var('status'));
+
+
+                       if(self::_validate($application))
                        {
-                               
phpgwapi_cache::message_set(lang('missing_agresso_id'), 'error');
-                       }
-                       else
-                       {
                                if 
(rental_soapplication::get_instance()->store($application))
                                {
                                        
phpgwapi_cache::message_set(lang('messages_saved_form'), 'message');
-                                       $application_id = 
$application->get_id();
+                                       self::redirect(array(
+                                               'menuaction' => 
'rental.uiapplication.edit',
+                                               'id'            => 
$application->get_id()
+                                               )
+                                       );
                                }
                                else
                                {
                                        
phpgwapi_cache::message_set(lang('messages_form_error'), 'error');
+
                                }
                        }
-                       $this->edit(array('application_id' => $application_id));
+                       $this->edit(array(
+                               'id'    =>$application->get_id(),
+                               'application'   => $application
+                               )
+                       );
                }
 
+
+               private function _validate( $application )
+               {
+                       return true;
+               }
+               
                public function set_value()
                {
                        if (!self::isExecutiveOfficer())

Modified: trunk/rental/inc/model/class.application.inc.php
===================================================================
--- trunk/rental/inc/model/class.application.inc.php    2016-08-04 13:52:33 UTC 
(rev 15420)
+++ trunk/rental/inc/model/class.application.inc.php    2016-08-04 13:53:25 UTC 
(rev 15421)
@@ -40,31 +40,37 @@
                protected $ecodimb;
                protected $district_id;
                protected $composite_type;
-               protected $start_date;
-               protected $end_date;
+               protected $date_start;
+               protected $date_end;
                protected $cleaning;
                protected $payment_method;
                protected $title;
                protected $description;
-               protected $name;
+               protected $firstname;
+               protected $lastname;
+               protected $company_name;
+               protected $department;
+               protected $address1;
+               protected $address2;
+               protected $postal_code;
+               protected $place;
+               protected $account_number;
+               protected $phone;
+               protected $email;
+               protected $unit_leader;
+               protected $comment;
+               protected $assign_date_start;
+               protected $assign_date_end;
+
                protected $type;
                protected $type_id;
-               protected $contract_id;
                protected $party_id;
+               protected $identifier;
 
                public function __construct( int $id = null )
                {
                        parent::__construct((int)$id);
                }
-               public function set_status( $status )
-               {
-                       $this->ecodimb = $status;
-               }
-
-               public function get_status()
-               {
-                       return $this->status;
-               }
                public function set_ecodimb( $ecodimb )
                {
                        $this->ecodimb = $ecodimb;
@@ -93,22 +99,22 @@
                {
                        return $this->composite_type;
                }
-               public function set_start_date( $start_date )
+               public function set_date_start( $start_date )
                {
-                       $this->start_date = $start_date;
+                       $this->date_start = $start_date;
                }
 
-               public function get_start_date()
+               public function get_date_start()
                {
                        return $this->start_date;
                }
-               public function set_end_date( $end_date )
+               public function set_date_end( $date_end )
                {
-                       $this->end_date = $end_date;
+                       $this->date_end = $date_end;
                }
-               public function get_end_date()
+               public function get_date_end()
                {
-                       return $this->end_date;
+                       return $this->date_end;
                }
 
                public function set_cleaning( $cleaning )
@@ -141,6 +147,16 @@
                        return $this->title;
                }
 
+               public function set_identifier( $identifier )
+               {
+                       $this->identifier = $identifier;
+               }
+
+               public function get_identifier()
+               {
+                       return $this->identifier;
+               }
+
                public function set_description( $description )
                {
                        $this->description = $description;
@@ -151,16 +167,163 @@
                        return $this->description;
                }
 
-               public function set_name( $name )
+               public function set_firstname( $firstname )
                {
-                       $this->name = $name;
+                       $this->firstname = $firstname;
                }
 
-               public function get_name()
+               public function get_firstname()
                {
-                       return $this->name;
+                       return $this->firstname;
                }
 
+               public function set_lastname( $lastname )
+               {
+                       $this->lastname = $lastname;
+               }
+
+               public function get_lastname()
+               {
+                       return $this->lastname;
+               }
+
+
+               public function set_company_name( $company_name )
+               {
+                       $this->company_name = $company_name;
+               }
+
+               public function get_company_name()
+               {
+                       return $this->company_name;
+               }
+               public function set_department( $department )
+               {
+                       $this->department = $department;
+               }
+
+               public function get_department()
+               {
+                       return $this->department;
+               }
+
+               public function set_address1( $address1 )
+               {
+                       $this->address1 = $address1;
+               }
+
+               public function get_address1()
+               {
+                       return $this->address1;
+               }
+
+               public function set_address2( $address2 )
+               {
+                       $this->address2 = $address2;
+               }
+
+               public function get_address2()
+               {
+                       return $this->address2;
+               }
+
+               public function set_postal_code( $postal_code )
+               {
+                       $this->postal_code = $postal_code;
+               }
+
+               public function get_postal_code()
+               {
+                       return $this->postal_code;
+               }
+
+               public function set_place( $place )
+               {
+                       $this->place = $place;
+               }
+
+               public function get_place()
+               {
+                       return $this->place;
+               }
+
+               public function set_account_number( $account_number )
+               {
+                       $this->account_number = $account_number;
+               }
+
+               public function get_account_number()
+               {
+                       return $this->account_number;
+               }
+
+               public function set_phone( $phone )
+               {
+                       $this->phone = $phone;
+               }
+
+               public function get_phone()
+               {
+                       return $this->phone;
+               }
+
+               public function set_email( $email )
+               {
+                       $this->email = $email;
+               }
+
+               public function get_email()
+               {
+                       return $this->email;
+               }
+
+               public function set_unit_leader( $unit_leader )
+               {
+                       $this->unit_leader = $unit_leader;
+               }
+
+               public function get_unit_leader()
+               {
+                       return $this->unit_leader;
+               }
+
+               public function set_comment( $comment )
+               {
+                       $this->comment = $comment;
+               }
+
+               public function get_comment()
+               {
+                       return $this->comment;
+               }
+
+               public function set_assign_date_start( $assign_date_start )
+               {
+                       $this->assign_date_start = $assign_date_start;
+               }
+
+               public function get_assign_date_start()
+               {
+                       return $this->assign_date_start;
+               }
+               public function set_assign_date_end( $assign_date_end )
+               {
+                       $this->assign_date_end = $assign_date_end;
+               }
+
+               public function get_assign_date_end()
+               {
+                       return $this->assign_date_end;
+               }
+               public function set_status( $status )
+               {
+                       $this->status = $status;
+               }
+
+               public function get_status()
+               {
+                       return $this->status;
+               }
                public function set_type( $type )
                {
                        $this->type = $type;
@@ -181,16 +344,6 @@
                        return $this->type_id;
                }
 
-               public function set_contract_id( $contract_id )
-               {
-                       $this->contract_id = $contract_id;
-               }
-
-               public function get_contract_id()
-               {
-                       return $this->contract_id;
-               }
-
                public function set_party_id( $party_id )
                {
                        $this->party_id = $party_id;

Modified: trunk/rental/templates/base/application.xsl
===================================================================
--- trunk/rental/templates/base/application.xsl 2016-08-04 13:52:33 UTC (rev 
15420)
+++ trunk/rental/templates/base/application.xsl 2016-08-04 13:53:25 UTC (rev 
15421)
@@ -324,12 +324,12 @@
                                                                <xsl:value-of 
select="$lang_date_start"/>
                                                        </label>
                                                        <input type="text" 
id="assign_date_start" name="assign_date_start" size="10" 
value="{value_assign_date_start}" readonly="readonly">
-                                                               <xsl:attribute 
name="data-validation">
+                                                               
<!--xsl:attribute name="data-validation">
                                                                        
<xsl:text>required</xsl:text>
                                                                </xsl:attribute>
                                                                <xsl:attribute 
name="data-validation-error-msg">
                                                                        
<xsl:value-of select="$lang_date_start"/>
-                                                               </xsl:attribute>
+                                                               
</xsl:attribute-->
 
                                                        </input>
                                                </div>
@@ -341,12 +341,12 @@
                                                                <xsl:value-of 
select="$lang_date_end"/>
                                                        </label>
                                                        <input type="text" 
id="assign_date_end" name="assign_date_end" size="10" 
value="{value_assign_date_end}" readonly="readonly">
-                                                               <xsl:attribute 
name="data-validation">
+                                                               
<!--xsl:attribute name="data-validation">
                                                                        
<xsl:text>required</xsl:text>
                                                                </xsl:attribute>
                                                                <xsl:attribute 
name="data-validation-error-msg">
                                                                        
<xsl:value-of select="$lang_date_end"/>
-                                                               </xsl:attribute>
+                                                               
</xsl:attribute-->
 
                                                        </input>
                                                </div>
@@ -361,12 +361,12 @@
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="$lang_status"/>
                                                                </xsl:attribute>
-                                                               <xsl:attribute 
name="data-validation">
+                                                               
<!--xsl:attribute name="data-validation">
                                                                        
<xsl:text>required</xsl:text>
                                                                </xsl:attribute>
                                                                <xsl:attribute 
name="data-validation-error-msg">
                                                                        
<xsl:value-of select="$lang_status"/>
-                                                               </xsl:attribute>
+                                                               
</xsl:attribute-->
                                                                <option 
value="">
                                                                        
<xsl:value-of select="$lang_status"/>
                                                                </option>




reply via email to

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