| 1 |
<?php |
<?php |
| 2 |
// $Id: storminvoiceitem.module,v 1.5.4.8 2008/08/03 17:55:11 robertogerola Exp $ |
// $Id: storminvoiceitem.module,v 1.5.4.9 2008/08/05 07:21:14 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 10 |
|
|
| 11 |
switch ($section) { |
switch ($section) { |
| 12 |
case "admin/help#storminvoiceitem": |
case "admin/help#storminvoiceitem": |
| 13 |
$o = '<p>'. t("Provides invoice item support for Storm") .'</p>'; |
$o = '<p>'. storm_t("Provides invoice item support for Storm", 'invoiceitem') .'</p>'; |
| 14 |
break; |
break; |
| 15 |
} |
} |
| 16 |
|
|
| 126 |
} |
} |
| 127 |
function storminvoiceitem_menu() { |
function storminvoiceitem_menu() { |
| 128 |
$items['node/%node/invoiceitems'] = array( |
$items['node/%node/invoiceitems'] = array( |
| 129 |
'title' => t('Invoice items'), |
'title' => storm_t('Invoice items', 'invoiceitem'), |
| 130 |
'page callback' => 'storminvoiceitem_invoiceitems', |
'page callback' => 'storminvoiceitem_invoiceitems', |
| 131 |
'page arguments' => array(1), |
'page arguments' => array(1), |
| 132 |
'access callback' => '_storminvoiceitem_invoiceitems_access', |
'access callback' => '_storminvoiceitem_invoiceitems_access', |
| 150 |
function storminvoiceitem_node_info() { |
function storminvoiceitem_node_info() { |
| 151 |
return array( |
return array( |
| 152 |
'storminvoiceitem' => array( |
'storminvoiceitem' => array( |
| 153 |
'name' => t('Invoice item'), |
'name' => storm_t('Invoice item', 'invoiceitem'), |
| 154 |
'module' => 'storminvoiceitem', |
'module' => 'storminvoiceitem', |
| 155 |
'description' => t("An invoice item for Storm."), |
'description' => storm_t("An invoice item for Storm.", 'invoiceitem'), |
| 156 |
'title_label' => t("Description"), |
'title_label' => storm_t("Description", 'invoiceitem'), |
| 157 |
'has_body' => false, |
'has_body' => false, |
| 158 |
) |
) |
| 159 |
); |
); |
| 199 |
|
|
| 200 |
$form['group2']['weight'] = array( |
$form['group2']['weight'] = array( |
| 201 |
'#type' => 'weight', |
'#type' => 'weight', |
| 202 |
'#title' => t('Weight'), |
'#title' => storm_t('Weight', 'invoiceitem'), |
| 203 |
'#default_value' => $node->weight, |
'#default_value' => $node->weight, |
| 204 |
); |
); |
| 205 |
|
|
| 212 |
$form['group3']['amount'] = array( |
$form['group3']['amount'] = array( |
| 213 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 214 |
'#withnull' => 'true', |
'#withnull' => 'true', |
| 215 |
'#title' => t('Amount'), |
'#title' => storm_t('Amount', 'invoiceitem'), |
| 216 |
'#size' => 15, |
'#size' => 15, |
| 217 |
'#default_value' => $node->amount, |
'#default_value' => $node->amount, |
| 218 |
); |
); |
| 220 |
$form['group3']['vatpercent'] = array( |
$form['group3']['vatpercent'] = array( |
| 221 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 222 |
'#withnull' => 'true', |
'#withnull' => 'true', |
| 223 |
'#title' => t('VAT percent'), |
'#title' => storm_t('VAT percent', 'invoiceitem'), |
| 224 |
'#size' => 15, |
'#size' => 15, |
| 225 |
'#default_value' => $node->vatpercent, |
'#default_value' => $node->vatpercent, |
| 226 |
); |
); |
| 228 |
$form['group3']['vat'] = array( |
$form['group3']['vat'] = array( |
| 229 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 230 |
'#withnull' => 'true', |
'#withnull' => 'true', |
| 231 |
'#title' => t('VAT'), |
'#title' => storm_t('VAT', 'invoiceitem'), |
| 232 |
'#size' => 15, |
'#size' => 15, |
| 233 |
'#default_value' => $node->vat, |
'#default_value' => $node->vat, |
| 234 |
); |
); |
| 236 |
$form['group3']['total'] = array( |
$form['group3']['total'] = array( |
| 237 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 238 |
'#withnull' => 'true', |
'#withnull' => 'true', |
| 239 |
'#title' => t('Total'), |
'#title' => storm_t('Total', 'invoiceitem'), |
| 240 |
'#size' => 15, |
'#size' => 15, |
| 241 |
'#default_value' => $node->total, |
'#default_value' => $node->total, |
| 242 |
); |
); |
| 313 |
|
|
| 314 |
function storminvoiceitem_validate(&$node) { |
function storminvoiceitem_validate(&$node) { |
| 315 |
if (($node->nid == $node->parent_nid) && $node->parent_nid) { |
if (($node->nid == $node->parent_nid) && $node->parent_nid) { |
| 316 |
form_set_error('parent_nid', t('Impossible to assign itself as parent.')); |
form_set_error('parent_nid', storm_t('Impossible to assign itself as parent.', 'invoiceitem')); |
| 317 |
} |
} |
| 318 |
} |
} |
| 319 |
|
|