Migrate spain to localtax type.

This commit is contained in:
Laurent Destailleur 2012-09-16 16:56:24 +02:00
parent b724a78cb3
commit df3227ef7e
4 changed files with 28 additions and 17 deletions

View File

@ -722,7 +722,7 @@ if ($id)
if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
$valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; $align="center"; }
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
@ -834,7 +834,7 @@ if ($id)
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
if ($fieldlist[$field]=='pays') { $valuetoshow=$langs->trans("Country"); }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; $align="center"; }
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
@ -861,11 +861,11 @@ if ($id)
// Lines with values
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$var=!$var;
//print_r($obj);
print "<tr ".$bc[$var].">";
$var = ! $var;
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
{
print '<form action="dict.php" method="post">';
@ -885,9 +885,9 @@ if ($id)
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
}
else
{
$tmpaction = 'view';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
{
$tmpaction = 'view';
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
@ -923,6 +923,7 @@ if ($id)
}
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
$valuetoshow=yn($valuetoshow);
$align="center";
}
else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) {
$valuetoshow=price($valuetoshow);
@ -1038,7 +1039,16 @@ if ($id)
$valuetoshow = '';
$align="right";
}
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
{
$align="right";
}
else if (in_array($fieldlist[$field],array('recuperableonly')))
{
$align="center";
}
// Show value for field
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
}
}
@ -1217,11 +1227,10 @@ function fieldList($fieldlist,$obj='',$tabname='')
}
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
$align="left";
// Les taxes locales sont cadrées à droite
if ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2')
$align="right";
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right
print '<td align="'.$align.'">';
print '<input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'"></td>';
print '<input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>';
}
elseif ($fieldlist[$field] == 'libelle_facture') {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';

View File

@ -120,8 +120,6 @@ class HookManager
*/
function executeHooks($method, $parameters=false, &$object='', &$action='')
{
global $var;
if (! is_array($this->hooks) || empty($this->hooks)) return '';
$parameters['context']=join(':',$this->contextarray);
@ -140,8 +138,6 @@ class HookManager
if (in_array($module,$modulealreadyexecuted)) continue;
$modulealreadyexecuted[$module]=$module;
$var=!$var;
// Hooks that return int
if (($method == 'doActions' || $method == 'formObjectOptions') && method_exists($actionclassinstance,$method))
{

View File

@ -238,3 +238,7 @@ create table llx_socpeople_extrafields
ALTER TABLE llx_socpeople_extrafields ADD INDEX idx_socpeople_extrafields (fk_object);
-- update type of localtax for spain
UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 41 AND fk_pays = 4 AND localtax1_type = '0';
UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 42 AND fk_pays = 4 AND localtax1_type = '0';
UPDATE llx_c_tva SET localtax1_type = '1' WHERE rowid = 43 AND fk_pays = 4 AND localtax1_type = '0';

View File

@ -247,6 +247,8 @@ Quadri=Quadri
MonthOfDay=Month of the day
HourShort=H
Rate=Rate
UseLocalTax=Include tax
LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:<br>1 : local tax apply on products and services without vat (vat is not applied on local tax)<br>2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)<br>3 : local tax apply on products without vat (vat is not applied on local tax)<br>4 : local tax apply on products before vat (vat is calculated on amount + localtax)<br>5 : local tax apply on services without vat (vat is not applied on local tax)<br>6 : local tax apply on services before vat (vat is calculated on amount + localtax)<br>7 : local tax is a fix amount applied on global invoice
Bytes=Bytes
KiloBytes=Kilobytes
MegaBytes=Megabytes