? issue_567558_extra.patch
? storm--891916-1.patch
? storm--891934-1.patch
? storm--891934-3.patch
Index: stormticket/stormticket.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/storm/stormticket/stormticket.module,v
retrieving revision 1.5.4.47
diff -u -p -r1.5.4.47 stormticket.module
--- stormticket/stormticket.module	9 Sep 2010 22:16:37 -0000	1.5.4.47
+++ stormticket/stormticket.module	11 Sep 2010 09:17:45 -0000
@@ -355,13 +355,13 @@ function stormticket_form(&$node) {
       }
     }
 
-    if ($_SESSION['stormticket_list_filter']['organization_nid'] && !$node->organization_nid) {
+    if (isset($_SESSION['stormticket_list_filter']['organization_nid']) && !$node->organization_nid) {
       $node->organization_nid = $_SESSION['stormticket_list_filter']['organization_nid'];
     }
-    if ($_SESSION['stormticket_list_filter']['project_nid'] && !$node->project_nid) {
+    if (isset($_SESSION['stormticket_list_filter']['project_nid']) && !$node->project_nid) {
       $node->project_nid = $_SESSION['stormticket_list_filter']['project_nid'];
     }
-    if ($_SESSION['stormticket_list_filter']['task_nid'] && !$node->task_nid) {
+    if (isset($_SESSION['stormticket_list_filter']['task_nid']) && !$node->task_nid) {
       $node->task_nid = $_SESSION['stormticket_list_filter']['task_nid'];
     }
 
@@ -395,7 +395,9 @@ function stormticket_form(&$node) {
   $organizations = array();
   while ($organization = db_fetch_object($r)) {
     $organizations[$organization->nid] = $organization->title;
-    if (!$node->organization_nid) $node->organization_nid = $organization->nid;
+    if (!isset($node->organization_nid)) {
+      $node->organization_nid = $organization->nid;
+    }
   }
   $form['group1']['organization_nid'] = array(
     '#type' => 'select',
@@ -417,7 +419,7 @@ function stormticket_form(&$node) {
   $form['group1']['project_nid'] = array(
     '#type' => 'select',
     '#title' => t('Project'),
-    '#default_value' => $node->project_nid,
+    '#default_value' => isset($node->project_nid) ? $node->project_nid : 0,
     '#options' => array(0 => '-') + $projects,
     '#process' => array('storm_dependent_select_process'),
     '#attributes' => array('onchange' => "stormtask_project_tasks('edit-organization-nid', this, 'edit-task-nid', 'edit-assigned-nid', true, '-')"),
@@ -428,14 +430,14 @@ function stormticket_form(&$node) {
   $form['group1']['task_nid'] = array(
     '#type' => 'select',
     '#title' => t('Task'),
-    '#default_value' => $node->task_nid,
+    '#default_value' => isset($node->task_nid) ? $node->task_nid : 0,
     '#options' => array(0 => '-') + $tasks,
     '#process' => array('storm_dependent_select_process'),
   );
   
   $form['group1']['task_nid_old'] = array(
     '#type' => 'hidden',
-    '#default_value' => $node->task_nid,
+    '#default_value' => isset($node->task_nid) ? $node->task_nid : NULL,
   );
   
   $form['group2'] = array(
@@ -493,7 +495,7 @@ function stormticket_form(&$node) {
     '#type' => 'dateext',
     '#title' => t('Date end'),
     '#withnull' => TRUE,
-    '#default_value' => _storm_gmtimestamp_to_date($node->dateend),
+    '#default_value' => isset($node->dateend) ? _storm_gmtimestamp_to_date($node->dateend) : NULL,
   );
 
   $durationunits = stormattribute_attributes_bydomain('Duration unit');
@@ -508,7 +510,7 @@ function stormticket_form(&$node) {
     '#type' => 'textfield',
     '#title' => t('Duration'),
     '#size' => 20,
-    '#default_value' => $node->duration,
+    '#default_value' => isset($node->duration) ? $node->duration : NULL,
   );
 
   $form['group4'] = array(
@@ -530,7 +532,7 @@ function stormticket_form(&$node) {
     '#title' => t('Price'),
     '#type' => 'textfield',
     '#size' => 15,
-    '#default_value' => $node->price,
+    '#default_value' => isset($node->price) ? $node->price : NULL,
   );
 
   $currencies = stormattribute_attributes_bydomain('Currency');
@@ -553,7 +555,7 @@ function stormticket_form(&$node) {
     '#type' => 'select',
     '#title' => t('Assigned to'),
     '#options' => $options,
-    '#default_value' => $node->assigned_nid,
+    '#default_value' => isset($node->assigned_nid) ? $node->assigned_nid : NULL,
   );
 
   $form['group6'] = array(
@@ -572,7 +574,7 @@ function stormticket_form(&$node) {
   $form['group6']['billed'] = array(
     '#type' => 'checkbox',
     '#title' => t('Billed'),
-    '#default_value' => $node->billed,
+    '#default_value' => isset($node->billed) ? $node->billed : 0,
     '#weight' => 2,
   );
 
@@ -582,7 +584,7 @@ function stormticket_form(&$node) {
 
   $form['title_old'] = array(
     '#type' => 'hidden',
-    '#default_value' => $node->title_old,
+    '#default_value' => isset($node->title_old) ? $node->title_old : NULL,
   );
 
   return $form;
@@ -687,7 +689,7 @@ function _stormticket_beforesave(&$node)
 function stormticket_nodeapi(&$node, $op, $teaser, $page) {
   switch ($op) {
     case 'prepare':
-      if (!$node->nid) {
+      if (!isset($node->nid)) {
         $category_list = stormattribute_attributes_bydomain('Ticket category');
         $node->ticketcategory = $category_list['default'];
 
Index: stormticket/stormticket.test
===================================================================
RCS file: stormticket/stormticket.test
diff -N stormticket/stormticket.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ stormticket/stormticket.test	11 Sep 2010 09:17:45 -0000
@@ -0,0 +1,45 @@
+<?php
+class StormticketTestCase extends DrupalWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => t('Storm Ticket Functionality'),
+      'description' => t('Test the functionality of the Storm Ticket module'),
+      'group' => 'Storm',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp('storm', 'stormattribute', 'stormorganization', 'stormproject', 'stormtask', 'stormticket');
+  }
+
+  public function testStormticketCreate() {
+    // Create and login user
+    $user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm ticket: add', 'Storm ticket: view all'));
+    $this->drupalLogin($user);
+
+    // Create organization and invoice
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $prj = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => '1',
+    );
+    $task = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $ticket = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $this->drupalPost('node/add/stormproject', $prj, t('Save'));
+    $this->drupalPost('node/add/stormtask', $task, t('Save'));
+    $this->drupalPost('node/add/stormticket', $ticket, t('Save'));
+
+    $this->assertText(t('Ticket @title has been created.', array('@title' => $ticket['title'])));;
+  }
+}
Index: stormticket/stormticket.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/storm/stormticket/stormticket.theme.inc,v
retrieving revision 1.5.4.19
diff -u -p -r1.5.4.19 stormticket.theme.inc
--- stormticket/stormticket.theme.inc	23 Aug 2010 16:46:13 -0000	1.5.4.19
+++ stormticket/stormticket.theme.inc	11 Sep 2010 09:17:45 -0000
@@ -37,7 +37,6 @@ function theme_stormticket_view($node, $
   drupal_add_css(drupal_get_path('module', 'storm') . '/storm-node.css', 'module');
   
   $node = node_prepare($node, $teaser);
-  $l_pos = 1; // Used to increase the link position number (see issue 814820)
   
   $node->content['links'] = array(
     '#prefix' => '<div class="stormlinks"><dl>',
@@ -55,7 +54,7 @@ function theme_stormticket_view($node, $
       '#prefix' => variable_get('storm_icons_display', TRUE) ? '<dt id="storminvoices" class="stormcomponent">' : '<dt class="stormcomponent">',
       '#suffix' => '</dt>',
       '#value' => theme('storminvoice_autoadd_links', $node->nid, $node->billable, $node->billed),
-      '#weight' => $l_pos++,
+      '#weight' => 1,
     );
   }
 
@@ -69,21 +68,21 @@ function theme_stormticket_view($node, $
     '#prefix' => '<div class="organization">',
     '#suffix' => '</div>',
     '#value' => theme('storm_view_item', t('Organization'), l($node->organization_title, 'node/'. $node->organization_nid)),
-    '#weight' => $w++,
+    '#weight' => 1,
   );
 
   $node->content['group1']['project_nid'] = array(
     '#prefix' => '<div class="project">',
     '#suffix' => '</div>',
     '#value' => theme('storm_view_item', t('Project'), l($node->project_title, 'node/'. $node->project_nid)),
-    '#weight' => $w++,
+    '#weight' => 2,
   );
 
   $node->content['group1']['task_nid'] = array(
     '#prefix' => '<div class="task">',
     '#suffix' => '</div>',
     '#value' => theme('storm_view_item', t('Task'), l($node->task_title, 'node/'. $node->task_nid)),
-    '#weight' => $w++,
+    '#weight' => 2,
   );
 
   $node->content['group2'] = array(
@@ -123,7 +122,6 @@ function theme_stormticket_view($node, $
     '#prefix' => '<div class="assigned">',
     '#suffix' => '</div>',
     '#value' => theme('storm_view_item', t('Assigned to'), l($node->assigned_title, 'node/'. $node->assigned_nid)),
-    '#weight' => 4,
   );
   
   $node->content['body_field'] = array(
