fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16776] more on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [16776] more on eventplanner
Date: Tue, 23 May 2017 09:00:15 -0400 (EDT)

Revision: 16776
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16776
Author:   sigurdne
Date:     2017-05-23 09:00:15 -0400 (Tue, 23 May 2017)
Log Message:
-----------
more on eventplanner

Modified Paths:
--------------
    trunk/eventplanner/inc/class.bobooking.inc.php
    trunk/eventplanner/inc/class.sovendor.inc.php
    trunk/eventplanner/inc/model/class.booking.inc.php
    trunk/eventplanner/inc/model/class.vendor.inc.php

Modified: trunk/eventplanner/inc/class.bobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bobooking.inc.php      2017-05-23 07:05:58 UTC 
(rev 16775)
+++ trunk/eventplanner/inc/class.bobooking.inc.php      2017-05-23 13:00:15 UTC 
(rev 16776)
@@ -100,12 +100,11 @@
                        $customer_contact_phone = 
$booking->customer_contact_phone;
                        $location = $booking->location;
 
-                       $from_ = 
$GLOBALS['phpgw']->common->show_date($booking->from_);
-                       $to_ = 
$GLOBALS['phpgw']->common->show_date($booking->to_);
-
-
                        $calendar_id = $booking->calendar_id;
                        $calendar = 
createObject('eventplanner.bocalendar')->read_single($calendar_id, true, 
$relaxe_acl = true);
+                       $from_ = 
$GLOBALS['phpgw']->common->show_date($calendar->from_);
+                       $to_ = 
$GLOBALS['phpgw']->common->show_date($calendar->to_);
+
                        $application = 
createObject('eventplanner.boapplication')->read_single($calendar->application_id,
 true, $relaxe_acl = true);
 //                     _debug_array($application);
 //                     _debug_array($application);
@@ -286,7 +285,9 @@
                                phpgwapi_cache::message_set($e->getMessage(), 
'error');
                        }
 
-                       return$rcpt;
+                       phpgwapi_cache::message_set("Email: $to_email, $cc", 
'message');
+
+                       return $rcpt;
                }
 
                public function read( $params )

Modified: trunk/eventplanner/inc/class.sovendor.inc.php
===================================================================
--- trunk/eventplanner/inc/class.sovendor.inc.php       2017-05-23 07:05:58 UTC 
(rev 16775)
+++ trunk/eventplanner/inc/class.sovendor.inc.php       2017-05-23 13:00:15 UTC 
(rev 16776)
@@ -115,7 +115,7 @@
                        return  $this->db->transaction_commit();
                }
 
-               function check_duplicate_organization($organization_number = 
false)
+               function check_duplicate_organization($organization_number = 
false, $vendor_id = 0)
                {
                        if(!$organization_number)
                        {
@@ -124,6 +124,11 @@
 
                        $query = $this->db->db_addslashes($organization_number);
                        $sql = "SELECT name FROM eventplanner_vendor WHERE 
organization_number = '{$query}'";
+                       if($vendor_id)
+                       {
+                               $sql .= ' AND id !=' . (int)$vendor_id;
+                       }
+
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();       
                        return $this->db->f('name', true);

Modified: trunk/eventplanner/inc/model/class.booking.inc.php
===================================================================
--- trunk/eventplanner/inc/model/class.booking.inc.php  2017-05-23 07:05:58 UTC 
(rev 16775)
+++ trunk/eventplanner/inc/model/class.booking.inc.php  2017-05-23 13:00:15 UTC 
(rev 16776)
@@ -290,12 +290,6 @@
 
                protected function doValidate( $entity, &$errors )
                {
-                       $params = array();
-                       $params['filters']['active'] = 1;
-                       $params['filters']['customer_id'] = 
$entity->customer_id;
-
-                       $bookings = 
eventplanner_sobooking::get_instance()->read($params);
-
                        $orig_customer_id = 0;
                        if ($entity->get_id())
                        {
@@ -319,11 +313,20 @@
 
                                $customer = 
createObject('eventplanner.bocustomer')->read_single($entity->customer_id);
                                $max_events = (int)$customer->max_events;
+
+                               $params = array();
+                               $params['filters']['active'] = 1;
+                               $params['filters']['customer_id'] = 
$entity->customer_id;
+                               $bookings = 
eventplanner_sobooking::get_instance()->read($params);
+
+                               $calendar_id = $entity->calendar_id;
+                               $calendar = 
createObject('eventplanner.bocalendar')->read_single($calendar_id, true, 
$relaxe_acl = true);
+
                                foreach ($bookings['results'] as $booking)
                                {
                                        $booking_year = date('Y', 
$booking['from_']);
 
-                                       if ($booking_year != date('Y', 
$entity->from_))
+                                       if ($booking_year != date('Y', 
$calendar->from_))
                                        {
                                                continue;
                                        }
@@ -330,7 +333,7 @@
                                        $test_total_tecords ++;
                                }
 
-                               if ($entity->customer_id || 
$entity->process_update) // update
+                               if ($entity->get_id() || 
$entity->process_update) // update
                                {
                                }
                                else // new entry

Modified: trunk/eventplanner/inc/model/class.vendor.inc.php
===================================================================
--- trunk/eventplanner/inc/model/class.vendor.inc.php   2017-05-23 07:05:58 UTC 
(rev 16775)
+++ trunk/eventplanner/inc/model/class.vendor.inc.php   2017-05-23 13:00:15 UTC 
(rev 16776)
@@ -267,7 +267,7 @@
                protected function doValidate( $entity, &$errors )
                {
                        $organization_number = $entity->organization_number;
-                       $duplicate_name = 
eventplanner_sovendor::get_instance()->check_duplicate_organization($organization_number);
+                       $duplicate_name = 
eventplanner_sovendor::get_instance()->check_duplicate_organization($organization_number,
 $entity->get_id());
                        if ($duplicate_name)
                        {
                                $errors['organization_number'] = 
lang('organization number already exists for %1', $duplicate_name);




reply via email to

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