Fix bad translation. Confusionbetween internal tranfert and bank

tranfert for payements
This commit is contained in:
Laurent Destailleur 2016-07-30 17:28:18 +02:00
parent 857de64607
commit e5583f1544
4 changed files with 45 additions and 86 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -62,100 +62,58 @@ if (empty($confirm))
$tmp=dol_getdate(dol_now()); $tmp=dol_getdate(dol_now());
$tables=array(
'propal'=>array(0=>'datep', 1=>'fin_validite', 2=>'date_valid', 3=>'date_cloture'),
'commande'=>array(0=>'date_commande', 1=>'date_valid', 2=>'date_cloture'),
'facture'=>array(0=>'datef', 1=>'date_valid', 2=>'date_lim_reglement'),
'paiement'=>array(0=>'datep'),
'bank'=>array(0=>'datev', 1=>'dateo', )
);
$year=2010; $year=2010;
$currentyear=$tmp['year']; $currentyear=$tmp['year'];
while ($year < ($currentyear - 1)) // We want to keep 2 years of data while ($year <= $currentyear)
{ {
$delta=($currentyear - $year); $delta=($currentyear - $year);
$delta=-1;
print "Correct proposal for year ".$year." and move them to current year ".$currentyear."\n"; if ($delta)
$sql="select rowid from ".MAIN_DB_PREFIX."propal where datep between '".$year."-01-01' and '".$year."-12-31'";
$resql = $db->query($sql);
if ($resql)
{ {
$num = $db->num_rows($resql); foreach($tables as $tablekey => $tableval)
$i=0;
while ($i < $num)
{ {
$obj=$db->fetch_object($resql); print "\nCorrect ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
if ($obj) $sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
//$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()";
$resql = $db->query($sql);
if ($resql)
{ {
print "."; $num = $db->num_rows($resql);
$i=0;
$sql2="UPDATE ".MAIN_DB_PREFIX."propal set "; while ($i < $num)
$sql2.= "datep = DATE_ADD(datep, INTERVAL ".$delta." YEAR),"; {
$sql2.= "fin_validite = DATE_ADD(fin_validite, INTERVAL ".$delta." YEAR),"; $obj=$db->fetch_object($resql);
$sql2.= "date_valid = DATE_ADD(date_valid, INTERVAL ".$delta." YEAR),"; if ($obj)
$sql2.= "date_cloture = DATE_ADD(date_cloture, INTERVAL ".$delta." YEAR)"; {
$sql2.=" WHERE rowid = ".$obj->rowid; print ".";
//print $sql2."\n"; $sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
$j=0;
$resql2 = $db->query($sql2); foreach($tableval as $field)
if (! $resql2) dol_print_error($db); {
} if ($j) $sql2.=", ";
$i++; $sql2.= $field." = DATE_ADD(".$field.", INTERVAL ".$delta." YEAR)";
} $j++;
} }
else dol_print_error($db); $sql2.=" WHERE rowid = ".$obj->rowid;
//print $sql2."\n";
print "Correct order for year ".$year." and move them to current year ".$currentyear."\n"; $resql2 = $db->query($sql2);
$sql="select rowid from ".MAIN_DB_PREFIX."commande where date_commande between '".$year."-01-01' and '".$year."-12-31'"; if (! $resql2) dol_print_error($db);
$resql = $db->query($sql); }
if ($resql) $i++;
{ }
$num = $db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
if ($obj)
{
print ".";
$sql2="UPDATE ".MAIN_DB_PREFIX."commande set ";
$sql2.= "date_commande = DATE_ADD(date_commande, INTERVAL ".$delta." YEAR),";
$sql2.= "date_valid = DATE_ADD(date_valid, INTERVAL ".$delta." YEAR),";
$sql2.= "date_cloture = DATE_ADD(date_cloture, INTERVAL ".$delta." YEAR)";
$sql2.=" WHERE rowid = ".$obj->rowid;
//print $sql2."\n";
$resql2 = $db->query($sql2);
if (! $resql2) dol_print_error($db);
} }
$i++; else dol_print_error($db);
} }
} }
else dol_print_error($db);
print "Correct invoice for year ".$year." and move them to current year ".$currentyear."\n";
$sql="select rowid from ".MAIN_DB_PREFIX."facture where datef between '".$year."-01-01' and '".$year."-12-31'";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
if ($obj)
{
print ".";
$sql2="UPDATE ".MAIN_DB_PREFIX."facture set ";
$sql2.= "datef = DATE_ADD(datef, INTERVAL ".$delta." YEAR),";
$sql2.= "date_valid = DATE_ADD(date_valid, INTERVAL ".$delta." YEAR),";
$sql2.= "date_lim_reglement = DATE_ADD(date_lim_reglement, INTERVAL ".$delta." YEAR)";
$sql2.=" WHERE rowid = ".$obj->rowid;
//print $sql2."\n";
$resql2 = $db->query($sql2);
if (! $resql2) dol_print_error($db);
}
$i++;
}
}
else dol_print_error($db);
$year++; $year++;
} }

View File

@ -152,7 +152,7 @@ if($error)
$amount = GETPOST('amount','int'); $amount = GETPOST('amount','int');
} }
print load_fiche_titre($langs->trans("BankTransfer"), '', 'title_bank.png'); print load_fiche_titre($langs->trans("MenuBankInternalTransfer"), '', 'title_bank.png');
print $langs->trans("TransferDesc"); print $langs->trans("TransferDesc");
print "<br><br>"; print "<br><br>";

View File

@ -1062,7 +1062,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer); $newmenu->add("/compta/bank/virement.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer);
} }
if (! empty($conf->categorie->enabled)) { if (! empty($conf->categorie->enabled)) {

View File

@ -94,7 +94,8 @@ WithdrawalPayment=Withdrawal payment
SocialContributionPayment=Social/fiscal tax payment SocialContributionPayment=Social/fiscal tax payment
BankTransfer=Bank transfer BankTransfer=Bank transfer
BankTransfers=Bank transfers BankTransfers=Bank transfers
TransferDesc=Transfer from one account to another one, Dolibarr will write two records (a debit in source account and a credit in target account, of the same amount. The same label and date will be used for this transaction) MenuBankInternalTransfer=Internal transfer
TransferDesc=Transfer from one account to another one, Dolibarr will write two records (a debit in source account and a credit in target account. The same amount (except sign), label and date will be used for this transaction)
TransferFrom=From TransferFrom=From
TransferTo=To TransferTo=To
TransferFromToDone=A transfer from <b>%s</b> to <b>%s</b> of <b>%s</b> %s has been recorded. TransferFromToDone=A transfer from <b>%s</b> to <b>%s</b> of <b>%s</b> %s has been recorded.