civicrmだけに発見: .DS_Store
/home/peterh/temp/civicrm/CRMだけに発見: Auction
diff -u -r /home/peterh/temp/civicrm/CRM/Contribute/BAO/ContributionPage.php civicrm/CRM/Contribute/BAO/ContributionPage.php
--- /home/peterh/temp/civicrm/CRM/Contribute/BAO/ContributionPage.php	2011-06-10 08:08:57.000000000 -0700
+++ civicrm/CRM/Contribute/BAO/ContributionPage.php	2011-08-23 13:37:24.570142578 -0700
@@ -287,7 +287,6 @@
                 'contactId'   => $contactID,
                 'tplParams'   => $tplParams,
                 'isTest'      => $isTest,
-            	'PDFFilename' => 'receipt.pdf',
             );
 
             require_once 'CRM/Core/BAO/MessageTemplates.php';
diff -u -r /home/peterh/temp/civicrm/CRM/Contribute/BAO/Query.php civicrm/CRM/Contribute/BAO/Query.php
--- /home/peterh/temp/civicrm/CRM/Contribute/BAO/Query.php	2011-05-25 13:11:34.000000000 -0700
+++ civicrm/CRM/Contribute/BAO/Query.php	2011-08-23 13:37:24.570142578 -0700
@@ -322,8 +322,8 @@
         
         case 'contribution_trxn_id':
         case 'contribution_transaction_id':
-            $wc = ( $op != 'LIKE' ) ? "LOWER(civicrm_contribution.trxn_id)" : "civicrm_contribution.trxn_id";
-            $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause( $wc, $op, $value, "String" ) ;
+			$wc = ( $op != 'LIKE' ) ? "LOWER(civicrm_contribution.trxn_id)" : "LOWER(civicrm_contribution.trxn_id)";
+			$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause( $wc, "LIKE", "$value%", "String" ) ;
             $query->_qill[$grouping][]  = ts( 'Transaction ID %1 %2', array( 1 => $op, 2 => $quoteValue ) );
             $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
             return;
diff -u -r /home/peterh/temp/civicrm/CRM/Contribute/Form/Contribution/Confirm.php civicrm/CRM/Contribute/Form/Contribution/Confirm.php
--- /home/peterh/temp/civicrm/CRM/Contribute/Form/Contribution/Confirm.php	2011-06-17 05:59:15.000000000 -0700
+++ civicrm/CRM/Contribute/Form/Contribution/Confirm.php	2011-08-23 13:37:24.570142578 -0700
@@ -350,7 +350,10 @@
                 $this->assign( 'button', 'Continue' );
             } else {
                 $contribButton = ts('Make Contribution');
-                $this->assign( 'button', 'Make Contribution' );
+		if ($this->_membershipBlock) {
+		    $contribButton = ts('Submit Membership');
+		}
+                $this->assign( 'button', $contribButton );
             }
             $this->addButtons(array(
                                     array ( 'type'      => 'next',
diff -u -r /home/peterh/temp/civicrm/CRM/Contribute/Form/Contribution/Main.php civicrm/CRM/Contribute/Form/Contribution/Main.php
--- /home/peterh/temp/civicrm/CRM/Contribute/Form/Contribution/Main.php	2011-06-22 23:12:34.000000000 -0700
+++ civicrm/CRM/Contribute/Form/Contribution/Main.php	2011-08-23 13:37:24.570142578 -0700
@@ -318,6 +318,8 @@
         $this->applyFilter('__ALL__', 'trim');
         $this->add( 'text', "email-{$this->_bltID}",
                     ts( 'Email Address' ), array( 'size' => 30, 'maxlength' => 60 ), true );
+        $this->add( 'text', "conf_email-{$this->_bltID}",
+                    ts( 'Confirm Email Address' ), array( 'size' => 30, 'maxlength' => 60 ), true );
         $this->addRule( "email-{$this->_bltID}", ts('Email is not valid.'), 'email' );
                 
         //build pledge block.
@@ -442,9 +444,13 @@
         
         if ( !( $this->_paymentProcessor['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON &&
                 !$this->_values['is_pay_later'] ) ) {
+	    $buttonName = ts('Confirm Contribution');
+	    if ( $this->_membershipBlock ) {
+		$buttonName = ts('Confirm Membership');
+	    }
             $this->addButtons(array( 
                                     array ( 'type'      => 'upload',
-                                            'name'      => ts('Confirm Contribution'), 
+                                            'name'      => $buttonName,
                                             'spacing'   => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 
                                             'isDefault' => true   ), 
                                     ) 
@@ -925,6 +931,12 @@
                 }
             }
         }
+
+        if ( isset( $fields["email-{$self->_bltID}"] ) &&
+             ($fields["conf_email-{$self->_bltID}"] != $fields["email-{$self->_bltID}"]) )
+        {
+            $errors["conf_email-{$self->_bltID}"] = ts('Email does not match.');
+        }
         
         return empty( $errors ) ? true : $errors;
     }
diff -u -r /home/peterh/temp/civicrm/CRM/Contribute/Form/Contribution.php civicrm/CRM/Contribute/Form/Contribution.php
--- /home/peterh/temp/civicrm/CRM/Contribute/Form/Contribution.php	2011-04-29 08:20:45.000000000 -0700
+++ civicrm/CRM/Contribute/Form/Contribution.php	2011-08-23 13:37:24.570142578 -0700
@@ -1564,7 +1564,9 @@
             CRM_Core_Session::setStatus( $statusMsg, false );
             //Offline Contribution ends.
         }
-        
+
+	$this->_id = $contribution->id;
+
         $buttonName = $this->controller->getButtonName( );
         if ( $this->_context == 'standalone' ) {
             if ( $buttonName == $this->getButtonName( 'upload', 'new' ) ) {
diff -u -r /home/peterh/temp/civicrm/CRM/Core/BAO/CMSUser.php civicrm/CRM/Core/BAO/CMSUser.php
--- /home/peterh/temp/civicrm/CRM/Core/BAO/CMSUser.php	2011-06-22 22:30:51.000000000 -0700
+++ civicrm/CRM/Core/BAO/CMSUser.php	2011-08-23 13:37:24.590142677 -0700
@@ -489,6 +489,7 @@
         $form_state['values']  = array (
                                     'name' => $params['cms_name'],
                                     'mail' => $params[$mail],
+                                    'conf_mail' => $params["conf_{$mail}"],
                                     'op'   => 'Create new account'
                                     );
         if ( !variable_get('user_email_verification', TRUE )) {
@@ -505,8 +506,16 @@
         $form['#post'] = $form_state['values'];
         drupal_prepare_form('user_register', $form, $form_state);
 
+<<<<<<< HEAD
+        if ($params['robots'] && function_exists('captcha_validate'))
+        {
+            // remove the captcha element from the form prior to processing
+            unset($form['captcha']);
+        }
+=======
         // remove the captcha element from the form prior to processing
         unset($form['captcha']);
+>>>>>>> master
         
         drupal_process_form('user_register', $form, $form_state);
         
diff -u -r /home/peterh/temp/civicrm/CRM/Core/BAO/MessageTemplates.php civicrm/CRM/Core/BAO/MessageTemplates.php
--- /home/peterh/temp/civicrm/CRM/Core/BAO/MessageTemplates.php	2011-06-12 08:31:55.000000000 -0700
+++ civicrm/CRM/Core/BAO/MessageTemplates.php	2011-08-23 13:37:24.590142677 -0700
@@ -342,6 +342,7 @@
     static function sendTemplate($params)
     {
         $defaults = array(
+            'table'       => 'civicrm_msg_template',
             'groupName'         => null,    // option group name of the template
             'valueName'         => null,    // option value name of the template
             'messageTemplateID' => null,    // ID of the template
@@ -378,6 +379,7 @@
                       WHERE og.name = %1 AND ov.name = %2 AND mt.is_default = 1';
             $sqlParams = array(1 => array($params['groupName'], 'String'), 2 => array($params['valueName'], 'String'));
         }
+        CRM_Utils_Hook::preLoad( $params );        $dao = CRM_Core_DAO::executeQuery($query, $sqlParams);
         $dao = CRM_Core_DAO::executeQuery($query, $sqlParams);
         $dao->fetch();
 
civicrm/CRM/Core/BAOだけに発見: Query.php
diff -u -r /home/peterh/temp/civicrm/CRM/Core/Block.php civicrm/CRM/Core/Block.php
--- /home/peterh/temp/civicrm/CRM/Core/Block.php	2011-05-27 10:17:58.000000000 -0700
+++ civicrm/CRM/Core/Block.php	2011-08-23 13:37:24.600141993 -0700
@@ -497,7 +497,7 @@
             $session = CRM_Core_Session::singleton( );
             // check if registration link should be displayed
             foreach ( $info as $id => $event ) {
-                $info[$id]['onlineRegistration'] = CRM_Event_BAO_Event::validRegistrationDate( $event,
+                $info[$id]['onlineRegistration'] = CRM_Event_BAO_Event::validRegistrationRequest( $event,
                                                                                                $session->get( 'userID' ) );
             }
 
diff -u -r /home/peterh/temp/civicrm/CRM/Core/DAO.php civicrm/CRM/Core/DAO.php
--- /home/peterh/temp/civicrm/CRM/Core/DAO.php	2011-05-28 10:22:57.000000000 -0700
+++ civicrm/CRM/Core/DAO.php	2011-08-23 13:37:24.600141993 -0700
@@ -374,6 +374,12 @@
         }
     }
 
+    function storeAllValues( &$object, &$values )
+    {
+        //TODO do not discard $values
+        $values = get_object_vars( $object );
+    }
+
     /**
      * create an attribute for this specific field. We only do this for strings and text
      *
diff -u -r /home/peterh/temp/civicrm/CRM/Event/BAO/Event.php civicrm/CRM/Event/BAO/Event.php
--- /home/peterh/temp/civicrm/CRM/Event/BAO/Event.php	2011-06-08 04:50:38.000000000 -0700
+++ civicrm/CRM/Event/BAO/Event.php	2011-08-23 13:37:24.630142385 -0700
@@ -1604,7 +1604,15 @@
         return CRM_Core_DAO::singleValueQuery( $query );
     }
 
-    static function validRegistrationDate( &$values, $contactID ) {
+    static function validRegistrationRequest( $values, $contactID ) {
+        // check that the user has permission to register for this event
+        $hasPermission = CRM_Core_Permission::event( CRM_Core_Permission::EDIT,
+                                                     $contactID );
+
+        return self::validRegistrationDate( $values ) && $hasPermission;
+    }
+
+    static function validRegistrationDate( &$values ) {
         // make sure that we are between  registration start date and registration end date
         $startDate = CRM_Utils_Date::unixTime( CRM_Utils_Array::value( 'registration_start_date', $values ) );
         $endDate   = CRM_Utils_Date::unixTime( CRM_Utils_Array::value( 'registration_end_date', $values ) );
@@ -1616,12 +1624,8 @@
         if ( $endDate && $endDate < $now ) {
             $validDate = false;
         }
-        
-        // also check that the user has permission to register for this event
-        $hasPermission = CRM_Core_Permission::event( CRM_Core_Permission::EDIT,
-                                                     $contactID );
 
-        return $validDate && $hasPermission;
+        return $validDate;
     }
  
     /* Function to Show - Hide the Registration Link.
diff -u -r /home/peterh/temp/civicrm/CRM/Event/BAO/Participant.php civicrm/CRM/Event/BAO/Participant.php
--- /home/peterh/temp/civicrm/CRM/Event/BAO/Participant.php	2011-05-19 04:12:18.000000000 -0700
+++ civicrm/CRM/Event/BAO/Participant.php	2011-08-23 13:37:24.630142385 -0700
@@ -433,7 +433,7 @@
             $eventFullText = $participants->event_full_text;
             $eventMaxSeats = $participants->max_participants;
             //don't have limit for event seats.
-            if ( $participants->max_participants == null ) {
+            if ( !$participants->max_participants ) {
                 return $result;
             }
         }
civicrm/CRM/Eventだけに発見: Cart
diff -u -r /home/peterh/temp/civicrm/CRM/Event/Form/EventFees.php civicrm/CRM/Event/Form/EventFees.php
--- /home/peterh/temp/civicrm/CRM/Event/Form/EventFees.php	2011-03-14 14:49:22.000000000 -0700
+++ civicrm/CRM/Event/Form/EventFees.php	2011-08-23 13:37:24.640143866 -0700
@@ -121,6 +121,7 @@
 
             list( $defaults[$form->_pId]['receive_date'] ) = CRM_Utils_Date::setDateDefaults( );
         }
+        $defaults[$form->_pId]['include_receipt'] = 0;
 
         if ( $form->_mode ) {
             $fields = array( );
@@ -537,7 +538,11 @@
         $form->addElement('checkbox', 
                           'send_receipt', 
                           ts('Send Confirmation?'), null, 
-                          array('onclick' =>"showHideByValue('send_receipt','','notice','table-row','radio',false); showHideByValue('send_receipt','','from-email','table-row','radio',false);") );
+                          array('onclick' =>"showHideByValue('send_receipt','','notice','table-row','radio',false); showHideByValue('send_receipt','','from-email','table-row','radio',false); showHideByValue('send_receipt','','include-receipt','table-row','radio',false)") );
+
+        $form->addElement('checkbox', 
+                          'include_receipt', 
+                          ts('Include a Receipt?'), null, null);
 
         $form->add( 'select', 'from_email_address', ts('Receipt From'), $form->_fromEmails['from_email_id'] );
         
diff -u -r /home/peterh/temp/civicrm/CRM/Event/Form/ManageEvent/EventInfo.php civicrm/CRM/Event/Form/ManageEvent/EventInfo.php
--- /home/peterh/temp/civicrm/CRM/Event/Form/ManageEvent/EventInfo.php	2011-04-29 08:20:45.000000000 -0700
+++ civicrm/CRM/Event/Form/ManageEvent/EventInfo.php	2011-08-23 13:37:24.640143866 -0700
@@ -234,7 +234,7 @@
         $this->addDateTime( 'end_date', ts('End Date / Time'), false, array('formatType' => 'activityDateTime') );
      
         $this->add('text','max_participants', ts('Max Number of Participants'),
-                    array('onchange' => "if (this.value != '') {show('id-waitlist','table-row'); showHideByValue('has_waitlist','0','id-waitlist-text','table-row','radio',false); showHideByValue('has_waitlist','0','id-event_full','table-row','radio',true); return;} else {hide('id-event_full','table-row'); hide('id-waitlist','table-row'); hide('id-waitlist-text','table-row'); return;}"));
+                    array('onchange' => "if (this.value != '' && this.value != '0') {show('id-waitlist','table-row'); showHideByValue('has_waitlist','0','id-waitlist-text','table-row','radio',false); showHideByValue('has_waitlist','0','id-event_full','table-row','radio',true); return;} else {hide('id-event_full','table-row'); hide('id-waitlist','table-row'); hide('id-waitlist-text','table-row'); return;}"));
         $this->addRule('max_participants', ts('Max participants should be a positive number') , 'positiveInteger');
 
         require_once 'CRM/Event/PseudoConstant.php';
@@ -452,9 +452,11 @@
         foreach ( $customValues as $key => $val ) {
             if ( $fieldKey = CRM_Core_BAO_CustomField::getKeyID( $key ) ) {
                 $defaults["custom_{$fieldKey}_-1"] = $val;
+                if ($customValues["{$key}_id"]) {
+                  $defaults["custom_{$fieldKey}_-1_id"] = $customValues["{$key}_id"];
+                }
             }
         }
-        
         return $defaults;
     }
 }
diff -u -r /home/peterh/temp/civicrm/CRM/Event/Form/Participant.php civicrm/CRM/Event/Form/Participant.php
--- /home/peterh/temp/civicrm/CRM/Event/Form/Participant.php	2011-06-13 02:27:42.000000000 -0700
+++ civicrm/CRM/Event/Form/Participant.php	2011-08-23 13:37:24.640143866 -0700
@@ -1038,7 +1038,7 @@
                 $params['fee_amount'] = $params['amount'];
             } 
             
-            if ( isset( $params['priceSetId'] ) ) {
+            if ( isset( $params['priceSetId'] ) && !empty($additionalParticipantDetails) && !empty($lineItem) ) {
                 $this->set( 'lineItem', $lineItem );
                 $this->_lineItem = $lineItem;
                 $lineItem = array_merge($lineItem, $additionalParticipantDetails);
@@ -1550,7 +1550,7 @@
 
                 $sendTemplateParams = array(
                     'groupName' => 'msg_tpl_workflow_event',
-                    'valueName' => 'event_offline_receipt',
+                    'valueName' => 'event_online_receipt',
                     'contactId' => $contactID,
                     'isTest'    => (bool) CRM_Utils_Array::value('is_test', $this->_defaultValues),
                 );
@@ -1565,6 +1565,10 @@
                     $sendTemplateParams['bcc']     = CRM_Utils_Array::value( 'bcc', $this->_fromEmails );
                 }
 
+                require_once 'CRM/Event/Cart/BAO/Conference.php';
+                $this->assign( 'conference_sessions', CRM_Event_Cart_BAO_Conference::get_participant_sessions($participants[$num]->id) );
+                $this->assign( 'include_receipt', $params['include_receipt'] == '1' );
+
                 require_once 'CRM/Core/BAO/MessageTemplates.php';
                 list ($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams);
                 if ($mailSent) {
diff -u -r /home/peterh/temp/civicrm/CRM/Event/Form/Registration/Register.php civicrm/CRM/Event/Form/Registration/Register.php
--- /home/peterh/temp/civicrm/CRM/Event/Form/Registration/Register.php	2011-06-16 00:35:54.000000000 -0700
+++ civicrm/CRM/Event/Form/Registration/Register.php	2011-08-23 13:37:24.640143866 -0700
@@ -81,6 +81,11 @@
      */ 
     function preProcess( ) 
     {
+        global $user;
+        if (!in_array('administrator', $user->roles)) {
+          drupal_goto(CIVICRM_UF_BASEURL.'/workshopspage');
+        }
+        
         parent::preProcess( );
         
         //CRM-4320.
diff -u -r /home/peterh/temp/civicrm/CRM/Event/Page/AJAX.php civicrm/CRM/Event/Page/AJAX.php
--- /home/peterh/temp/civicrm/CRM/Event/Page/AJAX.php	2011-03-14 14:49:22.000000000 -0700
+++ civicrm/CRM/Event/Page/AJAX.php	2011-08-23 13:37:24.640143866 -0700
@@ -99,25 +99,28 @@
     function eventFee( )
     {
         require_once 'CRM/Utils/Type.php';
-        $name = trim( CRM_Utils_Type::escape( $_GET['s'], 'String' ) );
-        if( !$name ) {
-            $name = '%';
+        $event_id = trim( CRM_Utils_Type::escape( $_GET['eventId'], 'Integer' ) );
+        if( $event_id ) {
+          require_once 'CRM/Price/BAO/Set.php';
+          $price_set_id = CRM_Price_BAO_Set::getFor( "civicrm_event", $event_id );
+          if (!$price_set_id)
+              CRM_Utils_System::civiExit( );
+          $price_sets = CRM_Price_BAO_Set::getSetDetail( $price_set_id, true );
+          $price_set = $price_sets[$price_set_id];
+          $elements = array();
+          foreach ( $price_set['fields'] as $fieldId => $field )
+          {
+            foreach ($field['options'] as $optionId => $option)
+            {
+              $elements[] = $option;
+            }
+          }
+          require_once "CRM/Utils/JSON.php";
+          echo json_encode( $elements );
+          CRM_Utils_System::civiExit( );
         }
         
-        $whereClause = "cv.label LIKE '$name%' ";
-        
-        $query = "
-SELECT distinct(cv.label), cv.id
-FROM civicrm_option_value cv, civicrm_option_group cg
-WHERE cg.name LIKE 'civicrm_event.amount%'
-   AND cg.id = cv.option_group_id AND {$whereClause}
-   GROUP BY cv.label
-";
-        $dao = CRM_Core_DAO::executeQuery( $query );
-        while ( $dao->fetch( ) ) {
-            echo $elements = "$dao->label|$dao->id\n";
-        }
-        CRM_Utils_System::civiExit( );
+//XXX removed unimplemented legacy case
     }
     
     function eventList(  ) {
diff -u -r /home/peterh/temp/civicrm/CRM/Event/Page/EventInfo.php civicrm/CRM/Event/Page/EventInfo.php
--- /home/peterh/temp/civicrm/CRM/Event/Page/EventInfo.php	2011-05-17 11:02:40.000000000 -0700
+++ civicrm/CRM/Event/Page/EventInfo.php	2011-08-23 13:37:24.650141925 -0700
@@ -55,6 +55,11 @@
      */
     function run()
     {
+        global $user;
+        if (!in_array('administrator', $user->roles)) {
+          drupal_goto(CIVICRM_UF_BASEURL.'/workshopspage');
+        }
+    
         //get the event id.
         $this->_id = CRM_Utils_Request::retrieve( 'id', 'Positive', $this, true );
         $config    = CRM_Core_Config::singleton( );
@@ -218,7 +223,7 @@
         
         $allowRegistration = false;
         if ( CRM_Utils_Array::value( 'is_online_registration', $values['event'] ) ) {
-            if ( CRM_Event_BAO_Event::validRegistrationDate( $values['event'], $this->_id ) ) {
+            if ( CRM_Event_BAO_Event::validRegistrationRequest( $values['event'], $this->_id ) ) {
                 if ( !$eventFullMessage || $hasWaitingList ) {
                     $registerText = ts('Register Now');
                     if ( CRM_Utils_Array::value('registration_link_text', $values['event'] ) ) {
@@ -243,7 +248,8 @@
                                                   true );
                 }
                 if ( !$eventFullMessage || $hasWaitingList ) {
-                    $this->assign( 'registerURL', $url    );
+                    require 'CRM/Event/Cart/BAO/EventInCart.php';
+                    $this->assign( 'registerURL', CRM_Event_Cart_BAO_EventInCart::get_event_registration_url( $this->_id, $action ) );
                 }
             } else if ( CRM_Core_Permission::check( 'register for events' ) ) {
                 $this->assign( 'registerClosed', true );
diff -u -r /home/peterh/temp/civicrm/CRM/Event/Page/ManageEvent.php civicrm/CRM/Event/Page/ManageEvent.php
--- /home/peterh/temp/civicrm/CRM/Event/Page/ManageEvent.php	2011-03-14 14:49:22.000000000 -0700
+++ civicrm/CRM/Event/Page/ManageEvent.php	2011-08-23 13:37:24.650141925 -0700
@@ -59,6 +59,8 @@
 
     protected $_isTemplate = false;
 
+    public $_query = null;
+
     /**
      * Get action Links
      *
@@ -201,14 +203,18 @@
         // get all custom groups sorted by weight
         $manageEvent = array();
 
-        $query = "
-  SELECT *
-    FROM civicrm_event
-   WHERE $whereClause
-ORDER BY start_date desc
-   LIMIT $offset, $rowCount";
-        
-        $dao = CRM_Core_DAO::executeQuery( $query, $params, true, 'CRM_Event_DAO_Event' );
+        require_once 'CRM/Core/BAO/Query.php';
+        $this->_query = new CRM_Core_BAO_Query( );
+        $this->_query->select = "*";
+        $this->_query->from = "civicrm_event";
+        $this->_query->where = "$whereClause";
+        $this->_query->sort = "start_date desc";
+        $this->_query->limit = "$offset, $rowCount";
+
+        require_once 'CRM/Utils/Hook.php';
+        CRM_Utils_Hook::alterQuery( get_class( $this ), $this->_query );
+
+        $dao = CRM_Core_DAO::executeQuery( $this->_query->buildSql( ), $params);
         $permissions = CRM_Event_BAO_Event::checkPermission( );
         
         //get all campaigns.
@@ -217,7 +223,7 @@
         while ($dao->fetch()) {
             if ( in_array( $dao->id, $permissions[CRM_Core_Permission::VIEW] ) ) {
                 $manageEvent[$dao->id] = array();
-                CRM_Core_DAO::storeValues( $dao, $manageEvent[$dao->id]);
+                CRM_Core_DAO::storeAllValues( $dao, $manageEvent[$dao->id] );
             
                 // form all action links
                 $action = array_sum(array_keys($this->links()));
diff -u -r /home/peterh/temp/civicrm/CRM/Event/xml/Menu/Event.xml civicrm/CRM/Event/xml/Menu/Event.xml
--- /home/peterh/temp/civicrm/CRM/Event/xml/Menu/Event.xml	2010-06-14 04:10:31.000000000 -0700
+++ civicrm/CRM/Event/xml/Menu/Event.xml	2011-08-16 17:33:07.710556200 -0700
@@ -234,4 +234,41 @@
      <page_callback>CRM_Event_Page_AJAX::eventList</page_callback>
      <access_arguments>access CiviCRM,access CiviEvent</access_arguments>
   </item>
+  <item>
+    <path>civicrm/ajax/event/add_participant_to_cart</path>
+    <page_callback>CRM_Event_Cart_Page_CheckoutAJAX::add_participant_to_cart</page_callback>
+    <access_callback>1</access_callback>
+  </item>
+  <item>
+    <path>civicrm/event/add_to_cart</path>
+    <title>Add Event To Cart</title>
+    <page_callback>CRM_Event_Cart_Page_AddToCart</page_callback>
+    <access_callback>1</access_callback>
+    <is_public>true</is_public>
+    <is_ssl>false</is_ssl>
+  </item>
+  <item>
+    <path>civicrm/event/cart_checkout</path>
+    <title>Cart Checkout</title>
+    <page_callback>CRM_Event_Cart_Controller_Checkout</page_callback>
+    <access_callback>1</access_callback>
+    <is_public>true</is_public>
+    <is_ssl>true</is_ssl>
+  </item>
+  <item>
+    <path>civicrm/event/remove_from_cart</path>
+    <title>Remove From Cart</title>
+    <page_callback>CRM_Event_Cart_Page_RemoveFromCart</page_callback>
+    <access_callback>1</access_callback>
+    <is_public>true</is_public>
+    <is_ssl>false</is_ssl>
+  </item>
+  <item>
+    <path>civicrm/event/view_cart</path>
+    <title>View Cart</title>
+    <page_callback>CRM_Event_Cart_Page_ViewCart</page_callback>
+    <access_callback>1</access_callback>
+    <is_public>true</is_public>
+    <is_ssl>false</is_ssl>
+  </item>
 </menu>
diff -u -r /home/peterh/temp/civicrm/CRM/Member/BAO/Membership.php civicrm/CRM/Member/BAO/Membership.php
--- /home/peterh/temp/civicrm/CRM/Member/BAO/Membership.php	2011-06-22 23:12:34.000000000 -0700
+++ civicrm/CRM/Member/BAO/Membership.php	2011-08-23 13:37:24.670143141 -0700
@@ -1097,6 +1097,7 @@
         //this condition arises when separate membership payment is
         //enabled and contribution amount is not selected. fix for CRM-3010
         require_once 'CRM/Contribute/BAO/Contribution/Utils.php';
+        $membershipParams['robots'] = true; // since CAPTCHA is not displayed to the user, do not require it for validation.
         if ( $form->_amount > 0.0 ) {
             $result = CRM_Contribute_BAO_Contribution_Utils::processConfirm( $form, $membershipParams, 
                                                                              $premiumParams, $contactID,
diff -u -r /home/peterh/temp/civicrm/CRM/Price/BAO/Field.php civicrm/CRM/Price/BAO/Field.php
--- /home/peterh/temp/civicrm/CRM/Price/BAO/Field.php	2011-04-29 04:42:05.000000000 -0700
+++ civicrm/CRM/Price/BAO/Field.php	2011-08-23 13:37:24.690143239 -0700
@@ -306,7 +306,7 @@
                 }
             }
 
-            if ( !$field->is_required ) {
+            if ( !$field->is_required && !$useRequired ) {
                 // add "none" option
                 $choice[] = $qf->createElement('radio', null, '', '-none-', '0', 
                                                 array('price' => json_encode( array( $elementName, "0" ) ) ) 
@@ -505,7 +505,7 @@
         
         while ( $priceField->fetch( ) ) {
             $key = "price_{$priceField->id}";
-            if ( CRM_Utils_Array::value( $key, $fields ) ) {
+            if ( CRM_Utils_Array::value( $key, $fields ) >= 0 ) {
                 $priceFields[$priceField->id] = $fields[$key];
             }
         }
/home/peterh/temp/civicrm/CRMだけに発見: Touchstone
/home/peterh/temp/civicrm/CRM/Upgradeだけに発見: 3.1.alpha3.msg_template
diff -u -r /home/peterh/temp/civicrm/CRM/Utils/Hook.php civicrm/CRM/Utils/Hook.php
--- /home/peterh/temp/civicrm/CRM/Utils/Hook.php	2011-06-09 10:53:42.000000000 -0700
+++ civicrm/CRM/Utils/Hook.php	2011-08-23 13:37:24.720142304 -0700
@@ -716,6 +716,22 @@
     }
     
     /** 
+     * Hook can be called before using CRM_Core_DAO::query to select an object
+     *
+     * @param array $selectParams  - key/value description of the object of our search.
+     */
+    static function preLoad( &$selectParams ) {
+        $config =& CRM_Core_Config::singleton( );
+        require_once( str_replace( '_', DIRECTORY_SEPARATOR, $config->userHookClass ) . '.php' );
+        $null =& CRM_Core_DAO::$_nullObject;
+
+        return
+            eval( 'return ' .
+                $config->userHookClass .
+                '::invoke( 1, $selectParams, $null, $null, $null, $null, \'civicrm_preLoad\' );' );
+    }
+
+    /**
      * This hook is called before record is exported as CSV
      * 
      * @param string $exportTempTable - name of the temporary export table used during export
@@ -755,6 +771,20 @@
                   '::invoke( 3, $obj, $type, $query, $null, $null , \'civicrm_dupeQuery\' );' );
     }
 
+    /**
+     *
+     */
+    static function alterQuery( $class, &$query ) {
+        $config =& CRM_Core_Config::singleton( );
+        require_once( str_replace( '_', DIRECTORY_SEPARATOR, $config->userHookClass ) . '.php' );
+        $null =& CRM_Core_DAO::$_nullObject;
+
+        return
+            eval( 'return ' .
+                  $config->userHookClass .
+                  '::invoke( 2, $class, $query, $null, $null, $null , \'civicrm_alterQuery\' );' );
+    }
+
 
     /**
      * This hook is called AFTER EACH email has been processed by the script bin/EmailProcessor.php
diff -u -r /home/peterh/temp/civicrm/CRM/Utils/Mail.php civicrm/CRM/Utils/Mail.php
--- /home/peterh/temp/civicrm/CRM/Utils/Mail.php	2011-04-12 15:01:56.000000000 -0700
+++ civicrm/CRM/Utils/Mail.php	2011-08-23 13:37:24.730142527 -0700
@@ -96,7 +96,7 @@
         $headers['Bcc']                       = CRM_Utils_Array::value( 'bcc', $params );
         $headers['Subject']                   = CRM_Utils_Array::value( 'subject', $params );
         $headers['Content-Type']              = $htmlMessage ? 'multipart/mixed; charset=utf-8' : 'text/plain; charset=utf-8';
-        $headers['Content-Disposition']       = 'inline';  
+//        $headers['Content-Disposition']       = 'inline';  
         $headers['Content-Transfer-Encoding'] = '8bit';  
         $headers['Return-Path']               = CRM_Utils_Array::value( 'returnPath', $params );
         $headers['Reply-To']                  = CRM_Utils_Array::value( 'replyTo', $params, $from );
diff -u -r /home/peterh/temp/civicrm/bin/UpdateMembershipRecord.php civicrm/bin/UpdateMembershipRecord.php
--- /home/peterh/temp/civicrm/bin/UpdateMembershipRecord.php	2011-05-17 00:26:42.000000000 -0700
+++ civicrm/bin/UpdateMembershipRecord.php	2011-08-18 16:22:37.369882201 -0700
@@ -2,9 +2,9 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 3.4                                               |
+ | CiviCRM version 3.3                                               |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2011                                |
+ | Copyright CiviCRM LLC (c) 2004-2010                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -81,7 +81,7 @@
         require_once 'CRM/Member/BAO/MembershipType.php';
         require_once 'CRM/Utils/Date.php';
         require_once 'CRM/Utils/System.php';
-        civicrm_api_include('membership', false, 2);
+        require_once 'api/v2/Membership.php';
         require_once 'CRM/Member/PseudoConstant.php';
         require_once 'CRM/Contact/BAO/Contact.php';
         require_once 'CRM/Activity/BAO/Activity.php';
@@ -263,12 +263,8 @@
                         $activityParams['subject']            = $allTypes[$dao->membership_type_id] . 
                             ": Status - " . $statusLabels[$newStatus['id']] . 
                             ", End Date - " . CRM_Utils_Date::customFormat(CRM_Utils_Date::isoToMysql($dao->end_date), $config->dateformatFull);
-                        $activityParams['source_record_id']   = $dao->membership_id;
-
-                        $session = & CRM_Core_Session::singleton();
-                        $activityParams['source_contact_id']   = $session->get('userID') ? $session->get('userID') : $dao->contact_id;
-                        $activityParams['assignee_contact_id'] = $dao->contact_id;
-
+                        $activityParams['source_record_id']   = $dao->membership_id; 
+                        $activityParams['source_contact_id']  = $dao->contact_id; 
                         $activityParams['activity_date_time'] = date('YmdHis');
 
                         static $actRelIds = array( );
civicrm/drupalだけに発見: .DS_Store
diff -u -r /home/peterh/temp/civicrm/drupal/civicrm.module civicrm/drupal/civicrm.module
--- /home/peterh/temp/civicrm/drupal/civicrm.module	2011-04-29 00:31:45.000000000 -0700
+++ civicrm/drupal/civicrm.module	2011-08-23 13:37:24.750144092 -0700
@@ -965,3 +965,26 @@
         $element->setValue(check_markup($value, $element->format));
     }
 }
+
+// XXX hack for Event/Cart to display civicrm messages to anonymous users
+function civicrm_init( ) {
+    if ( ! civicrm_initialize( ) ) {
+        return;
+    }
+  if ( arg(0) != 'civicrm' ) {
+    require_once 'CRM/Core/Session.php';
+    $session = CRM_Core_Session::singleton( );
+    if ( $session->getStatus( false ) ) {
+      $status = $session->getStatus( true );
+      if ( is_array( $status ) ) {
+        foreach ( $status as $key => $value )  {
+          drupal_set_message ( $value, $key );
+        }
+      }
+      else
+      {
+        drupal_set_message( $status, 'status' );
+      }
+    }
+  }
+}
\ ファイル末尾に改行がありません
diff -u -r /home/peterh/temp/civicrm/drupal/modules/views/civicrm/civicrm_handler_field_event_link.inc civicrm/drupal/modules/views/civicrm/civicrm_handler_field_event_link.inc
--- /home/peterh/temp/civicrm/drupal/modules/views/civicrm/civicrm_handler_field_event_link.inc	2011-03-14 15:01:36.000000000 -0700
+++ civicrm/drupal/modules/views/civicrm/civicrm_handler_field_event_link.inc	2011-08-23 13:37:24.760145432 -0700
@@ -106,9 +106,19 @@
     // LINKING TO EVENT REGISTRATION PAGE
       case 'registration':
            if (user_access('register for events') && $data !== NULL && $data !== '') {
-           return civicrm_views_href( $data,
-                                            'civicrm/event/register',
-                                            "reset=1&id={$values->{$this->aliases['id']}}" );
+                require_once 'CRM/Event/Cart/BAO/Cart.php';
+                //TODO don't call for every row
+                $cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session( );
+                $cart->load_associations( );
+                $event_in_cart = $cart->get_event_in_cart_by_event_id( $values->{$this->aliases['id']} );
+
+                if ($event_in_cart) {
+                  $data = "Remove From Cart";
+                  return civicrm_views_href( $data, 'civicrm/event/remove_from_cart', "reset=1&id={$event_in_cart->id}" );
+                } else {
+                  $data = "Add To Cart";
+                  return civicrm_views_href( $data, 'civicrm/event/add_to_cart', "reset=1&id={$values->{$this->aliases['id']}}" );
+                }
            }
 
     // LINKING TO EVENT CONFIG PAGE
diff -u -r /home/peterh/temp/civicrm/drupal/modules/views/civicrm/civicrm_handler_field_markup.inc civicrm/drupal/modules/views/civicrm/civicrm_handler_field_markup.inc
--- /home/peterh/temp/civicrm/drupal/modules/views/civicrm/civicrm_handler_field_markup.inc	2011-03-15 10:29:11.000000000 -0700
+++ civicrm/drupal/modules/views/civicrm/civicrm_handler_field_markup.inc	2011-08-23 13:37:24.760145432 -0700
@@ -1,5 +1,5 @@
-<?php
-/**
+<?php
+/**
  * A handler to run a field through check_markup, using the default format
  *
  */
@@ -11,6 +11,7 @@
     function render($values) {
         $value = $values->{$this->field_alias};
         $retval = check_markup($value, FILTER_FORMAT_DEFAULT, FALSE);
-        return ( $retval == 'n/a' ) ? null : $retval;
+	    //return check_markup($value, FILTER_FORMAT_DEFAULT, FALSE);
+        return ( $retval == 'n/a' ) ? null : $value;
     }
 }
diff -u -r /home/peterh/temp/civicrm/drupal/modules/views/civicrm.views.inc civicrm/drupal/modules/views/civicrm.views.inc
--- /home/peterh/temp/civicrm/drupal/modules/views/civicrm.views.inc	2011-06-10 07:54:11.000000000 -0700
+++ civicrm/drupal/modules/views/civicrm.views.inc	2011-08-23 13:37:24.760145432 -0700
@@ -6398,6 +6398,9 @@
                        'civicrm_handler_field_custom' => array(
                                                                'parent' => 'views_handler_field',
                                                                ),
+                       'civicrm_handler_field_markup' => array(
+                                                            'parent' => 'views_handler_field',
+                                                           ),
                        'civicrm_handler_field_campaign_type' => array(
                                                                       'parent' => 'views_handler_field',
                                                                       ),
/home/peterh/temp/civicrm/packages/IDS/vendors/htmlpurifier/HTMLPurifier/DefinitionCache/Serializerだけに発見: Test
/home/peterh/temp/civicrm/packages/jquery/plugins/DataTables-1.7.6だけに発見: extras
civicrmだけに発見: schema-multi
diff -u -r /home/peterh/temp/civicrm/sql/civicrm.mysql civicrm/sql/civicrm.mysql
--- /home/peterh/temp/civicrm/sql/civicrm.mysql	2011-06-23 07:04:37.000000000 -0700
+++ civicrm/sql/civicrm.mysql	2011-08-23 13:37:25.140144215 -0700
@@ -4593,4 +4593,79 @@
      CONSTRAINT FK_civicrm_pledge_payment_contribution_id FOREIGN KEY (contribution_id) REFERENCES civicrm_contribution(id) ON DELETE CASCADE  
 )  ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci  ;
 
- 
\ ファイル末尾に改行がありません
+-- /*****   Civicrm Multi-Event Registration   ***********/ 
+
+-- /*******************************************************
+-- *
+-- * civicrm_event_carts
+-- *
+-- *******************************************************/
+CREATE TABLE civicrm_event_carts (
+
+
+     id int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Cart Id',
+     user_id int unsigned    COMMENT 'FK to civicrm_contact who created this
+cart',
+     completed tinyint   DEFAULT 0
+,
+    PRIMARY KEY ( id )
+
+
+,
+     CONSTRAINT FK_civicrm_event_carts_user_id FOREIGN KEY (user_id)
+REFERENCES civicrm_contact(id) ON DELETE SET NULL
+)  ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci  ;
+
+-- /*******************************************************
+-- *
+-- * civicrm_events_in_carts
+-- *
+-- *******************************************************/
+CREATE TABLE civicrm_events_in_carts (
+
+
+     id int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Event In Cart Id',
+     event_id int unsigned    COMMENT 'FK to Event ID',
+     event_cart_id int unsigned    COMMENT 'FK to Event Cart ID'
+,
+    PRIMARY KEY ( id )
+
+
+,
+     CONSTRAINT FK_civicrm_events_in_carts_event_id FOREIGN KEY (event_id)
+REFERENCES civicrm_event(id) ON DELETE CASCADE,
+     CONSTRAINT FK_civicrm_events_in_carts_event_cart_id FOREIGN KEY
+(event_cart_id) REFERENCES civicrm_event_carts(id) ON DELETE CASCADE
+)  ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci  ;
+
+-- /*******************************************************
+-- *
+-- * civicrm_events_in_carts_participants
+-- *
+-- *******************************************************/
+CREATE TABLE civicrm_events_in_carts_participants (
+
+
+     id int unsigned  AUTO_INCREMENT  ,
+     contact_id int unsigned    COMMENT 'FK to Contact ID',
+     event_in_cart_id int unsigned NOT NULL   COMMENT 'FK to Event In Cart Id',
+     discount_amount int unsigned   DEFAULT 0 COMMENT 'Discount Amount',
+     cost int unsigned    COMMENT 'Cost',
+     fee_level int unsigned    COMMENT 'Fee Level',
+     participant_index int unsigned    COMMENT 'Participant Index in Cart',
+     email varchar(255)    COMMENT 'Email',
+     first_name varchar(255)    COMMENT 'First Name',
+     last_name varchar(255)    COMMENT 'Last Name',
+     must_wait tinyint   DEFAULT 0 COMMENT 'On Waiting List',
+     used_coupon tinyint   DEFAULT 0 COMMENT 'Used Coupon',
+     used_discount tinyint   DEFAULT 0 COMMENT 'Used Discount',
+     custom_data text    COMMENT 'Serialized custom data values' 
+,
+    PRIMARY KEY ( id )
+ 
+ 
+,      
+     CONSTRAINT FK_civicrm_events_in_carts_participants_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact(id) ON DELETE CASCADE,      
+     CONSTRAINT FK_civicrm_events_in_carts_participants_event_in_cart_id FOREIGN KEY (event_in_cart_id) REFERENCES civicrm_events_in_carts(id) ON DELETE CASCADE  
+)  ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci  ;
+
/home/peterh/temp/civicrm/templates/CRMだけに発見: Auction
/home/peterh/temp/civicrm/templates/CRM/Contact/Form/Editだけに発見: SubType
/home/peterh/temp/civicrm/templates/CRM/Contact/Page/Viewだけに発見: SubType
diff -u -r /home/peterh/temp/civicrm/templates/CRM/Contribute/Form/Contribution/Main.tpl civicrm/templates/CRM/Contribute/Form/Contribution/Main.tpl
--- /home/peterh/temp/civicrm/templates/CRM/Contribute/Form/Contribution/Main.tpl	2011-06-10 06:25:44.000000000 -0700
+++ civicrm/templates/CRM/Contribute/Form/Contribution/Main.tpl	2011-08-23 13:37:25.270143421 -0700
@@ -133,6 +133,7 @@
 	    </div>
 	{/if}
 	    {assign var=n value=email-$bltID}
+	    {assign var=conf_n value=conf_email-$bltID}
 	    <div class="crm-section {$form.$n.name}-section">
 	    	<div class="label">{$form.$n.label}</div>
 	    	<div class="content">
@@ -140,6 +141,13 @@
 	    	</div>
 	    	<div class="clear"></div> 
 	    </div>
+	    <div class="crm-section {$form.$conf_n.name}-section">
+	    	<div class="label">{$form.$conf_n.label}</div>
+	    	<div class="content">
+	    		{$form.$conf_n.html}
+	    	</div>
+	    	<div class="clear"></div> 
+	    </div>
 	
 	{if $form.is_for_organization}
 		<div class="crm-section {$form.is_for_organization.name}-section">
civicrm/templates/CRM/Eventだけに発見: Cart
diff -u -r /home/peterh/temp/civicrm/templates/CRM/Event/Form/EventFees.tpl civicrm/templates/CRM/Event/Form/EventFees.tpl
--- /home/peterh/temp/civicrm/templates/CRM/Event/Form/EventFees.tpl	2011-03-22 07:09:40.000000000 -0700
+++ civicrm/templates/CRM/Event/Form/EventFees.tpl	2011-08-23 13:37:25.280143295 -0700
@@ -130,13 +130,14 @@
     <fieldset id="send_confirmation_receipt"><legend>{if $paid}{ts}Registration Confirmation and Receipt{/ts}{else}{ts}Registration Confirmation{/ts}{/if}</legend>  
       <table class="form-layout" style="width:auto;">
 		 <tr class="crm-event-eventfees-form-block-send_receipt"> 
-            <td class="label">{if $paid}{ts}Send Confirmation and Receipt{/ts}{else}{ts}Send Confirmation{/ts}{/if}</td>
+            <td class="label">{ts}Send Confirmation{/ts}</td>
             <td>{$form.send_receipt.html}<br>
-              {if $paid}
-                <span class="description">{ts 1=$email}Automatically email a confirmation and receipt to %1?{/ts}</span></td>
-              {else}
-                <span class="description">{ts 1=$email}Automatically email a confirmation to %1?{/ts}</span></td>
-              {/if}
+                <span class="description">{ts 1=$email}Email a confirmation to %1?{/ts}</span></td>
+        </tr>
+        <tr id="include-receipt" class="crm-event-eventfees-form-block-include_receipt"> 
+            <td class="label">{ts}Include a receipt{/ts}</td>
+            <td>{$form.include_receipt.html}<br>
+                <span class="description">{ts 1=$email}Include a copy of the receipt?{/ts}</span></td>
         </tr>
 	<tr id="from-email" class="crm-event-eventfees-form-block-from_email_address">
             <td class="label">{$form.from_email_address.label}</td>
@@ -184,6 +185,14 @@
 {include file="CRM/common/showHideByFieldValue.tpl" 
     trigger_field_id    ="send_receipt"
     trigger_value       =""
+    target_element_id   ="include-receipt" 
+    target_element_type ="table-row"
+    field_type          ="radio"
+    invert              = 0
+}
+{include file="CRM/common/showHideByFieldValue.tpl" 
+    trigger_field_id    ="send_receipt"
+    trigger_value       =""
     target_element_id   ="notice" 
     target_element_type ="table-row"
     field_type          ="radio"
diff -u -r /home/peterh/temp/civicrm/templates/CRM/Event/Form/Search/Common.tpl civicrm/templates/CRM/Event/Form/Search/Common.tpl
--- /home/peterh/temp/civicrm/templates/CRM/Event/Form/Search/Common.tpl	2011-03-14 14:54:20.000000000 -0700
+++ civicrm/templates/CRM/Event/Form/Search/Common.tpl	2011-08-23 13:37:25.280143295 -0700
@@ -24,7 +24,7 @@
  +--------------------------------------------------------------------+
 *}
 <tr>
-    <td class="crm-event-form-block-event_type"> {$form.event_name.label}  <br />{$form.event_name.html|crmReplace:class:huge} </td>
+    <td class="crm-event-form-block-event_name"> {$form.event_name.label}  <br />{$form.event_name.html|crmReplace:class:huge} </td>
     <td class="crm-event-form-block-event_type"> {$form.event_type.label}<br />{$form.event_type.html} </td>
 </tr>     
  
/home/peterh/temp/civicrm/templates/CRM/Profileだけに発見: Selector
/home/peterh/temp/civicrm/templates/CRMだけに発見: Touchstone

