/[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.4.4.11, Mon Aug 25 09:04:45 2008 UTC revision 1.4.4.12, Mon Sep 1 08:50:21 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: storminvoice.module,v 1.4.4.10 2008/08/03 17:55:11 robertogerola Exp $  // $Id: storminvoice.module,v 1.4.4.11 2008/08/25 09:04:45 robertogerola Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 10  function storminvoice_help($path, $arg) Line 10  function storminvoice_help($path, $arg)
10    
11    switch ($path) {    switch ($path) {
12      case "admin/help#storminvoice":      case "admin/help#storminvoice":
13        $o = '<p>'. t("Provides invoice support for Storm") .'</p>';        $o = '<p>'. storm_t("Provides invoice support for Storm", 'invoice') .'</p>';
14        break;        break;
15    }    }
16    
# Line 155  function storminvoice_menu() { Line 155  function storminvoice_menu() {
155    $items = array();    $items = array();
156    
157    $items['storm/project_invoices_js/%/%'] = array(    $items['storm/project_invoices_js/%/%'] = array(
158      'title' => t('Tasks'),      'title' => storm_t('Tasks', 'invoice'),
159      'page callback' => '_storminvoice_project_invoices_js',      'page callback' => '_storminvoice_project_invoices_js',
160      'page arguments' => array(2, 3),      'page arguments' => array(2, 3),
161      'access arguments' => array('Storm invoice: access'),      'access arguments' => array('Storm invoice: access'),
# Line 164  function storminvoice_menu() { Line 164  function storminvoice_menu() {
164    );    );
165    
166    $items['storm/invoices'] = array(    $items['storm/invoices'] = array(
167      'title' => t('Invoices'),      'title' => storm_t('Invoices', 'invoice'),
168      'description' => t('Storm invoices'),      'description' => storm_t('Storm invoices', 'invoices'),
169      'page callback' => 'storminvoice_list',      'page callback' => 'storminvoice_list',
170      'access arguments' => array('Storm invoice: access'),      'access arguments' => array('Storm invoice: access'),
171      'type' => MENU_NORMAL_ITEM,      'type' => MENU_NORMAL_ITEM,
# Line 173  function storminvoice_menu() { Line 173  function storminvoice_menu() {
173    );    );
174    
175    $items['storm/invoice/report/%node/%/%'] = array(    $items['storm/invoice/report/%node/%/%'] = array(
176              'title' => t('Invoice'),              'title' => storm_t('Invoice', 'invoice'),
177              'page arguments' => array(3, 4, 5),              'page arguments' => array(3, 4, 5),
178              'description' => t('Storm Invoice'),              'description' => storm_t('Storm Invoice', 'invoice'),
179              'page callback' => 'storminvoice_report',              'page callback' => 'storminvoice_report',
180              'access arguments' => array('Storm invoice: access'),              'access arguments' => array('Storm invoice: access'),
181              'type' => MENU_CALLBACK,              'type' => MENU_CALLBACK,
# Line 205  function storminvoice_theme() { Line 205  function storminvoice_theme() {
205  function storminvoice_node_info() {  function storminvoice_node_info() {
206    return array(    return array(
207      'storminvoice' => array(      'storminvoice' => array(
208        'name' => t('Invoice'),        'name' => storm_t('Invoice', 'invoice'),
209        'module' => 'storminvoice',        'module' => 'storminvoice',
210        'description' => t("An invoice for Storm."),        'description' => storm_t("An invoice for Storm.", 'invoice'),
211        'title_label' => t("Description"),        'title_label' => storm_t("Description", 'invoice'),
212        'has_body' => false,        'has_body' => false,
213      )      )
214    );    );
# Line 272  function storminvoice_form(&$node) { Line 272  function storminvoice_form(&$node) {
272    
273    $form['group1']['number'] = array(    $form['group1']['number'] = array(
274      '#type' => 'textfield',      '#type' => 'textfield',
275      '#title' => t('Number'),      '#title' => storm_t('Number', 'invoice'),
276      '#required' => TRUE,      '#required' => TRUE,
277      '#size' => 10,      '#size' => 10,
278      '#default_value' => $node->number,      '#default_value' => $node->number,
# Line 301  function storminvoice_form(&$node) { Line 301  function storminvoice_form(&$node) {
301    }    }
302    $form['group2']['organization_nid'] = array(    $form['group2']['organization_nid'] = array(
303      '#type' => 'select',      '#type' => 'select',
304      '#title' => t('Organization'),      '#title' => storm_t('Organization', 'invoice'),
305      '#default_value' => $node->organization_nid,      '#default_value' => $node->organization_nid,
306      '#options' => $organizations,      '#options' => $organizations,
307      '#attributes' => array('onchange' => "stormproject_organization_projects(this, 'edit-project-nid', true, '-')"),      '#attributes' => array('onchange' => "stormproject_organization_projects(this, 'edit-project-nid', true, '-')"),
# Line 318  function storminvoice_form(&$node) { Line 318  function storminvoice_form(&$node) {
318    $projects = array(0 => '-') + $projects;    $projects = array(0 => '-') + $projects;
319    $form['group2']['project_nid'] = array(    $form['group2']['project_nid'] = array(
320      '#type' => 'select',      '#type' => 'select',
321      '#title' => t('Project'),      '#title' => storm_t('Project', 'invoice'),
322      '#default_value' => $node->project_nid,      '#default_value' => $node->project_nid,
323      '#options' => $projects,      '#options' => $projects,
324      '#process' => array('storm_dependent_select_process'),      '#process' => array('storm_dependent_select_process'),
# Line 326  function storminvoice_form(&$node) { Line 326  function storminvoice_form(&$node) {
326    
327    $form['group2']['reference'] = array(    $form['group2']['reference'] = array(
328      '#type' => 'textfield',      '#type' => 'textfield',
329      '#title' => t('Reference'),      '#title' => storm_t('Reference', 'invoice'),
330      '#default_value' => $node->reference,      '#default_value' => $node->reference,
331      '#size' => 40,      '#size' => 40,
332    );    );
# Line 340  function storminvoice_form(&$node) { Line 340  function storminvoice_form(&$node) {
340    $form['group3']['requestdate'] = array(    $form['group3']['requestdate'] = array(
341      '#type' => 'date',      '#type' => 'date',
342      '#withnull' => 'true',      '#withnull' => 'true',
343      '#title' => t('Request date'),      '#title' => storm_t('Request date', 'invoice'),
344      '#default_value' => _storm_gmtimestamp_to_date($node->requestdate),      '#default_value' => _storm_gmtimestamp_to_date($node->requestdate),
345    );    );
346    
347    $form['group3']['duedate'] = array(    $form['group3']['duedate'] = array(
348      '#type' => 'dateext',      '#type' => 'dateext',
349      '#withnull' => 'true',      '#withnull' => 'true',
350      '#title' => t('Due date'),      '#title' => storm_t('Due date', 'invoice'),
351      '#default_value' => _storm_gmtimestamp_to_date($node->duedate),      '#default_value' => _storm_gmtimestamp_to_date($node->duedate),
352    );    );
353    
354    $form['group3']['paymentdate'] = array(    $form['group3']['paymentdate'] = array(
355      '#type' => 'dateext',      '#type' => 'dateext',
356      '#withnull' => 'true',      '#withnull' => 'true',
357      '#title' => t('Payment date'),      '#title' => storm_t('Payment date', 'invoice'),
358      '#default_value' => _storm_gmtimestamp_to_date($node->paymentdate),      '#default_value' => _storm_gmtimestamp_to_date($node->paymentdate),
359    );    );
360    
# Line 366  function storminvoice_form(&$node) { Line 366  function storminvoice_form(&$node) {
366    
367    $form['group4']['amount'] = array(    $form['group4']['amount'] = array(
368      '#type' => 'textfield',      '#type' => 'textfield',
369      '#title' => t('Amount'),      '#title' => storm_t('Amount', 'invoice'),
370      '#attributes' => array('readonly' => 'readonly'),      '#attributes' => array('readonly' => 'readonly'),
371      '#size' => 15,      '#size' => 15,
372      '#default_value' => $node->amount,      '#default_value' => $node->amount,
373    );    );
374    
375    $form['group4']['vat'] = array(    $form['group4']['tax'] = array(
376      '#type' => 'textfield',      '#type' => 'textfield',
377      '#title' => t('VAT'),      '#title' => storm_t('Tax', 'invoice'),
378      '#attributes' => array('readonly' => 'readonly'),      '#attributes' => array('readonly' => 'readonly'),
379      '#size' => 15,      '#size' => 15,
380      '#default_value' => $node->vat,      '#default_value' => $node->tax,
381    );    );
382    
383    $form['group4']['total'] = array(    $form['group4']['total'] = array(
384      '#type' => 'textfield',      '#type' => 'textfield',
385      '#title' => t('Total'),      '#title' => storm_t('Total', 'invoice'),
386      '#attributes' => array('readonly' => 'readonly'),      '#attributes' => array('readonly' => 'readonly'),
387      '#size' => 15,      '#size' => 15,
388      '#default_value' => $node->total,      '#default_value' => $node->total,
# Line 390  function storminvoice_form(&$node) { Line 390  function storminvoice_form(&$node) {
390    
391    $form['group4']['totalcustomercurr'] = array(    $form['group4']['totalcustomercurr'] = array(
392      '#type' => 'textfield',      '#type' => 'textfield',
393      '#title' => t('Total in customer currency'),      '#title' => storm_t('Total in customer currency', 'invoice'),
394      '#size' => 15,      '#size' => 15,
395      '#default_value' => $node->totalcustomercurr,      '#default_value' => $node->totalcustomercurr,
396    );    );
397    
398    $form['vatexempt'] = array(    $form['taxexempt'] = array(
399      '#type' => 'checkbox',      '#type' => 'checkbox',
400      '#title' => t('Vat exempt'),      '#title' => storm_t('Tax exempt', 'invoice'),
401      '#weight' => -45,      '#weight' => -45,
402      '#default_value' => $node->vatexempt,      '#default_value' => $node->taxexempt,
403    );    );
404    
405    return $form;    return $form;
# Line 413  function storminvoice_insert($node) { Line 413  function storminvoice_insert($node) {
413             number, reference,             number, reference,
414             organization_nid, organization_title,             organization_nid, organization_title,
415             project_nid, project_title,             project_nid, project_title,
416             amount, vat, total, totalcustomercurr,             amount, tax, total, totalcustomercurr,
417             requestdate, duedate, paymentdate, vatexempt) VALUES             requestdate, duedate, paymentdate, taxexempt) VALUES
418             (%d, %d,             (%d, %d,
419             '%s', '%s',             '%s', '%s',
420             %d, '%s',             %d, '%s',
# Line 425  function storminvoice_insert($node) { Line 425  function storminvoice_insert($node) {
425            $node->number, $node->reference,            $node->number, $node->reference,
426            $node->organization_nid, $node->organization_title,            $node->organization_nid, $node->organization_title,
427            $node->project_nid, $node->project_title,            $node->project_nid, $node->project_title,
428            $node->amount, $node->vat, $node->total, $node->totalcustomercurr,            $node->amount, $node->tax, $node->total, $node->totalcustomercurr,
429            $node->requestdate, $node->duedate, $node->paymentdate, $node->vatexempt);            $node->requestdate, $node->duedate, $node->paymentdate, $node->taxexempt);
430  }  }
431    
432  function storminvoice_update($node) {  function storminvoice_update($node) {
# Line 436  function storminvoice_update($node) { Line 436  function storminvoice_update($node) {
436              number='%s', reference='%s',              number='%s', reference='%s',
437              organization_nid=%d, organization_title='%s',              organization_nid=%d, organization_title='%s',
438              project_nid=%d, project_title='%s',              project_nid=%d, project_title='%s',
439              amount=%f, vat=%f, total=%f, totalcustomercurr=%f,              amount=%f, tax=%f, total=%f, totalcustomercurr=%f,
440              requestdate=%d, duedate=%d, paymentdate=%d, vatexempt=%d WHERE vid = %d",              requestdate=%d, duedate=%d, paymentdate=%d, taxexempt=%d WHERE vid = %d",
441              $node->number, $node->reference,              $node->number, $node->reference,
442              $node->organization_nid, $node->organization_title,              $node->organization_nid, $node->organization_title,
443              $node->project_nid, $node->project_title,              $node->project_nid, $node->project_title,
444              $node->amount, $node->vat, $node->total, $node->totalcustomercurr,              $node->amount, $node->tax, $node->total, $node->totalcustomercurr,
445              $node->requestdate, $node->duedate, $node->paymentdate, $node->vatexempt, $node->vid);              $node->requestdate, $node->duedate, $node->paymentdate, $node->taxexempt, $node->vid);
446  }  }
447    
448  function _storminvoice_beforesave(&$node) {  function _storminvoice_beforesave(&$node) {
# Line 487  function storminvoice_form_alter(&$form, Line 487  function storminvoice_form_alter(&$form,
487    if ($form_id == 'storm_admin_settings') {    if ($form_id == 'storm_admin_settings') {
488      $form['storminvoice'] = array(      $form['storminvoice'] = array(
489        '#type' => 'fieldset',        '#type' => 'fieldset',
490        '#title' => t('Invoices'),        '#title' => storm_t('Invoices', 'invoice'),
491        '#collapsed' => false,        '#collapsed' => false,
492        '#collapsible' => true,        '#collapsible' => true,
493        '#weight' => -9,        '#weight' => -9,
494      );      );
495      $form['storminvoice']['storminvoice_payment_days'] = array(      $form['storminvoice']['storminvoice_payment_days'] = array(
496        '#type' => 'textfield',        '#type' => 'textfield',
497        '#title' => t('Number of days for invoice payment'),        '#title' => storm_t('Number of days for invoice payment', 'invoice'),
498        '#default_value' => variable_get('storminvoice_payment_days', 30),        '#default_value' => variable_get('storminvoice_payment_days', 30),
499        '#description' => t('Default number of days for invoice payment'),        '#description' => storm_t('Default number of days for invoice payment', 'invoice'),
500        '#size' => 5,        '#size' => 5,
501      );      );
502      $form['storminvoice']['storminvoice_payment_modes'] = array(      $form['storminvoice']['storminvoice_payment_modes'] = array(
503        '#type' => 'textarea',        '#type' => 'textarea',
504        '#title' => t('Modes for invoice payment'),        '#title' => storm_t('Modes for invoice payment', 'invoice'),
505        '#default_value' => variable_get('storminvoice_payment_modes', ''),        '#default_value' => variable_get('storminvoice_payment_modes', ''),
506        '#description' => t('Modes for invoice payment'),        '#description' => storm_t('Modes for invoice payment', 'invoice'),
507      );      );
508      $form['storminvoice']['storminvoice_payment_terms'] = array(      $form['storminvoice']['storminvoice_payment_terms'] = array(
509        '#type' => 'textfield',        '#type' => 'textfield',
510        '#title' => t('Payment terms'),        '#title' => storm_t('Payment terms', 'invoice'),
511        '#default_value' => variable_get('storminvoice_payment_terms', 'Due on receipt'),        '#default_value' => variable_get('storminvoice_payment_terms', t('Due on receipt')),
512        '#description' => t('Payment terms'),        '#description' => storm_t('Payment terms', 'invoice'),
513        '#size' => 50,        '#size' => 50,
514      );      );
515    }    }

Legend:
Removed from v.1.4.4.11  
changed lines
  Added in v.1.4.4.12

  ViewVC Help
Powered by ViewVC 1.1.2