Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Rui Strecht 2017-09-14 17:56:37 +01:00
commit 70a881ad47
43 changed files with 560 additions and 346 deletions

View File

@ -2,19 +2,15 @@
# from Dolibarr GitHub repository. # from Dolibarr GitHub repository.
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/
# We use dist: precise to have php 5.3 available
dist: precise dist: precise
sudo: required sudo: required
language: php language: php
php: # Start on every boot
- '5.3' services:
- '5.4' - memcached
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- nightly
addons: addons:
mariadb: '10.0' mariadb: '10.0'
@ -34,9 +30,15 @@ addons:
# We need pgloader for import mysql database into pgsql # We need pgloader for import mysql database into pgsql
- pgloader - pgloader
# Start on every boot php:
services: - '5.3'
- memcached - '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
#- hhvm only with dist: trusty
- nightly
env: env:
global: global:
@ -57,11 +59,22 @@ env:
matrix: matrix:
fast_finish: true fast_finish: true
allow_failures: allow_failures:
- php: 7.1 - php: hhvm
- php: nightly - php: nightly
#- env: DB=postgresql # We exclude some combinations not usefull to save Travis CPU
# TODO exclude:
#- env: DB=sqlite - php: '5.4'
env: DB=postgresql
- php: '5.5'
env: DB=postgresql
- php: '5.6'
env: DB=postgresql
- php: '7.0'
env: DB=postgresql
- php: hhvm
env: DB=postgresql
- php: nightly
env: DB=postgresql
notifications: notifications:
email: email:

View File

@ -162,6 +162,9 @@ Following changes may create regression for some external modules, but were nece
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
hook specifications so you must return output into "resprint". hook specifications so you must return output into "resprint".
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
FIX: Removed a bad symbolic link into custom directory.
FIX: Renaming a resource ref rename also the directory of attached files.
***** ChangeLog for 5.0.5 compared to 5.0.4 ***** ***** ChangeLog for 5.0.5 compared to 5.0.4 *****
FIX: #7075 : bad path for document FIX: #7075 : bad path for document

View File

@ -199,6 +199,9 @@ class Adherent extends CommonObject
$infos.= $langs->transnoentities("Town").": ".$this->town."\n"; $infos.= $langs->transnoentities("Town").": ".$this->town."\n";
$infos.= $langs->transnoentities("Country").": ".$this->country."\n"; $infos.= $langs->transnoentities("Country").": ".$this->country."\n";
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n"; $infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
$infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
$infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
$infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
$infos.= $langs->transnoentities("Login").": ".$this->login."\n"; $infos.= $langs->transnoentities("Login").": ".$this->login."\n";
@ -243,6 +246,11 @@ class Adherent extends CommonObject
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, '%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, '%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass, '%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
'%TYPE%'=>$msgishtml?dol_htmlentitiesbr($this->type):$this->type,
'%PHONE_PRO%'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
'%PHONE_PERSO%'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
'%PHONE_MOBILE%'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
// For backward compatibility
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos, '%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, '%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,

View File

@ -248,8 +248,8 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Page // Page
$texthelp=$langs->trans("PageUrlForDefaultValues"); $texthelp=$langs->trans("PageUrlForDefaultValues");
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php'); if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php'); else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/card.php?abc=val1&def=val2');
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp); $texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder); print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
// Field // Field

View File

@ -41,7 +41,7 @@ class Dolistore
/** /**
* Constructor * Constructor
* *
* @param array $options * @param array $options Options
*/ */
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{ {

View File

@ -331,25 +331,27 @@ if ($id > 0)
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
// Compte bancaire par défaut if (! empty($conf->banque->enabled))
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentBankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount')
{ {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1); // Compte bancaire par défaut
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentBankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount')
{
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1);
}
else
{
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none');
}
print "</td>";
print '</tr>';
} }
else
{
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none');
}
print "</td>";
print '</tr>';
// Relative discounts (Discounts-Drawbacks-Rebates) // Relative discounts (Discounts-Drawbacks-Rebates)
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';

View File

@ -1441,7 +1441,6 @@ if ($action == 'create' && $user->rights->commande->creer)
$note_private = $object->getDefaultCreateValueFor('note_private'); $note_private = $object->getDefaultCreateValueFor('note_private');
$note_public = $object->getDefaultCreateValueFor('note_public'); $note_public = $object->getDefaultCreateValueFor('note_public');
} }
$absolute_discount=$soc->getAvailableDiscounts();
print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';

View File

@ -2234,7 +2234,7 @@ class Commande extends CommonOrder
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null'); $sql.= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null');
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -3842,6 +3842,9 @@ class Facture extends CommonInvoice
$line->total_ht=-100; $line->total_ht=-100;
$line->total_ttc=-119.6; $line->total_ttc=-119.6;
$line->total_tva=-19.6; $line->total_tva=-19.6;
$line->multicurrency_total_ht=-200;
$line->multicurrency_total_ttc=-239.2;
$line->multicurrency_total_tva=-39.2;
} }
else if ($xnbp == 2) // UP is negative (free line) else if ($xnbp == 2) // UP is negative (free line)
{ {
@ -3850,6 +3853,9 @@ class Facture extends CommonInvoice
$line->total_ttc=-119.6; $line->total_ttc=-119.6;
$line->total_tva=-19.6; $line->total_tva=-19.6;
$line->remise_percent=0; $line->remise_percent=0;
$line->multicurrency_total_ht=-200;
$line->multicurrency_total_ttc=-239.2;
$line->multicurrency_total_tva=-39.2;
} }
else if ($xnbp == 3) // Discount is 50% (product line) else if ($xnbp == 3) // Discount is 50% (product line)
{ {
@ -3858,6 +3864,9 @@ class Facture extends CommonInvoice
$line->total_ht=50; $line->total_ht=50;
$line->total_ttc=59.8; $line->total_ttc=59.8;
$line->total_tva=9.8; $line->total_tva=9.8;
$line->multicurrency_total_ht=100;
$line->multicurrency_total_ttc=119.6;
$line->multicurrency_total_tva=19.6;
$line->remise_percent=50; $line->remise_percent=50;
} }
else // (product line) else // (product line)
@ -3867,15 +3876,23 @@ class Facture extends CommonInvoice
$line->total_ht=100; $line->total_ht=100;
$line->total_ttc=119.6; $line->total_ttc=119.6;
$line->total_tva=19.6; $line->total_tva=19.6;
$line->remise_percent=00; $line->multicurrency_total_ht=200;
$line->multicurrency_total_ttc=239.2;
$line->multicurrency_total_tva=39.2;
$line->remise_percent=0;
} }
$this->lines[$xnbp]=$line; $this->lines[$xnbp]=$line;
$this->total_ht += $line->total_ht; $this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva; $this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc; $this->total_ttc += $line->total_ttc;
$this->multicurrency_total_ht += $line->multicurrency_total_ht;
$this->multicurrency_total_tva += $line->multicurrency_total_tva;
$this->multicurrency_total_ttc += $line->multicurrency_total_ttc;
$xnbp++; $xnbp++;
} }
$this->revenuestamp = 0; $this->revenuestamp = 0;
@ -3892,6 +3909,9 @@ class Facture extends CommonInvoice
$line->total_ht=0; $line->total_ht=0;
$line->total_ttc=0; // 90 * 1.196 $line->total_ttc=0; // 90 * 1.196
$line->total_tva=0; $line->total_tva=0;
$line->multicurrency_total_ht=0;
$line->multicurrency_total_ttc=0;
$line->multicurrency_total_tva=0;
$prodid = mt_rand(1, $num_prods); $prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid]; $line->fk_product=$prodids[$prodid];

View File

@ -585,11 +585,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>'; if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>'; if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>'; if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$alreadypayedlabel.'</td>'; print '<td align="right">'.$alreadypayedlabel.'</td>';
print '<td align="right">'.$remaindertopay.'</td>'; print '<td align="right">'.$remaindertopay.'</td>';
print '<td align="right">'.$langs->trans('PaymentAmount').'</td>'; print '<td align="right">'.$langs->trans('PaymentAmount').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
print '<td align="right">&nbsp;</td>'; print '<td align="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -659,6 +659,29 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td align="right">'; print '<td align="right">';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay); if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
print '</td>'; print '</td>';
print '<td align="right">';
// Add remind multicurrency amount
$namef = 'multicurrency_amount_'.$objp->facid;
$nameRemain = 'multicurrency_remain_'.$objp->facid;
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
{
if ($action != 'add_paiement')
{
if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
else
{
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
}
print "</td>";
} }
// Price // Price
@ -695,33 +718,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
} }
print "</td>"; print "</td>";
// Multicurrency Price
if (! empty($conf->multicurrency->enabled))
{
print '<td align="right">';
// Add remind multicurrency amount
$namef = 'multicurrency_amount_'.$objp->facid;
$nameRemain = 'multicurrency_remain_'.$objp->facid;
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
{
if ($action != 'add_paiement')
{
if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
else
{
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
}
}
print "</td>";
}
// Warning // Warning
print '<td align="center" width="16">'; print '<td align="center" width="16">';
//print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>"; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>";
@ -754,6 +750,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>'; print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>';
print '<td align="right"><b>'.price($sign * $totalrecu); print '<td align="right"><b>'.price($sign * $totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
@ -761,7 +758,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '</b></td>'; print '</b></td>';
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>'; print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
print '<td align="right" id="result" style="font-weight: bold;"></td>'; // Autofilled print '<td align="right" id="result" style="font-weight: bold;"></td>'; // Autofilled
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -861,7 +861,7 @@ class RemiseCheque extends CommonObject
if ($user->rights->banque->cheque) if ($user->rights->banque->cheque)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null'); $sql.= " SET date_bordereau = ".($date ? "'".$this->db->idate($date)."'" : 'null');
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("RemiseCheque::set_date", LOG_DEBUG); dol_syslog("RemiseCheque::set_date", LOG_DEBUG);

View File

@ -2264,6 +2264,8 @@ abstract class CommonObject
$error=0; $error=0;
$multicurrency_tx = !empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1;
// Define constants to find lines to sum // Define constants to find lines to sum
$fieldtva='total_tva'; $fieldtva='total_tva';
$fieldlocaltax1='total_localtax1'; $fieldlocaltax1='total_localtax1';
@ -2316,7 +2318,6 @@ abstract class CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// Note: There is no check on detail line and no check on total, if $forcedroundingmode = 'none' // Note: There is no check on detail line and no check on total, if $forcedroundingmode = 'none'
$multicurrency_tx = !empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1;
if ($forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto' if ($forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto'
{ {
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx); $localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
@ -2334,11 +2335,14 @@ abstract class CommonObject
} }
} }
$this->total_ht += $obj->total_ht; // The only field visible at end of line detail $this->total_ht += $obj->total_ht; // The field visible at end of line detail
$this->total_tva += $obj->total_tva; $this->total_tva += $obj->total_tva;
$this->total_localtax1 += $obj->total_localtax1; $this->total_localtax1 += $obj->total_localtax1;
$this->total_localtax2 += $obj->total_localtax2; $this->total_localtax2 += $obj->total_localtax2;
$this->total_ttc += $obj->total_ttc; $this->total_ttc += $obj->total_ttc;
$this->multicurrency_total_ht += $obj->multicurrency_total_ht; // The field visible at end of line detail
$this->multicurrency_total_tva += $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc += $obj->multicurrency_total_ttc;
if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0; if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0;
if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0; if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0;
@ -2347,7 +2351,7 @@ abstract class CommonObject
$total_tva_by_vats[$obj->vatrate] += $obj->total_tva; $total_tva_by_vats[$obj->vatrate] += $obj->total_tva;
$total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc; $total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc;
if ($forcedroundingmode == '1') // Check if we need adjustement onto line for vat if ($forcedroundingmode == '1') // Check if we need adjustement onto line for vat. TODO This works on the company currency but not on multicurrency
{ {
$tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1); $tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1);
$diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1); $diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1);
@ -2371,26 +2375,25 @@ abstract class CommonObject
} }
// Add revenue stamp to total // Add revenue stamp to total
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0; $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
$this->multicurrency_total_ttc += isset($this->revenuestamp)?($this->revenuestamp * $multicurrency_tx):0;
// Situations totals // Situations totals
if ($this->situation_cycle_ref && $this->situation_counter > 1) { if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {
$prev_sits = $this->get_prev_sits(); $prev_sits = $this->get_prev_sits();
foreach ($prev_sits as $sit) { foreach ($prev_sits as $sit) { // $sit is an object Facture loaded with a fetch.
$this->total_ht -= $sit->total_ht; $this->total_ht -= $sit->total_ht;
$this->total_tva -= $sit->total_tva; $this->total_tva -= $sit->total_tva;
$this->total_localtax1 -= $sit->total_localtax1; $this->total_localtax1 -= $sit->total_localtax1;
$this->total_localtax2 -= $sit->total_localtax2; $this->total_localtax2 -= $sit->total_localtax2;
$this->total_ttc -= $sit->total_ttc; $this->total_ttc -= $sit->total_ttc;
$this->multicurrency_total_ht -= $sit->multicurrency_total_ht;
$this->multicurrency_total_tva -= $sit->multicurrency_total_tva;
$this->multicurrency_total_ttc -= $sit->multicurrency_total_ttc;
} }
} }
// Multicurrency
$this->multicurrency_total_ht += $this->total_ht * $multicurrency_tx;
$this->multicurrency_total_tva += $this->total_tva * $multicurrency_tx;
$this->multicurrency_total_ttc += $this->total_ttc * $multicurrency_tx;
$this->db->free($resql); $this->db->free($resql);
// Now update global field total_ht, total_ttc and tva // Now update global field total_ht, total_ttc and tva
@ -2404,7 +2407,7 @@ abstract class CommonObject
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva'; if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
if ($this->element == 'propal') $fieldttc='total'; if ($this->element == 'propal') $fieldttc='total';
if ($this->element == 'expensereport') $fieldtva='total_tva'; if ($this->element == 'expensereport') $fieldtva='total_tva';
if ($this->element == 'supplier_proposal') $fieldttc='total'; if ($this->element == 'supplier_proposal') $fieldttc='total';
if (empty($nodatabaseupdate)) if (empty($nodatabaseupdate))
{ {
@ -4210,7 +4213,7 @@ abstract class CommonObject
* *
* @param int $rowid Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters. * @param int $rowid Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters.
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
* @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded * @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
*/ */
function fetch_optionals($rowid=null,$optionsArray=null) function fetch_optionals($rowid=null,$optionsArray=null)
{ {

View File

@ -4297,7 +4297,7 @@ class Form
*/ */
function select_currency($selected='',$htmlname='currency_id') function select_currency($selected='',$htmlname='currency_id')
{ {
print $this->selectcurrency($selected,$htmlname); print $this->selectCurrency($selected,$htmlname);
} }
/** /**
@ -4307,35 +4307,40 @@ class Form
* @param string $htmlname name of HTML select list * @param string $htmlname name of HTML select list
* @return string * @return string
*/ */
function selectCurrency($selected='',$htmlname='currency_id') function selectCurrency($selected='',$htmlname='currency_id')
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$langs->loadCacheCurrencies(''); $langs->loadCacheCurrencies('');
$out=''; $out='';
if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite
$out.= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; $out.= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
foreach ($langs->cache_currencies as $code_iso => $currency) foreach ($langs->cache_currencies as $code_iso => $currency)
{ {
if ($selected && $selected == $code_iso) if ($selected && $selected == $code_iso)
{ {
$out.= '<option value="'.$code_iso.'" selected>'; $out.= '<option value="'.$code_iso.'" selected>';
} }
else else
{ {
$out.= '<option value="'.$code_iso.'">'; $out.= '<option value="'.$code_iso.'">';
} }
$out.= $currency['label']; $out.= $currency['label'];
$out.= ' ('.$langs->getCurrencySymbol($code_iso).')'; $out.= ' ('.$langs->getCurrencySymbol($code_iso).')';
$out.= '</option>'; $out.= '</option>';
} }
$out.= '</select>'; $out.= '</select>';
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
return $out;
} // Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
return $out;
}
/** /**
* Return array of currencies in user language * Return array of currencies in user language

View File

@ -601,29 +601,9 @@ class FormOther
static function showColor($color, $textifnotdefined='') static function showColor($color, $textifnotdefined='')
{ {
$textcolor='FFF'; $textcolor='FFF';
if ($color)
{
$tmp=explode(',', $color);
if (count($tmp) > 1) // This is a comma RGB ('255','255','255')
{
$r = $tmp[0];
$g = $tmp[1];
$b = $tmp[2];
}
else
{
$hexr=$color[0].$color[1];
$hexg=$color[2].$color[3];
$hexb=$color[4].$color[5];
$r = hexdec($hexr);
$g = hexdec($hexg);
$b = hexdec($hexb);
}
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
if ($bright > 0.6) $textcolor='000';
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if(colorIsLight($color)) $textcolor='000';
$color = colorArrayToHex(colorStringToArray($color,array()),''); $color = colorArrayToHex(colorStringToArray($color,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">'; if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">';

View File

@ -306,12 +306,25 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
// Else, retreive default values if we are not doing a sort // Else, retreive default values if we are not doing a sort
elseif (! isset($_GET['sortfield']) && ! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set elseif (! isset($_GET['sortfield']) && ! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set
{ {
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{ {
if (! empty($user->default_values)) // $user->default_values defined from menu default values if (! empty($user->default_values)) // $user->default_values defined from menu default values
{ {
//var_dump($user->default_values[$relativepathstring]['createform']); $qualified=1;
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname]; if (isset($user->default_values[$relativepathstring]['createform_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
{
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['createform_queries']);
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
foreach($tmpqueryarraytohave as $tmpquerytohave)
{
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
}
}
if ($qualified)
{
//var_dump($user->default_values[$relativepathstring]['createform']);
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
}
} }
} }
// Management of default search_filters and sort order // Management of default search_filters and sort order
@ -327,7 +340,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...'] if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
{ {
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']); $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
$tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']); $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
foreach($tmpqueryarraytohave as $tmpquerytohave) foreach($tmpqueryarraytohave as $tmpquerytohave)
{ {
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0; if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
@ -352,7 +365,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) if (isset($user->default_values[$relativepathstring]['sortorder_queries']))
{ {
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']); $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
$tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']); $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
foreach($tmpqueryarraytohave as $tmpquerytohave) foreach($tmpqueryarraytohave as $tmpquerytohave)
{ {
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0; if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
@ -377,7 +390,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
if (isset($user->default_values[$relativepathstring]['filters_queries'])) if (isset($user->default_values[$relativepathstring]['filters_queries']))
{ {
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['filters_queries']); $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['filters_queries']);
$tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']); $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
foreach($tmpqueryarraytohave as $tmpquerytohave) foreach($tmpqueryarraytohave as $tmpquerytohave)
{ {
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0; if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;

View File

@ -2150,6 +2150,40 @@ function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3])); return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3]));
} }
/**
* Return true if the color is light
*
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
* @return int -1 : Error with argument passed |0 : color is dark | 1 : color is light
*/
function colorIsLight($stringcolor)
{
$res = -1;
if (!empty($stringcolor))
{
$res = 0;
$tmp=explode(',', $stringcolor);
if (count($tmp) > 1) // This is a comma RGB ('255','255','255')
{
$r = $tmp[0];
$g = $tmp[1];
$b = $tmp[2];
}
else
{
$hexr=$stringcolor[0].$stringcolor[1];
$hexg=$stringcolor[2].$stringcolor[3];
$hexb=$stringcolor[4].$stringcolor[5];
$r = hexdec($hexr);
$g = hexdec($hexg);
$b = hexdec($hexb);
}
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
if ($bright > 0.6) $res = 1;
}
return $res;
}
/** /**
* Applies the Cartesian product algorithm to an array * Applies the Cartesian product algorithm to an array
* Source: http://stackoverflow.com/a/15973172 * Source: http://stackoverflow.com/a/15973172

View File

@ -50,7 +50,7 @@
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default) * @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
* @param double $multicurrency_tx Currency rate (1 by default) * @param double $multicurrency_tx Currency rate (1 by default)
* @param double $pu_ht_devise Amount in currency * @param double $pu_devise Amount in currency
* @return array [ * @return array [
* 0=total_ht, * 0=total_ht,
* 1=total_vat, (main vat only) * 1=total_vat, (main vat only)
@ -65,15 +65,16 @@
* 10=total_tax2 for total_ht, * 10=total_tax2 for total_ht,
* 11=pu_tax1 for pu_ht, !! should not be used * 11=pu_tax1 for pu_ht, !! should not be used
* 12=pu_tax2 for pu_ht, !! should not be used * 12=pu_tax2 for pu_ht, !! should not be used
* 13=!! should not be used * 13=?? !! should not be used
* 14=total_tax1 for total_ht_without_discount, * 14=total_tax1 for total_ht_without_discount,
* 15=total_tax2 for total_ht_without_discount] * 15=total_tax2 for total_ht_without_discount,
*
* 16=multicurrency_total_ht * 16=multicurrency_total_ht
* 17=multicurrency_total_tva * 17=multicurrency_total_tva
* 18=multicurrency_total_ttc * 18=multicurrency_total_ttc
* 19=multicurrency_pu_ht * 19=multicurrency_pu_ht
*/ */
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_ht_devise=0) function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_devise=0)
{ {
global $conf,$mysoc,$db; global $conf,$mysoc,$db;
@ -145,10 +146,11 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
} }
// pu calculation from pu_devise if pu empty // pu calculation from pu_devise if pu empty
if(empty($pu) && !empty($pu_ht_devise)) { if(empty($pu) && !empty($pu_devise)) {
$pu = $pu_ht_devise / $multicurrency_tx; $pu = $pu_devise / $multicurrency_tx;
} else { }
$pu_ht_devise = $pu * $multicurrency_tx; if(empty($pu_devise) && !empty($multicurrency_tx)) {
$pu_devise = $pu * $multicurrency_tx;
} }
// initialize total (may be HT or TTC depending on price_base_type) // initialize total (may be HT or TTC depending on price_base_type)
@ -340,11 +342,45 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
} }
// Multicurrency // Multicurrency
$result[16] = price2num($result[0] * $multicurrency_tx, 'MT'); if ($multicurrency_tx != 1)
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT'); {
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT'); // Recal function using the multicurrency price as reference price. We must set param $multicurrency_tx to 1 to avoid infinite loop.
$result[19] = price2num($pu_ht_devise, 'MU'); $newresult = calcul_price_total($qty, $pu_devise, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller, $localtaxes_array, $progress, 1, 0);
$result[16] = $newresult[0];
$result[17] = $newresult[1];
$result[18] = $newresult[2];
$result[19] = $newresult[3];
$result[20] = $newresult[4];
$result[21] = $newresult[5];
$result[22] = $newresult[6];
$result[23] = $newresult[7];
$result[24] = $newresult[8];
$result[25] = $newresult[9];
$result[26] = $newresult[10];
/*
$result[16] = price2num($result[0] * $multicurrency_tx, 'MT');
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT');
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT');
$result[19] = price2num($pu_devise, 'MU');
*/
}
else
{
$result[16] = $result[0];
$result[17] = $result[1];
$result[18] = $result[2];
$result[19] = $result[3];
$result[20] = $result[4];
$result[21] = $result[5];
$result[22] = $result[6];
$result[23] = $result[7];
$result[24] = $result[8];
$result[25] = $result[9];
$result[26] = $result[10];
}
//var_dump($result);
// initialize result array // initialize result array
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i]; //for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];

View File

@ -1468,8 +1468,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire); $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire);
$newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire); $newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire);
if (! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export); if (! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu=='none' || $leftmenu=="members" || $leftmenu=="export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export);
$newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire); $newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); $newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer);

View File

@ -859,6 +859,8 @@ class pdf_einstein extends ModelePDFCommandes
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
@ -1032,7 +1034,6 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }
@ -1045,7 +1046,7 @@ class pdf_einstein extends ModelePDFCommandes
//$creditnoteamount=$object->getSumCreditNotesUsed(); //$creditnoteamount=$object->getSumCreditNotesUsed();
//$depositsamount=$object->getSumDepositsUsed(); //$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if (! empty($object->paye)) $resteapayer=0; if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)

View File

@ -548,7 +548,7 @@ class pdf_rouget extends ModelePdfExpedition
} }
// Affiche zone totaux // Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
// Pied de page // Pied de page
$this->_pagefoot($pdf,$object,$outputlangs); $this->_pagefoot($pdf,$object,$outputlangs);

View File

@ -214,9 +214,9 @@ class pdf_crabe extends ModelePDFFactures
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement(); $deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_credit_notes_included = $object->getSumCreditNotesUsed(); $amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_deposits_included = $object->getSumDepositsUsed(); $amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
// Definition of $dir and $file // Definition of $dir and $file
if ($object->specimen) if ($object->specimen)
@ -773,7 +773,7 @@ class pdf_crabe extends ModelePDFFactures
// Loop on each deposits and credit notes included // Loop on each deposits and credit notes included
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; $sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
$sql.= " re.description, re.fk_facture_source,"; $sql.= " re.description, re.fk_facture_source,";
$sql.= " f.type, f.datef"; $sql.= " f.type, f.datef";
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re, ".MAIN_DB_PREFIX ."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re, ".MAIN_DB_PREFIX ."facture as f";
@ -798,7 +798,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); $pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$pdf->MultiCell(20, 3, $text, 0, 'L', 0); $pdf->MultiCell(20, 3, $text, 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top+$y); $pdf->SetXY($tab3_posx+58, $tab3_top+$y);
@ -817,7 +817,7 @@ class pdf_crabe extends ModelePDFFactures
// Loop on each payment // Loop on each payment
// TODO Call getListOfPaymentsgetListOfPayments instead of hard coded sql // TODO Call getListOfPaymentsgetListOfPayments instead of hard coded sql
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount,"; $sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code"; $sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
@ -837,7 +837,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($sign * $row->amount, 0, $outputlangs), 0, 'L', 0); $pdf->MultiCell(20, 3, price($sign * (($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount), 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);
@ -1062,6 +1062,8 @@ class pdf_crabe extends ModelePDFFactures
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
@ -1272,7 +1274,6 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }
@ -1280,10 +1281,10 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$creditnoteamount=$object->getSumCreditNotesUsed(); $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$depositsamount=$object->getSumDepositsUsed(); $depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0; if ($object->paye) $resteapayer=0;
if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0)

View File

@ -522,9 +522,6 @@ class pdf_standard extends ModelePDFProduct
// Affiche zone infos // Affiche zone infos
//$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); //$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
// Affiche zone totaux
//$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
// Pied de page // Pied de page
$this->_pagefoot($pdf,$object,$outputlangs); $this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

View File

@ -1012,6 +1012,8 @@ class pdf_azur extends ModelePDFPropales
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
@ -1188,7 +1190,6 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }

View File

@ -719,6 +719,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$useborder=0; $useborder=0;
// Total TTC
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@ -729,6 +730,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);
$creditnoteamount=0;
$depositsamount=0;
//$creditnoteamount=$object->getSumCreditNotesUsed();
//$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)
{ {
$index++; $index++;
@ -745,7 +754,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
@ -879,6 +888,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
*/ */
function _tableau_versements(&$pdf, $object, $posy, $outputlangs) function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{ {
global $conf;
$sign=1;
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$tab3_posx = 120; $tab3_posx = 120;
$tab3_top = $posy + 8; $tab3_top = $posy + 8;
$tab3_width = 80; $tab3_width = 80;
@ -912,8 +926,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetFont('','', $default_font_size - 4); $pdf->SetFont('','', $default_font_size - 4);
// Loop on each deposits and credit notes included
//
// Loop on each payment // Loop on each payment
$sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount,"; $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code"; $sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
@ -931,7 +948,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($tab3_posx, $tab3_top+$y); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0); $pdf->MultiCell(20, 3, price($sign * (($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y); $pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);

View File

@ -917,7 +917,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
//$creditnoteamount=$object->getSumCreditNotesUsed(); //$creditnoteamount=$object->getSumCreditNotesUsed();
//$depositsamount=$object->getSumDepositsUsed(); //$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if (! empty($object->paye)) $resteapayer=0; if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)

View File

@ -351,7 +351,7 @@ class SupplierInvoices extends DolibarrApi
function _validate($data) function _validate($data)
{ {
$invoice = array(); $invoice = array();
foreach (Invoices::$FIELDS as $field) { foreach (SupplierInvoices::$FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field]))
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
$invoice[$field] = $data[$field]; $invoice[$field] = $data[$field];

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
@ -1805,8 +1805,9 @@ class FactureFournisseur extends CommonInvoice
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24;
$response->label=$langs->trans("SupplierBillsToPay"); $response->label=$langs->trans("SupplierBillsToPay");
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills'; $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills';
$response->img=img_object('',"bill"); $response->img=img_object($langs->trans("Bills"),"bill");
$facturestatic = new FactureFournisseur($this->db); $facturestatic = new FactureFournisseur($this->db);

View File

@ -25,6 +25,9 @@
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
-- Missing in 5.0
ALTER TABLE llx_user MODIFY login varchar(50) NOT NULL;
-- Missing in 6.0 ? -- Missing in 6.0 ?
ALTER TABLE llx_product_price ADD COLUMN fk_multicurrency integer; ALTER TABLE llx_product_price ADD COLUMN fk_multicurrency integer;
ALTER TABLE llx_product_price ADD COLUMN multicurrency_code varchar(255); ALTER TABLE llx_product_price ADD COLUMN multicurrency_code varchar(255);

View File

@ -1,6 +1,7 @@
# Dolibarr language file - Source file is en_US - admin # Dolibarr language file - Source file is en_US - admin
Foundation=Foundation Foundation=Foundation
Version=Version Version=Version
Publisher=Publisher
VersionProgram=Version program VersionProgram=Version program
VersionLastInstall=Initial install version VersionLastInstall=Initial install version
VersionLastUpgrade=Latest version upgrade VersionLastUpgrade=Latest version upgrade
@ -451,8 +452,8 @@ DependsOn=This module need the module(s)
RequiredBy=This module is required by module(s) RequiredBy=This module is required by module(s)
TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. This need to have technical knowledges to read the content of the HTML page to get the key name of a field. TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. This need to have technical knowledges to read the content of the HTML page to get the key name of a field.
PageUrlForDefaultValues=You must enter here the relative url of the page. If you include parameters in URL, the default values will be effective if all parameters are set to same value. Examples: PageUrlForDefaultValues=You must enter here the relative url of the page. If you include parameters in URL, the default values will be effective if all parameters are set to same value. Examples:
PageUrlForDefaultValuesCreate=<br>For form to create a new thirdparty, it is <strong>%s</strong> PageUrlForDefaultValuesCreate=<br>For form to create a new thirdparty, it is <strong>%s</strong>,<br>If we want default only if url has some parameter, we can use <strong>%s</strong>
PageUrlForDefaultValuesList=<br>For page that list thirdparties, it is <strong>%s</strong> PageUrlForDefaultValuesList=<br>For page that list thirdparties, it is <strong>%s</strong>,<br>If we want default only if url has some parameter, we can use <strong>%s</strong>
EnableDefaultValues=Enable usage of personalized default values EnableDefaultValues=Enable usage of personalized default values
EnableOverwriteTranslation=Enable usage of overwrote translation EnableOverwriteTranslation=Enable usage of overwrote translation
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code, so to change this value, you must edit it fom Home-Setup-translation. GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code, so to change this value, you must edit it fom Home-Setup-translation.

View File

@ -213,3 +213,5 @@ AllowCommentOnTask=Allow user comments on tasks
TaskCommentLinks=Comments TaskCommentLinks=Comments
TaskNbComments=Number of comments TaskNbComments=Number of comments
TaskComment=Task's comments space TaskComment=Task's comments space
CommentAdded=Comment added
CommentDeleted=Comment deleted

View File

@ -55,7 +55,7 @@ IndependantSubProductStock=Product stock and subproduct stock are independant
QtyDispatched=Quantity dispatched QtyDispatched=Quantity dispatched
QtyDispatchedShort=Qty dispatched QtyDispatchedShort=Qty dispatched
QtyToDispatchShort=Qty to dispatch QtyToDispatchShort=Qty to dispatch
OrderDispatch=Goods Receptions OrderDispatch=Item receipts
RuleForStockManagementDecrease=Rule for automatic stock management decrease (manual decrease is always possible, even if an automatic decrease rule is activated) RuleForStockManagementDecrease=Rule for automatic stock management decrease (manual decrease is always possible, even if an automatic decrease rule is activated)
RuleForStockManagementIncrease=Rule for automatic stock management increase (manual increase is always possible, even if an automatic increase rule is activated) RuleForStockManagementIncrease=Rule for automatic stock management increase (manual increase is always possible, even if an automatic increase rule is activated)
DeStockOnBill=Decrease real stocks on customers invoices/credit notes validation DeStockOnBill=Decrease real stocks on customers invoices/credit notes validation

View File

@ -212,3 +212,5 @@ AllowCommentOnTask=Autoriser les commentaires entre utilisateurs sur les tâches
TaskCommentLinks=Commentaires TaskCommentLinks=Commentaires
TaskNbComments=Nombre de commentaires TaskNbComments=Nombre de commentaires
TaskComment=Tâches espace commentaires TaskComment=Tâches espace commentaires
CommentAdded=Commentaire ajouté avec succès
CommentDeleted=Commentaire supprimé avec succès

View File

@ -798,13 +798,13 @@ else
if (! empty($arrayfields['p.duration']['checked'])) if (! empty($arrayfields['p.duration']['checked']))
{ {
print '<td align="center">'; print '<td align="center">';
if (preg_match('/([0-9]+)[a-z]/i',$obj->duration)) if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration))
{ {
if (preg_match('/([0-9]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
elseif (preg_match('/([0-9]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
elseif (preg_match('/([0-9]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
elseif (preg_match('/([0-9]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
//elseif (preg_match('/([0-9]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); //elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
else print $obj->duration; else print $obj->duration;
} }
print '</td>'; print '</td>';

View File

@ -1950,7 +1950,7 @@ class TaskComment extends CommonObject
* @param int $ref ref object * @param int $ref ref object
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
function fetch($id) function fetch($id, $ref='')
{ {
global $langs; global $langs;

View File

@ -81,6 +81,7 @@ if ($action == 'addcomment')
$object->entity = $conf->entity; $object->entity = $conf->entity;
if ($object->create($user) > 0) if ($object->create($user) > 0)
{ {
setEventMessages($langs->trans("CommentAdded"), null, 'mesgs');
header('Location: '.DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$id.($withproject?'&withproject=1':'')); header('Location: '.DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$id.($withproject?'&withproject=1':''));
exit; exit;
} }
@ -97,6 +98,7 @@ if ($action == 'deletecomment')
{ {
if ($object->delete($user) > 0) if ($object->delete($user) > 0)
{ {
setEventMessages($langs->trans("CommentDeleted"), null, 'mesgs');
header('Location: '.DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$id.($withproject?'&withproject=1':'')); header('Location: '.DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$id.($withproject?'&withproject=1':''));
exit; exit;
} }
@ -348,35 +350,53 @@ if ($id > 0 || ! empty($ref))
// List of comments // List of comments
if(!empty($task->comments)) { if(!empty($task->comments)) {
// Default color for current user // Default color for current user
$TColors = array($user->id => 'efefef'); $TColors = array($user->id => array('bgcolor'=>'efefef','color'=>'555'));
$first = true; $first = true;
foreach($task->comments as $comment) { foreach($task->comments as $comment) {
$fk_user = $comment->fk_user; $fk_user = $comment->fk_user;
$userstatic->fetch($fk_user); $userstatic->fetch($fk_user);
if(empty($TColors[$fk_user])) { if(empty($TColors[$fk_user])) {
$TColors[$fk_user] = random_color(180,240); $bgcolor = random_color(180,240);
if(!empty($userstatic->color)) {
$bgcolor = $userstatic->color;
}
$color = (colorIsLight($bgcolor))?'555':'fff';
$TColors[$fk_user] = array('bgcolor'=>$bgcolor,'color'=>$color);
} }
print '<div class="width100p clearboth">'; print '<div class="width100p" style="color:#'.$TColors[$fk_user]['color'].'">';
if($comment->fk_user == $user->id) { if($comment->fk_user == $user->id) {
print '<div class="width25p float">&nbsp;</div>'; print '<div class="width25p float">&nbsp;</div>';
} }
print '<div class="width75p float comment" style="background-color:#'.$TColors[$fk_user].'">'; print '<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user]['bgcolor'].'">';
print '<div class="comment-description">'; print '<div class="comment-info comment-cell">';
print $comment->description; if (! empty($user->photo))
print '</div>'; {
print '<div class="comment-info">'; print Form::showphoto('userphoto', $userstatic, 80, 0, 0, '', 'small', 0, 1).'<br/>';
}
print $langs->trans('User').' : '.$userstatic->getNomUrl().'<br/>'; print $langs->trans('User').' : '.$userstatic->getNomUrl().'<br/>';
print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec'); print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec');
print '</div>'; // End comment-info
print '<div class="comment-cell comment-right">';
print '<div class="comment-table width100p">';
print '<div class="comment-description comment-cell">';
print $comment->description;
print '</div>'; // End comment-description
if(($first && $fk_user == $user->id) || $user->admin == 1) { if(($first && $fk_user == $user->id) || $user->admin == 1) {
print '<br/> <a href="?action=deletecomment&id='.$id.'&withproject=1&idcomment='.$comment->id.'">'.$langs->trans('Delete').'</a>'; print '<a class="comment-delete comment-cell" href="'.DOL_URL_ROOT.'/projet/tasks/comment.php?action=deletecomment&id='.$id.'&withproject=1&idcomment='.$comment->id.'" title="'.$langs->trans('Delete').'">';
print img_picto('', 'delete.png');
print '</a>';
} }
print '</div>'; print '</div>'; // End comment-table
print '</div>'; print '</div>'; // End comment-right
print '</div>'; // End comment
if($comment->fk_user != $user->id) { if($comment->fk_user != $user->id) {
print '<div class="width25p float">&nbsp;</div>'; print '<div class="width25p float">&nbsp;</div>';
} }
print '<div class="clearboth"></div>';
print '</div>'; // end 100p
$first = false; $first = false;
} }

View File

@ -452,8 +452,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$morehtmlref.='<br>'; $morehtmlref.='<br>';
// Third party // Third party
$morehtmlref.=$langs->trans("ThirdParty").': '; $morehtmlref.=$langs->trans("ThirdParty").': ';
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); if (is_object($projectstatic->thirdparty)) {
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref.='</div>'; $morehtmlref.='</div>';
} }
@ -462,7 +464,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Date start - Date end // Date start - Date end

View File

@ -1164,14 +1164,29 @@ if ($source == 'membersubscription')
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
if (empty($amount)) if (empty($amount))
{ {
print ' ('.$langs->trans("ToComplete"); if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ' ('.$langs->trans("ToComplete");
if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>';
print ')'; if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ')';
} }
print '</td><td class="CTableRow'.($var?'1':'2').'">'; print '</td><td class="CTableRow'.($var?'1':'2').'">';
if (empty($amount) || ! is_numeric($amount)) if (empty($amount) || ! is_numeric($amount))
{ {
$valtoshow=GETPOST("newamount",'int'); $valtoshow=GETPOST("newamount",'int');
// force default subscription amount to value defined into constant...
if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {
if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
$valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT;
}
}
else {
if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
$amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
}
}
}
if (empty($amount) || ! is_numeric($amount))
{
//$valtoshow=GETPOST("newamount",'int');
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat" size="8" type="text" name="newamount" value="'.$valtoshow.'">'; print '<input class="flat" size="8" type="text" name="newamount" value="'.$valtoshow.'">';

View File

@ -44,7 +44,7 @@ class Societe extends CommonObject
public $table_element = 'societe'; public $table_element = 'societe';
public $fk_element='fk_soc'; public $fk_element='fk_soc';
protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); // To test if we can delete object protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); // To test if we can delete object
protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notfy_def", "actioncomm"); protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm");
/** /**

View File

@ -441,7 +441,8 @@ if ($socid && $action != 'edit' && $action != "create")
$var = false; $var = false;
if (is_array($rib_list)) if (is_array($rib_list))
{ {
print '<table class="liste" width="100%">'; print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LabelRIB"); print_liste_field_titre("LabelRIB");
@ -618,6 +619,7 @@ if ($socid && $action != 'edit' && $action != "create")
} }
print '</table>'; print '</table>';
print '</div>';
} else { } else {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -43,6 +43,7 @@ if (! empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('companies'); $langs->load('companies');
$langs->load('propal');
$langs->load('supplier_proposal'); $langs->load('supplier_proposal');
$langs->load('compta'); $langs->load('compta');
$langs->load('bills'); $langs->load('bills');
@ -1024,6 +1025,7 @@ if ($resql)
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->supplier_proposal->lire; $genallowed=$user->rights->supplier_proposal->lire;
$delallowed=$user->rights->supplier_proposal->lire; $delallowed=$user->rights->supplier_proposal->lire;

View File

@ -485,9 +485,10 @@ hr { border: 0; border-top: 1px solid #ccc; }
box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
} }
.button:hover, .buttonDelete:hover { .button:hover, .buttonDelete:hover {
-moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); /* warning: having a larger shadow has side effect when button is completely on left of a table */
-webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); -moz-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); -webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
} }
.button:disabled, .buttonDelete:disabled { .button:disabled, .buttonDelete:disabled {
opacity: 0.4; opacity: 0.4;
@ -3817,16 +3818,45 @@ pre#editfilecontentaceeditorid {
#comment div { #comment div {
box-sizing:border-box; box-sizing:border-box;
} }
#comment .comment { #comment .comment {
border-radius:7px; border-radius:7px;
padding:7px 10px;
margin-bottom:10px; margin-bottom:10px;
overflow:hidden;
}
#comment .comment-table {
display:table;
height:100%;
}
#comment .comment-cell {
display:table-cell;
} }
#comment .comment-info { #comment .comment-info {
font-size:0.8em; font-size:0.8em;
color:#555; border-right:1px solid #dedede;
margin-top:5px; margin-right:10px;
width:160px;
text-align:center;
background:rgba(255,255,255,0.5);
vertical-align:middle;
padding:10px 2px;
}
#comment .comment-info a {
color:inherit;
}
#comment .comment-right {
vertical-align:top;
}
#comment .comment-description {
padding:10px;
vertical-align:top;
}
#comment .comment-delete {
width: 100px;
text-align:center;
vertical-align:middle;
}
#comment .comment-delete:hover {
background:rgba(250,20,20,0.8);
} }
#comment textarea { #comment textarea {
width: 100%; width: 100%;

View File

@ -199,13 +199,13 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
preg_match_all('/(...................)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/(...................)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach($matches as $key => $val)
{ {
if ($val[1] != 'dol_escape_htmltag(') if ($val[1] != 'dol_escape_htmltag(' && $val[1] != 'l_string_nohtmltag(')
{ {
$ok=false; $ok=false;
break; break;
} }
} }
$this->assertTrue($ok, 'Found a $_SERVER[\'QUERY_STRING\'] without dol_escape_htmltag around in file '.$file['fullname'].' ('.$val[1].'$_SERVER[\'QUERY_STRING\']). Bad.'); $this->assertTrue($ok, 'Found a $_SERVER[\'QUERY_STRING\'] without dol_escape_htmltag neither dol_string_nohtmltag around it, in file '.$file['fullname'].' ('.$val[1].'$_SERVER[\'QUERY_STRING\']). Bad.');
// Test that first param of print_liste_field_titre is a translation key and not the translated value // Test that first param of print_liste_field_titre is a translation key and not the translated value

View File

@ -141,6 +141,11 @@ class PricesTest extends PHPUnit_Framework_TestCase
global $mysoc; global $mysoc;
$mysoc=new Societe($db); $mysoc=new Societe($db);
// To force status that say module multicompany is on
//$conf->multicurrency=new stdClass();
//$conf->multicurrency->enabled = 0;
/* /*
* Country France * Country France
*/ */
@ -151,7 +156,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0); $result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0);
print __METHOD__." result1=".join(', ',$result1)."\n"; print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0, 0, 0, 0, 0, 0, 1.24, 0.12, 1.36, 1.24),$result1,'Test1 FR'); $this->assertEquals(array(1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0, 0, 0, 0, 0, 0, 1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0),$result1,'Test1 FR');
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value) // qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value)
$mysoc->country_code='FR'; $mysoc->country_code='FR';
@ -159,7 +164,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205); $result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205);
print __METHOD__." result1=".join(', ',$result1)."\n"; print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.56, 9.34795),$result1,'Test1 FR'); $this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.57, 9.34795, 0.93479, 10.28274, 18.7, 1.87, 20.57, 0, 0),$result1,'Test1b FR');
// qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100 // qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100
$mysoc->country_code='FR'; $mysoc->country_code='FR';
@ -167,7 +172,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20); $result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20);
print __METHOD__." result1=".join(', ',$result1)."\n"; print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(36.63, 3.66, 40.29, 18.31418, 1.83142, 20.1456, 36.63, 3.66, 40.29, 0, 0, 0, 0, 0, 0, 0, 40, 4, 44, 20),$result1,'Test1 FR'); $this->assertEquals(array(36.63, 3.66, 40.29, 18.31418, 1.83142, 20.1456, 36.63, 3.66, 40.29, 0, 0, 0, 0, 0, 0, 0, 40, 4, 44, 20, 2, 22, 40, 4, 44, 0, 0),$result1,'Test1c FR');
/* /*
* Country Spain * Country Spain
@ -181,7 +186,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, 0, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2 $result2=calcul_price_total(10, 10, 0, 10, 0, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10),$result2,'Test1 ES'); $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0),$result2,'Test1 ES');
// 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (other method autodetect) // 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (other method autodetect)
$mysoc->country_code='ES'; $mysoc->country_code='ES';
@ -191,7 +196,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2 $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10),$result2,'Test2 ES'); $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0),$result2,'Test2 ES');
// -------------------------------------------------------- // --------------------------------------------------------
@ -203,7 +208,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, 1.4, 0, 0, 'HT', 0, 0); $result2=calcul_price_total(10, 10, 0, 10, 1.4, 0, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10),$result2,'Test3 ES'); $this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0),$result2,'Test3 ES');
// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect) // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect)
$mysoc->country_code='ES'; $mysoc->country_code='ES';
@ -213,7 +218,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10),$result2,'Test4 ES'); $this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0),$result2,'Test4 ES');
// -------------------------------------------------------- // --------------------------------------------------------
@ -224,7 +229,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$mysoc->localtax2_assuj=1; $mysoc->localtax2_assuj=1;
$result2=calcul_price_total(10, 10, 0, 10, 0, -19, 0, 'HT', 0, 1); $result2=calcul_price_total(10, 10, 0, 10, 0, -19, 0, 'HT', 0, 1);
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10),$result2,'Test5 ES for service'); $this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19),$result2,'Test5 ES for service');
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a service and not a product // 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a service and not a product
$mysoc->country_code='ES'; $mysoc->country_code='ES';
@ -234,7 +239,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10),$result2,'Test6 ES for product'); $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0),$result2,'Test6 ES for product');
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a product and not a service // 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a product and not a service
$mysoc->country_code='ES'; $mysoc->country_code='ES';
@ -244,7 +249,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 1); $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 1);
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10),$result2,'Test6 ES for service'); $this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19),$result2,'Test6 ES for service');
// -------------------------------------------------------- // --------------------------------------------------------
@ -256,7 +261,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, -10, 0, 10, 0, 19, 0, 'HT', 0, 0); $result2=calcul_price_total(10, -10, 0, 10, 0, 19, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110, -10),$result2,'Test7 ES for product'); $this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0),$result2,'Test7 ES for product');
// Credit Note: 10 * -10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect), we provide a service and not a product // Credit Note: 10 * -10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect), we provide a service and not a product
$mysoc->country_code='ES'; $mysoc->country_code='ES';
@ -265,7 +270,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$mysoc->localtax2_assuj=1; $mysoc->localtax2_assuj=1;
$result2=calcul_price_total(10, -10, 0, 10, -1, -1, 0, 'HT', 0, 1); $result2=calcul_price_total(10, -10, 0, 10, -1, -1, 0, 'HT', 0, 1);
print __METHOD__." result2=".join(', ',$result2)."\n"; print __METHOD__." result2=".join(', ',$result2)."\n";
$this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91, -10),$result2,'Test8 ES for service'); $this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19),$result2,'Test8 ES for service');
/* /*
@ -282,7 +287,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2 $result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
print __METHOD__." result3=".join(', ',$result3)."\n"; print __METHOD__." result3=".join(', ',$result3)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10),$result3,'Test9 CI'); $this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0),$result3,'Test9 CI');
// 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (other method autodetect) // 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (other method autodetect)
$mysoc->country_code='CI'; $mysoc->country_code='CI';
@ -292,7 +297,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2 $result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
print __METHOD__." result3=".join(', ',$result3)."\n"; print __METHOD__." result3=".join(', ',$result3)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10),$result3,'Test10 CI'); $this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0),$result3,'Test10 CI');
return true; return true;
} }