/[drupal]/contributions/modules/storm/storminvoice/storminvoice.module
ViewVC logotype

Diff of /contributions/modules/storm/storminvoice/storminvoice.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3, Mon Jun 23 16:46:35 2008 UTC revision 1.4, Tue Jul 1 07:47:42 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: storminvoice.module,v 1.2 2008/06/17 07:59:24 robertogerola Exp $  // $Id: storminvoice.module,v 1.3 2008/06/23 16:46:35 robertogerola Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 246  function storminvoice_form(&$node) { Line 246  function storminvoice_form(&$node) {
246      '#weight' => -48,      '#weight' => -48,
247    );    );
248    
249    $s = "SELECT n.nid, n.title FROM {stormorganization} sor INNER JOIN {node} n ON sor.nid=n.nid WHERE n.status=1 AND n.type='stormorganization' ORDER BY n.title";    $s = "SELECT n.nid, n.title FROM {node} AS n INNER JOIN {stormorganization} AS sor ON sor.vid=n.vid WHERE n.status=1 AND n.type='stormorganization' ORDER BY n.title";
250      $s = db_rewrite_sql($s);
251    $r = db_query(stormorganization_access_sql($s));    $r = db_query(stormorganization_access_sql($s));
252    $organizations = array();    $organizations = array();
253    while ($organization = db_fetch_object($r)) {    while ($organization = db_fetch_object($r)) {
# Line 261  function storminvoice_form(&$node) { Line 262  function storminvoice_form(&$node) {
262      '#attributes' => array('onchange' => "stormproject_organization_projects(this, 'edit-project-nid', true, '-')"),      '#attributes' => array('onchange' => "stormproject_organization_projects(this, 'edit-project-nid', true, '-')"),
263    );    );
264    
265    $s = "SELECT n.nid, n.title FROM {stormproject} spr INNER JOIN {node} n ON spr.nid=n.nid WHERE spr.organization_nid=%d AND n.status=1 AND n.type='stormproject' ORDER BY n.title";    $s = "SELECT n.nid, n.title FROM {node} AS n INNER JOIN {stormproject} AS spr ON spr.vid=n.vid WHERE spr.organization_nid=%d AND n.status=1 AND n.type='stormproject' ORDER BY n.title";
266      $s = db_rewrite_sql($s);
267    $r = db_query(stormproject_access_sql($s), $node->organization_nid);    $r = db_query(stormproject_access_sql($s), $node->organization_nid);
268    $projects = array();    $projects = array();
269    while ($project = db_fetch_object($r)) {    while ($project = db_fetch_object($r)) {
# Line 403  function _storminvoice_beforesave(&$node Line 405  function _storminvoice_beforesave(&$node
405    if(is_array($node->paymentdate)) $node->paymentdate = _storm_date_to_gmtimestamp($node->paymentdate);    if(is_array($node->paymentdate)) $node->paymentdate = _storm_date_to_gmtimestamp($node->paymentdate);
406    
407    $s = "SELECT n.title    $s = "SELECT n.title
408          FROM {node} n INNER JOIN {stormorganization} o ON n.nid=o.nid          FROM {node} AS n INNER JOIN {stormorganization} AS o ON n.vid=o.vid
409          WHERE type='stormorganization' AND n.nid=%d";          WHERE type='stormorganization' AND n.nid=%d";
410    $r = db_query($s, $node->organization_nid);    $r = db_query($s, $node->organization_nid);
411    $o = db_fetch_object($r);    $o = db_fetch_object($r);
412    $node->organization_title = $o->title;    $node->organization_title = $o->title;
413    
414    $s = "SELECT n.title    $s = "SELECT n.title
415          FROM {node} n INNER JOIN {stormproject} p ON n.nid=p.nid          FROM {node} AS n INNER JOIN {stormproject} AS p ON n.vid=p.vid
416          WHERE type='stormproject' AND n.nid=%d";          WHERE type='stormproject' AND n.nid=%d";
417    $r = db_query($s, $node->project_nid);    $r = db_query($s, $node->project_nid);
418    $p = db_fetch_object($r);    $p = db_fetch_object($r);
# Line 442  function storminvoice_view($node, $tease Line 444  function storminvoice_view($node, $tease
444    
445  function storminvoice_form_alter(&$form, $form_state, $form_id) {  function storminvoice_form_alter(&$form, $form_state, $form_id) {
446    if ($form_id == 'storm_admin_settings') {    if ($form_id == 'storm_admin_settings') {
447      $form['storminvoice_payment_days'] = array(      $form['storminvoice'] = array(
448          '#type' => 'fieldset',
449          '#title' => t('Invoices'),
450          '#collapsed' => false,
451          '#collapsible' => true,
452          '#weight' => -9,
453        );
454        $form['storminvoice']['storminvoice_payment_days'] = array(
455        '#type' => 'textfield',        '#type' => 'textfield',
456        '#title' => t('Number of days for invoice payment'),        '#title' => t('Number of days for invoice payment'),
457        '#default_value' => variable_get('storminvoice_payment_days', 30),        '#default_value' => variable_get('storminvoice_payment_days', 30),
458        '#description' => t('Default number of days for invoice payment'),        '#description' => t('Default number of days for invoice payment'),
459        '#size' => 5,        '#size' => 5,
       '#weight' => -10,  
460      );      );
461      $form['storminvoice_payment_modes'] = array(      $form['storminvoice']['storminvoice_payment_modes'] = array(
462        '#type' => 'textarea',        '#type' => 'textarea',
463        '#title' => t('Modes for invoice payment'),        '#title' => t('Modes for invoice payment'),
464        '#default_value' => variable_get('storminvoice_payment_modes', ''),        '#default_value' => variable_get('storminvoice_payment_modes', ''),
465        '#description' => t('Modes for invoice payment'),        '#description' => t('Modes for invoice payment'),
       '#weight' => -9,  
466      );      );
467      $form['storminvoice_payment_terms'] = array(      $form['storminvoice']['storminvoice_payment_terms'] = array(
468        '#type' => 'textfield',        '#type' => 'textfield',
469        '#title' => t('Payment terms'),        '#title' => t('Payment terms'),
470        '#default_value' => variable_get('storminvoice_payment_terms', 'Due on receipt'),        '#default_value' => variable_get('storminvoice_payment_terms', 'Due on receipt'),
471        '#description' => t('Payment terms'),        '#description' => t('Payment terms'),
472        '#size' => 50,        '#size' => 50,
       '#weight' => -8,  
473      );      );
474    }    }
475  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2